@opencode-ai/ai 0.0.0-next-16134 → 0.0.0-next-16144
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 +1 -1
- package/dist/protocols/index.d.ts +1 -0
- package/dist/protocols/index.js +1 -0
- package/dist/protocols/open-responses.d.ts +613 -0
- package/dist/protocols/open-responses.js +756 -0
- package/dist/protocols/openai-chat.js +6 -7
- package/dist/protocols/openai-compatible-responses.d.ts +9 -21
- package/dist/protocols/openai-compatible-responses.js +8 -9
- package/dist/protocols/openai-responses.d.ts +55 -77
- package/dist/protocols/openai-responses.js +59 -771
- package/dist/protocols/utils/open-responses-options.d.ts +22 -0
- package/dist/protocols/utils/open-responses-options.js +42 -0
- package/dist/protocols/utils/openai-options.d.ts +8 -16
- package/dist/protocols/utils/openai-options.js +9 -59
- package/dist/protocols/utils/tool-schema.d.ts +1 -0
- package/dist/protocols/utils/tool-schema.js +2 -0
- package/dist/providers/azure.d.ts +4 -4
- package/dist/providers/github-copilot.d.ts +4 -4
- package/dist/providers/google-vertex-responses.d.ts +6 -18
- package/dist/providers/google-vertex-responses.js +1 -0
- package/dist/providers/open-responses-options.d.ts +17 -0
- package/dist/providers/open-responses-options.js +1 -0
- package/dist/providers/openai-compatible-responses.d.ts +10 -20
- package/dist/providers/openai-options.d.ts +3 -12
- package/dist/providers/openai.d.ts +8 -8
- package/dist/providers/xai.d.ts +4 -4
- package/dist/route/protocol.d.ts +2 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -300,7 +300,7 @@ OpenAI Chat and OpenAI Responses are separate semantic entrypoints:
|
|
|
300
300
|
- `@opencode-ai/ai/providers/google-vertex/responses`
|
|
301
301
|
- `@opencode-ai/ai/providers/google-vertex/messages`
|
|
302
302
|
|
|
303
|
-
Responses HTTP versus WebSocket is a scoped `transport` setting on the OpenAI Responses entrypoint, not another entrypoint. Azure follows the same Chat/Responses split at `providers/azure/chat` and `providers/azure/responses`. Generic OpenAI-compatible Chat remains at `providers/openai-compatible`;
|
|
303
|
+
Responses HTTP versus WebSocket is a scoped `transport` setting on the OpenAI Responses entrypoint, not another entrypoint. Azure follows the same Chat/Responses split at `providers/azure/chat` and `providers/azure/responses`. Generic OpenAI-compatible Chat remains at `providers/openai-compatible`; the Responses adapter at `providers/openai-compatible/responses` uses the provider-neutral Open Responses protocol. OpenAI Responses extends that baseline with OpenAI tools, event variants, metadata, defaults, and transports. Generic Anthropic Messages-compatible providers use `providers/anthropic-compatible`, which the named Anthropic provider composes. Google Gemini and Amazon Bedrock expose their single native API through their existing provider paths.
|
|
304
304
|
|
|
305
305
|
Vertex Gemini, Vertex Chat, Vertex Responses, and Vertex Messages are separate API entrypoints. All accept `project`, `location`, and an optional `accessToken`; when no explicit token or auth override is supplied they lazily use Google Application Default Credentials. Vertex Gemini instead selects express mode when `apiKey` or `GOOGLE_VERTEX_API_KEY` is present. Vertex Chat targets MaaS models through the OpenAI-compatible Chat Completions endpoint, while Vertex Responses targets Grok models and defaults `store` to `false` as required by Vertex. `providers/google-vertex` remains the default alias for `providers/google-vertex/gemini`.
|
|
306
306
|
|
|
@@ -6,3 +6,4 @@ export * as OpenAIImages from "./openai-images";
|
|
|
6
6
|
export * as OpenAICompatibleChat from "./openai-compatible-chat";
|
|
7
7
|
export * as OpenAICompatibleResponses from "./openai-compatible-responses";
|
|
8
8
|
export * as OpenAIResponses from "./openai-responses";
|
|
9
|
+
export * as OpenResponses from "./open-responses";
|
package/dist/protocols/index.js
CHANGED
|
@@ -6,3 +6,4 @@ export * as OpenAIImages from "./openai-images";
|
|
|
6
6
|
export * as OpenAICompatibleChat from "./openai-compatible-chat";
|
|
7
7
|
export * as OpenAICompatibleResponses from "./openai-compatible-responses";
|
|
8
8
|
export * as OpenAIResponses from "./openai-responses";
|
|
9
|
+
export * as OpenResponses from "./open-responses";
|
|
@@ -0,0 +1,613 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { HttpTransport } from "../route/transport";
|
|
3
|
+
import { Protocol } from "../route/protocol";
|
|
4
|
+
import { LLMError, LLMEvent, type LLMRequest, type MediaPart, type ProviderMetadata, type ToolDefinition } from "../schema";
|
|
5
|
+
import { ProviderShared } from "./shared";
|
|
6
|
+
import { Lifecycle } from "./utils/lifecycle";
|
|
7
|
+
import { ToolStream } from "./utils/tool-stream";
|
|
8
|
+
export declare const PATH = "/responses";
|
|
9
|
+
declare const MediaInput: Schema.Union<readonly [Schema.Struct<{
|
|
10
|
+
readonly type: Schema.tag<"input_image">;
|
|
11
|
+
readonly image_url: Schema.String;
|
|
12
|
+
}>, Schema.Struct<{
|
|
13
|
+
readonly type: Schema.tag<"input_file">;
|
|
14
|
+
readonly filename: Schema.String;
|
|
15
|
+
readonly file_data: Schema.String;
|
|
16
|
+
readonly mime_type: Schema.optional<Schema.String>;
|
|
17
|
+
}>]>;
|
|
18
|
+
export type MediaInput = Schema.Schema.Type<typeof MediaInput>;
|
|
19
|
+
export declare const Tool: Schema.Struct<{
|
|
20
|
+
readonly type: Schema.tag<"function">;
|
|
21
|
+
readonly name: Schema.String;
|
|
22
|
+
readonly description: Schema.String;
|
|
23
|
+
readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
24
|
+
readonly strict: Schema.optional<Schema.Boolean>;
|
|
25
|
+
}>;
|
|
26
|
+
export declare const ToolChoice: Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "required"]>, Schema.Struct<{
|
|
27
|
+
readonly type: Schema.tag<"function">;
|
|
28
|
+
readonly name: Schema.String;
|
|
29
|
+
}>]>;
|
|
30
|
+
export declare const coreFields: {
|
|
31
|
+
model: Schema.String;
|
|
32
|
+
input: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
33
|
+
readonly role: Schema.tag<"system">;
|
|
34
|
+
readonly content: Schema.String;
|
|
35
|
+
}>, Schema.Struct<{
|
|
36
|
+
readonly role: Schema.tag<"user">;
|
|
37
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
38
|
+
readonly type: Schema.tag<"input_text">;
|
|
39
|
+
readonly text: Schema.String;
|
|
40
|
+
}>, Schema.Union<readonly [Schema.Struct<{
|
|
41
|
+
readonly type: Schema.tag<"input_image">;
|
|
42
|
+
readonly image_url: Schema.String;
|
|
43
|
+
}>, Schema.Struct<{
|
|
44
|
+
readonly type: Schema.tag<"input_file">;
|
|
45
|
+
readonly filename: Schema.String;
|
|
46
|
+
readonly file_data: Schema.String;
|
|
47
|
+
readonly mime_type: Schema.optional<Schema.String>;
|
|
48
|
+
}>]>]>>;
|
|
49
|
+
}>, Schema.Struct<{
|
|
50
|
+
readonly role: Schema.tag<"assistant">;
|
|
51
|
+
readonly content: Schema.$Array<Schema.Struct<{
|
|
52
|
+
readonly type: Schema.tag<"output_text">;
|
|
53
|
+
readonly text: Schema.String;
|
|
54
|
+
}>>;
|
|
55
|
+
}>, Schema.Struct<{
|
|
56
|
+
readonly type: Schema.tag<"reasoning">;
|
|
57
|
+
readonly id: Schema.optionalKey<Schema.String>;
|
|
58
|
+
readonly summary: Schema.$Array<Schema.Struct<{
|
|
59
|
+
readonly type: Schema.tag<"summary_text">;
|
|
60
|
+
readonly text: Schema.String;
|
|
61
|
+
}>>;
|
|
62
|
+
readonly encrypted_content: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
63
|
+
}>, Schema.Struct<{
|
|
64
|
+
readonly type: Schema.tag<"item_reference">;
|
|
65
|
+
readonly id: Schema.String;
|
|
66
|
+
}>, Schema.Struct<{
|
|
67
|
+
readonly type: Schema.tag<"function_call">;
|
|
68
|
+
readonly call_id: Schema.String;
|
|
69
|
+
readonly name: Schema.String;
|
|
70
|
+
readonly arguments: Schema.String;
|
|
71
|
+
}>, Schema.Struct<{
|
|
72
|
+
readonly type: Schema.tag<"function_call_output">;
|
|
73
|
+
readonly call_id: Schema.String;
|
|
74
|
+
readonly output: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
75
|
+
readonly type: Schema.tag<"input_text">;
|
|
76
|
+
readonly text: Schema.String;
|
|
77
|
+
}>, Schema.Struct<{
|
|
78
|
+
readonly type: Schema.tag<"input_image">;
|
|
79
|
+
readonly image_url: Schema.String;
|
|
80
|
+
}>, Schema.Struct<{
|
|
81
|
+
readonly type: Schema.tag<"input_file">;
|
|
82
|
+
readonly filename: Schema.String;
|
|
83
|
+
readonly file_data: Schema.String;
|
|
84
|
+
readonly mime_type: Schema.optional<Schema.String>;
|
|
85
|
+
}>]>>]>;
|
|
86
|
+
}>]>>;
|
|
87
|
+
instructions: Schema.optional<Schema.String>;
|
|
88
|
+
tools: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
89
|
+
readonly type: Schema.tag<"function">;
|
|
90
|
+
readonly name: Schema.String;
|
|
91
|
+
readonly description: Schema.String;
|
|
92
|
+
readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
93
|
+
readonly strict: Schema.optional<Schema.Boolean>;
|
|
94
|
+
}>>>;
|
|
95
|
+
tool_choice: Schema.optional<Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "required"]>, Schema.Struct<{
|
|
96
|
+
readonly type: Schema.tag<"function">;
|
|
97
|
+
readonly name: Schema.String;
|
|
98
|
+
}>]>>;
|
|
99
|
+
store: Schema.optional<Schema.Boolean>;
|
|
100
|
+
service_tier: Schema.optional<Schema.Literals<readonly ["auto", "default", "flex", "priority"]>>;
|
|
101
|
+
prompt_cache_key: Schema.optional<Schema.String>;
|
|
102
|
+
include: Schema.optional<Schema.$Array<Schema.Literals<readonly ["file_search_call.results", "web_search_call.results", "web_search_call.action.sources", "message.input_image.image_url", "computer_call_output.output.image_url", "code_interpreter_call.outputs", "reasoning.encrypted_content", "message.output_text.logprobs"]>>>;
|
|
103
|
+
reasoning: Schema.optional<Schema.Struct<{
|
|
104
|
+
readonly effort: Schema.optional<Schema.String>;
|
|
105
|
+
readonly summary: Schema.optional<Schema.Literals<readonly ["auto", "concise", "detailed"]>>;
|
|
106
|
+
}>>;
|
|
107
|
+
text: Schema.optional<Schema.Struct<{
|
|
108
|
+
readonly verbosity: Schema.optional<Schema.Literals<readonly ["low", "medium", "high"]>>;
|
|
109
|
+
}>>;
|
|
110
|
+
max_output_tokens: Schema.optional<Schema.Number>;
|
|
111
|
+
temperature: Schema.optional<Schema.Number>;
|
|
112
|
+
top_p: Schema.optional<Schema.Number>;
|
|
113
|
+
};
|
|
114
|
+
declare const OpenResponsesBody: Schema.Struct<{
|
|
115
|
+
readonly stream: Schema.Literal<true>;
|
|
116
|
+
readonly model: Schema.String;
|
|
117
|
+
readonly input: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
118
|
+
readonly role: Schema.tag<"system">;
|
|
119
|
+
readonly content: Schema.String;
|
|
120
|
+
}>, Schema.Struct<{
|
|
121
|
+
readonly role: Schema.tag<"user">;
|
|
122
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
123
|
+
readonly type: Schema.tag<"input_text">;
|
|
124
|
+
readonly text: Schema.String;
|
|
125
|
+
}>, Schema.Union<readonly [Schema.Struct<{
|
|
126
|
+
readonly type: Schema.tag<"input_image">;
|
|
127
|
+
readonly image_url: Schema.String;
|
|
128
|
+
}>, Schema.Struct<{
|
|
129
|
+
readonly type: Schema.tag<"input_file">;
|
|
130
|
+
readonly filename: Schema.String;
|
|
131
|
+
readonly file_data: Schema.String;
|
|
132
|
+
readonly mime_type: Schema.optional<Schema.String>;
|
|
133
|
+
}>]>]>>;
|
|
134
|
+
}>, Schema.Struct<{
|
|
135
|
+
readonly role: Schema.tag<"assistant">;
|
|
136
|
+
readonly content: Schema.$Array<Schema.Struct<{
|
|
137
|
+
readonly type: Schema.tag<"output_text">;
|
|
138
|
+
readonly text: Schema.String;
|
|
139
|
+
}>>;
|
|
140
|
+
}>, Schema.Struct<{
|
|
141
|
+
readonly type: Schema.tag<"reasoning">;
|
|
142
|
+
readonly id: Schema.optionalKey<Schema.String>;
|
|
143
|
+
readonly summary: Schema.$Array<Schema.Struct<{
|
|
144
|
+
readonly type: Schema.tag<"summary_text">;
|
|
145
|
+
readonly text: Schema.String;
|
|
146
|
+
}>>;
|
|
147
|
+
readonly encrypted_content: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
148
|
+
}>, Schema.Struct<{
|
|
149
|
+
readonly type: Schema.tag<"item_reference">;
|
|
150
|
+
readonly id: Schema.String;
|
|
151
|
+
}>, Schema.Struct<{
|
|
152
|
+
readonly type: Schema.tag<"function_call">;
|
|
153
|
+
readonly call_id: Schema.String;
|
|
154
|
+
readonly name: Schema.String;
|
|
155
|
+
readonly arguments: Schema.String;
|
|
156
|
+
}>, Schema.Struct<{
|
|
157
|
+
readonly type: Schema.tag<"function_call_output">;
|
|
158
|
+
readonly call_id: Schema.String;
|
|
159
|
+
readonly output: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
160
|
+
readonly type: Schema.tag<"input_text">;
|
|
161
|
+
readonly text: Schema.String;
|
|
162
|
+
}>, Schema.Struct<{
|
|
163
|
+
readonly type: Schema.tag<"input_image">;
|
|
164
|
+
readonly image_url: Schema.String;
|
|
165
|
+
}>, Schema.Struct<{
|
|
166
|
+
readonly type: Schema.tag<"input_file">;
|
|
167
|
+
readonly filename: Schema.String;
|
|
168
|
+
readonly file_data: Schema.String;
|
|
169
|
+
readonly mime_type: Schema.optional<Schema.String>;
|
|
170
|
+
}>]>>]>;
|
|
171
|
+
}>]>>;
|
|
172
|
+
readonly instructions: Schema.optional<Schema.String>;
|
|
173
|
+
readonly tools: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
174
|
+
readonly type: Schema.tag<"function">;
|
|
175
|
+
readonly name: Schema.String;
|
|
176
|
+
readonly description: Schema.String;
|
|
177
|
+
readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
178
|
+
readonly strict: Schema.optional<Schema.Boolean>;
|
|
179
|
+
}>>>;
|
|
180
|
+
readonly tool_choice: Schema.optional<Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "required"]>, Schema.Struct<{
|
|
181
|
+
readonly type: Schema.tag<"function">;
|
|
182
|
+
readonly name: Schema.String;
|
|
183
|
+
}>]>>;
|
|
184
|
+
readonly store: Schema.optional<Schema.Boolean>;
|
|
185
|
+
readonly service_tier: Schema.optional<Schema.Literals<readonly ["auto", "default", "flex", "priority"]>>;
|
|
186
|
+
readonly prompt_cache_key: Schema.optional<Schema.String>;
|
|
187
|
+
readonly include: Schema.optional<Schema.$Array<Schema.Literals<readonly ["file_search_call.results", "web_search_call.results", "web_search_call.action.sources", "message.input_image.image_url", "computer_call_output.output.image_url", "code_interpreter_call.outputs", "reasoning.encrypted_content", "message.output_text.logprobs"]>>>;
|
|
188
|
+
readonly reasoning: Schema.optional<Schema.Struct<{
|
|
189
|
+
readonly effort: Schema.optional<Schema.String>;
|
|
190
|
+
readonly summary: Schema.optional<Schema.Literals<readonly ["auto", "concise", "detailed"]>>;
|
|
191
|
+
}>>;
|
|
192
|
+
readonly text: Schema.optional<Schema.Struct<{
|
|
193
|
+
readonly verbosity: Schema.optional<Schema.Literals<readonly ["low", "medium", "high"]>>;
|
|
194
|
+
}>>;
|
|
195
|
+
readonly max_output_tokens: Schema.optional<Schema.Number>;
|
|
196
|
+
readonly temperature: Schema.optional<Schema.Number>;
|
|
197
|
+
readonly top_p: Schema.optional<Schema.Number>;
|
|
198
|
+
}>;
|
|
199
|
+
export type OpenResponsesBody = Schema.Schema.Type<typeof OpenResponsesBody>;
|
|
200
|
+
export declare const StreamItem: Schema.StructWithRest<Schema.Struct<{
|
|
201
|
+
readonly type: Schema.String;
|
|
202
|
+
readonly id: Schema.optional<Schema.String>;
|
|
203
|
+
readonly call_id: Schema.optional<Schema.String>;
|
|
204
|
+
readonly name: Schema.optional<Schema.String>;
|
|
205
|
+
readonly arguments: Schema.optional<Schema.String>;
|
|
206
|
+
readonly encrypted_content: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
207
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
|
|
208
|
+
export type StreamItem = Schema.Schema.Type<typeof StreamItem>;
|
|
209
|
+
export declare const Event: Schema.StructWithRest<Schema.Struct<{
|
|
210
|
+
readonly type: Schema.String;
|
|
211
|
+
readonly delta: Schema.optional<Schema.String>;
|
|
212
|
+
readonly item_id: Schema.optional<Schema.String>;
|
|
213
|
+
readonly summary_index: Schema.optional<Schema.Number>;
|
|
214
|
+
readonly item: Schema.optional<Schema.StructWithRest<Schema.Struct<{
|
|
215
|
+
readonly type: Schema.String;
|
|
216
|
+
readonly id: Schema.optional<Schema.String>;
|
|
217
|
+
readonly call_id: Schema.optional<Schema.String>;
|
|
218
|
+
readonly name: Schema.optional<Schema.String>;
|
|
219
|
+
readonly arguments: Schema.optional<Schema.String>;
|
|
220
|
+
readonly encrypted_content: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
221
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>;
|
|
222
|
+
readonly response: Schema.optional<Schema.StructWithRest<Schema.Struct<{
|
|
223
|
+
readonly id: Schema.optional<Schema.String>;
|
|
224
|
+
readonly service_tier: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
225
|
+
readonly incomplete_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
226
|
+
readonly reason: Schema.optional<Schema.String>;
|
|
227
|
+
}>>>;
|
|
228
|
+
readonly usage: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
229
|
+
readonly input_tokens: Schema.optional<Schema.Number>;
|
|
230
|
+
readonly input_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
231
|
+
readonly cached_tokens: Schema.optional<Schema.Number>;
|
|
232
|
+
}>>>;
|
|
233
|
+
readonly output_tokens: Schema.optional<Schema.Number>;
|
|
234
|
+
readonly output_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
235
|
+
readonly reasoning_tokens: Schema.optional<Schema.Number>;
|
|
236
|
+
}>>>;
|
|
237
|
+
readonly total_tokens: Schema.optional<Schema.Number>;
|
|
238
|
+
}>>>;
|
|
239
|
+
readonly error: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
240
|
+
readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
241
|
+
readonly message: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
242
|
+
readonly param: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
243
|
+
}>>>;
|
|
244
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>;
|
|
245
|
+
readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
246
|
+
readonly message: Schema.optional<Schema.String>;
|
|
247
|
+
readonly param: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
248
|
+
readonly error: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
249
|
+
readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
250
|
+
readonly message: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
251
|
+
readonly param: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
252
|
+
}>>>;
|
|
253
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
|
|
254
|
+
export type Event = Schema.Schema.Type<typeof Event>;
|
|
255
|
+
export interface Extension {
|
|
256
|
+
readonly id: string;
|
|
257
|
+
readonly name: string;
|
|
258
|
+
readonly lowerMedia?: (input: {
|
|
259
|
+
readonly part: MediaPart;
|
|
260
|
+
readonly media: ProviderShared.ValidatedMedia;
|
|
261
|
+
readonly request: LLMRequest;
|
|
262
|
+
}) => MediaInput | undefined;
|
|
263
|
+
}
|
|
264
|
+
export interface ParserState {
|
|
265
|
+
readonly id: string;
|
|
266
|
+
readonly name: string;
|
|
267
|
+
readonly providerMetadataKey: string;
|
|
268
|
+
readonly tools: ToolStream.State<string>;
|
|
269
|
+
readonly hasFunctionCall: boolean;
|
|
270
|
+
readonly lifecycle: Lifecycle.State;
|
|
271
|
+
readonly reasoningItems: Readonly<Record<string, ReasoningStreamItem>>;
|
|
272
|
+
readonly store: boolean | undefined;
|
|
273
|
+
}
|
|
274
|
+
type ReasoningSummaryStatus = "active" | "can-conclude" | "concluded";
|
|
275
|
+
interface ReasoningStreamItem {
|
|
276
|
+
readonly encryptedContent: string | null | undefined;
|
|
277
|
+
readonly summaryParts: Readonly<Record<number, ReasoningSummaryStatus>>;
|
|
278
|
+
}
|
|
279
|
+
export declare const lowerTool: (protocolName: string, tool: ToolDefinition, inputSchema: {
|
|
280
|
+
readonly [x: string]: unknown;
|
|
281
|
+
}) => Effect.Effect<{
|
|
282
|
+
type: "function";
|
|
283
|
+
name: string;
|
|
284
|
+
description: string;
|
|
285
|
+
parameters: {
|
|
286
|
+
readonly [x: string]: unknown;
|
|
287
|
+
};
|
|
288
|
+
strict: boolean;
|
|
289
|
+
}, LLMError, never>;
|
|
290
|
+
export declare const lowerToolChoice: (protocolName: string, toolChoice: NonNullable<LLMRequest["toolChoice"]>) => Effect.Effect<"required" | "none" | "auto" | {
|
|
291
|
+
type: "function";
|
|
292
|
+
name: string;
|
|
293
|
+
}, LLMError, never>;
|
|
294
|
+
export declare const fromRequest: (request: LLMRequest, extension?: Extension | undefined) => Effect.Effect<{
|
|
295
|
+
service_tier?: "auto" | "default" | "flex" | "priority" | undefined;
|
|
296
|
+
text?: {
|
|
297
|
+
verbosity: "low" | "medium" | "high";
|
|
298
|
+
} | undefined;
|
|
299
|
+
reasoning?: {
|
|
300
|
+
effort: string | undefined;
|
|
301
|
+
summary: "auto" | "concise" | "detailed" | undefined;
|
|
302
|
+
} | undefined;
|
|
303
|
+
include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
|
|
304
|
+
prompt_cache_key?: string | undefined;
|
|
305
|
+
store?: boolean | undefined;
|
|
306
|
+
instructions?: string | undefined;
|
|
307
|
+
model: string & import("effect/Brand").Brand<"LLM.ModelID">;
|
|
308
|
+
input: ({
|
|
309
|
+
readonly type: "reasoning";
|
|
310
|
+
readonly summary: readonly Schema.Struct.ReadonlySide<{
|
|
311
|
+
readonly type: Schema.tag<"summary_text">;
|
|
312
|
+
readonly text: Schema.String;
|
|
313
|
+
}, "Type">[];
|
|
314
|
+
readonly id?: string | undefined;
|
|
315
|
+
readonly encrypted_content?: string | null | undefined;
|
|
316
|
+
} | Schema.Struct.ReadonlySide<{
|
|
317
|
+
readonly type: Schema.tag<"item_reference">;
|
|
318
|
+
readonly id: Schema.String;
|
|
319
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
320
|
+
readonly role: Schema.tag<"system">;
|
|
321
|
+
readonly content: Schema.String;
|
|
322
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
323
|
+
readonly role: Schema.tag<"user">;
|
|
324
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
325
|
+
readonly type: Schema.tag<"input_text">;
|
|
326
|
+
readonly text: Schema.String;
|
|
327
|
+
}>, Schema.Union<readonly [Schema.Struct<{
|
|
328
|
+
readonly type: Schema.tag<"input_image">;
|
|
329
|
+
readonly image_url: Schema.String;
|
|
330
|
+
}>, Schema.Struct<{
|
|
331
|
+
readonly type: Schema.tag<"input_file">;
|
|
332
|
+
readonly filename: Schema.String;
|
|
333
|
+
readonly file_data: Schema.String;
|
|
334
|
+
readonly mime_type: Schema.optional<Schema.String>;
|
|
335
|
+
}>]>]>>;
|
|
336
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
337
|
+
readonly role: Schema.tag<"assistant">;
|
|
338
|
+
readonly content: Schema.$Array<Schema.Struct<{
|
|
339
|
+
readonly type: Schema.tag<"output_text">;
|
|
340
|
+
readonly text: Schema.String;
|
|
341
|
+
}>>;
|
|
342
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
343
|
+
readonly type: Schema.tag<"function_call">;
|
|
344
|
+
readonly call_id: Schema.String;
|
|
345
|
+
readonly name: Schema.String;
|
|
346
|
+
readonly arguments: Schema.String;
|
|
347
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
348
|
+
readonly type: Schema.tag<"function_call_output">;
|
|
349
|
+
readonly call_id: Schema.String;
|
|
350
|
+
readonly output: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
351
|
+
readonly type: Schema.tag<"input_text">;
|
|
352
|
+
readonly text: Schema.String;
|
|
353
|
+
}>, Schema.Struct<{
|
|
354
|
+
readonly type: Schema.tag<"input_image">;
|
|
355
|
+
readonly image_url: Schema.String;
|
|
356
|
+
}>, Schema.Struct<{
|
|
357
|
+
readonly type: Schema.tag<"input_file">;
|
|
358
|
+
readonly filename: Schema.String;
|
|
359
|
+
readonly file_data: Schema.String;
|
|
360
|
+
readonly mime_type: Schema.optional<Schema.String>;
|
|
361
|
+
}>]>>]>;
|
|
362
|
+
}, "Type">)[];
|
|
363
|
+
tools: {
|
|
364
|
+
type: "function";
|
|
365
|
+
name: string;
|
|
366
|
+
description: string;
|
|
367
|
+
parameters: {
|
|
368
|
+
readonly [x: string]: unknown;
|
|
369
|
+
};
|
|
370
|
+
strict: boolean;
|
|
371
|
+
}[] | undefined;
|
|
372
|
+
tool_choice: "required" | "none" | "auto" | {
|
|
373
|
+
type: "function";
|
|
374
|
+
name: string;
|
|
375
|
+
} | undefined;
|
|
376
|
+
stream: true;
|
|
377
|
+
max_output_tokens: number | undefined;
|
|
378
|
+
temperature: number | undefined;
|
|
379
|
+
top_p: number | undefined;
|
|
380
|
+
}, LLMError, never>;
|
|
381
|
+
export declare const providerMetadata: (state: ParserState, metadata: Record<string, unknown>) => ProviderMetadata;
|
|
382
|
+
export type StepResult = readonly [ParserState, ReadonlyArray<LLMEvent>];
|
|
383
|
+
export declare const terminal: (event: Event) => boolean;
|
|
384
|
+
export declare const onReasoningDelta: (state: ParserState, event: Event) => StepResult;
|
|
385
|
+
export declare const onReasoningDone: (state: ParserState, _event: Event) => StepResult;
|
|
386
|
+
export declare const step: (state: ParserState, event: Event) => LLMError | Effect.Effect<StepResult, LLMError, never>;
|
|
387
|
+
/**
|
|
388
|
+
* The provider-neutral Open Responses protocol. Provider-specific Responses
|
|
389
|
+
* implementations compose this baseline with their own tools and event variants.
|
|
390
|
+
*/
|
|
391
|
+
export declare const initial: (request: LLMRequest, extension?: Extension) => ParserState;
|
|
392
|
+
export declare const protocol: Protocol<{
|
|
393
|
+
readonly input: readonly ({
|
|
394
|
+
readonly type: "reasoning";
|
|
395
|
+
readonly summary: readonly Schema.Struct.ReadonlySide<{
|
|
396
|
+
readonly type: Schema.tag<"summary_text">;
|
|
397
|
+
readonly text: Schema.String;
|
|
398
|
+
}, "Type">[];
|
|
399
|
+
readonly id?: string | undefined;
|
|
400
|
+
readonly encrypted_content?: string | null | undefined;
|
|
401
|
+
} | Schema.Struct.ReadonlySide<{
|
|
402
|
+
readonly type: Schema.tag<"item_reference">;
|
|
403
|
+
readonly id: Schema.String;
|
|
404
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
405
|
+
readonly role: Schema.tag<"system">;
|
|
406
|
+
readonly content: Schema.String;
|
|
407
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
408
|
+
readonly role: Schema.tag<"user">;
|
|
409
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
410
|
+
readonly type: Schema.tag<"input_text">;
|
|
411
|
+
readonly text: Schema.String;
|
|
412
|
+
}>, Schema.Union<readonly [Schema.Struct<{
|
|
413
|
+
readonly type: Schema.tag<"input_image">;
|
|
414
|
+
readonly image_url: Schema.String;
|
|
415
|
+
}>, Schema.Struct<{
|
|
416
|
+
readonly type: Schema.tag<"input_file">;
|
|
417
|
+
readonly filename: Schema.String;
|
|
418
|
+
readonly file_data: Schema.String;
|
|
419
|
+
readonly mime_type: Schema.optional<Schema.String>;
|
|
420
|
+
}>]>]>>;
|
|
421
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
422
|
+
readonly role: Schema.tag<"assistant">;
|
|
423
|
+
readonly content: Schema.$Array<Schema.Struct<{
|
|
424
|
+
readonly type: Schema.tag<"output_text">;
|
|
425
|
+
readonly text: Schema.String;
|
|
426
|
+
}>>;
|
|
427
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
428
|
+
readonly type: Schema.tag<"function_call">;
|
|
429
|
+
readonly call_id: Schema.String;
|
|
430
|
+
readonly name: Schema.String;
|
|
431
|
+
readonly arguments: Schema.String;
|
|
432
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
433
|
+
readonly type: Schema.tag<"function_call_output">;
|
|
434
|
+
readonly call_id: Schema.String;
|
|
435
|
+
readonly output: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
436
|
+
readonly type: Schema.tag<"input_text">;
|
|
437
|
+
readonly text: Schema.String;
|
|
438
|
+
}>, Schema.Struct<{
|
|
439
|
+
readonly type: Schema.tag<"input_image">;
|
|
440
|
+
readonly image_url: Schema.String;
|
|
441
|
+
}>, Schema.Struct<{
|
|
442
|
+
readonly type: Schema.tag<"input_file">;
|
|
443
|
+
readonly filename: Schema.String;
|
|
444
|
+
readonly file_data: Schema.String;
|
|
445
|
+
readonly mime_type: Schema.optional<Schema.String>;
|
|
446
|
+
}>]>>]>;
|
|
447
|
+
}, "Type">)[];
|
|
448
|
+
readonly model: string;
|
|
449
|
+
readonly stream: true;
|
|
450
|
+
readonly text?: {
|
|
451
|
+
readonly verbosity?: "low" | "medium" | "high" | undefined;
|
|
452
|
+
} | undefined;
|
|
453
|
+
readonly reasoning?: {
|
|
454
|
+
readonly effort?: string | undefined;
|
|
455
|
+
readonly summary?: "auto" | "concise" | "detailed" | undefined;
|
|
456
|
+
} | undefined;
|
|
457
|
+
readonly tools?: readonly {
|
|
458
|
+
readonly type: "function";
|
|
459
|
+
readonly name: string;
|
|
460
|
+
readonly description: string;
|
|
461
|
+
readonly parameters: {
|
|
462
|
+
readonly [x: string]: unknown;
|
|
463
|
+
};
|
|
464
|
+
readonly strict?: boolean | undefined;
|
|
465
|
+
}[] | undefined;
|
|
466
|
+
readonly temperature?: number | undefined;
|
|
467
|
+
readonly tool_choice?: "required" | "none" | "auto" | Schema.Struct.ReadonlySide<{
|
|
468
|
+
readonly type: Schema.tag<"function">;
|
|
469
|
+
readonly name: Schema.String;
|
|
470
|
+
}, "Type"> | undefined;
|
|
471
|
+
readonly top_p?: number | undefined;
|
|
472
|
+
readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
|
|
473
|
+
readonly instructions?: string | undefined;
|
|
474
|
+
readonly store?: boolean | undefined;
|
|
475
|
+
readonly service_tier?: "auto" | "default" | "flex" | "priority" | undefined;
|
|
476
|
+
readonly prompt_cache_key?: string | undefined;
|
|
477
|
+
readonly max_output_tokens?: number | undefined;
|
|
478
|
+
}, string, {
|
|
479
|
+
readonly [x: string]: unknown;
|
|
480
|
+
readonly type: string;
|
|
481
|
+
readonly error?: {
|
|
482
|
+
readonly message?: string | null | undefined;
|
|
483
|
+
readonly code?: string | null | undefined;
|
|
484
|
+
readonly param?: string | null | undefined;
|
|
485
|
+
} | null | undefined;
|
|
486
|
+
readonly response?: {
|
|
487
|
+
readonly [x: string]: unknown;
|
|
488
|
+
readonly error?: {
|
|
489
|
+
readonly message?: string | null | undefined;
|
|
490
|
+
readonly code?: string | null | undefined;
|
|
491
|
+
readonly param?: string | null | undefined;
|
|
492
|
+
} | null | undefined;
|
|
493
|
+
readonly id?: string | undefined;
|
|
494
|
+
readonly usage?: {
|
|
495
|
+
readonly input_tokens?: number | undefined;
|
|
496
|
+
readonly output_tokens?: number | undefined;
|
|
497
|
+
readonly total_tokens?: number | undefined;
|
|
498
|
+
readonly input_tokens_details?: {
|
|
499
|
+
readonly cached_tokens?: number | undefined;
|
|
500
|
+
} | null | undefined;
|
|
501
|
+
readonly output_tokens_details?: {
|
|
502
|
+
readonly reasoning_tokens?: number | undefined;
|
|
503
|
+
} | null | undefined;
|
|
504
|
+
} | null | undefined;
|
|
505
|
+
readonly service_tier?: string | null | undefined;
|
|
506
|
+
readonly incomplete_details?: {
|
|
507
|
+
readonly reason?: string | undefined;
|
|
508
|
+
} | null | undefined;
|
|
509
|
+
} | undefined;
|
|
510
|
+
readonly message?: string | undefined;
|
|
511
|
+
readonly code?: string | null | undefined;
|
|
512
|
+
readonly item?: {
|
|
513
|
+
readonly [x: string]: unknown;
|
|
514
|
+
readonly type: string;
|
|
515
|
+
readonly name?: string | undefined;
|
|
516
|
+
readonly id?: string | undefined;
|
|
517
|
+
readonly arguments?: string | undefined;
|
|
518
|
+
readonly encrypted_content?: string | null | undefined;
|
|
519
|
+
readonly call_id?: string | undefined;
|
|
520
|
+
} | undefined;
|
|
521
|
+
readonly delta?: string | undefined;
|
|
522
|
+
readonly param?: string | null | undefined;
|
|
523
|
+
readonly item_id?: string | undefined;
|
|
524
|
+
readonly summary_index?: number | undefined;
|
|
525
|
+
}, ParserState>;
|
|
526
|
+
export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
527
|
+
readonly input: readonly ({
|
|
528
|
+
readonly type: "reasoning";
|
|
529
|
+
readonly summary: readonly Schema.Struct.ReadonlySide<{
|
|
530
|
+
readonly type: Schema.tag<"summary_text">;
|
|
531
|
+
readonly text: Schema.String;
|
|
532
|
+
}, "Type">[];
|
|
533
|
+
readonly id?: string | undefined;
|
|
534
|
+
readonly encrypted_content?: string | null | undefined;
|
|
535
|
+
} | Schema.Struct.ReadonlySide<{
|
|
536
|
+
readonly type: Schema.tag<"item_reference">;
|
|
537
|
+
readonly id: Schema.String;
|
|
538
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
539
|
+
readonly role: Schema.tag<"system">;
|
|
540
|
+
readonly content: Schema.String;
|
|
541
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
542
|
+
readonly role: Schema.tag<"user">;
|
|
543
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
544
|
+
readonly type: Schema.tag<"input_text">;
|
|
545
|
+
readonly text: Schema.String;
|
|
546
|
+
}>, Schema.Union<readonly [Schema.Struct<{
|
|
547
|
+
readonly type: Schema.tag<"input_image">;
|
|
548
|
+
readonly image_url: Schema.String;
|
|
549
|
+
}>, Schema.Struct<{
|
|
550
|
+
readonly type: Schema.tag<"input_file">;
|
|
551
|
+
readonly filename: Schema.String;
|
|
552
|
+
readonly file_data: Schema.String;
|
|
553
|
+
readonly mime_type: Schema.optional<Schema.String>;
|
|
554
|
+
}>]>]>>;
|
|
555
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
556
|
+
readonly role: Schema.tag<"assistant">;
|
|
557
|
+
readonly content: Schema.$Array<Schema.Struct<{
|
|
558
|
+
readonly type: Schema.tag<"output_text">;
|
|
559
|
+
readonly text: Schema.String;
|
|
560
|
+
}>>;
|
|
561
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
562
|
+
readonly type: Schema.tag<"function_call">;
|
|
563
|
+
readonly call_id: Schema.String;
|
|
564
|
+
readonly name: Schema.String;
|
|
565
|
+
readonly arguments: Schema.String;
|
|
566
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
567
|
+
readonly type: Schema.tag<"function_call_output">;
|
|
568
|
+
readonly call_id: Schema.String;
|
|
569
|
+
readonly output: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
570
|
+
readonly type: Schema.tag<"input_text">;
|
|
571
|
+
readonly text: Schema.String;
|
|
572
|
+
}>, Schema.Struct<{
|
|
573
|
+
readonly type: Schema.tag<"input_image">;
|
|
574
|
+
readonly image_url: Schema.String;
|
|
575
|
+
}>, Schema.Struct<{
|
|
576
|
+
readonly type: Schema.tag<"input_file">;
|
|
577
|
+
readonly filename: Schema.String;
|
|
578
|
+
readonly file_data: Schema.String;
|
|
579
|
+
readonly mime_type: Schema.optional<Schema.String>;
|
|
580
|
+
}>]>>]>;
|
|
581
|
+
}, "Type">)[];
|
|
582
|
+
readonly model: string;
|
|
583
|
+
readonly stream: true;
|
|
584
|
+
readonly text?: {
|
|
585
|
+
readonly verbosity?: "low" | "medium" | "high" | undefined;
|
|
586
|
+
} | undefined;
|
|
587
|
+
readonly reasoning?: {
|
|
588
|
+
readonly effort?: string | undefined;
|
|
589
|
+
readonly summary?: "auto" | "concise" | "detailed" | undefined;
|
|
590
|
+
} | undefined;
|
|
591
|
+
readonly tools?: readonly {
|
|
592
|
+
readonly type: "function";
|
|
593
|
+
readonly name: string;
|
|
594
|
+
readonly description: string;
|
|
595
|
+
readonly parameters: {
|
|
596
|
+
readonly [x: string]: unknown;
|
|
597
|
+
};
|
|
598
|
+
readonly strict?: boolean | undefined;
|
|
599
|
+
}[] | undefined;
|
|
600
|
+
readonly temperature?: number | undefined;
|
|
601
|
+
readonly tool_choice?: "required" | "none" | "auto" | Schema.Struct.ReadonlySide<{
|
|
602
|
+
readonly type: Schema.tag<"function">;
|
|
603
|
+
readonly name: Schema.String;
|
|
604
|
+
}, "Type"> | undefined;
|
|
605
|
+
readonly top_p?: number | undefined;
|
|
606
|
+
readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
|
|
607
|
+
readonly instructions?: string | undefined;
|
|
608
|
+
readonly store?: boolean | undefined;
|
|
609
|
+
readonly service_tier?: "auto" | "default" | "flex" | "priority" | undefined;
|
|
610
|
+
readonly prompt_cache_key?: string | undefined;
|
|
611
|
+
readonly max_output_tokens?: number | undefined;
|
|
612
|
+
}, string>;
|
|
613
|
+
export * as OpenResponses from "./open-responses";
|