@opencode-ai/ai 0.0.0-bootstrap.0 → 0.0.0-next-15618

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.
Files changed (151) hide show
  1. package/README.md +176 -1
  2. package/dist/cache-policy.d.ts +2 -0
  3. package/dist/cache-policy.js +108 -0
  4. package/dist/index.d.ts +14 -0
  5. package/dist/index.js +9 -0
  6. package/dist/llm.d.ts +223 -0
  7. package/dist/llm.js +81 -0
  8. package/dist/protocols/anthropic-messages.d.ts +503 -0
  9. package/dist/protocols/anthropic-messages.js +745 -0
  10. package/dist/protocols/bedrock-converse.d.ts +476 -0
  11. package/dist/protocols/bedrock-converse.js +526 -0
  12. package/dist/protocols/bedrock-event-stream.d.ts +9 -0
  13. package/dist/protocols/bedrock-event-stream.js +64 -0
  14. package/dist/protocols/gemini.d.ts +220 -0
  15. package/dist/protocols/gemini.js +420 -0
  16. package/dist/protocols/google-vertex-anthropic.d.ts +494 -0
  17. package/dist/protocols/google-vertex-anthropic.js +33 -0
  18. package/dist/protocols/google-vertex-gemini.d.ts +59 -0
  19. package/dist/protocols/google-vertex-gemini.js +18 -0
  20. package/dist/protocols/index.d.ts +9 -0
  21. package/dist/protocols/index.js +9 -0
  22. package/dist/protocols/openai-chat.d.ts +391 -0
  23. package/dist/protocols/openai-chat.js +423 -0
  24. package/dist/protocols/openai-compatible-chat.d.ts +73 -0
  25. package/dist/protocols/openai-compatible-chat.js +20 -0
  26. package/dist/protocols/openai-compatible-responses.d.ts +85 -0
  27. package/dist/protocols/openai-compatible-responses.js +18 -0
  28. package/dist/protocols/openai-responses.d.ts +613 -0
  29. package/dist/protocols/openai-responses.js +828 -0
  30. package/dist/protocols/shared.d.ts +192 -0
  31. package/dist/protocols/shared.js +236 -0
  32. package/dist/protocols/utils/bedrock-auth.d.ts +18 -0
  33. package/dist/protocols/utils/bedrock-auth.js +41 -0
  34. package/dist/protocols/utils/bedrock-cache.d.ts +15 -0
  35. package/dist/protocols/utils/bedrock-cache.js +29 -0
  36. package/dist/protocols/utils/bedrock-media.d.ts +49 -0
  37. package/dist/protocols/utils/bedrock-media.js +68 -0
  38. package/dist/protocols/utils/cache.d.ts +6 -0
  39. package/dist/protocols/utils/cache.js +8 -0
  40. package/dist/protocols/utils/gemini-tool-schema.d.ts +2 -0
  41. package/dist/protocols/utils/gemini-tool-schema.js +83 -0
  42. package/dist/protocols/utils/lifecycle.d.ts +19 -0
  43. package/dist/protocols/utils/lifecycle.js +65 -0
  44. package/dist/protocols/utils/openai-options.d.ts +22 -0
  45. package/dist/protocols/utils/openai-options.js +64 -0
  46. package/dist/protocols/utils/tool-schema.d.ts +7 -0
  47. package/dist/protocols/utils/tool-schema.js +79 -0
  48. package/dist/protocols/utils/tool-stream.d.ts +155 -0
  49. package/dist/protocols/utils/tool-stream.js +136 -0
  50. package/dist/protocols.d.ts +1 -0
  51. package/dist/protocols.js +1 -0
  52. package/dist/provider-error.d.ts +13 -0
  53. package/dist/provider-error.js +122 -0
  54. package/dist/provider-package.d.ts +13 -0
  55. package/dist/provider-package.js +1 -0
  56. package/dist/provider.d.ts +23 -0
  57. package/dist/provider.js +2 -0
  58. package/dist/providers/amazon-bedrock.d.ts +150 -0
  59. package/dist/providers/amazon-bedrock.js +41 -0
  60. package/dist/providers/anthropic-compatible.d.ts +183 -0
  61. package/dist/providers/anthropic-compatible.js +44 -0
  62. package/dist/providers/anthropic.d.ts +181 -0
  63. package/dist/providers/anthropic.js +39 -0
  64. package/dist/providers/azure/chat.d.ts +2 -0
  65. package/dist/providers/azure/chat.js +1 -0
  66. package/dist/providers/azure/responses.d.ts +2 -0
  67. package/dist/providers/azure/responses.js +1 -0
  68. package/dist/providers/azure.d.ts +183 -0
  69. package/dist/providers/azure.js +89 -0
  70. package/dist/providers/cloudflare.d.ts +232 -0
  71. package/dist/providers/cloudflare.js +87 -0
  72. package/dist/providers/github-copilot.d.ts +167 -0
  73. package/dist/providers/github-copilot.js +47 -0
  74. package/dist/providers/google-vertex/anthropic.d.ts +2 -0
  75. package/dist/providers/google-vertex/anthropic.js +1 -0
  76. package/dist/providers/google-vertex-anthropic.d.ts +181 -0
  77. package/dist/providers/google-vertex-anthropic.js +46 -0
  78. package/dist/providers/google-vertex-shared.d.ts +22 -0
  79. package/dist/providers/google-vertex-shared.js +61 -0
  80. package/dist/providers/google-vertex.d.ts +93 -0
  81. package/dist/providers/google-vertex.js +49 -0
  82. package/dist/providers/google.d.ts +85 -0
  83. package/dist/providers/google.js +33 -0
  84. package/dist/providers/index.d.ts +15 -0
  85. package/dist/providers/index.js +15 -0
  86. package/dist/providers/openai/chat.d.ts +2 -0
  87. package/dist/providers/openai/chat.js +1 -0
  88. package/dist/providers/openai/responses.d.ts +2 -0
  89. package/dist/providers/openai/responses.js +1 -0
  90. package/dist/providers/openai-compatible/responses.d.ts +1 -0
  91. package/dist/providers/openai-compatible/responses.js +1 -0
  92. package/dist/providers/openai-compatible-profile.d.ts +43 -0
  93. package/dist/providers/openai-compatible-profile.js +12 -0
  94. package/dist/providers/openai-compatible-responses.d.ts +107 -0
  95. package/dist/providers/openai-compatible-responses.js +33 -0
  96. package/dist/providers/openai-compatible.d.ts +130 -0
  97. package/dist/providers/openai-compatible.js +55 -0
  98. package/dist/providers/openai-options.d.ts +30 -0
  99. package/dist/providers/openai-options.js +42 -0
  100. package/dist/providers/openai.d.ts +264 -0
  101. package/dist/providers/openai.js +62 -0
  102. package/dist/providers/openrouter.d.ts +321 -0
  103. package/dist/providers/openrouter.js +65 -0
  104. package/dist/providers/xai.d.ts +169 -0
  105. package/dist/providers/xai.js +43 -0
  106. package/dist/providers.d.ts +1 -0
  107. package/dist/providers.js +1 -0
  108. package/dist/route/auth-options.d.ts +34 -0
  109. package/dist/route/auth-options.js +14 -0
  110. package/dist/route/auth.d.ts +49 -0
  111. package/dist/route/auth.js +89 -0
  112. package/dist/route/client.d.ts +330 -0
  113. package/dist/route/client.js +211 -0
  114. package/dist/route/endpoint.d.ts +28 -0
  115. package/dist/route/endpoint.js +21 -0
  116. package/dist/route/executor.d.ts +12 -0
  117. package/dist/route/executor.js +229 -0
  118. package/dist/route/framing.d.ts +23 -0
  119. package/dist/route/framing.js +4 -0
  120. package/dist/route/index.d.ts +16 -0
  121. package/dist/route/index.js +9 -0
  122. package/dist/route/protocol.d.ts +76 -0
  123. package/dist/route/protocol.js +17 -0
  124. package/dist/route/transport/http.d.ts +33 -0
  125. package/dist/route/transport/http.js +98 -0
  126. package/dist/route/transport/index.d.ts +27 -0
  127. package/dist/route/transport/index.js +4 -0
  128. package/dist/route/transport/websocket.d.ts +56 -0
  129. package/dist/route/transport/websocket.js +181 -0
  130. package/dist/route.d.ts +1 -0
  131. package/dist/route.js +1 -0
  132. package/dist/schema/errors.d.ts +153 -0
  133. package/dist/schema/errors.js +150 -0
  134. package/dist/schema/events.d.ts +4292 -0
  135. package/dist/schema/events.js +482 -0
  136. package/dist/schema/ids.d.ts +30 -0
  137. package/dist/schema/ids.js +18 -0
  138. package/dist/schema/index.d.ts +5 -0
  139. package/dist/schema/index.js +5 -0
  140. package/dist/schema/messages.d.ts +385 -0
  141. package/dist/schema/messages.js +246 -0
  142. package/dist/schema/options.d.ts +143 -0
  143. package/dist/schema/options.js +195 -0
  144. package/dist/tool-runtime.d.ts +15 -0
  145. package/dist/tool-runtime.js +35 -0
  146. package/dist/tool.d.ts +134 -0
  147. package/dist/tool.js +66 -0
  148. package/dist/utils/record.d.ts +2 -0
  149. package/dist/utils/record.js +2 -0
  150. package/package.json +36 -9
  151. package/index.js +0 -1
