@opencode-ai/ai 0.0.0-next-15636 → 0.0.0-next-15646

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -127,23 +127,23 @@ OpenAI Chat and OpenAI Responses are separate semantic entrypoints:
127
127
  - `@opencode-ai/ai/providers/openai/responses`
128
128
  - `@opencode-ai/ai/providers/openai-compatible/responses`
129
129
  - `@opencode-ai/ai/providers/anthropic-compatible`
130
- - `@opencode-ai/ai/providers/google-vertex`
131
- - `@opencode-ai/ai/providers/google-vertex/anthropic`
130
+ - `@opencode-ai/ai/providers/google-vertex/gemini`
131
+ - `@opencode-ai/ai/providers/google-vertex/messages`
132
132
 
133
133
  Responses HTTP versus WebSocket is a scoped `transport` setting on the OpenAI Responses entrypoint, not another entrypoint. Azure follows the same Chat/Responses split at `providers/azure/chat` and `providers/azure/responses`. Generic OpenAI-compatible Chat remains at `providers/openai-compatible`; compatible Responses is separate at `providers/openai-compatible/responses`. Generic Anthropic Messages-compatible providers use `providers/anthropic-compatible`, which the named Anthropic provider composes. Google Gemini and Amazon Bedrock expose their single native API through their existing provider paths.
134
134
 
135
- Vertex Gemini and Vertex Anthropic are separate products with separate entrypoints. Both accept `project`, `location`, and an optional `accessToken`; when no explicit token or auth override is supplied they lazily use Google Application Default Credentials. Vertex Gemini instead selects express mode when `apiKey` or `GOOGLE_VERTEX_API_KEY` is present.
135
+ Vertex Gemini and Vertex Messages are separate API entrypoints. Both accept `project`, `location`, and an optional `accessToken`; when no explicit token or auth override is supplied they lazily use Google Application Default Credentials. Vertex Gemini instead selects express mode when `apiKey` or `GOOGLE_VERTEX_API_KEY` is present. `providers/google-vertex` remains the default alias for `providers/google-vertex/gemini`.
136
136
 
137
137
  Tuned Vertex Gemini deployments use model ids shaped like `endpoints/1234567890` and require OAuth or ADC; Vertex express-mode API keys support publisher models only.
138
138
 
139
139
  ```ts
140
- import { model } from "@opencode-ai/ai/providers/google-vertex"
140
+ import { model } from "@opencode-ai/ai/providers/google-vertex/gemini"
141
141
 
142
142
  model("gemini-3.5-flash", { project: "my-project", location: "global" })
143
143
  ```
144
144
 
145
145
  ```ts
146
- import { model } from "@opencode-ai/ai/providers/google-vertex/anthropic"
146
+ import { model } from "@opencode-ai/ai/providers/google-vertex/messages"
147
147
 
148
148
  model("claude-sonnet-4-6", { project: "my-project", location: "global" })
149
149
  ```
@@ -1,6 +1,4 @@
1
1
  export * as AnthropicMessages from "./anthropic-messages";
2
- export * as GoogleVertexAnthropic from "./google-vertex-anthropic";
3
- export * as GoogleVertexGemini from "./google-vertex-gemini";
4
2
  export * as BedrockConverse from "./bedrock-converse";
5
3
  export * as Gemini from "./gemini";
6
4
  export * as OpenAIChat from "./openai-chat";
@@ -1,6 +1,4 @@
1
1
  export * as AnthropicMessages from "./anthropic-messages";
2
- export * as GoogleVertexAnthropic from "./google-vertex-anthropic";
3
- export * as GoogleVertexGemini from "./google-vertex-gemini";
4
2
  export * as BedrockConverse from "./bedrock-converse";
5
3
  export * as Gemini from "./gemini";
6
4
  export * as OpenAIChat from "./openai-chat";
@@ -0,0 +1,2 @@
1
+ export { model } from "../google-vertex";
2
+ export type { Settings } from "../google-vertex";
@@ -0,0 +1 @@
1
+ export { model } from "../google-vertex";
@@ -0,0 +1,2 @@
1
+ export { model } from "../google-vertex-messages";
2
+ export type { Settings } from "../google-vertex-messages";
@@ -0,0 +1 @@
1
+ export { model } from "../google-vertex-messages";
@@ -1,5 +1,5 @@
1
1
  import type { ProviderPackage } from "../provider-package";
2
- import type { RouteDefaultsInput } from "../route/client";
2
+ import { Route, type RouteDefaultsInput } from "../route/client";
3
3
  import { type ModelID, type ProviderOptions } from "../schema";
4
4
  import { GoogleVertexShared } from "./google-vertex-shared";
5
5
  export declare const id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
