@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.
- package/README.md +176 -1
- package/dist/cache-policy.d.ts +2 -0
- package/dist/cache-policy.js +108 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +9 -0
- package/dist/llm.d.ts +223 -0
- package/dist/llm.js +81 -0
- package/dist/protocols/anthropic-messages.d.ts +503 -0
- package/dist/protocols/anthropic-messages.js +745 -0
- package/dist/protocols/bedrock-converse.d.ts +476 -0
- package/dist/protocols/bedrock-converse.js +526 -0
- package/dist/protocols/bedrock-event-stream.d.ts +9 -0
- package/dist/protocols/bedrock-event-stream.js +64 -0
- package/dist/protocols/gemini.d.ts +220 -0
- package/dist/protocols/gemini.js +420 -0
- package/dist/protocols/google-vertex-anthropic.d.ts +494 -0
- package/dist/protocols/google-vertex-anthropic.js +33 -0
- package/dist/protocols/google-vertex-gemini.d.ts +59 -0
- package/dist/protocols/google-vertex-gemini.js +18 -0
- package/dist/protocols/index.d.ts +9 -0
- package/dist/protocols/index.js +9 -0
- package/dist/protocols/openai-chat.d.ts +391 -0
- package/dist/protocols/openai-chat.js +423 -0
- package/dist/protocols/openai-compatible-chat.d.ts +73 -0
- package/dist/protocols/openai-compatible-chat.js +20 -0
- package/dist/protocols/openai-compatible-responses.d.ts +85 -0
- package/dist/protocols/openai-compatible-responses.js +18 -0
- package/dist/protocols/openai-responses.d.ts +613 -0
- package/dist/protocols/openai-responses.js +828 -0
- package/dist/protocols/shared.d.ts +192 -0
- package/dist/protocols/shared.js +236 -0
- package/dist/protocols/utils/bedrock-auth.d.ts +18 -0
- package/dist/protocols/utils/bedrock-auth.js +41 -0
- package/dist/protocols/utils/bedrock-cache.d.ts +15 -0
- package/dist/protocols/utils/bedrock-cache.js +29 -0
- package/dist/protocols/utils/bedrock-media.d.ts +49 -0
- package/dist/protocols/utils/bedrock-media.js +68 -0
- package/dist/protocols/utils/cache.d.ts +6 -0
- package/dist/protocols/utils/cache.js +8 -0
- package/dist/protocols/utils/gemini-tool-schema.d.ts +2 -0
- package/dist/protocols/utils/gemini-tool-schema.js +83 -0
- package/dist/protocols/utils/lifecycle.d.ts +19 -0
- package/dist/protocols/utils/lifecycle.js +65 -0
- package/dist/protocols/utils/openai-options.d.ts +22 -0
- package/dist/protocols/utils/openai-options.js +64 -0
- package/dist/protocols/utils/tool-schema.d.ts +7 -0
- package/dist/protocols/utils/tool-schema.js +79 -0
- package/dist/protocols/utils/tool-stream.d.ts +155 -0
- package/dist/protocols/utils/tool-stream.js +136 -0
- package/dist/protocols.d.ts +1 -0
- package/dist/protocols.js +1 -0
- package/dist/provider-error.d.ts +13 -0
- package/dist/provider-error.js +122 -0
- package/dist/provider-package.d.ts +13 -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.d.ts +150 -0
- package/dist/providers/amazon-bedrock.js +41 -0
- package/dist/providers/anthropic-compatible.d.ts +183 -0
- package/dist/providers/anthropic-compatible.js +44 -0
- package/dist/providers/anthropic.d.ts +181 -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 +183 -0
- package/dist/providers/azure.js +89 -0
- package/dist/providers/cloudflare.d.ts +232 -0
- package/dist/providers/cloudflare.js +87 -0
- package/dist/providers/github-copilot.d.ts +167 -0
- package/dist/providers/github-copilot.js +47 -0
- package/dist/providers/google-vertex/anthropic.d.ts +2 -0
- package/dist/providers/google-vertex/anthropic.js +1 -0
- package/dist/providers/google-vertex-anthropic.d.ts +181 -0
- package/dist/providers/google-vertex-anthropic.js +46 -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 +93 -0
- package/dist/providers/google-vertex.js +49 -0
- package/dist/providers/google.d.ts +85 -0
- package/dist/providers/google.js +33 -0
- package/dist/providers/index.d.ts +15 -0
- package/dist/providers/index.js +15 -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-profile.d.ts +43 -0
- package/dist/providers/openai-compatible-profile.js +12 -0
- package/dist/providers/openai-compatible-responses.d.ts +107 -0
- package/dist/providers/openai-compatible-responses.js +33 -0
- package/dist/providers/openai-compatible.d.ts +130 -0
- package/dist/providers/openai-compatible.js +55 -0
- package/dist/providers/openai-options.d.ts +30 -0
- package/dist/providers/openai-options.js +42 -0
- package/dist/providers/openai.d.ts +264 -0
- package/dist/providers/openai.js +62 -0
- package/dist/providers/openrouter.d.ts +321 -0
- package/dist/providers/openrouter.js +65 -0
- package/dist/providers/xai.d.ts +169 -0
- package/dist/providers/xai.js +43 -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 +49 -0
- package/dist/route/auth.js +89 -0
- package/dist/route/client.d.ts +330 -0
- package/dist/route/client.js +211 -0
- package/dist/route/endpoint.d.ts +28 -0
- package/dist/route/endpoint.js +21 -0
- package/dist/route/executor.d.ts +12 -0
- package/dist/route/executor.js +229 -0
- package/dist/route/framing.d.ts +23 -0
- package/dist/route/framing.js +4 -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 +17 -0
- package/dist/route/transport/http.d.ts +33 -0
- package/dist/route/transport/http.js +98 -0
- package/dist/route/transport/index.d.ts +27 -0
- package/dist/route/transport/index.js +4 -0
- package/dist/route/transport/websocket.d.ts +56 -0
- package/dist/route/transport/websocket.js +181 -0
- package/dist/route.d.ts +1 -0
- package/dist/route.js +1 -0
- package/dist/schema/errors.d.ts +153 -0
- package/dist/schema/errors.js +150 -0
- package/dist/schema/events.d.ts +4292 -0
- package/dist/schema/events.js +482 -0
- package/dist/schema/ids.d.ts +30 -0
- package/dist/schema/ids.js +18 -0
- package/dist/schema/index.d.ts +5 -0
- package/dist/schema/index.js +5 -0
- package/dist/schema/messages.d.ts +385 -0
- package/dist/schema/messages.js +246 -0
- package/dist/schema/options.d.ts +143 -0
- package/dist/schema/options.js +195 -0
- package/dist/tool-runtime.d.ts +15 -0
- package/dist/tool-runtime.js +35 -0
- package/dist/tool.d.ts +134 -0
- package/dist/tool.js +66 -0
- package/dist/utils/record.d.ts +2 -0
- package/dist/utils/record.js +2 -0
- package/package.json +36 -9
- package/index.js +0 -1
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { Route } from "../route/client";
|
|
3
|
+
import { HttpTransport } from "../route/transport";
|
|
4
|
+
import { Protocol } from "../route/protocol";
|
|
5
|
+
import { LLMEvent, Usage, type FinishReason } from "../schema";
|
|
6
|
+
import { Lifecycle } from "./utils/lifecycle";
|
|
7
|
+
import { ToolStream } from "./utils/tool-stream";
|
|
8
|
+
export declare const DEFAULT_BASE_URL = "https://api.openai.com/v1";
|
|
9
|
+
export declare const PATH = "/chat/completions";
|
|
10
|
+
export declare const bodyFields: {
|
|
11
|
+
model: Schema.String;
|
|
12
|
+
messages: Schema.$Array<Schema.toTaggedUnion<"role", readonly [Schema.Struct<{
|
|
13
|
+
readonly role: Schema.Literal<"system">;
|
|
14
|
+
readonly content: Schema.String;
|
|
15
|
+
}>, Schema.Struct<{
|
|
16
|
+
readonly role: Schema.Literal<"user">;
|
|
17
|
+
readonly content: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
18
|
+
readonly type: Schema.Literal<"text">;
|
|
19
|
+
readonly text: Schema.String;
|
|
20
|
+
}>, Schema.Struct<{
|
|
21
|
+
readonly type: Schema.Literal<"image_url">;
|
|
22
|
+
readonly image_url: Schema.Struct<{
|
|
23
|
+
readonly url: Schema.String;
|
|
24
|
+
}>;
|
|
25
|
+
}>]>>]>;
|
|
26
|
+
}>, Schema.Struct<{
|
|
27
|
+
readonly role: Schema.Literal<"assistant">;
|
|
28
|
+
readonly content: Schema.NullOr<Schema.String>;
|
|
29
|
+
readonly tool_calls: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
30
|
+
readonly id: Schema.String;
|
|
31
|
+
readonly type: Schema.tag<"function">;
|
|
32
|
+
readonly function: Schema.Struct<{
|
|
33
|
+
readonly name: Schema.String;
|
|
34
|
+
readonly arguments: Schema.String;
|
|
35
|
+
}>;
|
|
36
|
+
}>>>;
|
|
37
|
+
readonly reasoning_content: Schema.optional<Schema.String>;
|
|
38
|
+
}>, Schema.Struct<{
|
|
39
|
+
readonly role: Schema.Literal<"tool">;
|
|
40
|
+
readonly tool_call_id: Schema.String;
|
|
41
|
+
readonly content: Schema.String;
|
|
42
|
+
}>]>>;
|
|
43
|
+
tools: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
44
|
+
readonly type: Schema.tag<"function">;
|
|
45
|
+
readonly function: Schema.Struct<{
|
|
46
|
+
readonly name: Schema.String;
|
|
47
|
+
readonly description: Schema.String;
|
|
48
|
+
readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
49
|
+
}>;
|
|
50
|
+
}>>>;
|
|
51
|
+
tool_choice: Schema.optional<Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "required"]>, Schema.Struct<{
|
|
52
|
+
readonly type: Schema.tag<"function">;
|
|
53
|
+
readonly function: Schema.Struct<{
|
|
54
|
+
readonly name: Schema.String;
|
|
55
|
+
}>;
|
|
56
|
+
}>]>>;
|
|
57
|
+
stream: Schema.Literal<true>;
|
|
58
|
+
stream_options: Schema.optional<Schema.Struct<{
|
|
59
|
+
readonly include_usage: Schema.Boolean;
|
|
60
|
+
}>>;
|
|
61
|
+
store: Schema.optional<Schema.Boolean>;
|
|
62
|
+
reasoning_effort: Schema.optional<Schema.String>;
|
|
63
|
+
max_tokens: Schema.optional<Schema.Number>;
|
|
64
|
+
temperature: Schema.optional<Schema.Number>;
|
|
65
|
+
top_p: Schema.optional<Schema.Number>;
|
|
66
|
+
frequency_penalty: Schema.optional<Schema.Number>;
|
|
67
|
+
presence_penalty: Schema.optional<Schema.Number>;
|
|
68
|
+
seed: Schema.optional<Schema.Number>;
|
|
69
|
+
stop: Schema.optional<Schema.$Array<Schema.String>>;
|
|
70
|
+
};
|
|
71
|
+
declare const OpenAIChatBody: Schema.Struct<{
|
|
72
|
+
model: Schema.String;
|
|
73
|
+
messages: Schema.$Array<Schema.toTaggedUnion<"role", readonly [Schema.Struct<{
|
|
74
|
+
readonly role: Schema.Literal<"system">;
|
|
75
|
+
readonly content: Schema.String;
|
|
76
|
+
}>, Schema.Struct<{
|
|
77
|
+
readonly role: Schema.Literal<"user">;
|
|
78
|
+
readonly content: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
79
|
+
readonly type: Schema.Literal<"text">;
|
|
80
|
+
readonly text: Schema.String;
|
|
81
|
+
}>, Schema.Struct<{
|
|
82
|
+
readonly type: Schema.Literal<"image_url">;
|
|
83
|
+
readonly image_url: Schema.Struct<{
|
|
84
|
+
readonly url: Schema.String;
|
|
85
|
+
}>;
|
|
86
|
+
}>]>>]>;
|
|
87
|
+
}>, Schema.Struct<{
|
|
88
|
+
readonly role: Schema.Literal<"assistant">;
|
|
89
|
+
readonly content: Schema.NullOr<Schema.String>;
|
|
90
|
+
readonly tool_calls: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
91
|
+
readonly id: Schema.String;
|
|
92
|
+
readonly type: Schema.tag<"function">;
|
|
93
|
+
readonly function: Schema.Struct<{
|
|
94
|
+
readonly name: Schema.String;
|
|
95
|
+
readonly arguments: Schema.String;
|
|
96
|
+
}>;
|
|
97
|
+
}>>>;
|
|
98
|
+
readonly reasoning_content: Schema.optional<Schema.String>;
|
|
99
|
+
}>, Schema.Struct<{
|
|
100
|
+
readonly role: Schema.Literal<"tool">;
|
|
101
|
+
readonly tool_call_id: Schema.String;
|
|
102
|
+
readonly content: Schema.String;
|
|
103
|
+
}>]>>;
|
|
104
|
+
tools: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
105
|
+
readonly type: Schema.tag<"function">;
|
|
106
|
+
readonly function: Schema.Struct<{
|
|
107
|
+
readonly name: Schema.String;
|
|
108
|
+
readonly description: Schema.String;
|
|
109
|
+
readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
110
|
+
}>;
|
|
111
|
+
}>>>;
|
|
112
|
+
tool_choice: Schema.optional<Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "required"]>, Schema.Struct<{
|
|
113
|
+
readonly type: Schema.tag<"function">;
|
|
114
|
+
readonly function: Schema.Struct<{
|
|
115
|
+
readonly name: Schema.String;
|
|
116
|
+
}>;
|
|
117
|
+
}>]>>;
|
|
118
|
+
stream: Schema.Literal<true>;
|
|
119
|
+
stream_options: Schema.optional<Schema.Struct<{
|
|
120
|
+
readonly include_usage: Schema.Boolean;
|
|
121
|
+
}>>;
|
|
122
|
+
store: Schema.optional<Schema.Boolean>;
|
|
123
|
+
reasoning_effort: Schema.optional<Schema.String>;
|
|
124
|
+
max_tokens: Schema.optional<Schema.Number>;
|
|
125
|
+
temperature: Schema.optional<Schema.Number>;
|
|
126
|
+
top_p: Schema.optional<Schema.Number>;
|
|
127
|
+
frequency_penalty: Schema.optional<Schema.Number>;
|
|
128
|
+
presence_penalty: Schema.optional<Schema.Number>;
|
|
129
|
+
seed: Schema.optional<Schema.Number>;
|
|
130
|
+
stop: Schema.optional<Schema.$Array<Schema.String>>;
|
|
131
|
+
}>;
|
|
132
|
+
export type OpenAIChatBody = Schema.Schema.Type<typeof OpenAIChatBody>;
|
|
133
|
+
export declare const OpenAIChatEvent: Schema.Struct<{
|
|
134
|
+
readonly choices: Schema.$Array<Schema.Struct<{
|
|
135
|
+
readonly delta: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
136
|
+
readonly content: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
137
|
+
readonly reasoning_content: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
138
|
+
readonly tool_calls: Schema.optional<Schema.NullOr<Schema.$Array<Schema.Struct<{
|
|
139
|
+
readonly index: Schema.Number;
|
|
140
|
+
readonly id: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
141
|
+
readonly function: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
142
|
+
readonly name: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
143
|
+
readonly arguments: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
144
|
+
}>>>;
|
|
145
|
+
}>>>>;
|
|
146
|
+
}>>>;
|
|
147
|
+
readonly finish_reason: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
148
|
+
}>>;
|
|
149
|
+
readonly usage: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
150
|
+
readonly prompt_tokens: Schema.optional<Schema.Number>;
|
|
151
|
+
readonly completion_tokens: Schema.optional<Schema.Number>;
|
|
152
|
+
readonly total_tokens: Schema.optional<Schema.Number>;
|
|
153
|
+
readonly prompt_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
154
|
+
readonly cached_tokens: Schema.optional<Schema.Number>;
|
|
155
|
+
}>>>;
|
|
156
|
+
readonly completion_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
157
|
+
readonly reasoning_tokens: Schema.optional<Schema.Number>;
|
|
158
|
+
}>>>;
|
|
159
|
+
}>>>;
|
|
160
|
+
}>;
|
|
161
|
+
export type OpenAIChatEvent = Schema.Schema.Type<typeof OpenAIChatEvent>;
|
|
162
|
+
export interface ParserState {
|
|
163
|
+
readonly tools: ToolStream.State<number>;
|
|
164
|
+
readonly toolCallEvents: ReadonlyArray<LLMEvent>;
|
|
165
|
+
readonly usage?: Usage;
|
|
166
|
+
readonly finishReason?: FinishReason;
|
|
167
|
+
readonly lifecycle: Lifecycle.State;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* The OpenAI Chat protocol — request body construction, body schema, and the
|
|
171
|
+
* streaming-event state machine. Reused by every route that speaks OpenAI Chat
|
|
172
|
+
* over HTTP+SSE: native OpenAI, DeepSeek, TogetherAI, Cerebras, Baseten,
|
|
173
|
+
* Fireworks, DeepInfra, and (once added) Azure OpenAI Chat.
|
|
174
|
+
*/
|
|
175
|
+
export declare const protocol: Protocol<{
|
|
176
|
+
readonly model: string;
|
|
177
|
+
readonly messages: readonly ({
|
|
178
|
+
readonly role: "system";
|
|
179
|
+
readonly content: string;
|
|
180
|
+
} | {
|
|
181
|
+
readonly role: "user";
|
|
182
|
+
readonly content: string | readonly ({
|
|
183
|
+
readonly type: "text";
|
|
184
|
+
readonly text: string;
|
|
185
|
+
} | {
|
|
186
|
+
readonly type: "image_url";
|
|
187
|
+
readonly image_url: {
|
|
188
|
+
readonly url: string;
|
|
189
|
+
};
|
|
190
|
+
})[];
|
|
191
|
+
} | {
|
|
192
|
+
readonly role: "assistant";
|
|
193
|
+
readonly content: string | null;
|
|
194
|
+
readonly tool_calls?: readonly {
|
|
195
|
+
readonly id: string;
|
|
196
|
+
readonly type: "function";
|
|
197
|
+
readonly function: {
|
|
198
|
+
readonly name: string;
|
|
199
|
+
readonly arguments: string;
|
|
200
|
+
};
|
|
201
|
+
}[] | undefined;
|
|
202
|
+
readonly reasoning_content?: string | undefined;
|
|
203
|
+
} | {
|
|
204
|
+
readonly role: "tool";
|
|
205
|
+
readonly tool_call_id: string;
|
|
206
|
+
readonly content: string;
|
|
207
|
+
})[];
|
|
208
|
+
readonly stream: true;
|
|
209
|
+
readonly tools?: readonly {
|
|
210
|
+
readonly type: "function";
|
|
211
|
+
readonly function: {
|
|
212
|
+
readonly name: string;
|
|
213
|
+
readonly description: string;
|
|
214
|
+
readonly parameters: {
|
|
215
|
+
readonly [x: string]: unknown;
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
}[] | undefined;
|
|
219
|
+
readonly tool_choice?: "required" | "none" | "auto" | {
|
|
220
|
+
readonly type: "function";
|
|
221
|
+
readonly function: {
|
|
222
|
+
readonly name: string;
|
|
223
|
+
};
|
|
224
|
+
} | undefined;
|
|
225
|
+
readonly stream_options?: {
|
|
226
|
+
readonly include_usage: boolean;
|
|
227
|
+
} | undefined;
|
|
228
|
+
readonly store?: boolean | undefined;
|
|
229
|
+
readonly reasoning_effort?: string | undefined;
|
|
230
|
+
readonly max_tokens?: number | undefined;
|
|
231
|
+
readonly temperature?: number | undefined;
|
|
232
|
+
readonly top_p?: number | undefined;
|
|
233
|
+
readonly frequency_penalty?: number | undefined;
|
|
234
|
+
readonly presence_penalty?: number | undefined;
|
|
235
|
+
readonly seed?: number | undefined;
|
|
236
|
+
readonly stop?: readonly string[] | undefined;
|
|
237
|
+
}, string, {
|
|
238
|
+
readonly choices: readonly {
|
|
239
|
+
readonly delta?: {
|
|
240
|
+
readonly content?: string | null | undefined;
|
|
241
|
+
readonly reasoning_content?: string | null | undefined;
|
|
242
|
+
readonly tool_calls?: readonly {
|
|
243
|
+
readonly index: number;
|
|
244
|
+
readonly id?: string | null | undefined;
|
|
245
|
+
readonly function?: {
|
|
246
|
+
readonly name?: string | null | undefined;
|
|
247
|
+
readonly arguments?: string | null | undefined;
|
|
248
|
+
} | null | undefined;
|
|
249
|
+
}[] | null | undefined;
|
|
250
|
+
} | null | undefined;
|
|
251
|
+
readonly finish_reason?: string | null | undefined;
|
|
252
|
+
}[];
|
|
253
|
+
readonly usage?: {
|
|
254
|
+
readonly prompt_tokens?: number | undefined;
|
|
255
|
+
readonly completion_tokens?: number | undefined;
|
|
256
|
+
readonly total_tokens?: number | undefined;
|
|
257
|
+
readonly prompt_tokens_details?: {
|
|
258
|
+
readonly cached_tokens?: number | undefined;
|
|
259
|
+
} | null | undefined;
|
|
260
|
+
readonly completion_tokens_details?: {
|
|
261
|
+
readonly reasoning_tokens?: number | undefined;
|
|
262
|
+
} | null | undefined;
|
|
263
|
+
} | null | undefined;
|
|
264
|
+
}, ParserState>;
|
|
265
|
+
export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
266
|
+
readonly model: string;
|
|
267
|
+
readonly messages: readonly ({
|
|
268
|
+
readonly role: "system";
|
|
269
|
+
readonly content: string;
|
|
270
|
+
} | {
|
|
271
|
+
readonly role: "user";
|
|
272
|
+
readonly content: string | readonly ({
|
|
273
|
+
readonly type: "text";
|
|
274
|
+
readonly text: string;
|
|
275
|
+
} | {
|
|
276
|
+
readonly type: "image_url";
|
|
277
|
+
readonly image_url: {
|
|
278
|
+
readonly url: string;
|
|
279
|
+
};
|
|
280
|
+
})[];
|
|
281
|
+
} | {
|
|
282
|
+
readonly role: "assistant";
|
|
283
|
+
readonly content: string | null;
|
|
284
|
+
readonly tool_calls?: readonly {
|
|
285
|
+
readonly id: string;
|
|
286
|
+
readonly type: "function";
|
|
287
|
+
readonly function: {
|
|
288
|
+
readonly name: string;
|
|
289
|
+
readonly arguments: string;
|
|
290
|
+
};
|
|
291
|
+
}[] | undefined;
|
|
292
|
+
readonly reasoning_content?: string | undefined;
|
|
293
|
+
} | {
|
|
294
|
+
readonly role: "tool";
|
|
295
|
+
readonly tool_call_id: string;
|
|
296
|
+
readonly content: string;
|
|
297
|
+
})[];
|
|
298
|
+
readonly stream: true;
|
|
299
|
+
readonly tools?: readonly {
|
|
300
|
+
readonly type: "function";
|
|
301
|
+
readonly function: {
|
|
302
|
+
readonly name: string;
|
|
303
|
+
readonly description: string;
|
|
304
|
+
readonly parameters: {
|
|
305
|
+
readonly [x: string]: unknown;
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
}[] | undefined;
|
|
309
|
+
readonly tool_choice?: "required" | "none" | "auto" | {
|
|
310
|
+
readonly type: "function";
|
|
311
|
+
readonly function: {
|
|
312
|
+
readonly name: string;
|
|
313
|
+
};
|
|
314
|
+
} | undefined;
|
|
315
|
+
readonly stream_options?: {
|
|
316
|
+
readonly include_usage: boolean;
|
|
317
|
+
} | undefined;
|
|
318
|
+
readonly store?: boolean | undefined;
|
|
319
|
+
readonly reasoning_effort?: string | undefined;
|
|
320
|
+
readonly max_tokens?: number | undefined;
|
|
321
|
+
readonly temperature?: number | undefined;
|
|
322
|
+
readonly top_p?: number | undefined;
|
|
323
|
+
readonly frequency_penalty?: number | undefined;
|
|
324
|
+
readonly presence_penalty?: number | undefined;
|
|
325
|
+
readonly seed?: number | undefined;
|
|
326
|
+
readonly stop?: readonly string[] | undefined;
|
|
327
|
+
}, string>;
|
|
328
|
+
export declare const route: Route<{
|
|
329
|
+
readonly model: string;
|
|
330
|
+
readonly messages: readonly ({
|
|
331
|
+
readonly role: "system";
|
|
332
|
+
readonly content: string;
|
|
333
|
+
} | {
|
|
334
|
+
readonly role: "user";
|
|
335
|
+
readonly content: string | readonly ({
|
|
336
|
+
readonly type: "text";
|
|
337
|
+
readonly text: string;
|
|
338
|
+
} | {
|
|
339
|
+
readonly type: "image_url";
|
|
340
|
+
readonly image_url: {
|
|
341
|
+
readonly url: string;
|
|
342
|
+
};
|
|
343
|
+
})[];
|
|
344
|
+
} | {
|
|
345
|
+
readonly role: "assistant";
|
|
346
|
+
readonly content: string | null;
|
|
347
|
+
readonly tool_calls?: readonly {
|
|
348
|
+
readonly id: string;
|
|
349
|
+
readonly type: "function";
|
|
350
|
+
readonly function: {
|
|
351
|
+
readonly name: string;
|
|
352
|
+
readonly arguments: string;
|
|
353
|
+
};
|
|
354
|
+
}[] | undefined;
|
|
355
|
+
readonly reasoning_content?: string | undefined;
|
|
356
|
+
} | {
|
|
357
|
+
readonly role: "tool";
|
|
358
|
+
readonly tool_call_id: string;
|
|
359
|
+
readonly content: string;
|
|
360
|
+
})[];
|
|
361
|
+
readonly stream: true;
|
|
362
|
+
readonly tools?: readonly {
|
|
363
|
+
readonly type: "function";
|
|
364
|
+
readonly function: {
|
|
365
|
+
readonly name: string;
|
|
366
|
+
readonly description: string;
|
|
367
|
+
readonly parameters: {
|
|
368
|
+
readonly [x: string]: unknown;
|
|
369
|
+
};
|
|
370
|
+
};
|
|
371
|
+
}[] | undefined;
|
|
372
|
+
readonly tool_choice?: "required" | "none" | "auto" | {
|
|
373
|
+
readonly type: "function";
|
|
374
|
+
readonly function: {
|
|
375
|
+
readonly name: string;
|
|
376
|
+
};
|
|
377
|
+
} | undefined;
|
|
378
|
+
readonly stream_options?: {
|
|
379
|
+
readonly include_usage: boolean;
|
|
380
|
+
} | undefined;
|
|
381
|
+
readonly store?: boolean | undefined;
|
|
382
|
+
readonly reasoning_effort?: string | undefined;
|
|
383
|
+
readonly max_tokens?: number | undefined;
|
|
384
|
+
readonly temperature?: number | undefined;
|
|
385
|
+
readonly top_p?: number | undefined;
|
|
386
|
+
readonly frequency_penalty?: number | undefined;
|
|
387
|
+
readonly presence_penalty?: number | undefined;
|
|
388
|
+
readonly seed?: number | undefined;
|
|
389
|
+
readonly stop?: readonly string[] | undefined;
|
|
390
|
+
}, HttpTransport.HttpPrepared<string>>;
|
|
391
|
+
export * as OpenAIChat from "./openai-chat";
|