@@ -0,0 +1,494 @@
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";
@@ -0,0 +1,33 @@
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";
@@ -0,0 +1,59 @@
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";
@@ -0,0 +1,18 @@
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";
@@ -0,0 +1,9 @@
1
+ export * as AnthropicMessages from "./anthropic-messages";
2
+ export * as GoogleVertexAnthropic from "./google-vertex-anthropic";
3
+ export * as GoogleVertexGemini from "./google-vertex-gemini";
4
+ export * as BedrockConverse from "./bedrock-converse";
5
+ export * as Gemini from "./gemini";
6
+ export * as OpenAIChat from "./openai-chat";
7
+ export * as OpenAICompatibleChat from "./openai-compatible-chat";
8
+ export * as OpenAICompatibleResponses from "./openai-compatible-responses";
9
+ export * as OpenAIResponses from "./openai-responses";
@@ -0,0 +1,9 @@
1
+ export * as AnthropicMessages from "./anthropic-messages";
2
+ export * as GoogleVertexAnthropic from "./google-vertex-anthropic";
3
+ export * as GoogleVertexGemini from "./google-vertex-gemini";
4
+ export * as BedrockConverse from "./bedrock-converse";
5
+ export * as Gemini from "./gemini";
6
+ export * as OpenAIChat from "./openai-chat";
7
+ export * as OpenAICompatibleChat from "./openai-compatible-chat";
8
+ export * as OpenAICompatibleResponses from "./openai-compatible-responses";
9
+ export * as OpenAIResponses from "./openai-responses";