@opencode/ai 0.0.0-beta-19275
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 +682 -0
- package/dist/cache-policy.d.ts +2 -0
- package/dist/cache-policy.js +129 -0
- package/dist/image-client.d.ts +19 -0
- package/dist/image-client.js +28 -0
- package/dist/image.d.ts +110 -0
- package/dist/image.js +103 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +12 -0
- package/dist/llm.d.ts +252 -0
- package/dist/llm.js +74 -0
- package/dist/protocols/anthropic-messages.d.ts +957 -0
- package/dist/protocols/anthropic-messages.js +1414 -0
- package/dist/protocols/bedrock-converse.d.ts +499 -0
- package/dist/protocols/bedrock-converse.js +643 -0
- package/dist/protocols/bedrock-event-stream.d.ts +9 -0
- package/dist/protocols/bedrock-event-stream.js +97 -0
- package/dist/protocols/gemini.d.ts +285 -0
- package/dist/protocols/gemini.js +671 -0
- package/dist/protocols/google-images.d.ts +30 -0
- package/dist/protocols/google-images.js +181 -0
- package/dist/protocols/index.d.ts +12 -0
- package/dist/protocols/index.js +12 -0
- package/dist/protocols/meta-images.d.ts +26 -0
- package/dist/protocols/meta-images.js +89 -0
- package/dist/protocols/meta-messages.d.ts +350 -0
- package/dist/protocols/meta-messages.js +41 -0
- package/dist/protocols/meta-responses.d.ts +473 -0
- package/dist/protocols/meta-responses.js +173 -0
- package/dist/protocols/mistral-chat.d.ts +540 -0
- package/dist/protocols/mistral-chat.js +624 -0
- package/dist/protocols/open-responses-channel.d.ts +23 -0
- package/dist/protocols/open-responses-channel.js +141 -0
- package/dist/protocols/open-responses-continuation.d.ts +12 -0
- package/dist/protocols/open-responses-continuation.js +161 -0
- package/dist/protocols/open-responses.d.ts +1583 -0
- package/dist/protocols/open-responses.js +1206 -0
- package/dist/protocols/openai-chat.d.ts +860 -0
- package/dist/protocols/openai-chat.js +966 -0
- package/dist/protocols/openai-compatible-chat.d.ts +109 -0
- package/dist/protocols/openai-compatible-chat.js +19 -0
- package/dist/protocols/openai-compatible-responses.d.ts +172 -0
- package/dist/protocols/openai-compatible-responses.js +18 -0
- package/dist/protocols/openai-images.d.ts +32 -0
- package/dist/protocols/openai-images.js +183 -0
- package/dist/protocols/openai-responses.d.ts +1389 -0
- package/dist/protocols/openai-responses.js +260 -0
- package/dist/protocols/shared.d.ts +193 -0
- package/dist/protocols/shared.js +290 -0
- package/dist/protocols/utils/bedrock-auth.d.ts +60 -0
- package/dist/protocols/utils/bedrock-auth.js +85 -0
- package/dist/protocols/utils/bedrock-cache.d.ts +19 -0
- package/dist/protocols/utils/bedrock-cache.js +49 -0
- package/dist/protocols/utils/bedrock-media.d.ts +55 -0
- package/dist/protocols/utils/bedrock-media.js +73 -0
- package/dist/protocols/utils/cache.d.ts +6 -0
- package/dist/protocols/utils/cache.js +5 -0
- package/dist/protocols/utils/gemini-tool-schema.d.ts +2 -0
- package/dist/protocols/utils/gemini-tool-schema.js +103 -0
- package/dist/protocols/utils/image-input.d.ts +21 -0
- package/dist/protocols/utils/image-input.js +20 -0
- package/dist/protocols/utils/lifecycle.d.ts +24 -0
- package/dist/protocols/utils/lifecycle.js +72 -0
- package/dist/protocols/utils/meta-image.d.ts +2 -0
- package/dist/protocols/utils/meta-image.js +13 -0
- package/dist/protocols/utils/open-responses-options.d.ts +56 -0
- package/dist/protocols/utils/open-responses-options.js +61 -0
- package/dist/protocols/utils/openai-image.d.ts +5 -0
- package/dist/protocols/utils/openai-image.js +18 -0
- package/dist/protocols/utils/openai-options.d.ts +16 -0
- package/dist/protocols/utils/openai-options.js +14 -0
- package/dist/protocols/utils/partial-json-options.d.ts +62 -0
- package/dist/protocols/utils/partial-json-options.js +52 -0
- package/dist/protocols/utils/partial-json.d.ts +8 -0
- package/dist/protocols/utils/partial-json.js +279 -0
- package/dist/protocols/utils/responses-checkpoint.d.ts +4 -0
- package/dist/protocols/utils/responses-checkpoint.js +107 -0
- package/dist/protocols/utils/responses-compaction.d.ts +4 -0
- package/dist/protocols/utils/responses-compaction.js +129 -0
- package/dist/protocols/utils/responses-hosted-tools.d.ts +26 -0
- package/dist/protocols/utils/responses-hosted-tools.js +32 -0
- package/dist/protocols/utils/tool-schema.d.ts +8 -0
- package/dist/protocols/utils/tool-schema.js +54 -0
- package/dist/protocols/utils/tool-stream.d.ts +710 -0
- package/dist/protocols/utils/tool-stream.js +155 -0
- package/dist/protocols/xai-images.d.ts +26 -0
- package/dist/protocols/xai-images.js +106 -0
- package/dist/protocols/xai-responses.d.ts +250 -0
- package/dist/protocols/xai-responses.js +81 -0
- package/dist/protocols/zai-images.d.ts +22 -0
- package/dist/protocols/zai-images.js +79 -0
- package/dist/protocols.d.ts +1 -0
- package/dist/protocols.js +1 -0
- package/dist/provider-error.d.ts +15 -0
- package/dist/provider-error.js +125 -0
- package/dist/provider-package.d.ts +11 -0
- package/dist/provider-package.js +1 -0
- package/dist/provider.d.ts +23 -0
- package/dist/provider.js +2 -0
- package/dist/providers/amazon-bedrock/mantle/chat.d.ts +2 -0
- package/dist/providers/amazon-bedrock/mantle/chat.js +1 -0
- package/dist/providers/amazon-bedrock/mantle/responses.d.ts +2 -0
- package/dist/providers/amazon-bedrock/mantle/responses.js +1 -0
- package/dist/providers/amazon-bedrock/mantle.d.ts +2 -0
- package/dist/providers/amazon-bedrock/mantle.js +1 -0
- package/dist/providers/amazon-bedrock-mantle.d.ts +371 -0
- package/dist/providers/amazon-bedrock-mantle.js +76 -0
- package/dist/providers/amazon-bedrock.d.ts +173 -0
- package/dist/providers/amazon-bedrock.js +41 -0
- package/dist/providers/anthropic-compatible.d.ts +304 -0
- package/dist/providers/anthropic-compatible.js +44 -0
- package/dist/providers/anthropic.d.ts +302 -0
- package/dist/providers/anthropic.js +39 -0
- package/dist/providers/azure/chat.d.ts +2 -0
- package/dist/providers/azure/chat.js +1 -0
- package/dist/providers/azure/responses.d.ts +2 -0
- package/dist/providers/azure/responses.js +1 -0
- package/dist/providers/azure.d.ts +599 -0
- package/dist/providers/azure.js +115 -0
- package/dist/providers/baseten.d.ts +229 -0
- package/dist/providers/baseten.js +38 -0
- package/dist/providers/cerebras.d.ts +228 -0
- package/dist/providers/cerebras.js +40 -0
- package/dist/providers/cloudflare-ai-gateway.d.ts +238 -0
- package/dist/providers/cloudflare-ai-gateway.js +59 -0
- package/dist/providers/cloudflare-workers-ai.d.ts +232 -0
- package/dist/providers/cloudflare-workers-ai.js +45 -0
- package/dist/providers/deepinfra.d.ts +228 -0
- package/dist/providers/deepinfra.js +43 -0
- package/dist/providers/deepseek.d.ts +229 -0
- package/dist/providers/deepseek.js +41 -0
- package/dist/providers/fireworks.d.ts +229 -0
- package/dist/providers/fireworks.js +38 -0
- package/dist/providers/google-vertex/chat.d.ts +2 -0
- package/dist/providers/google-vertex/chat.js +1 -0
- package/dist/providers/google-vertex/gemini.d.ts +2 -0
- package/dist/providers/google-vertex/gemini.js +1 -0
- package/dist/providers/google-vertex/messages.d.ts +2 -0
- package/dist/providers/google-vertex/messages.js +1 -0
- package/dist/providers/google-vertex/responses.d.ts +2 -0
- package/dist/providers/google-vertex/responses.js +1 -0
- package/dist/providers/google-vertex-chat.d.ts +133 -0
- package/dist/providers/google-vertex-chat.js +55 -0
- package/dist/providers/google-vertex-messages.d.ts +301 -0
- package/dist/providers/google-vertex-messages.js +75 -0
- package/dist/providers/google-vertex-responses.d.ts +198 -0
- package/dist/providers/google-vertex-responses.js +56 -0
- package/dist/providers/google-vertex-shared.d.ts +22 -0
- package/dist/providers/google-vertex-shared.js +61 -0
- package/dist/providers/google-vertex.d.ts +120 -0
- package/dist/providers/google-vertex.js +92 -0
- package/dist/providers/google.d.ts +115 -0
- package/dist/providers/google.js +42 -0
- package/dist/providers/groq.d.ts +315 -0
- package/dist/providers/groq.js +81 -0
- package/dist/providers/index.d.ts +28 -0
- package/dist/providers/index.js +28 -0
- package/dist/providers/meta/chat.d.ts +2 -0
- package/dist/providers/meta/chat.js +1 -0
- package/dist/providers/meta/messages.d.ts +2 -0
- package/dist/providers/meta/messages.js +1 -0
- package/dist/providers/meta/responses.d.ts +2 -0
- package/dist/providers/meta/responses.js +1 -0
- package/dist/providers/meta.d.ts +631 -0
- package/dist/providers/meta.js +113 -0
- package/dist/providers/minimax/chat.d.ts +4 -0
- package/dist/providers/minimax/chat.js +8 -0
- package/dist/providers/minimax/messages.d.ts +1 -0
- package/dist/providers/minimax/messages.js +1 -0
- package/dist/providers/minimax/responses.d.ts +4 -0
- package/dist/providers/minimax/responses.js +8 -0
- package/dist/providers/minimax.d.ts +593 -0
- package/dist/providers/minimax.js +89 -0
- package/dist/providers/mistral.d.ts +208 -0
- package/dist/providers/mistral.js +28 -0
- package/dist/providers/open-responses-options.d.ts +6 -0
- package/dist/providers/open-responses-options.js +1 -0
- package/dist/providers/openai/chat.d.ts +2 -0
- package/dist/providers/openai/chat.js +1 -0
- package/dist/providers/openai/responses.d.ts +2 -0
- package/dist/providers/openai/responses.js +1 -0
- package/dist/providers/openai-compatible/responses.d.ts +1 -0
- package/dist/providers/openai-compatible/responses.js +1 -0
- package/dist/providers/openai-compatible-responses.d.ts +196 -0
- package/dist/providers/openai-compatible-responses.js +32 -0
- package/dist/providers/openai-compatible.d.ts +131 -0
- package/dist/providers/openai-compatible.js +33 -0
- package/dist/providers/openai-options.d.ts +26 -0
- package/dist/providers/openai-options.js +41 -0
- package/dist/providers/openai.d.ts +405 -0
- package/dist/providers/openai.js +82 -0
- package/dist/providers/openrouter.d.ts +564 -0
- package/dist/providers/openrouter.js +114 -0
- package/dist/providers/togetherai.d.ts +228 -0
- package/dist/providers/togetherai.js +40 -0
- package/dist/providers/xai.d.ts +164 -0
- package/dist/providers/xai.js +84 -0
- package/dist/providers/zai.d.ts +24 -0
- package/dist/providers/zai.js +21 -0
- package/dist/providers.d.ts +1 -0
- package/dist/providers.js +1 -0
- package/dist/route/auth-options.d.ts +34 -0
- package/dist/route/auth-options.js +14 -0
- package/dist/route/auth.d.ts +51 -0
- package/dist/route/auth.js +87 -0
- package/dist/route/client.d.ts +430 -0
- package/dist/route/client.js +304 -0
- package/dist/route/endpoint.d.ts +28 -0
- package/dist/route/endpoint.js +21 -0
- package/dist/route/executor.d.ts +27 -0
- package/dist/route/executor.js +183 -0
- package/dist/route/framing.d.ts +29 -0
- package/dist/route/framing.js +14 -0
- package/dist/route/index.d.ts +16 -0
- package/dist/route/index.js +9 -0
- package/dist/route/protocol.d.ts +76 -0
- package/dist/route/protocol.js +16 -0
- package/dist/route/transport/http.d.ts +34 -0
- package/dist/route/transport/http.js +68 -0
- package/dist/route/transport/index.d.ts +41 -0
- package/dist/route/transport/index.js +4 -0
- package/dist/route/transport/websocket-channel.d.ts +57 -0
- package/dist/route/transport/websocket-channel.js +1 -0
- package/dist/route/transport/websocket.d.ts +56 -0
- package/dist/route/transport/websocket.js +366 -0
- package/dist/route.d.ts +1 -0
- package/dist/route.js +1 -0
- package/dist/schema/errors.d.ts +158 -0
- package/dist/schema/errors.js +120 -0
- package/dist/schema/events.d.ts +8123 -0
- package/dist/schema/events.js +550 -0
- package/dist/schema/ids.d.ts +17 -0
- package/dist/schema/ids.js +10 -0
- package/dist/schema/index.d.ts +5 -0
- package/dist/schema/index.js +5 -0
- package/dist/schema/messages.d.ts +646 -0
- package/dist/schema/messages.js +301 -0
- package/dist/schema/options.d.ts +157 -0
- package/dist/schema/options.js +187 -0
- package/dist/testing.d.ts +1693 -0
- package/dist/testing.js +129 -0
- package/dist/tool-history.d.ts +2 -0
- package/dist/tool-history.js +84 -0
- package/dist/tool-runtime.d.ts +15 -0
- package/dist/tool-runtime.js +62 -0
- package/dist/tool.d.ts +136 -0
- package/dist/tool.js +66 -0
- package/dist/utils/record.d.ts +2 -0
- package/dist/utils/record.js +2 -0
- package/dist/utils/sanitize.d.ts +1 -0
- package/dist/utils/sanitize.js +12 -0
- package/package.json +48 -0
|
@@ -0,0 +1,957 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { Route } from "../route/client.js";
|
|
3
|
+
import { Framing } from "../route/framing.js";
|
|
4
|
+
import { Protocol } from "../route/protocol.js";
|
|
5
|
+
import { HttpTransport } from "../route/transport/index.js";
|
|
6
|
+
import { AIError, LLMRequest } from "../schema/index.js";
|
|
7
|
+
import { Lifecycle } from "./utils/lifecycle.js";
|
|
8
|
+
import { ToolStream } from "./utils/tool-stream.js";
|
|
9
|
+
export declare const DEFAULT_BASE_URL = "https://api.anthropic.com/v1";
|
|
10
|
+
export declare const PATH = "/messages";
|
|
11
|
+
export declare const DEFAULT_MAX_TOKENS = 32000;
|
|
12
|
+
export declare const framing: Framing.Definition<string>;
|
|
13
|
+
export type ThinkingInput = {
|
|
14
|
+
readonly type: "adaptive";
|
|
15
|
+
readonly display?: "summarized" | "omitted";
|
|
16
|
+
} | {
|
|
17
|
+
readonly type: "disabled";
|
|
18
|
+
} | ({
|
|
19
|
+
readonly type: "enabled";
|
|
20
|
+
readonly display?: "summarized" | "omitted";
|
|
21
|
+
} & ({
|
|
22
|
+
readonly budgetTokens: number;
|
|
23
|
+
readonly budget_tokens?: number;
|
|
24
|
+
} | {
|
|
25
|
+
readonly budgetTokens?: number;
|
|
26
|
+
readonly budget_tokens: number;
|
|
27
|
+
}));
|
|
28
|
+
export interface OptionsInput {
|
|
29
|
+
/** Advanced in-band compaction. The caller owns checkpoint persistence and recovery. */
|
|
30
|
+
readonly contextManagement?: ContextManagement;
|
|
31
|
+
readonly [key: string]: unknown;
|
|
32
|
+
readonly thinking?: ThinkingInput;
|
|
33
|
+
readonly effort?: string;
|
|
34
|
+
readonly service_tier?: "auto" | "standard_only";
|
|
35
|
+
readonly serviceTier?: "auto" | "standard_only";
|
|
36
|
+
readonly metadata?: {
|
|
37
|
+
readonly user_id?: string | null;
|
|
38
|
+
};
|
|
39
|
+
readonly container?: string | {
|
|
40
|
+
readonly id?: string | null;
|
|
41
|
+
readonly skills?: ReadonlyArray<Record<string, unknown>> | null;
|
|
42
|
+
};
|
|
43
|
+
readonly inference_geo?: string | null;
|
|
44
|
+
readonly inferenceGeo?: string | null;
|
|
45
|
+
readonly cache_control?: {
|
|
46
|
+
readonly type: "ephemeral";
|
|
47
|
+
readonly ttl?: "5m" | "1h";
|
|
48
|
+
};
|
|
49
|
+
readonly cacheControl?: {
|
|
50
|
+
readonly type: "ephemeral";
|
|
51
|
+
readonly ttl?: "5m" | "1h";
|
|
52
|
+
};
|
|
53
|
+
readonly output_config?: {
|
|
54
|
+
readonly effort?: string | null;
|
|
55
|
+
readonly format?: {
|
|
56
|
+
readonly type: "json_schema";
|
|
57
|
+
readonly schema: Record<string, unknown>;
|
|
58
|
+
} | null;
|
|
59
|
+
};
|
|
60
|
+
readonly outputConfig?: {
|
|
61
|
+
readonly effort?: string | null;
|
|
62
|
+
readonly format?: {
|
|
63
|
+
readonly type: "json_schema";
|
|
64
|
+
readonly schema: Record<string, unknown>;
|
|
65
|
+
} | null;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export type ProviderOptionsInput = OptionsInput;
|
|
69
|
+
export declare const ContextManagement: Schema.Struct<{
|
|
70
|
+
readonly edits: Schema.$Array<Schema.Struct<{
|
|
71
|
+
readonly type: Schema.Literal<"compact_20260112">;
|
|
72
|
+
readonly trigger: Schema.optional<Schema.Struct<{
|
|
73
|
+
readonly type: Schema.Literal<"input_tokens">;
|
|
74
|
+
readonly value: Schema.Int;
|
|
75
|
+
}>>;
|
|
76
|
+
readonly pauseAfterCompaction: Schema.optional<Schema.Boolean>;
|
|
77
|
+
readonly instructions: Schema.optional<Schema.String>;
|
|
78
|
+
}>>;
|
|
79
|
+
}>;
|
|
80
|
+
export type ContextManagement = typeof ContextManagement.Type;
|
|
81
|
+
export declare const AnthropicMessagesBody: Schema.Struct<{
|
|
82
|
+
context_management: Schema.optional<Schema.Struct<{
|
|
83
|
+
readonly edits: Schema.$Array<Schema.Struct<{
|
|
84
|
+
readonly type: Schema.Literal<"compact_20260112">;
|
|
85
|
+
readonly trigger: Schema.optional<Schema.Struct<{
|
|
86
|
+
readonly type: Schema.Literal<"input_tokens">;
|
|
87
|
+
readonly value: Schema.Int;
|
|
88
|
+
}>>;
|
|
89
|
+
readonly pause_after_compaction: Schema.optional<Schema.Boolean>;
|
|
90
|
+
readonly instructions: Schema.optional<Schema.String>;
|
|
91
|
+
}>>;
|
|
92
|
+
}>>;
|
|
93
|
+
model: Schema.String;
|
|
94
|
+
system: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
95
|
+
readonly type: Schema.tag<"text">;
|
|
96
|
+
readonly text: Schema.String;
|
|
97
|
+
readonly cache_control: Schema.optional<Schema.Struct<{
|
|
98
|
+
readonly type: Schema.tag<"ephemeral">;
|
|
99
|
+
readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
|
|
100
|
+
}>>;
|
|
101
|
+
}>>>;
|
|
102
|
+
messages: Schema.$Array<Schema.toTaggedUnion<"role", readonly [Schema.Struct<{
|
|
103
|
+
readonly role: Schema.Literal<"user">;
|
|
104
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
105
|
+
readonly type: Schema.tag<"text">;
|
|
106
|
+
readonly text: Schema.String;
|
|
107
|
+
readonly cache_control: Schema.optional<Schema.Struct<{
|
|
108
|
+
readonly type: Schema.tag<"ephemeral">;
|
|
109
|
+
readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
|
|
110
|
+
}>>;
|
|
111
|
+
}>, Schema.Struct<{
|
|
112
|
+
readonly type: Schema.tag<"image">;
|
|
113
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
114
|
+
readonly type: Schema.tag<"base64">;
|
|
115
|
+
readonly media_type: Schema.String;
|
|
116
|
+
readonly data: Schema.String;
|
|
117
|
+
}>, Schema.Struct<{
|
|
118
|
+
readonly type: Schema.tag<"url">;
|
|
119
|
+
readonly url: Schema.String;
|
|
120
|
+
}>, Schema.Struct<{
|
|
121
|
+
readonly type: Schema.tag<"file">;
|
|
122
|
+
readonly file_id: Schema.String;
|
|
123
|
+
}>]>;
|
|
124
|
+
readonly cache_control: Schema.optional<Schema.Struct<{
|
|
125
|
+
readonly type: Schema.tag<"ephemeral">;
|
|
126
|
+
readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
|
|
127
|
+
}>>;
|
|
128
|
+
readonly transformations: Schema.optional<Schema.Struct<{
|
|
129
|
+
readonly oversized_image: Schema.optional<Schema.Literals<readonly ["downsize", "error"]>>;
|
|
130
|
+
}>>;
|
|
131
|
+
}>, Schema.Struct<{
|
|
132
|
+
readonly type: Schema.tag<"document">;
|
|
133
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
134
|
+
readonly type: Schema.tag<"base64">;
|
|
135
|
+
readonly media_type: Schema.Literal<"application/pdf">;
|
|
136
|
+
readonly data: Schema.String;
|
|
137
|
+
}>, Schema.Struct<{
|
|
138
|
+
readonly type: Schema.tag<"text">;
|
|
139
|
+
readonly media_type: Schema.Literal<"text/plain">;
|
|
140
|
+
readonly data: Schema.String;
|
|
141
|
+
}>, Schema.Struct<{
|
|
142
|
+
readonly type: Schema.tag<"url">;
|
|
143
|
+
readonly url: Schema.String;
|
|
144
|
+
}>, Schema.Struct<{
|
|
145
|
+
readonly type: Schema.tag<"file">;
|
|
146
|
+
readonly file_id: Schema.String;
|
|
147
|
+
}>]>;
|
|
148
|
+
readonly cache_control: Schema.optional<Schema.Struct<{
|
|
149
|
+
readonly type: Schema.tag<"ephemeral">;
|
|
150
|
+
readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
|
|
151
|
+
}>>;
|
|
152
|
+
readonly title: Schema.optional<Schema.String>;
|
|
153
|
+
readonly context: Schema.optional<Schema.String>;
|
|
154
|
+
readonly citations: Schema.optional<Schema.Struct<{
|
|
155
|
+
readonly enabled: Schema.Boolean;
|
|
156
|
+
}>>;
|
|
157
|
+
}>, Schema.Struct<{
|
|
158
|
+
readonly type: Schema.tag<"tool_result">;
|
|
159
|
+
readonly tool_use_id: Schema.String;
|
|
160
|
+
readonly content: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
161
|
+
readonly type: Schema.tag<"text">;
|
|
162
|
+
readonly text: Schema.String;
|
|
163
|
+
readonly cache_control: Schema.optional<Schema.Struct<{
|
|
164
|
+
readonly type: Schema.tag<"ephemeral">;
|
|
165
|
+
readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
|
|
166
|
+
}>>;
|
|
167
|
+
}>, Schema.Struct<{
|
|
168
|
+
readonly type: Schema.tag<"image">;
|
|
169
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
170
|
+
readonly type: Schema.tag<"base64">;
|
|
171
|
+
readonly media_type: Schema.String;
|
|
172
|
+
readonly data: Schema.String;
|
|
173
|
+
}>, Schema.Struct<{
|
|
174
|
+
readonly type: Schema.tag<"url">;
|
|
175
|
+
readonly url: Schema.String;
|
|
176
|
+
}>, Schema.Struct<{
|
|
177
|
+
readonly type: Schema.tag<"file">;
|
|
178
|
+
readonly file_id: Schema.String;
|
|
179
|
+
}>]>;
|
|
180
|
+
readonly cache_control: Schema.optional<Schema.Struct<{
|
|
181
|
+
readonly type: Schema.tag<"ephemeral">;
|
|
182
|
+
readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
|
|
183
|
+
}>>;
|
|
184
|
+
readonly transformations: Schema.optional<Schema.Struct<{
|
|
185
|
+
readonly oversized_image: Schema.optional<Schema.Literals<readonly ["downsize", "error"]>>;
|
|
186
|
+
}>>;
|
|
187
|
+
}>, Schema.Struct<{
|
|
188
|
+
readonly type: Schema.tag<"document">;
|
|
189
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
190
|
+
readonly type: Schema.tag<"base64">;
|
|
191
|
+
readonly media_type: Schema.Literal<"application/pdf">;
|
|
192
|
+
readonly data: Schema.String;
|
|
193
|
+
}>, Schema.Struct<{
|
|
194
|
+
readonly type: Schema.tag<"text">;
|
|
195
|
+
readonly media_type: Schema.Literal<"text/plain">;
|
|
196
|
+
readonly data: Schema.String;
|
|
197
|
+
}>, Schema.Struct<{
|
|
198
|
+
readonly type: Schema.tag<"url">;
|
|
199
|
+
readonly url: Schema.String;
|
|
200
|
+
}>, Schema.Struct<{
|
|
201
|
+
readonly type: Schema.tag<"file">;
|
|
202
|
+
readonly file_id: Schema.String;
|
|
203
|
+
}>]>;
|
|
204
|
+
readonly cache_control: Schema.optional<Schema.Struct<{
|
|
205
|
+
readonly type: Schema.tag<"ephemeral">;
|
|
206
|
+
readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
|
|
207
|
+
}>>;
|
|
208
|
+
readonly title: Schema.optional<Schema.String>;
|
|
209
|
+
readonly context: Schema.optional<Schema.String>;
|
|
210
|
+
readonly citations: Schema.optional<Schema.Struct<{
|
|
211
|
+
readonly enabled: Schema.Boolean;
|
|
212
|
+
}>>;
|
|
213
|
+
}>]>>]>;
|
|
214
|
+
readonly is_error: Schema.optional<Schema.Boolean>;
|
|
215
|
+
readonly cache_control: Schema.optional<Schema.Struct<{
|
|
216
|
+
readonly type: Schema.tag<"ephemeral">;
|
|
217
|
+
readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
|
|
218
|
+
}>>;
|
|
219
|
+
}>]>>;
|
|
220
|
+
}>, Schema.Struct<{
|
|
221
|
+
readonly role: Schema.Literal<"assistant">;
|
|
222
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
223
|
+
readonly type: Schema.Literal<"compaction">;
|
|
224
|
+
readonly content: Schema.NullOr<Schema.String>;
|
|
225
|
+
}>, Schema.Struct<{
|
|
226
|
+
readonly type: Schema.tag<"text">;
|
|
227
|
+
readonly text: Schema.String;
|
|
228
|
+
readonly cache_control: Schema.optional<Schema.Struct<{
|
|
229
|
+
readonly type: Schema.tag<"ephemeral">;
|
|
230
|
+
readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
|
|
231
|
+
}>>;
|
|
232
|
+
}>, Schema.Struct<{
|
|
233
|
+
readonly type: Schema.tag<"thinking">;
|
|
234
|
+
readonly thinking: Schema.String;
|
|
235
|
+
readonly signature: Schema.String;
|
|
236
|
+
readonly cache_control: Schema.optional<Schema.Struct<{
|
|
237
|
+
readonly type: Schema.tag<"ephemeral">;
|
|
238
|
+
readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
|
|
239
|
+
}>>;
|
|
240
|
+
}>, Schema.Struct<{
|
|
241
|
+
readonly type: Schema.tag<"redacted_thinking">;
|
|
242
|
+
readonly data: Schema.String;
|
|
243
|
+
readonly cache_control: Schema.optional<Schema.Struct<{
|
|
244
|
+
readonly type: Schema.tag<"ephemeral">;
|
|
245
|
+
readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
|
|
246
|
+
}>>;
|
|
247
|
+
}>, Schema.Struct<{
|
|
248
|
+
readonly type: Schema.tag<"tool_use">;
|
|
249
|
+
readonly id: Schema.String;
|
|
250
|
+
readonly name: Schema.String;
|
|
251
|
+
readonly input: Schema.Unknown;
|
|
252
|
+
readonly cache_control: Schema.optional<Schema.Struct<{
|
|
253
|
+
readonly type: Schema.tag<"ephemeral">;
|
|
254
|
+
readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
|
|
255
|
+
}>>;
|
|
256
|
+
}>, Schema.Struct<{
|
|
257
|
+
readonly type: Schema.tag<"server_tool_use">;
|
|
258
|
+
readonly id: Schema.String;
|
|
259
|
+
readonly name: Schema.String;
|
|
260
|
+
readonly input: Schema.Unknown;
|
|
261
|
+
readonly cache_control: Schema.optional<Schema.Struct<{
|
|
262
|
+
readonly type: Schema.tag<"ephemeral">;
|
|
263
|
+
readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
|
|
264
|
+
}>>;
|
|
265
|
+
}>, Schema.Struct<{
|
|
266
|
+
readonly type: Schema.Literals<readonly ["web_search_tool_result", "code_execution_tool_result", "web_fetch_tool_result"]>;
|
|
267
|
+
readonly tool_use_id: Schema.String;
|
|
268
|
+
readonly content: Schema.Unknown;
|
|
269
|
+
readonly cache_control: Schema.optional<Schema.Struct<{
|
|
270
|
+
readonly type: Schema.tag<"ephemeral">;
|
|
271
|
+
readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
|
|
272
|
+
}>>;
|
|
273
|
+
}>]>>;
|
|
274
|
+
}>, Schema.Struct<{
|
|
275
|
+
readonly role: Schema.Literal<"system">;
|
|
276
|
+
readonly content: Schema.$Array<Schema.Struct<{
|
|
277
|
+
readonly type: Schema.tag<"text">;
|
|
278
|
+
readonly text: Schema.String;
|
|
279
|
+
readonly cache_control: Schema.optional<Schema.Struct<{
|
|
280
|
+
readonly type: Schema.tag<"ephemeral">;
|
|
281
|
+
readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
|
|
282
|
+
}>>;
|
|
283
|
+
}>>;
|
|
284
|
+
}>]>>;
|
|
285
|
+
tools: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
286
|
+
readonly name: Schema.String;
|
|
287
|
+
readonly description: Schema.String;
|
|
288
|
+
readonly input_schema: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
289
|
+
readonly cache_control: Schema.optional<Schema.Struct<{
|
|
290
|
+
readonly type: Schema.tag<"ephemeral">;
|
|
291
|
+
readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
|
|
292
|
+
}>>;
|
|
293
|
+
}>>>;
|
|
294
|
+
tool_choice: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
295
|
+
readonly type: Schema.Literals<readonly ["auto", "any", "none"]>;
|
|
296
|
+
readonly disable_parallel_tool_use: Schema.optional<Schema.Boolean>;
|
|
297
|
+
}>, Schema.Struct<{
|
|
298
|
+
readonly type: Schema.tag<"tool">;
|
|
299
|
+
readonly name: Schema.String;
|
|
300
|
+
readonly disable_parallel_tool_use: Schema.optional<Schema.Boolean>;
|
|
301
|
+
}>]>>;
|
|
302
|
+
stream: Schema.Literal<true>;
|
|
303
|
+
max_tokens: Schema.Number;
|
|
304
|
+
temperature: Schema.optional<Schema.Number>;
|
|
305
|
+
top_p: Schema.optional<Schema.Number>;
|
|
306
|
+
top_k: Schema.optional<Schema.Number>;
|
|
307
|
+
stop_sequences: Schema.optional<Schema.$Array<Schema.String>>;
|
|
308
|
+
thinking: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
309
|
+
readonly type: Schema.tag<"enabled">;
|
|
310
|
+
readonly budget_tokens: Schema.Number;
|
|
311
|
+
readonly display: Schema.optional<Schema.Literals<readonly ["summarized", "omitted"]>>;
|
|
312
|
+
}>, Schema.Struct<{
|
|
313
|
+
readonly type: Schema.tag<"adaptive">;
|
|
314
|
+
readonly display: Schema.optional<Schema.Literals<readonly ["summarized", "omitted"]>>;
|
|
315
|
+
}>, Schema.Struct<{
|
|
316
|
+
readonly type: Schema.tag<"disabled">;
|
|
317
|
+
}>]>>;
|
|
318
|
+
output_config: Schema.optional<Schema.Struct<{
|
|
319
|
+
readonly effort: Schema.optional<Schema.String>;
|
|
320
|
+
readonly format: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
321
|
+
readonly type: Schema.Literal<"json_schema">;
|
|
322
|
+
readonly schema: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
323
|
+
}>>>;
|
|
324
|
+
}>>;
|
|
325
|
+
cache_control: Schema.optional<Schema.Struct<{
|
|
326
|
+
readonly type: Schema.tag<"ephemeral">;
|
|
327
|
+
readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
|
|
328
|
+
}>>;
|
|
329
|
+
container: Schema.optional<Schema.NullOr<Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
330
|
+
readonly id: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
331
|
+
readonly skills: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>;
|
|
332
|
+
}>]>>>;
|
|
333
|
+
inference_geo: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
334
|
+
metadata: Schema.optional<Schema.Struct<{
|
|
335
|
+
readonly user_id: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
336
|
+
}>>;
|
|
337
|
+
service_tier: Schema.optional<Schema.Literals<readonly ["auto", "standard_only"]>>;
|
|
338
|
+
}>;
|
|
339
|
+
export type AnthropicMessagesBody = Schema.Schema.Type<typeof AnthropicMessagesBody>;
|
|
340
|
+
/**
|
|
341
|
+
* The Anthropic Messages protocol — request body construction, body schema,
|
|
342
|
+
* and the streaming-event state machine shared by Anthropic-compatible and
|
|
343
|
+
* Vertex-hosted Messages routes.
|
|
344
|
+
*/
|
|
345
|
+
export declare const protocol: Protocol<{
|
|
346
|
+
readonly max_tokens: number;
|
|
347
|
+
readonly model: string;
|
|
348
|
+
readonly messages: readonly ({
|
|
349
|
+
readonly role: "user";
|
|
350
|
+
readonly content: readonly ({
|
|
351
|
+
readonly type: "text";
|
|
352
|
+
readonly text: string;
|
|
353
|
+
readonly cache_control?: {
|
|
354
|
+
readonly type: "ephemeral";
|
|
355
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
356
|
+
} | undefined;
|
|
357
|
+
} | {
|
|
358
|
+
readonly type: "image";
|
|
359
|
+
readonly source: {
|
|
360
|
+
readonly type: "base64";
|
|
361
|
+
readonly media_type: string;
|
|
362
|
+
readonly data: string;
|
|
363
|
+
} | {
|
|
364
|
+
readonly type: "url";
|
|
365
|
+
readonly url: string;
|
|
366
|
+
} | {
|
|
367
|
+
readonly type: "file";
|
|
368
|
+
readonly file_id: string;
|
|
369
|
+
};
|
|
370
|
+
readonly cache_control?: {
|
|
371
|
+
readonly type: "ephemeral";
|
|
372
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
373
|
+
} | undefined;
|
|
374
|
+
readonly transformations?: {
|
|
375
|
+
readonly oversized_image?: "error" | "downsize" | undefined;
|
|
376
|
+
} | undefined;
|
|
377
|
+
} | {
|
|
378
|
+
readonly type: "document";
|
|
379
|
+
readonly source: {
|
|
380
|
+
readonly type: "base64";
|
|
381
|
+
readonly media_type: "application/pdf";
|
|
382
|
+
readonly data: string;
|
|
383
|
+
} | {
|
|
384
|
+
readonly type: "text";
|
|
385
|
+
readonly media_type: "text/plain";
|
|
386
|
+
readonly data: string;
|
|
387
|
+
} | {
|
|
388
|
+
readonly type: "url";
|
|
389
|
+
readonly url: string;
|
|
390
|
+
} | {
|
|
391
|
+
readonly type: "file";
|
|
392
|
+
readonly file_id: string;
|
|
393
|
+
};
|
|
394
|
+
readonly title?: string | undefined;
|
|
395
|
+
readonly context?: string | undefined;
|
|
396
|
+
readonly cache_control?: {
|
|
397
|
+
readonly type: "ephemeral";
|
|
398
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
399
|
+
} | undefined;
|
|
400
|
+
readonly citations?: {
|
|
401
|
+
readonly enabled: boolean;
|
|
402
|
+
} | undefined;
|
|
403
|
+
} | {
|
|
404
|
+
readonly type: "tool_result";
|
|
405
|
+
readonly content: string | 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: "image";
|
|
414
|
+
readonly source: {
|
|
415
|
+
readonly type: "base64";
|
|
416
|
+
readonly media_type: string;
|
|
417
|
+
readonly data: string;
|
|
418
|
+
} | {
|
|
419
|
+
readonly type: "url";
|
|
420
|
+
readonly url: string;
|
|
421
|
+
} | {
|
|
422
|
+
readonly type: "file";
|
|
423
|
+
readonly file_id: string;
|
|
424
|
+
};
|
|
425
|
+
readonly cache_control?: {
|
|
426
|
+
readonly type: "ephemeral";
|
|
427
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
428
|
+
} | undefined;
|
|
429
|
+
readonly transformations?: {
|
|
430
|
+
readonly oversized_image?: "error" | "downsize" | undefined;
|
|
431
|
+
} | undefined;
|
|
432
|
+
} | {
|
|
433
|
+
readonly type: "document";
|
|
434
|
+
readonly source: {
|
|
435
|
+
readonly type: "base64";
|
|
436
|
+
readonly media_type: "application/pdf";
|
|
437
|
+
readonly data: string;
|
|
438
|
+
} | {
|
|
439
|
+
readonly type: "text";
|
|
440
|
+
readonly media_type: "text/plain";
|
|
441
|
+
readonly data: string;
|
|
442
|
+
} | {
|
|
443
|
+
readonly type: "url";
|
|
444
|
+
readonly url: string;
|
|
445
|
+
} | {
|
|
446
|
+
readonly type: "file";
|
|
447
|
+
readonly file_id: string;
|
|
448
|
+
};
|
|
449
|
+
readonly title?: string | undefined;
|
|
450
|
+
readonly context?: string | undefined;
|
|
451
|
+
readonly cache_control?: {
|
|
452
|
+
readonly type: "ephemeral";
|
|
453
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
454
|
+
} | undefined;
|
|
455
|
+
readonly citations?: {
|
|
456
|
+
readonly enabled: boolean;
|
|
457
|
+
} | undefined;
|
|
458
|
+
})[];
|
|
459
|
+
readonly tool_use_id: string;
|
|
460
|
+
readonly cache_control?: {
|
|
461
|
+
readonly type: "ephemeral";
|
|
462
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
463
|
+
} | undefined;
|
|
464
|
+
readonly is_error?: boolean | undefined;
|
|
465
|
+
})[];
|
|
466
|
+
} | {
|
|
467
|
+
readonly role: "assistant";
|
|
468
|
+
readonly content: readonly ({
|
|
469
|
+
readonly type: "text";
|
|
470
|
+
readonly text: string;
|
|
471
|
+
readonly cache_control?: {
|
|
472
|
+
readonly type: "ephemeral";
|
|
473
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
474
|
+
} | undefined;
|
|
475
|
+
} | {
|
|
476
|
+
readonly id: string;
|
|
477
|
+
readonly type: "tool_use";
|
|
478
|
+
readonly name: string;
|
|
479
|
+
readonly input: unknown;
|
|
480
|
+
readonly cache_control?: {
|
|
481
|
+
readonly type: "ephemeral";
|
|
482
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
483
|
+
} | undefined;
|
|
484
|
+
} | {
|
|
485
|
+
readonly id: string;
|
|
486
|
+
readonly type: "server_tool_use";
|
|
487
|
+
readonly name: string;
|
|
488
|
+
readonly input: unknown;
|
|
489
|
+
readonly cache_control?: {
|
|
490
|
+
readonly type: "ephemeral";
|
|
491
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
492
|
+
} | undefined;
|
|
493
|
+
} | {
|
|
494
|
+
readonly type: "web_search_tool_result" | "code_execution_tool_result" | "web_fetch_tool_result";
|
|
495
|
+
readonly content: unknown;
|
|
496
|
+
readonly tool_use_id: string;
|
|
497
|
+
readonly cache_control?: {
|
|
498
|
+
readonly type: "ephemeral";
|
|
499
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
500
|
+
} | undefined;
|
|
501
|
+
} | {
|
|
502
|
+
readonly type: "thinking";
|
|
503
|
+
readonly thinking: string;
|
|
504
|
+
readonly signature: string;
|
|
505
|
+
readonly cache_control?: {
|
|
506
|
+
readonly type: "ephemeral";
|
|
507
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
508
|
+
} | undefined;
|
|
509
|
+
} | {
|
|
510
|
+
readonly data: string;
|
|
511
|
+
readonly type: "redacted_thinking";
|
|
512
|
+
readonly cache_control?: {
|
|
513
|
+
readonly type: "ephemeral";
|
|
514
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
515
|
+
} | undefined;
|
|
516
|
+
} | {
|
|
517
|
+
readonly type: "compaction";
|
|
518
|
+
readonly content: string | null;
|
|
519
|
+
})[];
|
|
520
|
+
} | {
|
|
521
|
+
readonly role: "system";
|
|
522
|
+
readonly content: readonly {
|
|
523
|
+
readonly type: "text";
|
|
524
|
+
readonly text: string;
|
|
525
|
+
readonly cache_control?: {
|
|
526
|
+
readonly type: "ephemeral";
|
|
527
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
528
|
+
} | undefined;
|
|
529
|
+
}[];
|
|
530
|
+
})[];
|
|
531
|
+
readonly stream: true;
|
|
532
|
+
readonly metadata?: {
|
|
533
|
+
readonly user_id?: string | null | undefined;
|
|
534
|
+
} | undefined;
|
|
535
|
+
readonly tools?: readonly {
|
|
536
|
+
readonly description: string;
|
|
537
|
+
readonly name: string;
|
|
538
|
+
readonly input_schema: {
|
|
539
|
+
readonly [x: string]: unknown;
|
|
540
|
+
};
|
|
541
|
+
readonly cache_control?: {
|
|
542
|
+
readonly type: "ephemeral";
|
|
543
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
544
|
+
} | undefined;
|
|
545
|
+
}[] | undefined;
|
|
546
|
+
readonly system?: readonly {
|
|
547
|
+
readonly type: "text";
|
|
548
|
+
readonly text: string;
|
|
549
|
+
readonly cache_control?: {
|
|
550
|
+
readonly type: "ephemeral";
|
|
551
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
552
|
+
} | undefined;
|
|
553
|
+
}[] | undefined;
|
|
554
|
+
readonly temperature?: number | undefined;
|
|
555
|
+
readonly thinking?: {
|
|
556
|
+
readonly type: "enabled";
|
|
557
|
+
readonly budget_tokens: number;
|
|
558
|
+
readonly display?: "summarized" | "omitted" | undefined;
|
|
559
|
+
} | {
|
|
560
|
+
readonly type: "adaptive";
|
|
561
|
+
readonly display?: "summarized" | "omitted" | undefined;
|
|
562
|
+
} | {
|
|
563
|
+
readonly type: "disabled";
|
|
564
|
+
} | undefined;
|
|
565
|
+
readonly service_tier?: "auto" | "standard_only" | undefined;
|
|
566
|
+
readonly container?: string | {
|
|
567
|
+
readonly id?: string | null | undefined;
|
|
568
|
+
readonly skills?: readonly {
|
|
569
|
+
readonly [x: string]: unknown;
|
|
570
|
+
}[] | null | undefined;
|
|
571
|
+
} | null | undefined;
|
|
572
|
+
readonly inference_geo?: string | null | undefined;
|
|
573
|
+
readonly cache_control?: {
|
|
574
|
+
readonly type: "ephemeral";
|
|
575
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
576
|
+
} | undefined;
|
|
577
|
+
readonly output_config?: {
|
|
578
|
+
readonly format?: {
|
|
579
|
+
readonly type: "json_schema";
|
|
580
|
+
readonly schema: {
|
|
581
|
+
readonly [x: string]: unknown;
|
|
582
|
+
};
|
|
583
|
+
} | null | undefined;
|
|
584
|
+
readonly effort?: string | undefined;
|
|
585
|
+
} | undefined;
|
|
586
|
+
readonly context_management?: {
|
|
587
|
+
readonly edits: readonly {
|
|
588
|
+
readonly type: "compact_20260112";
|
|
589
|
+
readonly instructions?: string | undefined;
|
|
590
|
+
readonly trigger?: {
|
|
591
|
+
readonly type: "input_tokens";
|
|
592
|
+
readonly value: number;
|
|
593
|
+
} | undefined;
|
|
594
|
+
readonly pause_after_compaction?: boolean | undefined;
|
|
595
|
+
}[];
|
|
596
|
+
} | undefined;
|
|
597
|
+
readonly tool_choice?: {
|
|
598
|
+
readonly type: "auto" | "none" | "any";
|
|
599
|
+
readonly disable_parallel_tool_use?: boolean | undefined;
|
|
600
|
+
} | {
|
|
601
|
+
readonly type: "tool";
|
|
602
|
+
readonly name: string;
|
|
603
|
+
readonly disable_parallel_tool_use?: boolean | undefined;
|
|
604
|
+
} | undefined;
|
|
605
|
+
readonly top_p?: number | undefined;
|
|
606
|
+
readonly top_k?: number | undefined;
|
|
607
|
+
readonly stop_sequences?: readonly string[] | undefined;
|
|
608
|
+
}, string, {
|
|
609
|
+
readonly type: string;
|
|
610
|
+
readonly message?: {
|
|
611
|
+
readonly usage?: {
|
|
612
|
+
readonly [x: string]: unknown;
|
|
613
|
+
readonly input_tokens?: number | null | undefined;
|
|
614
|
+
readonly server_tool_use?: {
|
|
615
|
+
readonly [x: string]: unknown;
|
|
616
|
+
readonly web_search_requests?: number | undefined;
|
|
617
|
+
} | null | undefined;
|
|
618
|
+
readonly output_tokens?: number | undefined;
|
|
619
|
+
readonly cache_creation_input_tokens?: number | null | undefined;
|
|
620
|
+
readonly cache_read_input_tokens?: number | null | undefined;
|
|
621
|
+
readonly output_tokens_details?: {
|
|
622
|
+
readonly [x: string]: unknown;
|
|
623
|
+
readonly thinking_tokens?: number | undefined;
|
|
624
|
+
} | null | undefined;
|
|
625
|
+
readonly iterations?: readonly {
|
|
626
|
+
readonly [x: string]: unknown;
|
|
627
|
+
readonly input_tokens?: number | null | undefined;
|
|
628
|
+
readonly server_tool_use?: {
|
|
629
|
+
readonly [x: string]: unknown;
|
|
630
|
+
readonly web_search_requests?: number | undefined;
|
|
631
|
+
} | null | undefined;
|
|
632
|
+
readonly output_tokens?: number | undefined;
|
|
633
|
+
readonly cache_creation_input_tokens?: number | null | undefined;
|
|
634
|
+
readonly cache_read_input_tokens?: number | null | undefined;
|
|
635
|
+
readonly output_tokens_details?: {
|
|
636
|
+
readonly [x: string]: unknown;
|
|
637
|
+
readonly thinking_tokens?: number | undefined;
|
|
638
|
+
} | null | undefined;
|
|
639
|
+
}[] | undefined;
|
|
640
|
+
} | undefined;
|
|
641
|
+
} | undefined;
|
|
642
|
+
readonly error?: {
|
|
643
|
+
readonly type?: string | undefined;
|
|
644
|
+
readonly message?: string | undefined;
|
|
645
|
+
} | undefined;
|
|
646
|
+
readonly delta?: unknown;
|
|
647
|
+
readonly index?: number | undefined;
|
|
648
|
+
readonly usage?: {
|
|
649
|
+
readonly [x: string]: unknown;
|
|
650
|
+
readonly input_tokens?: number | null | undefined;
|
|
651
|
+
readonly server_tool_use?: {
|
|
652
|
+
readonly [x: string]: unknown;
|
|
653
|
+
readonly web_search_requests?: number | undefined;
|
|
654
|
+
} | null | undefined;
|
|
655
|
+
readonly output_tokens?: number | undefined;
|
|
656
|
+
readonly cache_creation_input_tokens?: number | null | undefined;
|
|
657
|
+
readonly cache_read_input_tokens?: number | null | undefined;
|
|
658
|
+
readonly output_tokens_details?: {
|
|
659
|
+
readonly [x: string]: unknown;
|
|
660
|
+
readonly thinking_tokens?: number | undefined;
|
|
661
|
+
} | null | undefined;
|
|
662
|
+
readonly iterations?: readonly {
|
|
663
|
+
readonly [x: string]: unknown;
|
|
664
|
+
readonly input_tokens?: number | null | undefined;
|
|
665
|
+
readonly server_tool_use?: {
|
|
666
|
+
readonly [x: string]: unknown;
|
|
667
|
+
readonly web_search_requests?: number | undefined;
|
|
668
|
+
} | null | undefined;
|
|
669
|
+
readonly output_tokens?: number | undefined;
|
|
670
|
+
readonly cache_creation_input_tokens?: number | null | undefined;
|
|
671
|
+
readonly cache_read_input_tokens?: number | null | undefined;
|
|
672
|
+
readonly output_tokens_details?: {
|
|
673
|
+
readonly [x: string]: unknown;
|
|
674
|
+
readonly thinking_tokens?: number | undefined;
|
|
675
|
+
} | null | undefined;
|
|
676
|
+
}[] | undefined;
|
|
677
|
+
} | undefined;
|
|
678
|
+
readonly content_block?: unknown;
|
|
679
|
+
}, {
|
|
680
|
+
provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
681
|
+
compactions: {};
|
|
682
|
+
providerMetadataKey: string;
|
|
683
|
+
tools: Partial<Record<number, ToolStream.PendingTool>>;
|
|
684
|
+
reasoningSignatures: {};
|
|
685
|
+
lifecycle: Lifecycle.State;
|
|
686
|
+
}>;
|
|
687
|
+
export declare const transport: <Body extends Pick<AnthropicMessagesBody, "messages" | "context_management">>() => {
|
|
688
|
+
prepare: (input: Parameters<(input: import("../route/transport/index.js").TransportPrepareInput<Body>) => Effect.Effect<HttpTransport.HttpPrepared<string>, AIError, never>>[0]) => Effect.Effect<HttpTransport.HttpPrepared<string>, AIError, never>;
|
|
689
|
+
with: (patch: Partial<HttpTransport.HttpJsonInput<Body, string>>) => HttpTransport.HttpJsonTransport<Body, string>;
|
|
690
|
+
id: string;
|
|
691
|
+
execute: (prepared: HttpTransport.HttpPrepared<string>, request: LLMRequest, runtime: import("../route/transport/index.js").TransportRuntime, options?: import("../route/transport/index.js").TransportExecuteOptions) => Effect.Effect<import("../route/transport/index.js").TransportExecution<string>, AIError, import("effect/Scope").Scope>;
|
|
692
|
+
};
|
|
693
|
+
export declare const route: Route<{
|
|
694
|
+
readonly max_tokens: number;
|
|
695
|
+
readonly model: string;
|
|
696
|
+
readonly messages: readonly ({
|
|
697
|
+
readonly role: "user";
|
|
698
|
+
readonly content: readonly ({
|
|
699
|
+
readonly type: "text";
|
|
700
|
+
readonly text: string;
|
|
701
|
+
readonly cache_control?: {
|
|
702
|
+
readonly type: "ephemeral";
|
|
703
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
704
|
+
} | undefined;
|
|
705
|
+
} | {
|
|
706
|
+
readonly type: "image";
|
|
707
|
+
readonly source: {
|
|
708
|
+
readonly type: "base64";
|
|
709
|
+
readonly media_type: string;
|
|
710
|
+
readonly data: string;
|
|
711
|
+
} | {
|
|
712
|
+
readonly type: "url";
|
|
713
|
+
readonly url: string;
|
|
714
|
+
} | {
|
|
715
|
+
readonly type: "file";
|
|
716
|
+
readonly file_id: string;
|
|
717
|
+
};
|
|
718
|
+
readonly cache_control?: {
|
|
719
|
+
readonly type: "ephemeral";
|
|
720
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
721
|
+
} | undefined;
|
|
722
|
+
readonly transformations?: {
|
|
723
|
+
readonly oversized_image?: "error" | "downsize" | undefined;
|
|
724
|
+
} | undefined;
|
|
725
|
+
} | {
|
|
726
|
+
readonly type: "document";
|
|
727
|
+
readonly source: {
|
|
728
|
+
readonly type: "base64";
|
|
729
|
+
readonly media_type: "application/pdf";
|
|
730
|
+
readonly data: string;
|
|
731
|
+
} | {
|
|
732
|
+
readonly type: "text";
|
|
733
|
+
readonly media_type: "text/plain";
|
|
734
|
+
readonly data: string;
|
|
735
|
+
} | {
|
|
736
|
+
readonly type: "url";
|
|
737
|
+
readonly url: string;
|
|
738
|
+
} | {
|
|
739
|
+
readonly type: "file";
|
|
740
|
+
readonly file_id: string;
|
|
741
|
+
};
|
|
742
|
+
readonly title?: string | undefined;
|
|
743
|
+
readonly context?: string | undefined;
|
|
744
|
+
readonly cache_control?: {
|
|
745
|
+
readonly type: "ephemeral";
|
|
746
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
747
|
+
} | undefined;
|
|
748
|
+
readonly citations?: {
|
|
749
|
+
readonly enabled: boolean;
|
|
750
|
+
} | undefined;
|
|
751
|
+
} | {
|
|
752
|
+
readonly type: "tool_result";
|
|
753
|
+
readonly content: string | readonly ({
|
|
754
|
+
readonly type: "text";
|
|
755
|
+
readonly text: string;
|
|
756
|
+
readonly cache_control?: {
|
|
757
|
+
readonly type: "ephemeral";
|
|
758
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
759
|
+
} | undefined;
|
|
760
|
+
} | {
|
|
761
|
+
readonly type: "image";
|
|
762
|
+
readonly source: {
|
|
763
|
+
readonly type: "base64";
|
|
764
|
+
readonly media_type: string;
|
|
765
|
+
readonly data: string;
|
|
766
|
+
} | {
|
|
767
|
+
readonly type: "url";
|
|
768
|
+
readonly url: string;
|
|
769
|
+
} | {
|
|
770
|
+
readonly type: "file";
|
|
771
|
+
readonly file_id: string;
|
|
772
|
+
};
|
|
773
|
+
readonly cache_control?: {
|
|
774
|
+
readonly type: "ephemeral";
|
|
775
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
776
|
+
} | undefined;
|
|
777
|
+
readonly transformations?: {
|
|
778
|
+
readonly oversized_image?: "error" | "downsize" | undefined;
|
|
779
|
+
} | undefined;
|
|
780
|
+
} | {
|
|
781
|
+
readonly type: "document";
|
|
782
|
+
readonly source: {
|
|
783
|
+
readonly type: "base64";
|
|
784
|
+
readonly media_type: "application/pdf";
|
|
785
|
+
readonly data: string;
|
|
786
|
+
} | {
|
|
787
|
+
readonly type: "text";
|
|
788
|
+
readonly media_type: "text/plain";
|
|
789
|
+
readonly data: string;
|
|
790
|
+
} | {
|
|
791
|
+
readonly type: "url";
|
|
792
|
+
readonly url: string;
|
|
793
|
+
} | {
|
|
794
|
+
readonly type: "file";
|
|
795
|
+
readonly file_id: string;
|
|
796
|
+
};
|
|
797
|
+
readonly title?: string | undefined;
|
|
798
|
+
readonly context?: string | undefined;
|
|
799
|
+
readonly cache_control?: {
|
|
800
|
+
readonly type: "ephemeral";
|
|
801
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
802
|
+
} | undefined;
|
|
803
|
+
readonly citations?: {
|
|
804
|
+
readonly enabled: boolean;
|
|
805
|
+
} | undefined;
|
|
806
|
+
})[];
|
|
807
|
+
readonly tool_use_id: string;
|
|
808
|
+
readonly cache_control?: {
|
|
809
|
+
readonly type: "ephemeral";
|
|
810
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
811
|
+
} | undefined;
|
|
812
|
+
readonly is_error?: boolean | undefined;
|
|
813
|
+
})[];
|
|
814
|
+
} | {
|
|
815
|
+
readonly role: "assistant";
|
|
816
|
+
readonly content: readonly ({
|
|
817
|
+
readonly type: "text";
|
|
818
|
+
readonly text: string;
|
|
819
|
+
readonly cache_control?: {
|
|
820
|
+
readonly type: "ephemeral";
|
|
821
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
822
|
+
} | undefined;
|
|
823
|
+
} | {
|
|
824
|
+
readonly id: string;
|
|
825
|
+
readonly type: "tool_use";
|
|
826
|
+
readonly name: string;
|
|
827
|
+
readonly input: unknown;
|
|
828
|
+
readonly cache_control?: {
|
|
829
|
+
readonly type: "ephemeral";
|
|
830
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
831
|
+
} | undefined;
|
|
832
|
+
} | {
|
|
833
|
+
readonly id: string;
|
|
834
|
+
readonly type: "server_tool_use";
|
|
835
|
+
readonly name: string;
|
|
836
|
+
readonly input: unknown;
|
|
837
|
+
readonly cache_control?: {
|
|
838
|
+
readonly type: "ephemeral";
|
|
839
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
840
|
+
} | undefined;
|
|
841
|
+
} | {
|
|
842
|
+
readonly type: "web_search_tool_result" | "code_execution_tool_result" | "web_fetch_tool_result";
|
|
843
|
+
readonly content: unknown;
|
|
844
|
+
readonly tool_use_id: string;
|
|
845
|
+
readonly cache_control?: {
|
|
846
|
+
readonly type: "ephemeral";
|
|
847
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
848
|
+
} | undefined;
|
|
849
|
+
} | {
|
|
850
|
+
readonly type: "thinking";
|
|
851
|
+
readonly thinking: string;
|
|
852
|
+
readonly signature: string;
|
|
853
|
+
readonly cache_control?: {
|
|
854
|
+
readonly type: "ephemeral";
|
|
855
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
856
|
+
} | undefined;
|
|
857
|
+
} | {
|
|
858
|
+
readonly data: string;
|
|
859
|
+
readonly type: "redacted_thinking";
|
|
860
|
+
readonly cache_control?: {
|
|
861
|
+
readonly type: "ephemeral";
|
|
862
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
863
|
+
} | undefined;
|
|
864
|
+
} | {
|
|
865
|
+
readonly type: "compaction";
|
|
866
|
+
readonly content: string | null;
|
|
867
|
+
})[];
|
|
868
|
+
} | {
|
|
869
|
+
readonly role: "system";
|
|
870
|
+
readonly content: readonly {
|
|
871
|
+
readonly type: "text";
|
|
872
|
+
readonly text: string;
|
|
873
|
+
readonly cache_control?: {
|
|
874
|
+
readonly type: "ephemeral";
|
|
875
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
876
|
+
} | undefined;
|
|
877
|
+
}[];
|
|
878
|
+
})[];
|
|
879
|
+
readonly stream: true;
|
|
880
|
+
readonly metadata?: {
|
|
881
|
+
readonly user_id?: string | null | undefined;
|
|
882
|
+
} | undefined;
|
|
883
|
+
readonly tools?: readonly {
|
|
884
|
+
readonly description: string;
|
|
885
|
+
readonly name: string;
|
|
886
|
+
readonly input_schema: {
|
|
887
|
+
readonly [x: string]: unknown;
|
|
888
|
+
};
|
|
889
|
+
readonly cache_control?: {
|
|
890
|
+
readonly type: "ephemeral";
|
|
891
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
892
|
+
} | undefined;
|
|
893
|
+
}[] | undefined;
|
|
894
|
+
readonly system?: readonly {
|
|
895
|
+
readonly type: "text";
|
|
896
|
+
readonly text: string;
|
|
897
|
+
readonly cache_control?: {
|
|
898
|
+
readonly type: "ephemeral";
|
|
899
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
900
|
+
} | undefined;
|
|
901
|
+
}[] | undefined;
|
|
902
|
+
readonly temperature?: number | undefined;
|
|
903
|
+
readonly thinking?: {
|
|
904
|
+
readonly type: "enabled";
|
|
905
|
+
readonly budget_tokens: number;
|
|
906
|
+
readonly display?: "summarized" | "omitted" | undefined;
|
|
907
|
+
} | {
|
|
908
|
+
readonly type: "adaptive";
|
|
909
|
+
readonly display?: "summarized" | "omitted" | undefined;
|
|
910
|
+
} | {
|
|
911
|
+
readonly type: "disabled";
|
|
912
|
+
} | undefined;
|
|
913
|
+
readonly service_tier?: "auto" | "standard_only" | undefined;
|
|
914
|
+
readonly container?: string | {
|
|
915
|
+
readonly id?: string | null | undefined;
|
|
916
|
+
readonly skills?: readonly {
|
|
917
|
+
readonly [x: string]: unknown;
|
|
918
|
+
}[] | null | undefined;
|
|
919
|
+
} | null | undefined;
|
|
920
|
+
readonly inference_geo?: string | null | undefined;
|
|
921
|
+
readonly cache_control?: {
|
|
922
|
+
readonly type: "ephemeral";
|
|
923
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
924
|
+
} | undefined;
|
|
925
|
+
readonly output_config?: {
|
|
926
|
+
readonly format?: {
|
|
927
|
+
readonly type: "json_schema";
|
|
928
|
+
readonly schema: {
|
|
929
|
+
readonly [x: string]: unknown;
|
|
930
|
+
};
|
|
931
|
+
} | null | undefined;
|
|
932
|
+
readonly effort?: string | undefined;
|
|
933
|
+
} | undefined;
|
|
934
|
+
readonly context_management?: {
|
|
935
|
+
readonly edits: readonly {
|
|
936
|
+
readonly type: "compact_20260112";
|
|
937
|
+
readonly instructions?: string | undefined;
|
|
938
|
+
readonly trigger?: {
|
|
939
|
+
readonly type: "input_tokens";
|
|
940
|
+
readonly value: number;
|
|
941
|
+
} | undefined;
|
|
942
|
+
readonly pause_after_compaction?: boolean | undefined;
|
|
943
|
+
}[];
|
|
944
|
+
} | undefined;
|
|
945
|
+
readonly tool_choice?: {
|
|
946
|
+
readonly type: "auto" | "none" | "any";
|
|
947
|
+
readonly disable_parallel_tool_use?: boolean | undefined;
|
|
948
|
+
} | {
|
|
949
|
+
readonly type: "tool";
|
|
950
|
+
readonly name: string;
|
|
951
|
+
readonly disable_parallel_tool_use?: boolean | undefined;
|
|
952
|
+
} | undefined;
|
|
953
|
+
readonly top_p?: number | undefined;
|
|
954
|
+
readonly top_k?: number | undefined;
|
|
955
|
+
readonly stop_sequences?: readonly string[] | undefined;
|
|
956
|
+
}, HttpTransport.HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>;
|
|
957
|
+
export * as AnthropicMessages from "./anthropic-messages.js";
|