@@ -16,7 +16,7 @@ export interface Settings extends ProviderPackage.Settings {
16
16
  readonly project?: string;
17
17
  readonly providerOptions?: ProviderOptions;
18
18
  }
19
- export declare const routes: import("../route").Route<{
19
+ export declare const routes: Route<{
20
20
  anthropic_version: "vertex-2023-10-16";
21
21
  system?: readonly {
22
22
  readonly type: "text";
@@ -1,15 +1,45 @@
1
- import { GoogleVertexAnthropic } from "../protocols/google-vertex-anthropic";
1
+ import { Effect, Schema, Struct } from "effect";
2
+ import { AnthropicMessages } from "../protocols/anthropic-messages";
3
+ import { Auth } from "../route/auth";
4
+ import { Route } from "../route/client";
5
+ import { Endpoint } from "../route/endpoint";
6
+ import { Framing } from "../route/framing";
7
+ import { Protocol } from "../route/protocol";
2
8
  import { ProviderID } from "../schema";
3
9
  import { GoogleVertexShared } from "./google-vertex-shared";
10
+ const VERSION = "vertex-2023-10-16";
11
+ // models.dev uses this provider id even though the API contract is Anthropic Messages.
4
12
  export const id = ProviderID.make("google-vertex-anthropic");
5
- export const routes = [GoogleVertexAnthropic.route];
13
+ const route = Route.make({
14
+ id: "google-vertex-messages",
15
+ provider: id,
16
+ providerMetadataKey: "anthropic",
17
+ protocol: Protocol.make({
18
+ id: AnthropicMessages.protocol.id,
19
+ body: {
20
+ schema: Schema.Struct({
21
+ ...Struct.omit(AnthropicMessages.AnthropicMessagesBody.fields, ["model"]),
22
+ anthropic_version: Schema.Literal(VERSION),
23
+ }),
24
+ from: (request) => AnthropicMessages.protocol.body.from(request).pipe(Effect.map((body) => ({
25
+ ...Struct.omit(body, ["model"]),
26
+ anthropic_version: VERSION,
27
+ }))),
28
+ },
29
+ stream: AnthropicMessages.protocol.stream,
30
+ }),
31
+ endpoint: Endpoint.path(({ request }) => `/${request.model.id}:streamRawPredict`),
32
+ auth: Auth.none,
33
+ framing: Framing.sse,
34
+ });
35
+ export const routes = [route];
6
36
  const configuredRoute = (input) => {
7
37
  if ("apiKey" in input && input.apiKey !== undefined)
8
- throw new Error("Google Vertex Anthropic does not support API keys");
38
+ throw new Error("Google Vertex Messages does not support API keys");
9
39
  const { accessToken: _accessToken, auth: _auth, baseURL, location: inputLocation, project: inputProject, ...rest } = input;
10
40
  const location = GoogleVertexShared.location(inputLocation, "global");
11
41
  const project = GoogleVertexShared.project(inputProject);
12
- return GoogleVertexAnthropic.route.with({
42
+ return route.with({
13
43
  ...rest,
14
44
  endpoint: {
15
45
  baseURL: baseURL ??
@@ -32,7 +62,7 @@ export const provider = {
32
62
  };
33
63
  export const model = (modelID, settings) => {
34
64
  if (settings.apiKey !== undefined)
35
- throw new Error("Google Vertex Anthropic does not support API keys");
65
+ throw new Error("Google Vertex Messages does not support API keys");
36
66
  return configure({
37
67
  accessToken: settings.accessToken,
38
68
  baseURL: settings.baseURL,
@@ -1,5 +1,5 @@
1
1
  import type { ProviderPackage } from "../provider-package";
2
- import type { RouteDefaultsInput } from "../route/client";
2
+ import { Route, type RouteDefaultsInput } from "../route/client";
3
3
  import { type ModelID, type ProviderOptions } from "../schema";
4
4
  import { GoogleVertexShared } from "./google-vertex-shared";
5
5
  export declare const id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
@@ -20,7 +20,7 @@ export type Settings = ProviderPackage.Settings & ({
20
20
  readonly project?: string;
21
21
  readonly providerOptions?: ProviderOptions;
22
22
  };
23
- export declare const routes: import("../route").Route<{
23
+ export declare const routes: Route<{
24
24
  readonly contents: readonly {
25
25
  readonly role: "user" | "model";
26
26
  readonly parts: readonly ({
@@ -1,9 +1,24 @@
1
- import { GoogleVertexGemini } from "../protocols/google-vertex-gemini";
1
+ import { Gemini } from "../protocols/gemini";
2
2
  import { Auth } from "../route/auth";
3
+ import { Route } from "../route/client";
4
+ import { Endpoint } from "../route/endpoint";
5
+ import { Framing } from "../route/framing";
3
6
  import { ProviderID } from "../schema";
4
7
  import { GoogleVertexShared } from "./google-vertex-shared";
5
8
  export const id = ProviderID.make("google-vertex");
6
- export const routes = [GoogleVertexGemini.route];
9
+ const route = Route.make({
10
+ id: "google-vertex-gemini",
11
+ provider: id,
12
+ providerMetadataKey: "google",
13
+ protocol: Gemini.protocol,
14
+ endpoint: Endpoint.path(({ request }) => {
15
+ const model = String(request.model.id);
16
+ return `/${model.startsWith("endpoints/") ? model : `models/${model}`}:streamGenerateContent?alt=sse`;
17
+ }),
18
+ auth: Auth.none,
19
+ framing: Framing.sse,
20
+ });
21
+ export const routes = [route];
7
22
  const configuredRoute = (input, modelID) => {
8
23
  const { accessToken: _accessToken, apiKey: _apiKey, auth: _auth, baseURL, location: inputLocation, project: inputProject, ...rest } = input;
9
24
  const apiKey = GoogleVertexShared.apiKey(input);
@@ -16,7 +31,7 @@ const configuredRoute = (input, modelID) => {
16
31
  (apiKey
17
32
  ? "https://aiplatform.googleapis.com/v1/publishers/google"
18
33
  : `https://${GoogleVertexShared.host(location)}/v1beta1/projects/${GoogleVertexShared.requireProject(project)}/locations/${location}${endpointModel ? "" : "/publishers/google"}`);
19
- return GoogleVertexGemini.route.with({
34
+ return route.with({
20
35
  ...rest,
21
36
  endpoint: { baseURL: endpoint },
22
37
  auth: apiKey === undefined ? GoogleVertexShared.oauth(input, project) : Auth.header("x-goog-api-key", apiKey),
@@ -7,7 +7,7 @@ export { CloudflareAIGateway, CloudflareWorkersAI } from "./cloudflare";
7
7
  export * as GitHubCopilot from "./github-copilot";
8
8
  export * as Google from "./google";
9
9
  export * as GoogleVertex from "./google-vertex";
10
- export * as GoogleVertexAnthropic from "./google-vertex-anthropic";
10
+ export * as GoogleVertexMessages from "./google-vertex-messages";
11
11
  export * as OpenAI from "./openai";
12
12
  export * as OpenAICompatible from "./openai-compatible";
13
13
  export * as OpenAICompatibleResponses from "./openai-compatible-responses";
@@ -7,7 +7,7 @@ export { CloudflareAIGateway, CloudflareWorkersAI } from "./cloudflare";
7
7
  export * as GitHubCopilot from "./github-copilot";
8
8
  export * as Google from "./google";
9
9
  export * as GoogleVertex from "./google-vertex";
10
- export * as GoogleVertexAnthropic from "./google-vertex-anthropic";
10
+ export * as GoogleVertexMessages from "./google-vertex-messages";
11
11
  export * as OpenAI from "./openai";
12
12
  export * as OpenAICompatible from "./openai-compatible";
13
13
  export * as OpenAICompatibleResponses from "./openai-compatible-responses";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "0.0.0-next-15636",
3
+ "version": "0.0.0-next-15646",
4
4
  "name": "@opencode-ai/ai",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -26,7 +26,7 @@
26
26
  "devDependencies": {
27
27
  "@clack/prompts": "1.0.0-alpha.1",
28
28
  "@effect/platform-node": "4.0.0-beta.83",
29
- "@opencode-ai/http-recorder": "0.0.0-next-15636",
29
+ "@opencode-ai/http-recorder": "0.0.0-next-15646",
30
30
  "@tsconfig/bun": "1.0.9",
31
31
  "@types/bun": "1.3.13",
32
32
  "@typescript/native-preview": "7.0.0-dev.20251207.1",
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@smithy/eventstream-codec": "4.2.14",
37
37
  "@smithy/util-utf8": "4.2.2",
38
- "@opencode-ai/schema": "0.0.0-next-15636",
38
+ "@opencode-ai/schema": "0.0.0-next-15646",
39
39
  "aws4fetch": "1.0.20",
40
40
  "effect": "4.0.0-beta.83",
41
41
  "google-auth-library": "10.5.0"
@@ -1,494 +0,0 @@
1
- import { Schema } from "effect";
2
- import { Route } from "../route/client";
3
- import { Protocol } from "../route/protocol";
4
- export declare const GoogleVertexAnthropicBody: Schema.Struct<{
5
- readonly anthropic_version: Schema.Literal<"vertex-2023-10-16">;
6
- readonly system: Schema.optional<Schema.$Array<Schema.Struct<{
7
- readonly type: Schema.tag<"text">;
8
- readonly text: Schema.String;
9
- readonly cache_control: Schema.optional<Schema.Struct<{
10
- readonly type: Schema.tag<"ephemeral">;
11
- readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
12
- }>>;
13
- }>>>;
14
- readonly messages: Schema.$Array<Schema.toTaggedUnion<"role", readonly [Schema.Struct<{
15
- readonly role: Schema.Literal<"user">;
16
- readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
17
- readonly type: Schema.tag<"text">;
18
- readonly text: Schema.String;
19
- readonly cache_control: Schema.optional<Schema.Struct<{
20
- readonly type: Schema.tag<"ephemeral">;
21
- readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
22
- }>>;
23
- }>, Schema.Struct<{
24
- readonly type: Schema.tag<"image">;
25
- readonly source: Schema.Struct<{
26
- readonly type: Schema.tag<"base64">;
27
- readonly media_type: Schema.String;
28
- readonly data: Schema.String;
29
- }>;
30
- readonly cache_control: Schema.optional<Schema.Struct<{
31
- readonly type: Schema.tag<"ephemeral">;
32
- readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
33
- }>>;
34
- }>, Schema.Struct<{
35
- readonly type: Schema.tag<"tool_result">;
36
- readonly tool_use_id: Schema.String;
37
- readonly content: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
38
- readonly type: Schema.tag<"text">;
39
- readonly text: Schema.String;
40
- readonly cache_control: Schema.optional<Schema.Struct<{
41
- readonly type: Schema.tag<"ephemeral">;
42
- readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
43
- }>>;
44
- }>, Schema.Struct<{
45
- readonly type: Schema.tag<"image">;
46
- readonly source: Schema.Struct<{
47
- readonly type: Schema.tag<"base64">;
48
- readonly media_type: Schema.String;
49
- readonly data: Schema.String;
50
- }>;
51
- readonly cache_control: Schema.optional<Schema.Struct<{
52
- readonly type: Schema.tag<"ephemeral">;
53
- readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
54
- }>>;
55
- }>]>>]>;
56
- readonly is_error: Schema.optional<Schema.Boolean>;
57
- readonly cache_control: Schema.optional<Schema.Struct<{
58
- readonly type: Schema.tag<"ephemeral">;
59
- readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
60
- }>>;
61
- }>]>>;
62
- }>, Schema.Struct<{
63
- readonly role: Schema.Literal<"assistant">;
64
- readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
65
- readonly type: Schema.tag<"text">;
66
- readonly text: Schema.String;
67
- readonly cache_control: Schema.optional<Schema.Struct<{
68
- readonly type: Schema.tag<"ephemeral">;
69
- readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
70
- }>>;
71
- }>, Schema.Struct<{
72
- readonly type: Schema.tag<"thinking">;
73
- readonly thinking: Schema.String;
74
- readonly signature: Schema.optional<Schema.String>;
75
- readonly cache_control: Schema.optional<Schema.Struct<{
76
- readonly type: Schema.tag<"ephemeral">;
77
- readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
78
- }>>;
79
- }>, Schema.Struct<{
80
- readonly type: Schema.tag<"tool_use">;
81
- readonly id: Schema.String;
82
- readonly name: Schema.String;
83
- readonly input: Schema.Unknown;
84
- readonly cache_control: Schema.optional<Schema.Struct<{
85
- readonly type: Schema.tag<"ephemeral">;
86
- readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
87
- }>>;
88
- }>, Schema.Struct<{
89
- readonly type: Schema.tag<"server_tool_use">;
90
- readonly id: Schema.String;
91
- readonly name: Schema.String;
92
- readonly input: Schema.Unknown;
93
- readonly cache_control: Schema.optional<Schema.Struct<{
94
- readonly type: Schema.tag<"ephemeral">;
95
- readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
96
- }>>;
97
- }>, Schema.Struct<{
98
- readonly type: Schema.Literals<readonly ["web_search_tool_result", "code_execution_tool_result", "web_fetch_tool_result"]>;
99
- readonly tool_use_id: Schema.String;
100
- readonly content: Schema.Unknown;
101
- readonly cache_control: Schema.optional<Schema.Struct<{
102
- readonly type: Schema.tag<"ephemeral">;
103
- readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
104
- }>>;
105
- }>]>>;
106
- }>, Schema.Struct<{
107
- readonly role: Schema.Literal<"system">;
108
- readonly content: Schema.$Array<Schema.Struct<{
109
- readonly type: Schema.tag<"text">;
110
- readonly text: Schema.String;
111
- readonly cache_control: Schema.optional<Schema.Struct<{
112
- readonly type: Schema.tag<"ephemeral">;
113
- readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
114
- }>>;
115
- }>>;
116
- }>]>>;
117
- readonly tools: Schema.optional<Schema.$Array<Schema.Struct<{
118
- readonly name: Schema.String;
119
- readonly description: Schema.String;
120
- readonly input_schema: Schema.$Record<Schema.String, Schema.Unknown>;
121
- readonly cache_control: Schema.optional<Schema.Struct<{
122
- readonly type: Schema.tag<"ephemeral">;
123
- readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
124
- }>>;
125
- }>>>;
126
- readonly temperature: Schema.optional<Schema.Number>;
127
- readonly stream: Schema.Literal<true>;
128
- readonly max_tokens: Schema.Number;
129
- readonly stop_sequences: Schema.optional<Schema.$Array<Schema.String>>;
130
- readonly thinking: Schema.optional<Schema.Union<readonly [Schema.Struct<{
131
- readonly type: Schema.tag<"enabled">;
132
- readonly budget_tokens: Schema.Number;
133
- }>, Schema.Struct<{
134
- readonly type: Schema.tag<"adaptive">;
135
- readonly display: Schema.optional<Schema.Literals<readonly ["summarized", "omitted"]>>;
136
- }>, Schema.Struct<{
137
- readonly type: Schema.tag<"disabled">;
138
- }>]>>;
139
- readonly tool_choice: Schema.optional<Schema.Union<readonly [Schema.Struct<{
140
- readonly type: Schema.Literals<readonly ["auto", "any"]>;
141
- }>, Schema.Struct<{
142
- readonly type: Schema.tag<"tool">;
143
- readonly name: Schema.String;
144
- }>]>>;
145
- readonly top_k: Schema.optional<Schema.Number>;
146
- readonly top_p: Schema.optional<Schema.Number>;
147
- readonly output_config: Schema.optional<Schema.Struct<{
148
- readonly effort: Schema.optional<Schema.String>;
149
- }>>;
150
- }>;
151
- export type GoogleVertexAnthropicBody = Schema.Schema.Type<typeof GoogleVertexAnthropicBody>;
152
- export declare const protocol: Protocol<{
153
- anthropic_version: "vertex-2023-10-16";
154
- system?: readonly {
155
- readonly type: "text";
156
- readonly text: string;
157
- readonly cache_control?: {
158
- readonly type: "ephemeral";
159
- readonly ttl?: "1h" | "5m" | undefined;
160
- } | undefined;
161
- }[] | undefined;
162
- messages: readonly ({
163
- readonly role: "user";
164
- readonly content: readonly ({
165
- readonly type: "text";
166
- readonly text: string;
167
- readonly cache_control?: {
168
- readonly type: "ephemeral";
169
- readonly ttl?: "1h" | "5m" | undefined;
170
- } | undefined;
171
- } | {
172
- readonly type: "image";
173
- readonly source: {
174
- readonly type: "base64";
175
- readonly media_type: string;
176
- readonly data: string;
177
- };
178
- readonly cache_control?: {
179
- readonly type: "ephemeral";
180
- readonly ttl?: "1h" | "5m" | undefined;
181
- } | undefined;
182
- } | {
183
- readonly type: "tool_result";
184
- readonly tool_use_id: string;
185
- readonly content: string | readonly ({
186
- readonly type: "text";
187
- readonly text: string;
188
- readonly cache_control?: {
189
- readonly type: "ephemeral";
190
- readonly ttl?: "1h" | "5m" | undefined;
191
- } | undefined;
192
- } | {
193
- readonly type: "image";
194
- readonly source: {
195
- readonly type: "base64";
196
- readonly media_type: string;
197
- readonly data: string;
198
- };
199
- readonly cache_control?: {
200
- readonly type: "ephemeral";
201
- readonly ttl?: "1h" | "5m" | undefined;
202
- } | undefined;
203
- })[];
204
- readonly is_error?: boolean | undefined;
205
- readonly cache_control?: {
206
- readonly type: "ephemeral";
207
- readonly ttl?: "1h" | "5m" | undefined;
208
- } | undefined;
209
- })[];
210
- } | {
211
- readonly role: "assistant";
212
- readonly content: readonly ({
213
- readonly type: "text";
214
- readonly text: string;
215
- readonly cache_control?: {
216
- readonly type: "ephemeral";
217
- readonly ttl?: "1h" | "5m" | undefined;
218
- } | undefined;
219
- } | {
220
- readonly type: "tool_use";
221
- readonly id: string;
222
- readonly name: string;
223
- readonly input: unknown;
224
- readonly cache_control?: {
225
- readonly type: "ephemeral";
226
- readonly ttl?: "1h" | "5m" | undefined;
227
- } | undefined;
228
- } | {
229
- readonly type: "server_tool_use";
230
- readonly id: string;
231
- readonly name: string;
232
- readonly input: unknown;
233
- readonly cache_control?: {
234
- readonly type: "ephemeral";
235
- readonly ttl?: "1h" | "5m" | undefined;
236
- } | undefined;
237
- } | {
238
- readonly type: "web_search_tool_result" | "code_execution_tool_result" | "web_fetch_tool_result";
239
- readonly tool_use_id: string;
240
- readonly content: unknown;
241
- readonly cache_control?: {
242
- readonly type: "ephemeral";
243
- readonly ttl?: "1h" | "5m" | undefined;
244
- } | undefined;
245
- } | {
246
- readonly type: "thinking";
247
- readonly thinking: string;
248
- readonly signature?: string | undefined;
249
- readonly cache_control?: {
250
- readonly type: "ephemeral";
251
- readonly ttl?: "1h" | "5m" | undefined;
252
- } | undefined;
253
- })[];
254
- } | {
255
- readonly role: "system";
256
- readonly content: readonly {
257
- readonly type: "text";
258
- readonly text: string;
259
- readonly cache_control?: {
260
- readonly type: "ephemeral";
261
- readonly ttl?: "1h" | "5m" | undefined;
262
- } | undefined;
263
- }[];
264
- })[];
265
- tools?: readonly {
266
- readonly name: string;
267
- readonly description: string;
268
- readonly input_schema: {
269
- readonly [x: string]: unknown;
270
- };
271
- readonly cache_control?: {
272
- readonly type: "ephemeral";
273
- readonly ttl?: "1h" | "5m" | undefined;
274
- } | undefined;
275
- }[] | undefined;
276
- temperature?: number | undefined;
277
- stream: true;
278
- max_tokens: number;
279
- stop_sequences?: readonly string[] | undefined;
280
- thinking?: {
281
- readonly type: "enabled";
282
- readonly budget_tokens: number;
283
- } | {
284
- readonly type: "adaptive";
285
- readonly display?: "summarized" | "omitted" | undefined;
286
- } | {
287
- readonly type: "disabled";
288
- } | undefined;
289
- tool_choice?: {
290
- readonly type: "auto" | "any";
291
- } | {
292
- readonly type: "tool";
293
- readonly name: string;
294
- } | undefined;
295
- top_k?: number | undefined;
296
- top_p?: number | undefined;
297
- output_config?: {
298
- readonly effort?: string | undefined;
299
- } | undefined;
300
- }, string, {
301
- readonly type: string;
302
- readonly index?: number | undefined;
303
- readonly message?: {
304
- readonly usage?: {
305
- readonly input_tokens?: number | undefined;
306
- readonly output_tokens?: number | undefined;
307
- readonly cache_creation_input_tokens?: number | null | undefined;
308
- readonly cache_read_input_tokens?: number | null | undefined;
309
- } | undefined;
310
- } | undefined;
311
- readonly content_block?: {
312
- readonly type: string;
313
- readonly id?: string | undefined;
314
- readonly name?: string | undefined;
315
- readonly text?: string | undefined;
316
- readonly thinking?: string | undefined;
317
- readonly signature?: string | undefined;
318
- readonly input?: unknown;
319
- readonly tool_use_id?: string | undefined;
320
- readonly content?: unknown;
321
- } | undefined;
322
- readonly delta?: {
323
- readonly type?: string | undefined;
324
- readonly text?: string | undefined;
325
- readonly thinking?: string | undefined;
326
- readonly partial_json?: string | undefined;
327
- readonly signature?: string | undefined;
328
- readonly stop_reason?: string | null | undefined;
329
- readonly stop_sequence?: string | null | undefined;
330
- } | undefined;
331
- readonly usage?: {
332
- readonly input_tokens?: number | undefined;
333
- readonly output_tokens?: number | undefined;
334
- readonly cache_creation_input_tokens?: number | null | undefined;
335
- readonly cache_read_input_tokens?: number | null | undefined;
336
- } | undefined;
337
- readonly error?: {
338
- readonly type?: string | undefined;
339
- readonly message?: string | undefined;
340
- } | undefined;
341
- }, {
342
- tools: Partial<Record<number, import("./utils/tool-stream").PendingTool>>;
343
- lifecycle: import("./utils/lifecycle").State;
344
- }>;
345
- export declare const route: Route<{
346
- anthropic_version: "vertex-2023-10-16";
347
- system?: readonly {
348
- readonly type: "text";
349
- readonly text: string;
350
- readonly cache_control?: {
351
- readonly type: "ephemeral";
352
- readonly ttl?: "1h" | "5m" | undefined;
353
- } | undefined;
354
- }[] | undefined;
355
- messages: readonly ({
356
- readonly role: "user";
357
- readonly content: readonly ({
358
- readonly type: "text";
359
- readonly text: string;
360
- readonly cache_control?: {
361
- readonly type: "ephemeral";
362
- readonly ttl?: "1h" | "5m" | undefined;
363
- } | undefined;
364
- } | {
365
- readonly type: "image";
366
- readonly source: {
367
- readonly type: "base64";
368
- readonly media_type: string;
369
- readonly data: string;
370
- };
371
- readonly cache_control?: {
372
- readonly type: "ephemeral";
373
- readonly ttl?: "1h" | "5m" | undefined;
374
- } | undefined;
375
- } | {
376
- readonly type: "tool_result";
377
- readonly tool_use_id: string;
378
- readonly content: string | readonly ({
379
- readonly type: "text";
380
- readonly text: string;
381
- readonly cache_control?: {
382
- readonly type: "ephemeral";
383
- readonly ttl?: "1h" | "5m" | undefined;
384
- } | undefined;
385
- } | {
386
- readonly type: "image";
387
- readonly source: {
388
- readonly type: "base64";
389
- readonly media_type: string;
390
- readonly data: string;
391
- };
392
- readonly cache_control?: {
393
- readonly type: "ephemeral";
394
- readonly ttl?: "1h" | "5m" | undefined;
395
- } | undefined;
396
- })[];
397
- readonly is_error?: boolean | undefined;
398
- readonly cache_control?: {
399
- readonly type: "ephemeral";
400
- readonly ttl?: "1h" | "5m" | undefined;
401
- } | undefined;
402
- })[];
403
- } | {
404
- readonly role: "assistant";
405
- readonly content: readonly ({
406
- readonly type: "text";
407
- readonly text: string;
408
- readonly cache_control?: {
409
- readonly type: "ephemeral";
410
- readonly ttl?: "1h" | "5m" | undefined;
411
- } | undefined;
412
- } | {
413
- readonly type: "tool_use";
414
- readonly id: string;
415
- readonly name: string;
416
- readonly input: unknown;
417
- readonly cache_control?: {
418
- readonly type: "ephemeral";
419
- readonly ttl?: "1h" | "5m" | undefined;
420
- } | undefined;
421
- } | {
422
- readonly type: "server_tool_use";
423
- readonly id: string;
424
- readonly name: string;
425
- readonly input: unknown;
426
- readonly cache_control?: {
427
- readonly type: "ephemeral";
428
- readonly ttl?: "1h" | "5m" | undefined;
429
- } | undefined;
430
- } | {
431
- readonly type: "web_search_tool_result" | "code_execution_tool_result" | "web_fetch_tool_result";
432
- readonly tool_use_id: string;
433
- readonly content: unknown;
434
- readonly cache_control?: {
435
- readonly type: "ephemeral";
436
- readonly ttl?: "1h" | "5m" | undefined;
437
- } | undefined;
438
- } | {
439
- readonly type: "thinking";
440
- readonly thinking: string;
441
- readonly signature?: string | undefined;
442
- readonly cache_control?: {
443
- readonly type: "ephemeral";
444
- readonly ttl?: "1h" | "5m" | undefined;
445
- } | undefined;
446
- })[];
447
- } | {
448
- readonly role: "system";
449
- readonly content: readonly {
450
- readonly type: "text";
451
- readonly text: string;
452
- readonly cache_control?: {
453
- readonly type: "ephemeral";
454
- readonly ttl?: "1h" | "5m" | undefined;
455
- } | undefined;
456
- }[];
457
- })[];
458
- tools?: readonly {
459
- readonly name: string;
460
- readonly description: string;
461
- readonly input_schema: {
462
- readonly [x: string]: unknown;
463
- };
464
- readonly cache_control?: {
465
- readonly type: "ephemeral";
466
- readonly ttl?: "1h" | "5m" | undefined;
467
- } | undefined;
468
- }[] | undefined;
469
- temperature?: number | undefined;
470
- stream: true;
471
- max_tokens: number;
472
- stop_sequences?: readonly string[] | undefined;
473
- thinking?: {
474
- readonly type: "enabled";
475
- readonly budget_tokens: number;
476
- } | {
477
- readonly type: "adaptive";
478
- readonly display?: "summarized" | "omitted" | undefined;
479
- } | {
480
- readonly type: "disabled";
481
- } | undefined;
482
- tool_choice?: {
483
- readonly type: "auto" | "any";
484
- } | {
485
- readonly type: "tool";
486
- readonly name: string;
487
- } | undefined;
488
- top_k?: number | undefined;
489
- top_p?: number | undefined;
490
- output_config?: {
491
- readonly effort?: string | undefined;
492
- } | undefined;
493
- }, import("../route/transport/http").HttpPrepared<string>>;
494
- export * as GoogleVertexAnthropic from "./google-vertex-anthropic";
@@ -1,33 +0,0 @@
1
- import { Effect, Schema, Struct } from "effect";
2
- import { AnthropicMessages } from "./anthropic-messages";
3
- import { Auth } from "../route/auth";
4
- import { Route } from "../route/client";
5
- import { Endpoint } from "../route/endpoint";
6
- import { Framing } from "../route/framing";
7
- import { Protocol } from "../route/protocol";
8
- const VERSION = "vertex-2023-10-16";
9
- export const GoogleVertexAnthropicBody = Schema.Struct({
10
- ...Struct.omit(AnthropicMessages.AnthropicMessagesBody.fields, ["model"]),
11
- anthropic_version: Schema.Literal(VERSION),
12
- });
13
- export const protocol = Protocol.make({
14
- id: "google-vertex-anthropic",
15
- body: {
16
- schema: GoogleVertexAnthropicBody,
17
- from: (request) => AnthropicMessages.protocol.body.from(request).pipe(Effect.map((body) => ({
18
- ...Struct.omit(body, ["model"]),
19
- anthropic_version: VERSION,
20
- }))),
21
- },
22
- stream: AnthropicMessages.protocol.stream,
23
- });
24
- export const route = Route.make({
25
- id: "google-vertex-anthropic",
26
- provider: "google-vertex-anthropic",
27
- providerMetadataKey: "anthropic",
28
- protocol,
29
- endpoint: Endpoint.path(({ request }) => `/${request.model.id}:streamRawPredict`),
30
- auth: Auth.none,
31
- framing: Framing.sse,
32
- });
33
- export * as GoogleVertexAnthropic from "./google-vertex-anthropic";
@@ -1,59 +0,0 @@
1
- import { Route } from "../route/client";
2
- export declare const route: Route<{
3
- readonly contents: readonly {
4
- readonly role: "user" | "model";
5
- readonly parts: readonly ({
6
- readonly text: string;
7
- readonly thought?: boolean | undefined;
8
- readonly thoughtSignature?: string | undefined;
9
- } | {
10
- readonly inlineData: {
11
- readonly mimeType: string;
12
- readonly data: string;
13
- };
14
- } | {
15
- readonly functionCall: {
16
- readonly name: string;
17
- readonly args: unknown;
18
- };
19
- readonly thoughtSignature?: string | undefined;
20
- } | {
21
- readonly functionResponse: {
22
- readonly name: string;
23
- readonly response: unknown;
24
- };
25
- })[];
26
- }[];
27
- readonly systemInstruction?: {
28
- readonly parts: readonly {
29
- readonly text: string;
30
- }[];
31
- } | undefined;
32
- readonly tools?: readonly {
33
- readonly functionDeclarations: readonly {
34
- readonly name: string;
35
- readonly description: string;
36
- readonly parameters?: {
37
- readonly [x: string]: unknown;
38
- } | undefined;
39
- }[];
40
- }[] | undefined;
41
- readonly toolConfig?: {
42
- readonly functionCallingConfig: {
43
- readonly mode: "AUTO" | "NONE" | "ANY";
44
- readonly allowedFunctionNames?: readonly string[] | undefined;
45
- };
46
- } | undefined;
47
- readonly generationConfig?: {
48
- readonly maxOutputTokens?: number | undefined;
49
- readonly temperature?: number | undefined;
50
- readonly topP?: number | undefined;
51
- readonly topK?: number | undefined;
52
- readonly stopSequences?: readonly string[] | undefined;
53
- readonly thinkingConfig?: {
54
- readonly thinkingBudget?: number | undefined;
55
- readonly includeThoughts?: boolean | undefined;
56
- } | undefined;
57
- } | undefined;
58
- }, import("../route/transport/http").HttpPrepared<string>>;
59
- export * as GoogleVertexGemini from "./google-vertex-gemini";
@@ -1,18 +0,0 @@
1
- import { Gemini } from "./gemini";
2
- import { Auth } from "../route/auth";
3
- import { Route } from "../route/client";
4
- import { Endpoint } from "../route/endpoint";
5
- import { Framing } from "../route/framing";
6
- export const route = Route.make({
7
- id: "google-vertex-gemini",
8
- provider: "google-vertex",
9
- providerMetadataKey: "google",
10
- protocol: Gemini.protocol,
11
- endpoint: Endpoint.path(({ request }) => {
12
- const model = String(request.model.id);
13
- return `/${model.startsWith("endpoints/") ? model : `models/${model}`}:streamGenerateContent?alt=sse`;
14
- }),
15
- auth: Auth.none,
16
- framing: Framing.sse,
17
- });
18
- export * as GoogleVertexGemini from "./google-vertex-gemini";
@@ -1,2 +0,0 @@
1
- export { model } from "../google-vertex-anthropic";
2
- export type { Settings } from "../google-vertex-anthropic";
@@ -1 +0,0 @@
1
- export { model } from "../google-vertex-anthropic";