@opencode/ai 2.0.3 → 2.0.4
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/cache-policy.js +10 -2
- package/dist/effort-updates.d.ts +12 -0
- package/dist/effort-updates.js +23 -0
- package/dist/protocols/alibaba-messages.d.ts +4 -1
- package/dist/protocols/alibaba-responses.d.ts +3 -1
- package/dist/protocols/anthropic-messages.d.ts +11 -2
- package/dist/protocols/anthropic-messages.js +48 -17
- package/dist/protocols/bedrock-converse.js +17 -12
- package/dist/protocols/meta-messages.d.ts +4 -1
- package/dist/protocols/meta-responses.d.ts +8 -4
- package/dist/protocols/mistral-chat.js +5 -33
- package/dist/protocols/open-responses-channel.js +4 -0
- package/dist/protocols/open-responses.d.ts +27 -9
- package/dist/protocols/open-responses.js +24 -8
- package/dist/protocols/openai-chat.d.ts +7 -7
- package/dist/protocols/openai-chat.js +10 -4
- package/dist/protocols/openai-compatible-chat.d.ts +1 -1
- package/dist/protocols/openai-compatible-responses.d.ts +4 -2
- package/dist/protocols/openai-responses.d.ts +74 -31
- package/dist/protocols/openai-responses.js +27 -6
- package/dist/protocols/utils/bedrock-media.d.ts +10 -8
- package/dist/protocols/utils/bedrock-media.js +29 -5
- package/dist/protocols/utils/mistral-tool-id.d.ts +5 -0
- package/dist/protocols/utils/mistral-tool-id.js +31 -0
- package/dist/protocols/utils/open-responses-options.d.ts +2 -4
- package/dist/protocols/utils/open-responses-options.js +2 -2
- package/dist/protocols/utils/responses-compaction.js +3 -1
- package/dist/protocols/xai-responses.d.ts +4 -2
- package/dist/protocols/zai-chat.d.ts +1 -1
- package/dist/protocols/zai-messages.d.ts +4 -1
- package/dist/provider-error.js +40 -4
- package/dist/providers/alibaba.d.ts +15 -10
- package/dist/providers/amazon-bedrock-mantle.d.ts +5 -3
- package/dist/providers/anthropic-compatible.d.ts +4 -1
- package/dist/providers/anthropic.d.ts +4 -1
- package/dist/providers/azure.d.ts +19 -5
- package/dist/providers/azure.js +1 -8
- package/dist/providers/baseten.d.ts +2 -2
- package/dist/providers/cerebras.d.ts +2 -2
- package/dist/providers/cerebras.js +1 -1
- package/dist/providers/cloudflare-ai-gateway.d.ts +1024 -13
- package/dist/providers/cloudflare-ai-gateway.js +64 -27
- package/dist/providers/cloudflare-workers-ai.d.ts +3 -3
- package/dist/providers/cloudflare-workers-ai.js +1 -1
- package/dist/providers/deepinfra.d.ts +2 -2
- package/dist/providers/deepinfra.js +1 -1
- package/dist/providers/deepseek.d.ts +2 -2
- package/dist/providers/fireworks.d.ts +2 -2
- package/dist/providers/fireworks.js +1 -1
- package/dist/providers/google-vertex-chat.d.ts +1 -1
- package/dist/providers/google-vertex-messages.d.ts +4 -1
- package/dist/providers/google-vertex-responses.d.ts +4 -2
- package/dist/providers/google-vertex.js +5 -1
- package/dist/providers/groq.d.ts +2 -2
- package/dist/providers/meta.d.ts +9 -4
- package/dist/providers/meta.js +1 -1
- package/dist/providers/minimax.d.ts +9 -4
- package/dist/providers/moonshot.d.ts +9 -4
- package/dist/providers/moonshot.js +1 -0
- package/dist/providers/openai-compatible-responses.d.ts +4 -2
- package/dist/providers/openai-compatible.d.ts +1 -1
- package/dist/providers/openai.d.ts +10 -3
- package/dist/providers/openai.js +4 -1
- package/dist/providers/openrouter.d.ts +4 -4
- package/dist/providers/openrouter.js +1 -1
- package/dist/providers/togetherai.d.ts +2 -2
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers/zai-coding-plan.d.ts +9 -4
- package/dist/providers/zai.d.ts +1 -1
- package/dist/route/client.d.ts +1 -0
- package/dist/route/client.js +3 -1
- package/dist/route/protocol.d.ts +2 -0
- package/dist/schema/messages.d.ts +22 -3
- package/dist/schema/messages.js +9 -1
- package/dist/schema/options.d.ts +6 -0
- package/dist/schema/options.js +7 -0
- package/package.json +3 -3
|
@@ -51,12 +51,15 @@ export declare const protocol: Protocol<{
|
|
|
51
51
|
readonly encrypted_content: string;
|
|
52
52
|
readonly id?: string | null | undefined;
|
|
53
53
|
} | {
|
|
54
|
+
readonly type: "message";
|
|
54
55
|
readonly role: "system";
|
|
55
56
|
readonly content: string;
|
|
56
57
|
} | {
|
|
58
|
+
readonly type: "message";
|
|
57
59
|
readonly role: "developer";
|
|
58
60
|
readonly content: string;
|
|
59
61
|
} | {
|
|
62
|
+
readonly type: "message";
|
|
60
63
|
readonly content: readonly ({
|
|
61
64
|
readonly type: "input_image";
|
|
62
65
|
readonly image_url: string;
|
|
@@ -73,7 +76,6 @@ export declare const protocol: Protocol<{
|
|
|
73
76
|
})[];
|
|
74
77
|
readonly role: "user";
|
|
75
78
|
readonly id?: string | undefined;
|
|
76
|
-
readonly type?: "message" | undefined;
|
|
77
79
|
readonly status?: string | undefined;
|
|
78
80
|
} | {
|
|
79
81
|
readonly type: "message";
|
|
@@ -136,7 +138,7 @@ export declare const protocol: Protocol<{
|
|
|
136
138
|
readonly instructions?: string | undefined;
|
|
137
139
|
readonly reasoning?: {
|
|
138
140
|
readonly summary?: "auto" | "concise" | "detailed" | undefined;
|
|
139
|
-
readonly effort?: import("
|
|
141
|
+
readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
140
142
|
} | undefined;
|
|
141
143
|
readonly tools?: readonly {
|
|
142
144
|
readonly type: "function";
|
|
@@ -120,7 +120,7 @@ export declare const protocol: Protocol<{
|
|
|
120
120
|
readonly frequency_penalty?: number | undefined;
|
|
121
121
|
readonly presence_penalty?: number | undefined;
|
|
122
122
|
readonly prompt_cache_key?: string | undefined;
|
|
123
|
-
readonly reasoning_effort?: import("
|
|
123
|
+
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
124
124
|
readonly store?: boolean | undefined;
|
|
125
125
|
readonly stream_options?: {
|
|
126
126
|
readonly include_usage: boolean;
|
|
@@ -182,7 +182,6 @@ export declare const protocol: Protocol<{
|
|
|
182
182
|
readonly content: string | null;
|
|
183
183
|
})[];
|
|
184
184
|
} | {
|
|
185
|
-
readonly role: "system";
|
|
186
185
|
readonly content: readonly {
|
|
187
186
|
readonly type: "text";
|
|
188
187
|
readonly text: string;
|
|
@@ -191,6 +190,10 @@ export declare const protocol: Protocol<{
|
|
|
191
190
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
192
191
|
} | undefined;
|
|
193
192
|
}[];
|
|
193
|
+
readonly role: "system";
|
|
194
|
+
readonly output_config?: {
|
|
195
|
+
readonly effort: string;
|
|
196
|
+
} | undefined;
|
|
194
197
|
})[];
|
|
195
198
|
readonly stream: true;
|
|
196
199
|
readonly metadata?: {
|
package/dist/provider-error.js
CHANGED
|
@@ -52,9 +52,26 @@ const SERVER_CODES = new Set([
|
|
|
52
52
|
"serviceunavailableexception",
|
|
53
53
|
]);
|
|
54
54
|
const INVALID_REQUEST_CODES = new Set(["invalid_prompt", "invalid_request_error", "validationexception"]);
|
|
55
|
+
// Azure OpenAI reports `content_filter` with `innererror.code` ResponsibleAIPolicyViolation.
|
|
56
|
+
// OpenRouter tags provider failures with a typed `error_type`; its Responses skin also
|
|
57
|
+
// emits `image_content_policy_violation` as the native code.
|
|
58
|
+
const CONTENT_POLICY_CODES = new Set([
|
|
59
|
+
"content_filter",
|
|
60
|
+
"responsibleaipolicyviolation",
|
|
61
|
+
"content_policy_violation",
|
|
62
|
+
"image_content_policy_violation",
|
|
63
|
+
"refusal",
|
|
64
|
+
]);
|
|
65
|
+
// OpenCode Zen replaces upstream codes outside its allow-list but keeps the original
|
|
66
|
+
// as a `[code]` label at the start of the rewritten message.
|
|
67
|
+
const GATEWAY_CODE_LABEL = /^[^:\n]+: \[([A-Za-z0-9_.-]+)\]/;
|
|
55
68
|
const RATE_LIMIT_TEXT = /rate increased too quickly|rate[-_\s]?limit|too[_\s]?many[_\s]?requests/i;
|
|
56
69
|
const QUOTA_TEXT = /insufficient[-_\s]?quota|quota[-_\s]?exceeded/i;
|
|
57
|
-
|
|
70
|
+
// Policy rejections without a dedicated code, matched against the provider's own
|
|
71
|
+
// explanation only. OpenAI reuses `invalid_prompt` for usage-policy rejections while
|
|
72
|
+
// Bedrock Mantle reuses it for schema validation; Anthropic reports blocked output
|
|
73
|
+
// under `invalid_request_error`.
|
|
74
|
+
const CONTENT_POLICY_TEXT = /violating our usage policy|blocked by content filtering policy|content[-_\s]?policy|rejected as a result of our safety system/i;
|
|
58
75
|
const SERVER_ERROR_TEXT = /\b(?:try again|(?:please |you can )?retry (?:the |this |your )?request|try (?:the |this |your )?request again|(?:currently |temporarily )?at capacity|overloaded|temporarily unavailable|service[-_\s]?unavailable|(?:server|internal)[-_\s]?error|server (?:is )?busy|provider returned (?:an )?error|resource[-_\s]?exhausted|upstream (?:connect|connection|request)|request buffer limit while retrying upstream)\b/i;
|
|
59
76
|
// Classification records affirmative evidence about a failure. Deterministic
|
|
60
77
|
// failures need positive identification (a 4xx status, quota/auth/policy
|
|
@@ -65,7 +82,12 @@ const SERVER_ERROR_TEXT = /\b(?:try again|(?:please |you can )?retry (?:the |thi
|
|
|
65
82
|
export function classifyProviderFailure(input) {
|
|
66
83
|
const details = { message: input.message, body: input.rawBody, http: input.http, cause: input.cause };
|
|
67
84
|
const body = input.rawBody ?? "";
|
|
68
|
-
const codes = [
|
|
85
|
+
const codes = [
|
|
86
|
+
...providerCodes(input.data),
|
|
87
|
+
...providerCodes(body),
|
|
88
|
+
...providerCodes(input.message),
|
|
89
|
+
...(GATEWAY_CODE_LABEL.exec(input.message)?.slice(1) ?? []),
|
|
90
|
+
].map((code) => code.toLowerCase());
|
|
69
91
|
// Scan the raw payload too so signals missing from the summary message
|
|
70
92
|
// (e.g. overflow phrases nested in a JSON error body) still classify.
|
|
71
93
|
const text = [input.message, body].filter((value) => value.length > 0).join("\n");
|
|
@@ -78,7 +100,7 @@ export function classifyProviderFailure(input) {
|
|
|
78
100
|
return new InvalidRequestError({ ...details, classification: "context-overflow" });
|
|
79
101
|
if (input.status === 413 || isPayloadTooLarge(text))
|
|
80
102
|
return new InvalidRequestError({ ...details, classification: "payload-too-large" });
|
|
81
|
-
if (CONTENT_POLICY_TEXT.test(
|
|
103
|
+
if (codes.some((code) => CONTENT_POLICY_CODES.has(code)) || (clientScoped && CONTENT_POLICY_TEXT.test(input.message)))
|
|
82
104
|
return new ContentPolicyError(details);
|
|
83
105
|
if (codes.some((code) => QUOTA_CODES.has(code)) || (input.status === 429 && QUOTA_TEXT.test(text)))
|
|
84
106
|
return new QuotaExceededError(details);
|
|
@@ -115,10 +137,24 @@ function providerCodes(value) {
|
|
|
115
137
|
if (!isRecord(decoded))
|
|
116
138
|
return [];
|
|
117
139
|
const error = isRecord(decoded.error) ? decoded.error : undefined;
|
|
140
|
+
const inner = error && isRecord(error.innererror) ? error.innererror : undefined;
|
|
141
|
+
const metadata = error && isRecord(error.metadata) ? error.metadata : undefined;
|
|
118
142
|
const response = isRecord(decoded.response) ? decoded.response : undefined;
|
|
119
143
|
const responseError = response && isRecord(response.error) ? response.error : undefined;
|
|
120
144
|
const exception = isRecord(decoded.exception) ? decoded.exception : undefined;
|
|
121
|
-
return [
|
|
145
|
+
return [
|
|
146
|
+
decoded.code,
|
|
147
|
+
decoded.error_type,
|
|
148
|
+
error?.code,
|
|
149
|
+
error?.type,
|
|
150
|
+
error?.status,
|
|
151
|
+
error?.error_type,
|
|
152
|
+
inner?.code,
|
|
153
|
+
metadata?.error_type,
|
|
154
|
+
responseError?.code,
|
|
155
|
+
response?.error_type,
|
|
156
|
+
exception?.type,
|
|
157
|
+
].filter((value) => typeof value === "string");
|
|
122
158
|
}
|
|
123
159
|
function isRecord(value) {
|
|
124
160
|
return typeof value === "object" && value !== null;
|
|
@@ -120,7 +120,7 @@ export declare const routes: (Route<{
|
|
|
120
120
|
readonly presence_penalty?: number | undefined;
|
|
121
121
|
readonly prompt_cache_key?: string | undefined;
|
|
122
122
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
123
|
-
readonly reasoning_effort?: import("../
|
|
123
|
+
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
124
124
|
readonly store?: boolean | undefined;
|
|
125
125
|
readonly stream_options?: {
|
|
126
126
|
readonly include_usage: boolean;
|
|
@@ -319,7 +319,6 @@ export declare const routes: (Route<{
|
|
|
319
319
|
readonly content: string | null;
|
|
320
320
|
})[];
|
|
321
321
|
} | {
|
|
322
|
-
readonly role: "system";
|
|
323
322
|
readonly content: readonly {
|
|
324
323
|
readonly type: "text";
|
|
325
324
|
readonly text: string;
|
|
@@ -328,6 +327,10 @@ export declare const routes: (Route<{
|
|
|
328
327
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
329
328
|
} | undefined;
|
|
330
329
|
}[];
|
|
330
|
+
readonly role: "system";
|
|
331
|
+
readonly output_config?: {
|
|
332
|
+
readonly effort: string;
|
|
333
|
+
} | undefined;
|
|
331
334
|
})[];
|
|
332
335
|
readonly stream: true;
|
|
333
336
|
readonly metadata?: {
|
|
@@ -451,12 +454,15 @@ export declare const routes: (Route<{
|
|
|
451
454
|
readonly encrypted_content: string;
|
|
452
455
|
readonly id?: string | null | undefined;
|
|
453
456
|
} | {
|
|
457
|
+
readonly type: "message";
|
|
454
458
|
readonly role: "system";
|
|
455
459
|
readonly content: string;
|
|
456
460
|
} | {
|
|
461
|
+
readonly type: "message";
|
|
457
462
|
readonly role: "developer";
|
|
458
463
|
readonly content: string;
|
|
459
464
|
} | {
|
|
465
|
+
readonly type: "message";
|
|
460
466
|
readonly content: readonly ({
|
|
461
467
|
readonly type: "input_image";
|
|
462
468
|
readonly image_url: string;
|
|
@@ -473,7 +479,6 @@ export declare const routes: (Route<{
|
|
|
473
479
|
})[];
|
|
474
480
|
readonly role: "user";
|
|
475
481
|
readonly id?: string | undefined;
|
|
476
|
-
readonly type?: "message" | undefined;
|
|
477
482
|
readonly status?: string | undefined;
|
|
478
483
|
} | {
|
|
479
484
|
readonly type: "message";
|
|
@@ -527,7 +532,7 @@ export declare const routes: (Route<{
|
|
|
527
532
|
readonly instructions?: string | undefined;
|
|
528
533
|
readonly reasoning?: {
|
|
529
534
|
readonly summary?: "auto" | "concise" | "detailed" | undefined;
|
|
530
|
-
readonly effort?: import("../
|
|
535
|
+
readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
531
536
|
} | undefined;
|
|
532
537
|
readonly tools?: readonly ({
|
|
533
538
|
readonly type: "function";
|
|
@@ -583,7 +588,7 @@ export declare const configure: (input: Config) => {
|
|
|
583
588
|
} | undefined;
|
|
584
589
|
readonly thinkingBudget?: number | undefined;
|
|
585
590
|
readonly parallelToolCalls?: boolean | undefined;
|
|
586
|
-
readonly reasoningEffort?: import("../
|
|
591
|
+
readonly reasoningEffort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
587
592
|
readonly enableThinking?: boolean | undefined;
|
|
588
593
|
readonly preserveThinking?: boolean | undefined;
|
|
589
594
|
readonly clearThinking?: boolean | undefined;
|
|
@@ -608,7 +613,7 @@ export declare const configure: (input: Config) => {
|
|
|
608
613
|
} | undefined;
|
|
609
614
|
readonly thinkingBudget?: number | undefined;
|
|
610
615
|
readonly parallelToolCalls?: boolean | undefined;
|
|
611
|
-
readonly reasoningEffort?: import("../
|
|
616
|
+
readonly reasoningEffort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
612
617
|
readonly enableThinking?: boolean | undefined;
|
|
613
618
|
readonly preserveThinking?: boolean | undefined;
|
|
614
619
|
readonly clearThinking?: boolean | undefined;
|
|
@@ -629,7 +634,7 @@ export declare const configure: (input: Config) => {
|
|
|
629
634
|
}, import("../route/client.js").CompactionOperations | undefined>;
|
|
630
635
|
messages: (id: string | ModelID) => import("../schema/options.js").LanguageModel<AlibabaMessages.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
631
636
|
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<{
|
|
632
|
-
readonly reasoningEffort?: import("../
|
|
637
|
+
readonly reasoningEffort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
633
638
|
readonly store?: boolean | undefined;
|
|
634
639
|
readonly conversation?: string | undefined;
|
|
635
640
|
readonly enableThinking?: boolean | undefined;
|
|
@@ -647,7 +652,7 @@ export declare const provider: {
|
|
|
647
652
|
} | undefined;
|
|
648
653
|
readonly thinkingBudget?: number | undefined;
|
|
649
654
|
readonly parallelToolCalls?: boolean | undefined;
|
|
650
|
-
readonly reasoningEffort?: import("../
|
|
655
|
+
readonly reasoningEffort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
651
656
|
readonly enableThinking?: boolean | undefined;
|
|
652
657
|
readonly preserveThinking?: boolean | undefined;
|
|
653
658
|
readonly clearThinking?: boolean | undefined;
|
|
@@ -672,7 +677,7 @@ export declare const provider: {
|
|
|
672
677
|
} | undefined;
|
|
673
678
|
readonly thinkingBudget?: number | undefined;
|
|
674
679
|
readonly parallelToolCalls?: boolean | undefined;
|
|
675
|
-
readonly reasoningEffort?: import("../
|
|
680
|
+
readonly reasoningEffort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
676
681
|
readonly enableThinking?: boolean | undefined;
|
|
677
682
|
readonly preserveThinking?: boolean | undefined;
|
|
678
683
|
readonly clearThinking?: boolean | undefined;
|
|
@@ -693,7 +698,7 @@ export declare const provider: {
|
|
|
693
698
|
}, import("../route/client.js").CompactionOperations | undefined>;
|
|
694
699
|
messages: (id: string | ModelID) => import("../schema/options.js").LanguageModel<AlibabaMessages.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
695
700
|
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<{
|
|
696
|
-
readonly reasoningEffort?: import("../
|
|
701
|
+
readonly reasoningEffort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
697
702
|
readonly store?: boolean | undefined;
|
|
698
703
|
readonly conversation?: string | undefined;
|
|
699
704
|
readonly enableThinking?: boolean | undefined;
|
|
@@ -118,7 +118,7 @@ export declare const routes: (Route<{
|
|
|
118
118
|
readonly frequency_penalty?: number | undefined;
|
|
119
119
|
readonly presence_penalty?: number | undefined;
|
|
120
120
|
readonly prompt_cache_key?: string | undefined;
|
|
121
|
-
readonly reasoning_effort?: import("../
|
|
121
|
+
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
122
122
|
readonly store?: boolean | undefined;
|
|
123
123
|
readonly stream_options?: {
|
|
124
124
|
readonly include_usage: boolean;
|
|
@@ -175,12 +175,15 @@ export declare const routes: (Route<{
|
|
|
175
175
|
readonly encrypted_content: string;
|
|
176
176
|
readonly id?: string | null | undefined;
|
|
177
177
|
} | {
|
|
178
|
+
readonly type: "message";
|
|
178
179
|
readonly role: "system";
|
|
179
180
|
readonly content: string;
|
|
180
181
|
} | {
|
|
182
|
+
readonly type: "message";
|
|
181
183
|
readonly role: "developer";
|
|
182
184
|
readonly content: string;
|
|
183
185
|
} | {
|
|
186
|
+
readonly type: "message";
|
|
184
187
|
readonly content: readonly ({
|
|
185
188
|
readonly type: "input_image";
|
|
186
189
|
readonly image_url: string;
|
|
@@ -197,7 +200,6 @@ export declare const routes: (Route<{
|
|
|
197
200
|
})[];
|
|
198
201
|
readonly role: "user";
|
|
199
202
|
readonly id?: string | undefined;
|
|
200
|
-
readonly type?: "message" | undefined;
|
|
201
203
|
readonly status?: string | undefined;
|
|
202
204
|
} | {
|
|
203
205
|
readonly type: "message";
|
|
@@ -245,7 +247,7 @@ export declare const routes: (Route<{
|
|
|
245
247
|
readonly instructions?: string | undefined;
|
|
246
248
|
readonly reasoning?: {
|
|
247
249
|
readonly summary?: "auto" | "concise" | "detailed" | undefined;
|
|
248
|
-
readonly effort?: import("../
|
|
250
|
+
readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
249
251
|
} | undefined;
|
|
250
252
|
readonly tools?: readonly {
|
|
251
253
|
readonly type: "function";
|
|
@@ -198,7 +198,6 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
198
198
|
readonly content: string | null;
|
|
199
199
|
})[];
|
|
200
200
|
} | {
|
|
201
|
-
readonly role: "system";
|
|
202
201
|
readonly content: readonly {
|
|
203
202
|
readonly type: "text";
|
|
204
203
|
readonly text: string;
|
|
@@ -207,6 +206,10 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
207
206
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
208
207
|
} | undefined;
|
|
209
208
|
}[];
|
|
209
|
+
readonly role: "system";
|
|
210
|
+
readonly output_config?: {
|
|
211
|
+
readonly effort: string;
|
|
212
|
+
} | undefined;
|
|
210
213
|
})[];
|
|
211
214
|
readonly stream: true;
|
|
212
215
|
readonly metadata?: {
|
|
@@ -183,7 +183,6 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
183
183
|
readonly content: string | null;
|
|
184
184
|
})[];
|
|
185
185
|
} | {
|
|
186
|
-
readonly role: "system";
|
|
187
186
|
readonly content: readonly {
|
|
188
187
|
readonly type: "text";
|
|
189
188
|
readonly text: string;
|
|
@@ -192,6 +191,10 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
192
191
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
193
192
|
} | undefined;
|
|
194
193
|
}[];
|
|
194
|
+
readonly role: "system";
|
|
195
|
+
readonly output_config?: {
|
|
196
|
+
readonly effort: string;
|
|
197
|
+
} | undefined;
|
|
195
198
|
})[];
|
|
196
199
|
readonly stream: true;
|
|
197
200
|
readonly metadata?: {
|
|
@@ -59,6 +59,11 @@ declare const responsesRoute: Route<{
|
|
|
59
59
|
readonly error?: unknown;
|
|
60
60
|
readonly arguments?: string | undefined;
|
|
61
61
|
readonly server_label?: string | undefined;
|
|
62
|
+
} | {
|
|
63
|
+
readonly type: "configuration_update";
|
|
64
|
+
readonly reasoning: {
|
|
65
|
+
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
66
|
+
};
|
|
62
67
|
} | {
|
|
63
68
|
readonly type: "reasoning";
|
|
64
69
|
readonly summary: readonly {
|
|
@@ -72,12 +77,15 @@ declare const responsesRoute: Route<{
|
|
|
72
77
|
readonly encrypted_content: string;
|
|
73
78
|
readonly id?: string | null | undefined;
|
|
74
79
|
} | {
|
|
80
|
+
readonly type: "message";
|
|
75
81
|
readonly role: "system";
|
|
76
82
|
readonly content: string;
|
|
77
83
|
} | {
|
|
84
|
+
readonly type: "message";
|
|
78
85
|
readonly role: "developer";
|
|
79
86
|
readonly content: string;
|
|
80
87
|
} | {
|
|
88
|
+
readonly type: "message";
|
|
81
89
|
readonly content: readonly ({
|
|
82
90
|
readonly type: "input_image";
|
|
83
91
|
readonly image_url: string;
|
|
@@ -94,7 +102,6 @@ declare const responsesRoute: Route<{
|
|
|
94
102
|
})[];
|
|
95
103
|
readonly role: "user";
|
|
96
104
|
readonly id?: string | undefined;
|
|
97
|
-
readonly type?: "message" | undefined;
|
|
98
105
|
readonly status?: string | undefined;
|
|
99
106
|
} | {
|
|
100
107
|
readonly type: "message";
|
|
@@ -170,7 +177,7 @@ declare const responsesRoute: Route<{
|
|
|
170
177
|
readonly instructions?: string | undefined;
|
|
171
178
|
readonly reasoning?: {
|
|
172
179
|
readonly summary?: "auto" | "concise" | "detailed" | undefined;
|
|
173
|
-
readonly effort?: import("../
|
|
180
|
+
readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
174
181
|
} | undefined;
|
|
175
182
|
readonly tools?: readonly ({
|
|
176
183
|
readonly type: "function";
|
|
@@ -336,7 +343,7 @@ export declare const routes: (Route<{
|
|
|
336
343
|
readonly frequency_penalty?: number | undefined;
|
|
337
344
|
readonly presence_penalty?: number | undefined;
|
|
338
345
|
readonly prompt_cache_key?: string | undefined;
|
|
339
|
-
readonly reasoning_effort?: import("../
|
|
346
|
+
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
340
347
|
readonly store?: boolean | undefined;
|
|
341
348
|
readonly stream_options?: {
|
|
342
349
|
readonly include_usage: boolean;
|
|
@@ -380,6 +387,11 @@ export declare const routes: (Route<{
|
|
|
380
387
|
readonly error?: unknown;
|
|
381
388
|
readonly arguments?: string | undefined;
|
|
382
389
|
readonly server_label?: string | undefined;
|
|
390
|
+
} | {
|
|
391
|
+
readonly type: "configuration_update";
|
|
392
|
+
readonly reasoning: {
|
|
393
|
+
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
394
|
+
};
|
|
383
395
|
} | {
|
|
384
396
|
readonly type: "reasoning";
|
|
385
397
|
readonly summary: readonly {
|
|
@@ -393,12 +405,15 @@ export declare const routes: (Route<{
|
|
|
393
405
|
readonly encrypted_content: string;
|
|
394
406
|
readonly id?: string | null | undefined;
|
|
395
407
|
} | {
|
|
408
|
+
readonly type: "message";
|
|
396
409
|
readonly role: "system";
|
|
397
410
|
readonly content: string;
|
|
398
411
|
} | {
|
|
412
|
+
readonly type: "message";
|
|
399
413
|
readonly role: "developer";
|
|
400
414
|
readonly content: string;
|
|
401
415
|
} | {
|
|
416
|
+
readonly type: "message";
|
|
402
417
|
readonly content: readonly ({
|
|
403
418
|
readonly type: "input_image";
|
|
404
419
|
readonly image_url: string;
|
|
@@ -415,7 +430,6 @@ export declare const routes: (Route<{
|
|
|
415
430
|
})[];
|
|
416
431
|
readonly role: "user";
|
|
417
432
|
readonly id?: string | undefined;
|
|
418
|
-
readonly type?: "message" | undefined;
|
|
419
433
|
readonly status?: string | undefined;
|
|
420
434
|
} | {
|
|
421
435
|
readonly type: "message";
|
|
@@ -491,7 +505,7 @@ export declare const routes: (Route<{
|
|
|
491
505
|
readonly instructions?: string | undefined;
|
|
492
506
|
readonly reasoning?: {
|
|
493
507
|
readonly summary?: "auto" | "concise" | "detailed" | undefined;
|
|
494
|
-
readonly effort?: import("../
|
|
508
|
+
readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
495
509
|
} | undefined;
|
|
496
510
|
readonly tools?: readonly ({
|
|
497
511
|
readonly type: "function";
|
package/dist/providers/azure.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Headers } from "effect/unstable/http";
|
|
2
1
|
import { Auth } from "../route/auth.js";
|
|
3
2
|
import {} from "../route/auth-options.js";
|
|
4
3
|
import { ProviderConfigurationError, ProviderID } from "../schema/index.js";
|
|
@@ -31,12 +30,6 @@ const responsesRoute = OpenAIResponses.route.with({
|
|
|
31
30
|
url.searchParams.delete("api-version");
|
|
32
31
|
return url.toString();
|
|
33
32
|
},
|
|
34
|
-
headers: (headers) => {
|
|
35
|
-
const apiKey = headers["api-key"];
|
|
36
|
-
if (!apiKey)
|
|
37
|
-
return headers;
|
|
38
|
-
return Headers.remove(Headers.set(headers, "authorization", `Bearer ${apiKey}`), "api-key");
|
|
39
|
-
},
|
|
40
33
|
}),
|
|
41
34
|
});
|
|
42
35
|
const chatRoute = OpenAIChat.route.with({
|
|
@@ -81,7 +74,7 @@ export const configure = (input) => {
|
|
|
81
74
|
.model({ id: modelID });
|
|
82
75
|
const chat = (modelID) => configuredRoute(chatRoute, input, modelID)
|
|
83
76
|
.with(withOpenAIOptions(modelID, modelDefaults))
|
|
84
|
-
.model({ id: modelID });
|
|
77
|
+
.model({ id: modelID, compatibility: { supportsPromptCacheKey: true } });
|
|
85
78
|
return {
|
|
86
79
|
id,
|
|
87
80
|
model: responses,
|
|
@@ -104,7 +104,7 @@ export declare const route: Route<{
|
|
|
104
104
|
readonly frequency_penalty?: number | undefined;
|
|
105
105
|
readonly presence_penalty?: number | undefined;
|
|
106
106
|
readonly prompt_cache_key?: string | undefined;
|
|
107
|
-
readonly reasoning_effort?: import("../
|
|
107
|
+
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
108
108
|
readonly store?: boolean | undefined;
|
|
109
109
|
readonly stream_options?: {
|
|
110
110
|
readonly include_usage: boolean;
|
|
@@ -203,7 +203,7 @@ export declare const routes: Route<{
|
|
|
203
203
|
readonly frequency_penalty?: number | undefined;
|
|
204
204
|
readonly presence_penalty?: number | undefined;
|
|
205
205
|
readonly prompt_cache_key?: string | undefined;
|
|
206
|
-
readonly reasoning_effort?: import("../
|
|
206
|
+
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
207
207
|
readonly store?: boolean | undefined;
|
|
208
208
|
readonly stream_options?: {
|
|
209
209
|
readonly include_usage: boolean;
|
|
@@ -104,7 +104,7 @@ export declare const route: Route<{
|
|
|
104
104
|
readonly frequency_penalty?: number | undefined;
|
|
105
105
|
readonly presence_penalty?: number | undefined;
|
|
106
106
|
readonly prompt_cache_key?: string | undefined;
|
|
107
|
-
readonly reasoning_effort?: import("../
|
|
107
|
+
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
108
108
|
readonly store?: boolean | undefined;
|
|
109
109
|
readonly stream_options?: {
|
|
110
110
|
readonly include_usage: boolean;
|
|
@@ -203,7 +203,7 @@ export declare const routes: Route<{
|
|
|
203
203
|
readonly frequency_penalty?: number | undefined;
|
|
204
204
|
readonly presence_penalty?: number | undefined;
|
|
205
205
|
readonly prompt_cache_key?: string | undefined;
|
|
206
|
-
readonly reasoning_effort?: import("../
|
|
206
|
+
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
207
207
|
readonly store?: boolean | undefined;
|
|
208
208
|
readonly stream_options?: {
|
|
209
209
|
readonly include_usage: boolean;
|
|
@@ -25,7 +25,7 @@ export const configure = (input = {}) => {
|
|
|
25
25
|
id,
|
|
26
26
|
model: (modelID) => configured.model({
|
|
27
27
|
id: modelID,
|
|
28
|
-
compatibility: { maxTokensField: "max_tokens", reasoningField: "reasoning", supportsStore: false },
|
|
28
|
+
compatibility: { maxTokensField: "max_tokens", reasoningField: "reasoning", supportsStore: false, supportsPromptCacheKey: true },
|
|
29
29
|
}),
|
|
30
30
|
configure,
|
|
31
31
|
};
|