@opencode-ai/ai 0.0.0-beta-18050 → 0.0.0-beta-18138
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/dist/protocols/anthropic-messages.d.ts +259 -17
- package/dist/protocols/anthropic-messages.js +337 -24
- package/dist/protocols/gemini.d.ts +4 -31
- package/dist/protocols/gemini.js +23 -4
- package/dist/protocols/open-responses.d.ts +8 -4
- package/dist/protocols/open-responses.js +73 -38
- package/dist/protocols/openai-chat.d.ts +25 -11
- package/dist/protocols/openai-chat.js +124 -8
- package/dist/protocols/openai-compatible-chat.d.ts +3 -1
- package/dist/protocols/openai-compatible-responses.d.ts +1 -1
- package/dist/protocols/openai-responses.d.ts +5 -5
- package/dist/protocols/openai-responses.js +21 -5
- package/dist/protocols/utils/bedrock-media.d.ts +1 -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 +224 -0
- package/dist/protocols/xai-responses.d.ts +1 -1
- package/dist/protocols/xai-responses.js +2 -10
- package/dist/providers/amazon-bedrock-mantle.d.ts +4 -2
- package/dist/providers/anthropic-compatible.d.ts +75 -4
- package/dist/providers/anthropic.d.ts +75 -4
- package/dist/providers/azure.d.ts +4 -2
- package/dist/providers/cloudflare.d.ts +9 -3
- package/dist/providers/google-vertex-chat.d.ts +3 -1
- package/dist/providers/google-vertex-messages.d.ts +75 -4
- package/dist/providers/google-vertex-responses.d.ts +1 -1
- package/dist/providers/google-vertex.d.ts +1 -1
- package/dist/providers/google.d.ts +1 -1
- package/dist/providers/openai-compatible-responses.d.ts +1 -1
- package/dist/providers/openai-compatible.d.ts +3 -1
- package/dist/providers/openai.d.ts +4 -2
- package/dist/providers/openrouter.d.ts +11 -3
- package/dist/providers/xai.d.ts +3 -1
- package/dist/schema/messages.d.ts +4 -0
- package/dist/schema/messages.js +2 -0
- package/dist/schema/options.d.ts +5 -0
- package/dist/schema/options.js +5 -0
- package/package.json +3 -3
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Adapted from partial-json by the Promplate Dev Team:
|
|
3
|
+
* https://github.com/promplate/partial-json-parser-js
|
|
4
|
+
*
|
|
5
|
+
* MIT License
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2023 Promplate Dev Team
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
* in the Software without restriction, including without limitation the rights
|
|
12
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
* furnished to do so, subject to the following conditions:
|
|
15
|
+
*
|
|
16
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
* copies or substantial portions of the Software.
|
|
18
|
+
*
|
|
19
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
* SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
import { Schema } from "effect";
|
|
28
|
+
import { Allow } from "./partial-json-options.js";
|
|
29
|
+
export * from "./partial-json-options.js";
|
|
30
|
+
export class PartialJSON extends Error {
|
|
31
|
+
}
|
|
32
|
+
export class MalformedJSON extends Error {
|
|
33
|
+
}
|
|
34
|
+
const decodeJson = Schema.decodeUnknownSync(Schema.fromJsonString(Schema.Unknown));
|
|
35
|
+
/** Parse complete or incomplete JSON, restricted by the supplied partial-value flags. */
|
|
36
|
+
export function parseJSON(jsonString, allowPartial = Allow.ALL) {
|
|
37
|
+
if (typeof jsonString !== "string")
|
|
38
|
+
throw new TypeError(`expecting str, got ${typeof jsonString}`);
|
|
39
|
+
const input = jsonString.trim();
|
|
40
|
+
if (!input)
|
|
41
|
+
throw new Error(`${jsonString} is empty`);
|
|
42
|
+
try {
|
|
43
|
+
return decodeJson(input);
|
|
44
|
+
}
|
|
45
|
+
catch { }
|
|
46
|
+
return _parseJSON(input, allowPartial);
|
|
47
|
+
}
|
|
48
|
+
const _parseJSON = (jsonString, allow) => {
|
|
49
|
+
const length = jsonString.length;
|
|
50
|
+
let index = 0;
|
|
51
|
+
const markPartialJSON = (message) => {
|
|
52
|
+
throw new PartialJSON(`${message} at position ${index}`);
|
|
53
|
+
};
|
|
54
|
+
const throwMalformedError = (message) => {
|
|
55
|
+
throw new MalformedJSON(`${message} at position ${index}`);
|
|
56
|
+
};
|
|
57
|
+
const parseAny = () => {
|
|
58
|
+
skipBlank();
|
|
59
|
+
if (index >= length)
|
|
60
|
+
markPartialJSON("Unexpected end of input");
|
|
61
|
+
if (jsonString[index] === '"')
|
|
62
|
+
return parseStr();
|
|
63
|
+
if (jsonString[index] === "{")
|
|
64
|
+
return parseObj();
|
|
65
|
+
if (jsonString[index] === "[")
|
|
66
|
+
return parseArr();
|
|
67
|
+
if (jsonString.substring(index, index + 4) === "null" ||
|
|
68
|
+
(Allow.NULL & allow && length - index < 4 && "null".startsWith(jsonString.substring(index)))) {
|
|
69
|
+
index += 4;
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
if (jsonString.substring(index, index + 4) === "true" ||
|
|
73
|
+
(Allow.BOOL & allow && length - index < 4 && "true".startsWith(jsonString.substring(index)))) {
|
|
74
|
+
index += 4;
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
if (jsonString.substring(index, index + 5) === "false" ||
|
|
78
|
+
(Allow.BOOL & allow && length - index < 5 && "false".startsWith(jsonString.substring(index)))) {
|
|
79
|
+
index += 5;
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
if (jsonString.substring(index, index + 8) === "Infinity" ||
|
|
83
|
+
(Allow.INFINITY & allow && length - index < 8 && "Infinity".startsWith(jsonString.substring(index)))) {
|
|
84
|
+
index += 8;
|
|
85
|
+
return Infinity;
|
|
86
|
+
}
|
|
87
|
+
if (jsonString.substring(index, index + 9) === "-Infinity" ||
|
|
88
|
+
(Allow._INFINITY & allow &&
|
|
89
|
+
1 < length - index &&
|
|
90
|
+
length - index < 9 &&
|
|
91
|
+
"-Infinity".startsWith(jsonString.substring(index)))) {
|
|
92
|
+
index += 9;
|
|
93
|
+
return -Infinity;
|
|
94
|
+
}
|
|
95
|
+
if (jsonString.substring(index, index + 3) === "NaN" ||
|
|
96
|
+
(Allow.NAN & allow && length - index < 3 && "NaN".startsWith(jsonString.substring(index)))) {
|
|
97
|
+
index += 3;
|
|
98
|
+
return NaN;
|
|
99
|
+
}
|
|
100
|
+
return parseNum();
|
|
101
|
+
};
|
|
102
|
+
const parseStr = () => {
|
|
103
|
+
const start = index;
|
|
104
|
+
let escape = false;
|
|
105
|
+
index++;
|
|
106
|
+
while (index < length && (jsonString[index] !== '"' || (escape && jsonString[index - 1] === "\\"))) {
|
|
107
|
+
escape = jsonString[index] === "\\" ? !escape : false;
|
|
108
|
+
index++;
|
|
109
|
+
}
|
|
110
|
+
if (jsonString.charAt(index) === '"') {
|
|
111
|
+
try {
|
|
112
|
+
return decodeJson(jsonString.substring(start, ++index - Number(escape)));
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
throwMalformedError(String(error));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (Allow.STR & allow) {
|
|
119
|
+
try {
|
|
120
|
+
return decodeJson(`${jsonString.substring(start, index - Number(escape))}"`);
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
return decodeJson(`${jsonString.substring(start, jsonString.lastIndexOf("\\"))}"`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return markPartialJSON("Unterminated string literal");
|
|
127
|
+
};
|
|
128
|
+
const parseObj = () => {
|
|
129
|
+
index++;
|
|
130
|
+
skipBlank();
|
|
131
|
+
const object = {};
|
|
132
|
+
try {
|
|
133
|
+
while (jsonString[index] !== "}") {
|
|
134
|
+
skipBlank();
|
|
135
|
+
if (index >= length && Allow.OBJ & allow)
|
|
136
|
+
return object;
|
|
137
|
+
const key = parseStr();
|
|
138
|
+
skipBlank();
|
|
139
|
+
index++;
|
|
140
|
+
try {
|
|
141
|
+
object[key] = parseAny();
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
if (Allow.OBJ & allow)
|
|
145
|
+
return object;
|
|
146
|
+
throw error;
|
|
147
|
+
}
|
|
148
|
+
skipBlank();
|
|
149
|
+
if (jsonString[index] === ",")
|
|
150
|
+
index++;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
if (Allow.OBJ & allow)
|
|
155
|
+
return object;
|
|
156
|
+
return markPartialJSON("Expected '}' at end of object");
|
|
157
|
+
}
|
|
158
|
+
index++;
|
|
159
|
+
return object;
|
|
160
|
+
};
|
|
161
|
+
const parseArr = () => {
|
|
162
|
+
index++;
|
|
163
|
+
const array = [];
|
|
164
|
+
try {
|
|
165
|
+
while (jsonString[index] !== "]") {
|
|
166
|
+
array.push(parseAny());
|
|
167
|
+
skipBlank();
|
|
168
|
+
if (jsonString[index] === ",")
|
|
169
|
+
index++;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
if (Allow.ARR & allow)
|
|
174
|
+
return array;
|
|
175
|
+
return markPartialJSON("Expected ']' at end of array");
|
|
176
|
+
}
|
|
177
|
+
index++;
|
|
178
|
+
return array;
|
|
179
|
+
};
|
|
180
|
+
const parseNum = () => {
|
|
181
|
+
if (index === 0) {
|
|
182
|
+
if (jsonString === "-")
|
|
183
|
+
throwMalformedError("Not sure what '-' is");
|
|
184
|
+
try {
|
|
185
|
+
return decodeJson(jsonString);
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
if (Allow.NUM & allow) {
|
|
189
|
+
try {
|
|
190
|
+
return decodeJson(jsonString.substring(0, jsonString.lastIndexOf("e")));
|
|
191
|
+
}
|
|
192
|
+
catch { }
|
|
193
|
+
}
|
|
194
|
+
throwMalformedError(String(error));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
const start = index;
|
|
198
|
+
if (jsonString[index] === "-")
|
|
199
|
+
index++;
|
|
200
|
+
while (jsonString[index] && !",]}".includes(jsonString[index]))
|
|
201
|
+
index++;
|
|
202
|
+
if (index === length && !(Allow.NUM & allow))
|
|
203
|
+
markPartialJSON("Unterminated number literal");
|
|
204
|
+
try {
|
|
205
|
+
return decodeJson(jsonString.substring(start, index));
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
if (jsonString.substring(start, index) === "-")
|
|
209
|
+
markPartialJSON("Not sure what '-' is");
|
|
210
|
+
try {
|
|
211
|
+
return decodeJson(jsonString.substring(start, jsonString.lastIndexOf("e")));
|
|
212
|
+
}
|
|
213
|
+
catch {
|
|
214
|
+
throwMalformedError(String(error));
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
const skipBlank = () => {
|
|
219
|
+
while (index < length && " \n\r\t".includes(jsonString[index]))
|
|
220
|
+
index++;
|
|
221
|
+
};
|
|
222
|
+
return parseAny();
|
|
223
|
+
};
|
|
224
|
+
export const parse = parseJSON;
|
|
@@ -89,6 +89,7 @@ export declare const protocol: Protocol<{
|
|
|
89
89
|
readonly verbosity?: import("./utils/open-responses-options.js").TextVerbosity | undefined;
|
|
90
90
|
} | undefined;
|
|
91
91
|
readonly temperature?: number | undefined;
|
|
92
|
+
readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
|
|
92
93
|
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
93
94
|
readonly type: "function";
|
|
94
95
|
readonly name: string;
|
|
@@ -112,7 +113,6 @@ export declare const protocol: Protocol<{
|
|
|
112
113
|
readonly presence_penalty?: number | undefined;
|
|
113
114
|
readonly safety_identifier?: string | undefined;
|
|
114
115
|
readonly top_logprobs?: number | undefined;
|
|
115
|
-
readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
|
|
116
116
|
readonly max_output_tokens?: number | undefined;
|
|
117
117
|
readonly max_tool_calls?: number | undefined;
|
|
118
118
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
1
|
import { Protocol } from "../route/protocol.js";
|
|
3
2
|
import { OpenResponses } from "./open-responses.js";
|
|
4
|
-
import { ProviderShared } from "./shared.js";
|
|
5
3
|
import { ResponsesHostedTools } from "./utils/responses-hosted-tools.js";
|
|
6
4
|
const ADAPTER = "xai-responses";
|
|
7
5
|
const NAME = "xAI Responses";
|
|
@@ -23,15 +21,9 @@ const HOSTED_TOOLS = {
|
|
|
23
21
|
input: (item) => ({ server_label: item.server_label, name: item.name, arguments: item.arguments }),
|
|
24
22
|
},
|
|
25
23
|
};
|
|
24
|
+
// Grok speaks the standard Responses reasoning dialect (`reasoning_summary_text.*`,
|
|
25
|
+
// handled by the baseline); only its hosted tool vocabulary differs.
|
|
26
26
|
const step = (state, event) => {
|
|
27
|
-
if (event.type === "response.reasoning_text.delta" || event.type === "response.reasoning_summary.delta")
|
|
28
|
-
return event.item_id
|
|
29
|
-
? Effect.succeed(OpenResponses.onReasoningDelta(state, event, event.item_id))
|
|
30
|
-
: ProviderShared.eventError(ADAPTER, `${event.type} is missing item_id`);
|
|
31
|
-
if (event.type === "response.reasoning_text.done" || event.type === "response.reasoning_summary.done")
|
|
32
|
-
return event.item_id
|
|
33
|
-
? Effect.succeed(OpenResponses.onReasoningDone(state, event))
|
|
34
|
-
: ProviderShared.eventError(ADAPTER, `${event.type} is missing item_id`);
|
|
35
27
|
if (event.type === "response.output_item.done" && event.item && ResponsesHostedTools.isItem(event.item, HOSTED_TOOLS))
|
|
36
28
|
return ResponsesHostedTools.onDone(state, event.item, HOSTED_TOOLS);
|
|
37
29
|
return OpenResponses.step(state, event);
|
|
@@ -85,11 +85,12 @@ export declare const routes: (RouteDef<{
|
|
|
85
85
|
readonly max_tokens?: number | undefined;
|
|
86
86
|
readonly tools?: readonly {
|
|
87
87
|
readonly function: {
|
|
88
|
-
readonly name: string;
|
|
89
88
|
readonly description: string;
|
|
89
|
+
readonly name: string;
|
|
90
90
|
readonly parameters: {
|
|
91
91
|
readonly [x: string]: unknown;
|
|
92
92
|
};
|
|
93
|
+
readonly strict?: boolean | undefined;
|
|
93
94
|
};
|
|
94
95
|
readonly type: "function";
|
|
95
96
|
readonly cache_control?: {
|
|
@@ -113,6 +114,7 @@ export declare const routes: (RouteDef<{
|
|
|
113
114
|
} | undefined;
|
|
114
115
|
readonly prompt_cache_key?: string | undefined;
|
|
115
116
|
readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
|
|
117
|
+
readonly tool_stream?: boolean | undefined;
|
|
116
118
|
readonly frequency_penalty?: number | undefined;
|
|
117
119
|
readonly presence_penalty?: number | undefined;
|
|
118
120
|
}, import("../route/transport/http.js").HttpPrepared<string>> | RouteDef<{
|
|
@@ -214,6 +216,7 @@ export declare const routes: (RouteDef<{
|
|
|
214
216
|
readonly verbosity?: import("../protocols/utils/open-responses-options.js").TextVerbosity | undefined;
|
|
215
217
|
} | undefined;
|
|
216
218
|
readonly temperature?: number | undefined;
|
|
219
|
+
readonly service_tier?: import("../protocols/utils/open-responses-options.js").ServiceTier | undefined;
|
|
217
220
|
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
218
221
|
readonly type: "function";
|
|
219
222
|
readonly name: string;
|
|
@@ -239,7 +242,6 @@ export declare const routes: (RouteDef<{
|
|
|
239
242
|
readonly presence_penalty?: number | undefined;
|
|
240
243
|
readonly safety_identifier?: string | undefined;
|
|
241
244
|
readonly top_logprobs?: number | undefined;
|
|
242
|
-
readonly service_tier?: import("../protocols/utils/open-responses-options.js").ServiceTier | undefined;
|
|
243
245
|
readonly max_output_tokens?: number | undefined;
|
|
244
246
|
readonly max_tool_calls?: number | undefined;
|
|
245
247
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
@@ -41,22 +41,46 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
41
41
|
readonly type: "base64";
|
|
42
42
|
readonly media_type: string;
|
|
43
43
|
readonly data: string;
|
|
44
|
+
} | {
|
|
45
|
+
readonly type: "url";
|
|
46
|
+
readonly url: string;
|
|
47
|
+
} | {
|
|
48
|
+
readonly type: "file";
|
|
49
|
+
readonly file_id: string;
|
|
44
50
|
};
|
|
45
51
|
readonly cache_control?: {
|
|
46
52
|
readonly type: "ephemeral";
|
|
47
53
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
48
54
|
} | undefined;
|
|
55
|
+
readonly transformations?: {
|
|
56
|
+
readonly oversized_image?: "error" | "downsize" | undefined;
|
|
57
|
+
} | undefined;
|
|
49
58
|
} | {
|
|
50
59
|
readonly type: "document";
|
|
51
60
|
readonly source: {
|
|
52
61
|
readonly type: "base64";
|
|
53
62
|
readonly media_type: "application/pdf";
|
|
54
63
|
readonly data: string;
|
|
64
|
+
} | {
|
|
65
|
+
readonly type: "text";
|
|
66
|
+
readonly media_type: "text/plain";
|
|
67
|
+
readonly data: string;
|
|
68
|
+
} | {
|
|
69
|
+
readonly type: "url";
|
|
70
|
+
readonly url: string;
|
|
71
|
+
} | {
|
|
72
|
+
readonly type: "file";
|
|
73
|
+
readonly file_id: string;
|
|
55
74
|
};
|
|
75
|
+
readonly title?: string | undefined;
|
|
76
|
+
readonly context?: string | undefined;
|
|
56
77
|
readonly cache_control?: {
|
|
57
78
|
readonly type: "ephemeral";
|
|
58
79
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
59
80
|
} | undefined;
|
|
81
|
+
readonly citations?: {
|
|
82
|
+
readonly enabled: boolean;
|
|
83
|
+
} | undefined;
|
|
60
84
|
} | {
|
|
61
85
|
readonly type: "tool_result";
|
|
62
86
|
readonly content: string | readonly ({
|
|
@@ -72,22 +96,46 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
72
96
|
readonly type: "base64";
|
|
73
97
|
readonly media_type: string;
|
|
74
98
|
readonly data: string;
|
|
99
|
+
} | {
|
|
100
|
+
readonly type: "url";
|
|
101
|
+
readonly url: string;
|
|
102
|
+
} | {
|
|
103
|
+
readonly type: "file";
|
|
104
|
+
readonly file_id: string;
|
|
75
105
|
};
|
|
76
106
|
readonly cache_control?: {
|
|
77
107
|
readonly type: "ephemeral";
|
|
78
108
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
79
109
|
} | undefined;
|
|
110
|
+
readonly transformations?: {
|
|
111
|
+
readonly oversized_image?: "error" | "downsize" | undefined;
|
|
112
|
+
} | undefined;
|
|
80
113
|
} | {
|
|
81
114
|
readonly type: "document";
|
|
82
115
|
readonly source: {
|
|
83
116
|
readonly type: "base64";
|
|
84
117
|
readonly media_type: "application/pdf";
|
|
85
118
|
readonly data: string;
|
|
119
|
+
} | {
|
|
120
|
+
readonly type: "text";
|
|
121
|
+
readonly media_type: "text/plain";
|
|
122
|
+
readonly data: string;
|
|
123
|
+
} | {
|
|
124
|
+
readonly type: "url";
|
|
125
|
+
readonly url: string;
|
|
126
|
+
} | {
|
|
127
|
+
readonly type: "file";
|
|
128
|
+
readonly file_id: string;
|
|
86
129
|
};
|
|
130
|
+
readonly title?: string | undefined;
|
|
131
|
+
readonly context?: string | undefined;
|
|
87
132
|
readonly cache_control?: {
|
|
88
133
|
readonly type: "ephemeral";
|
|
89
134
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
90
135
|
} | undefined;
|
|
136
|
+
readonly citations?: {
|
|
137
|
+
readonly enabled: boolean;
|
|
138
|
+
} | undefined;
|
|
91
139
|
})[];
|
|
92
140
|
readonly tool_use_id: string;
|
|
93
141
|
readonly cache_control?: {
|
|
@@ -134,11 +182,11 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
134
182
|
} | {
|
|
135
183
|
readonly type: "thinking";
|
|
136
184
|
readonly thinking: string;
|
|
185
|
+
readonly signature: string;
|
|
137
186
|
readonly cache_control?: {
|
|
138
187
|
readonly type: "ephemeral";
|
|
139
188
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
140
189
|
} | undefined;
|
|
141
|
-
readonly signature?: string | undefined;
|
|
142
190
|
} | {
|
|
143
191
|
readonly data: string;
|
|
144
192
|
readonly type: "redacted_thinking";
|
|
@@ -159,6 +207,9 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
159
207
|
}[];
|
|
160
208
|
})[];
|
|
161
209
|
readonly stream: true;
|
|
210
|
+
readonly metadata?: {
|
|
211
|
+
readonly user_id?: string | null | undefined;
|
|
212
|
+
} | undefined;
|
|
162
213
|
readonly tools?: readonly {
|
|
163
214
|
readonly description: string;
|
|
164
215
|
readonly name: string;
|
|
@@ -189,18 +240,38 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
189
240
|
} | {
|
|
190
241
|
readonly type: "disabled";
|
|
191
242
|
} | undefined;
|
|
243
|
+
readonly service_tier?: "auto" | "standard_only" | undefined;
|
|
244
|
+
readonly container?: string | {
|
|
245
|
+
readonly id?: string | null | undefined;
|
|
246
|
+
readonly skills?: readonly {
|
|
247
|
+
readonly [x: string]: unknown;
|
|
248
|
+
}[] | null | undefined;
|
|
249
|
+
} | null | undefined;
|
|
250
|
+
readonly inference_geo?: string | null | undefined;
|
|
251
|
+
readonly cache_control?: {
|
|
252
|
+
readonly type: "ephemeral";
|
|
253
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
254
|
+
} | undefined;
|
|
255
|
+
readonly output_config?: {
|
|
256
|
+
readonly format?: {
|
|
257
|
+
readonly type: "json_schema";
|
|
258
|
+
readonly schema: {
|
|
259
|
+
readonly [x: string]: unknown;
|
|
260
|
+
};
|
|
261
|
+
} | null | undefined;
|
|
262
|
+
readonly effort?: string | undefined;
|
|
263
|
+
} | undefined;
|
|
192
264
|
readonly tool_choice?: {
|
|
193
265
|
readonly type: "auto" | "none" | "any";
|
|
266
|
+
readonly disable_parallel_tool_use?: boolean | undefined;
|
|
194
267
|
} | {
|
|
195
268
|
readonly type: "tool";
|
|
196
269
|
readonly name: string;
|
|
270
|
+
readonly disable_parallel_tool_use?: boolean | undefined;
|
|
197
271
|
} | undefined;
|
|
198
272
|
readonly top_p?: number | undefined;
|
|
199
273
|
readonly top_k?: number | undefined;
|
|
200
274
|
readonly stop_sequences?: readonly string[] | undefined;
|
|
201
|
-
readonly output_config?: {
|
|
202
|
-
readonly effort?: string | undefined;
|
|
203
|
-
} | undefined;
|
|
204
275
|
}, import("../route/transport/http.js").HttpPrepared<string>>[];
|
|
205
276
|
export declare const configure: (input: Config) => {
|
|
206
277
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
@@ -25,22 +25,46 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
25
25
|
readonly type: "base64";
|
|
26
26
|
readonly media_type: string;
|
|
27
27
|
readonly data: string;
|
|
28
|
+
} | {
|
|
29
|
+
readonly type: "url";
|
|
30
|
+
readonly url: string;
|
|
31
|
+
} | {
|
|
32
|
+
readonly type: "file";
|
|
33
|
+
readonly file_id: string;
|
|
28
34
|
};
|
|
29
35
|
readonly cache_control?: {
|
|
30
36
|
readonly type: "ephemeral";
|
|
31
37
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
32
38
|
} | undefined;
|
|
39
|
+
readonly transformations?: {
|
|
40
|
+
readonly oversized_image?: "error" | "downsize" | undefined;
|
|
41
|
+
} | undefined;
|
|
33
42
|
} | {
|
|
34
43
|
readonly type: "document";
|
|
35
44
|
readonly source: {
|
|
36
45
|
readonly type: "base64";
|
|
37
46
|
readonly media_type: "application/pdf";
|
|
38
47
|
readonly data: string;
|
|
48
|
+
} | {
|
|
49
|
+
readonly type: "text";
|
|
50
|
+
readonly media_type: "text/plain";
|
|
51
|
+
readonly data: string;
|
|
52
|
+
} | {
|
|
53
|
+
readonly type: "url";
|
|
54
|
+
readonly url: string;
|
|
55
|
+
} | {
|
|
56
|
+
readonly type: "file";
|
|
57
|
+
readonly file_id: string;
|
|
39
58
|
};
|
|
59
|
+
readonly title?: string | undefined;
|
|
60
|
+
readonly context?: string | undefined;
|
|
40
61
|
readonly cache_control?: {
|
|
41
62
|
readonly type: "ephemeral";
|
|
42
63
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
43
64
|
} | undefined;
|
|
65
|
+
readonly citations?: {
|
|
66
|
+
readonly enabled: boolean;
|
|
67
|
+
} | undefined;
|
|
44
68
|
} | {
|
|
45
69
|
readonly type: "tool_result";
|
|
46
70
|
readonly content: string | readonly ({
|
|
@@ -56,22 +80,46 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
56
80
|
readonly type: "base64";
|
|
57
81
|
readonly media_type: string;
|
|
58
82
|
readonly data: string;
|
|
83
|
+
} | {
|
|
84
|
+
readonly type: "url";
|
|
85
|
+
readonly url: string;
|
|
86
|
+
} | {
|
|
87
|
+
readonly type: "file";
|
|
88
|
+
readonly file_id: string;
|
|
59
89
|
};
|
|
60
90
|
readonly cache_control?: {
|
|
61
91
|
readonly type: "ephemeral";
|
|
62
92
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
63
93
|
} | undefined;
|
|
94
|
+
readonly transformations?: {
|
|
95
|
+
readonly oversized_image?: "error" | "downsize" | undefined;
|
|
96
|
+
} | undefined;
|
|
64
97
|
} | {
|
|
65
98
|
readonly type: "document";
|
|
66
99
|
readonly source: {
|
|
67
100
|
readonly type: "base64";
|
|
68
101
|
readonly media_type: "application/pdf";
|
|
69
102
|
readonly data: string;
|
|
103
|
+
} | {
|
|
104
|
+
readonly type: "text";
|
|
105
|
+
readonly media_type: "text/plain";
|
|
106
|
+
readonly data: string;
|
|
107
|
+
} | {
|
|
108
|
+
readonly type: "url";
|
|
109
|
+
readonly url: string;
|
|
110
|
+
} | {
|
|
111
|
+
readonly type: "file";
|
|
112
|
+
readonly file_id: string;
|
|
70
113
|
};
|
|
114
|
+
readonly title?: string | undefined;
|
|
115
|
+
readonly context?: string | undefined;
|
|
71
116
|
readonly cache_control?: {
|
|
72
117
|
readonly type: "ephemeral";
|
|
73
118
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
74
119
|
} | undefined;
|
|
120
|
+
readonly citations?: {
|
|
121
|
+
readonly enabled: boolean;
|
|
122
|
+
} | undefined;
|
|
75
123
|
})[];
|
|
76
124
|
readonly tool_use_id: string;
|
|
77
125
|
readonly cache_control?: {
|
|
@@ -118,11 +166,11 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
118
166
|
} | {
|
|
119
167
|
readonly type: "thinking";
|
|
120
168
|
readonly thinking: string;
|
|
169
|
+
readonly signature: string;
|
|
121
170
|
readonly cache_control?: {
|
|
122
171
|
readonly type: "ephemeral";
|
|
123
172
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
124
173
|
} | undefined;
|
|
125
|
-
readonly signature?: string | undefined;
|
|
126
174
|
} | {
|
|
127
175
|
readonly data: string;
|
|
128
176
|
readonly type: "redacted_thinking";
|
|
@@ -143,6 +191,9 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
143
191
|
}[];
|
|
144
192
|
})[];
|
|
145
193
|
readonly stream: true;
|
|
194
|
+
readonly metadata?: {
|
|
195
|
+
readonly user_id?: string | null | undefined;
|
|
196
|
+
} | undefined;
|
|
146
197
|
readonly tools?: readonly {
|
|
147
198
|
readonly description: string;
|
|
148
199
|
readonly name: string;
|
|
@@ -173,18 +224,38 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
173
224
|
} | {
|
|
174
225
|
readonly type: "disabled";
|
|
175
226
|
} | undefined;
|
|
227
|
+
readonly service_tier?: "auto" | "standard_only" | undefined;
|
|
228
|
+
readonly container?: string | {
|
|
229
|
+
readonly id?: string | null | undefined;
|
|
230
|
+
readonly skills?: readonly {
|
|
231
|
+
readonly [x: string]: unknown;
|
|
232
|
+
}[] | null | undefined;
|
|
233
|
+
} | null | undefined;
|
|
234
|
+
readonly inference_geo?: string | null | undefined;
|
|
235
|
+
readonly cache_control?: {
|
|
236
|
+
readonly type: "ephemeral";
|
|
237
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
238
|
+
} | undefined;
|
|
239
|
+
readonly output_config?: {
|
|
240
|
+
readonly format?: {
|
|
241
|
+
readonly type: "json_schema";
|
|
242
|
+
readonly schema: {
|
|
243
|
+
readonly [x: string]: unknown;
|
|
244
|
+
};
|
|
245
|
+
} | null | undefined;
|
|
246
|
+
readonly effort?: string | undefined;
|
|
247
|
+
} | undefined;
|
|
176
248
|
readonly tool_choice?: {
|
|
177
249
|
readonly type: "auto" | "none" | "any";
|
|
250
|
+
readonly disable_parallel_tool_use?: boolean | undefined;
|
|
178
251
|
} | {
|
|
179
252
|
readonly type: "tool";
|
|
180
253
|
readonly name: string;
|
|
254
|
+
readonly disable_parallel_tool_use?: boolean | undefined;
|
|
181
255
|
} | undefined;
|
|
182
256
|
readonly top_p?: number | undefined;
|
|
183
257
|
readonly top_k?: number | undefined;
|
|
184
258
|
readonly stop_sequences?: readonly string[] | undefined;
|
|
185
|
-
readonly output_config?: {
|
|
186
|
-
readonly effort?: string | undefined;
|
|
187
|
-
} | undefined;
|
|
188
259
|
}, import("../route/transport/http.js").HttpPrepared<string>>[];
|
|
189
260
|
export type Config = RouteDefaultsInput & ProviderAuthOption<"optional"> & {
|
|
190
261
|
readonly baseURL?: string;
|
|
@@ -88,11 +88,12 @@ export declare const routes: (RouteDef<{
|
|
|
88
88
|
readonly max_tokens?: number | undefined;
|
|
89
89
|
readonly tools?: readonly {
|
|
90
90
|
readonly function: {
|
|
91
|
-
readonly name: string;
|
|
92
91
|
readonly description: string;
|
|
92
|
+
readonly name: string;
|
|
93
93
|
readonly parameters: {
|
|
94
94
|
readonly [x: string]: unknown;
|
|
95
95
|
};
|
|
96
|
+
readonly strict?: boolean | undefined;
|
|
96
97
|
};
|
|
97
98
|
readonly type: "function";
|
|
98
99
|
readonly cache_control?: {
|
|
@@ -116,6 +117,7 @@ export declare const routes: (RouteDef<{
|
|
|
116
117
|
} | undefined;
|
|
117
118
|
readonly prompt_cache_key?: string | undefined;
|
|
118
119
|
readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
|
|
120
|
+
readonly tool_stream?: boolean | undefined;
|
|
119
121
|
readonly frequency_penalty?: number | undefined;
|
|
120
122
|
readonly presence_penalty?: number | undefined;
|
|
121
123
|
}, import("../route/transport/http.js").HttpPrepared<string>> | RouteDef<{
|
|
@@ -217,6 +219,7 @@ export declare const routes: (RouteDef<{
|
|
|
217
219
|
readonly verbosity?: import("../protocols/utils/open-responses-options.js").TextVerbosity | undefined;
|
|
218
220
|
} | undefined;
|
|
219
221
|
readonly temperature?: number | undefined;
|
|
222
|
+
readonly service_tier?: import("../protocols/utils/open-responses-options.js").ServiceTier | undefined;
|
|
220
223
|
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
221
224
|
readonly type: "function";
|
|
222
225
|
readonly name: string;
|
|
@@ -242,7 +245,6 @@ export declare const routes: (RouteDef<{
|
|
|
242
245
|
readonly presence_penalty?: number | undefined;
|
|
243
246
|
readonly safety_identifier?: string | undefined;
|
|
244
247
|
readonly top_logprobs?: number | undefined;
|
|
245
|
-
readonly service_tier?: import("../protocols/utils/open-responses-options.js").ServiceTier | undefined;
|
|
246
248
|
readonly max_output_tokens?: number | undefined;
|
|
247
249
|
readonly max_tool_calls?: number | undefined;
|
|
248
250
|
readonly parallel_tool_calls?: boolean | undefined;
|