@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 60 lines 1.93 KB
Raw
1 import * as GCP from "@alchemy.run/gcp";
2 import { expect } from "@alchemy.run/test";
3 import * as Test from "@alchemy.run/test/Alchemy";
4 import { Action } from "alchemy/Action";
5 import * as Effect from "effect/Effect";
6
7 const { test } = Test.make({ providers: GCP.providers() });
8
9 test.provider(
10 "GenerateContent calls Gemini through the HTTP binding",
11 (stack) =>
12 Effect.gen(function* () {
13 yield* stack.destroy();
14
15 const out = yield* stack.deploy(
16 Effect.gen(function* () {
17 const Probe = Action(
18 "Probe",
19 Effect.gen(function* () {
20 const global = yield* GCP.AIPlatform.GenerateContent("gemini-2.5-flash");
21 const regional = yield* GCP.AIPlatform.GenerateContent({
22 model: "gemini-2.5-flash",
23 location: "us-central1",
24 });
25 return Effect.fn(function* () {
26 const text = yield* global.text("Reply with exactly: pong");
27 const response = yield* regional.generate({
28 contents: [
29 {
30 role: "user",
31 parts: [{ text: "Reply with exactly: ping" }],
32 },
33 ],
34 });
35 return {
36 text,
37 regional:
38 response.candidates?.[0]?.content?.parts
39 ?.map((part) => part.text ?? "")
40 .join("") ?? "",
41 modelVersion: response.modelVersion,
42 };
43 });
44 }),
45 );
46 return yield* Probe({});
47 }),
48 );
49
50 expect(out.text.toLowerCase()).toContain("pong");
51 expect(out.regional.toLowerCase()).toContain("ping");
52 expect(out.modelVersion).toContain("gemini-2.5-flash");
53
54 yield* stack.destroy();
55 }),
56 {
57 tags: ["provider:gcp", "provider:gcp:aiplatform", "live"],
58 timeout: 120_000,
59 },
60 );