@opencode/ai 2.1.3 → 2.1.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/experimental/evaluation.js +3 -10
- package/dist/image-client.d.ts +8 -8
- package/dist/image.d.ts +148 -148
- package/dist/promise.d.ts +120 -120
- package/dist/protocols/alibaba-chat.d.ts +12 -12
- package/dist/protocols/alibaba-messages.d.ts +11 -11
- package/dist/protocols/alibaba-responses.d.ts +35 -35
- package/dist/protocols/anthropic-messages.d.ts +40 -44
- package/dist/protocols/anthropic-messages.js +3 -3
- package/dist/protocols/bedrock-converse.d.ts +30 -32
- package/dist/protocols/bedrock-converse.js +2 -3
- package/dist/protocols/cartesia-speech.d.ts +32 -32
- package/dist/protocols/cohere-chat.d.ts +7 -8
- package/dist/protocols/deepgram-speech.d.ts +32 -32
- package/dist/protocols/elevenlabs-speech.d.ts +32 -32
- package/dist/protocols/gemini.d.ts +34 -34
- package/dist/protocols/gemini.js +2 -2
- package/dist/protocols/google-interactions.d.ts +14 -14
- package/dist/protocols/google-interactions.js +2 -2
- package/dist/protocols/google-speech.d.ts +32 -32
- package/dist/protocols/google-transcription.d.ts +32 -32
- package/dist/protocols/meta-messages.d.ts +23 -23
- package/dist/protocols/meta-responses.d.ts +78 -78
- package/dist/protocols/mistral-chat.d.ts +81 -78
- package/dist/protocols/mistral-chat.js +2 -1
- package/dist/protocols/open-responses-channel.js +47 -46
- package/dist/protocols/open-responses-continuation.d.ts +8 -2
- package/dist/protocols/open-responses-continuation.js +3 -1
- package/dist/protocols/open-responses.d.ts +398 -398
- package/dist/protocols/open-responses.js +8 -7
- package/dist/protocols/openai-chat.d.ts +60 -60
- package/dist/protocols/openai-chat.js +3 -3
- package/dist/protocols/openai-compatible-chat.d.ts +13 -14
- package/dist/protocols/openai-compatible-responses.d.ts +36 -37
- package/dist/protocols/openai-images.d.ts +32 -32
- package/dist/protocols/openai-responses.d.ts +235 -235
- package/dist/protocols/openai-responses.js +1 -1
- package/dist/protocols/openai-speech.d.ts +32 -32
- package/dist/protocols/openai-transcription.d.ts +32 -32
- package/dist/protocols/openai-transcription.js +12 -7
- package/dist/protocols/utils/partial-json-options.d.ts +0 -1
- package/dist/protocols/utils/partial-json-options.js +0 -1
- package/dist/protocols/utils/tool-stream.d.ts +1 -1
- package/dist/protocols/venice-chat.d.ts +52 -53
- package/dist/protocols/venice-chat.js +6 -5
- package/dist/protocols/xai-responses.d.ts +78 -78
- package/dist/protocols/zai-chat.d.ts +33 -30
- package/dist/protocols/zai-chat.js +8 -3
- package/dist/protocols/zai-messages.d.ts +21 -19
- package/dist/protocols/zai-messages.js +3 -2
- package/dist/provider-error.js +5 -3
- package/dist/providers/alibaba.d.ts +69 -69
- package/dist/providers/amazon-bedrock-mantle.d.ts +202 -202
- package/dist/providers/amazon-bedrock.d.ts +15 -15
- package/dist/providers/anthropic-compatible.d.ts +13 -13
- package/dist/providers/anthropic.d.ts +13 -13
- package/dist/providers/azure.d.ts +106 -106
- package/dist/providers/baseten.d.ts +24 -24
- package/dist/providers/cerebras.d.ts +24 -24
- package/dist/providers/cloudflare-ai-gateway.d.ts +230 -227
- package/dist/providers/cloudflare-ai-gateway.js +1 -2
- package/dist/providers/cloudflare-workers-ai.d.ts +24 -24
- package/dist/providers/cohere.d.ts +75 -75
- package/dist/providers/deepinfra.d.ts +24 -24
- package/dist/providers/deepseek.d.ts +24 -24
- package/dist/providers/digitalocean.d.ts +36 -36
- package/dist/providers/fireworks.d.ts +24 -24
- package/dist/providers/google-vertex-chat.d.ts +12 -12
- package/dist/providers/google-vertex-messages.d.ts +13 -13
- package/dist/providers/google-vertex-mistral.d.ts +17 -17
- package/dist/providers/google-vertex-responses.d.ts +35 -35
- package/dist/providers/google-vertex.d.ts +17 -17
- package/dist/providers/google-vertex.js +2 -2
- package/dist/providers/google.d.ts +17 -17
- package/dist/providers/groq.d.ts +24 -24
- package/dist/providers/meta.d.ts +179 -179
- package/dist/providers/minimax.d.ts +71 -71
- package/dist/providers/mistral.d.ts +28 -28
- package/dist/providers/moonshot.d.ts +202 -202
- package/dist/providers/open-responses-options.d.ts +0 -1
- package/dist/providers/open-responses-options.js +1 -1
- package/dist/providers/openai-compatible-responses.d.ts +35 -35
- package/dist/providers/openai-compatible.d.ts +12 -12
- package/dist/providers/openai-compatible.js +1 -1
- package/dist/providers/openai-options.d.ts +0 -1
- package/dist/providers/openai-options.js +0 -1
- package/dist/providers/openai.d.ts +100 -100
- package/dist/providers/openrouter.d.ts +36 -36
- package/dist/providers/togetherai.d.ts +24 -24
- package/dist/providers/venice.d.ts +195 -20
- package/dist/providers/xai.d.ts +12 -12
- package/dist/providers/zai-coding-plan.d.ts +149 -69
- package/dist/providers/zai.d.ts +84 -19
- package/dist/route/auth-options.d.ts +0 -3
- package/dist/route/auth.d.ts +0 -2
- package/dist/route/auth.js +0 -2
- package/dist/route/client.d.ts +0 -2
- package/dist/route/client.js +3 -4
- package/dist/route/executor-service.js +1 -1
- package/dist/speech-client.d.ts +8 -8
- package/dist/speech.d.ts +148 -148
- package/dist/transcription-client.d.ts +8 -8
- package/dist/transcription.d.ts +148 -148
- package/dist/video-client.d.ts +8 -8
- package/dist/video.d.ts +114 -114
- package/package.json +6 -5
|
@@ -170,7 +170,7 @@ const fromRequest = Effect.fn("OpenAIResponses.fromRequest")(function* (request)
|
|
|
170
170
|
tools: request.tools.length === 0 ? undefined : yield* lowerTools(request),
|
|
171
171
|
tool_choice: request.tools.length === 0
|
|
172
172
|
? undefined
|
|
173
|
-
: (OpenResponses.allowedToolChoice(request) ??
|
|
173
|
+
: (OpenResponses.allowedToolChoice(request, options) ??
|
|
174
174
|
(request.toolChoice ? yield* lowerToolChoice(request.toolChoice, request.tools) : undefined)),
|
|
175
175
|
};
|
|
176
176
|
});
|
|
@@ -16,14 +16,6 @@ interface State extends SpeechStream.Audio {
|
|
|
16
16
|
readonly usage?: MediaUsage;
|
|
17
17
|
}
|
|
18
18
|
export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
19
|
-
readonly type: "generation-queued";
|
|
20
|
-
readonly id: string;
|
|
21
|
-
readonly position?: number | undefined;
|
|
22
|
-
} | {
|
|
23
|
-
readonly type: "generation-progress";
|
|
24
|
-
readonly id: string;
|
|
25
|
-
readonly progress?: number | undefined;
|
|
26
|
-
} | {
|
|
27
19
|
readonly type: "audio-delta";
|
|
28
20
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
29
21
|
} | {
|
|
@@ -33,18 +25,18 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
33
25
|
readonly startSeconds: number;
|
|
34
26
|
readonly endSeconds: number;
|
|
35
27
|
}[];
|
|
28
|
+
} | {
|
|
29
|
+
readonly type: "generation-queued";
|
|
30
|
+
readonly id: string;
|
|
31
|
+
readonly position?: number | undefined;
|
|
32
|
+
} | {
|
|
33
|
+
readonly type: "generation-progress";
|
|
34
|
+
readonly id: string;
|
|
35
|
+
readonly progress?: number | undefined;
|
|
36
36
|
} | {
|
|
37
37
|
readonly type: "finish";
|
|
38
38
|
readonly audio: import("../media.js").Asset;
|
|
39
39
|
readonly usage?: {
|
|
40
|
-
readonly type: "tokens";
|
|
41
|
-
readonly input?: number | undefined;
|
|
42
|
-
readonly output?: number | undefined;
|
|
43
|
-
readonly total?: number | undefined;
|
|
44
|
-
readonly details?: {
|
|
45
|
-
readonly [x: string]: unknown;
|
|
46
|
-
} | undefined;
|
|
47
|
-
} | {
|
|
48
40
|
readonly type: "seconds";
|
|
49
41
|
readonly seconds: number;
|
|
50
42
|
} | {
|
|
@@ -56,6 +48,14 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
56
48
|
} | {
|
|
57
49
|
readonly type: "compute";
|
|
58
50
|
readonly seconds: number;
|
|
51
|
+
} | {
|
|
52
|
+
readonly type: "tokens";
|
|
53
|
+
readonly input?: number | undefined;
|
|
54
|
+
readonly output?: number | undefined;
|
|
55
|
+
readonly total?: number | undefined;
|
|
56
|
+
readonly details?: {
|
|
57
|
+
readonly [x: string]: unknown;
|
|
58
|
+
} | undefined;
|
|
59
59
|
} | undefined;
|
|
60
60
|
readonly notices?: readonly {
|
|
61
61
|
readonly type: "filtered" | "moderated" | "other";
|
|
@@ -75,14 +75,6 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
75
75
|
export declare const model: (input: MediaRoute.ModelInput) => SpeechModel<OpenAISpeechOptions>;
|
|
76
76
|
export declare const OpenAISpeech: {
|
|
77
77
|
readonly protocol: MediaProtocol.Streamed<Request, {
|
|
78
|
-
readonly type: "generation-queued";
|
|
79
|
-
readonly id: string;
|
|
80
|
-
readonly position?: number | undefined;
|
|
81
|
-
} | {
|
|
82
|
-
readonly type: "generation-progress";
|
|
83
|
-
readonly id: string;
|
|
84
|
-
readonly progress?: number | undefined;
|
|
85
|
-
} | {
|
|
86
78
|
readonly type: "audio-delta";
|
|
87
79
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
88
80
|
} | {
|
|
@@ -92,18 +84,18 @@ export declare const OpenAISpeech: {
|
|
|
92
84
|
readonly startSeconds: number;
|
|
93
85
|
readonly endSeconds: number;
|
|
94
86
|
}[];
|
|
87
|
+
} | {
|
|
88
|
+
readonly type: "generation-queued";
|
|
89
|
+
readonly id: string;
|
|
90
|
+
readonly position?: number | undefined;
|
|
91
|
+
} | {
|
|
92
|
+
readonly type: "generation-progress";
|
|
93
|
+
readonly id: string;
|
|
94
|
+
readonly progress?: number | undefined;
|
|
95
95
|
} | {
|
|
96
96
|
readonly type: "finish";
|
|
97
97
|
readonly audio: import("../media.js").Asset;
|
|
98
98
|
readonly usage?: {
|
|
99
|
-
readonly type: "tokens";
|
|
100
|
-
readonly input?: number | undefined;
|
|
101
|
-
readonly output?: number | undefined;
|
|
102
|
-
readonly total?: number | undefined;
|
|
103
|
-
readonly details?: {
|
|
104
|
-
readonly [x: string]: unknown;
|
|
105
|
-
} | undefined;
|
|
106
|
-
} | {
|
|
107
99
|
readonly type: "seconds";
|
|
108
100
|
readonly seconds: number;
|
|
109
101
|
} | {
|
|
@@ -115,6 +107,14 @@ export declare const OpenAISpeech: {
|
|
|
115
107
|
} | {
|
|
116
108
|
readonly type: "compute";
|
|
117
109
|
readonly seconds: number;
|
|
110
|
+
} | {
|
|
111
|
+
readonly type: "tokens";
|
|
112
|
+
readonly input?: number | undefined;
|
|
113
|
+
readonly output?: number | undefined;
|
|
114
|
+
readonly total?: number | undefined;
|
|
115
|
+
readonly details?: {
|
|
116
|
+
readonly [x: string]: unknown;
|
|
117
|
+
} | undefined;
|
|
118
118
|
} | undefined;
|
|
119
119
|
readonly notices?: readonly {
|
|
120
120
|
readonly type: "filtered" | "moderated" | "other";
|
|
@@ -59,14 +59,6 @@ interface State {
|
|
|
59
59
|
readonly transcript?: Transcript;
|
|
60
60
|
}
|
|
61
61
|
export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
62
|
-
readonly type: "generation-queued";
|
|
63
|
-
readonly id: string;
|
|
64
|
-
readonly position?: number | undefined;
|
|
65
|
-
} | {
|
|
66
|
-
readonly type: "generation-progress";
|
|
67
|
-
readonly id: string;
|
|
68
|
-
readonly progress?: number | undefined;
|
|
69
|
-
} | {
|
|
70
62
|
readonly type: "text-delta";
|
|
71
63
|
readonly delta: string;
|
|
72
64
|
} | {
|
|
@@ -77,6 +69,14 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
77
69
|
readonly endSeconds: number;
|
|
78
70
|
readonly speaker?: string | undefined;
|
|
79
71
|
};
|
|
72
|
+
} | {
|
|
73
|
+
readonly type: "generation-queued";
|
|
74
|
+
readonly id: string;
|
|
75
|
+
readonly position?: number | undefined;
|
|
76
|
+
} | {
|
|
77
|
+
readonly type: "generation-progress";
|
|
78
|
+
readonly id: string;
|
|
79
|
+
readonly progress?: number | undefined;
|
|
80
80
|
} | {
|
|
81
81
|
readonly text: string;
|
|
82
82
|
readonly segments?: readonly {
|
|
@@ -95,14 +95,6 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
95
95
|
readonly language?: string | undefined;
|
|
96
96
|
readonly durationSeconds?: number | undefined;
|
|
97
97
|
readonly usage?: {
|
|
98
|
-
readonly type: "tokens";
|
|
99
|
-
readonly input?: number | undefined;
|
|
100
|
-
readonly output?: number | undefined;
|
|
101
|
-
readonly total?: number | undefined;
|
|
102
|
-
readonly details?: {
|
|
103
|
-
readonly [x: string]: unknown;
|
|
104
|
-
} | undefined;
|
|
105
|
-
} | {
|
|
106
98
|
readonly type: "seconds";
|
|
107
99
|
readonly seconds: number;
|
|
108
100
|
} | {
|
|
@@ -114,6 +106,14 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
114
106
|
} | {
|
|
115
107
|
readonly type: "compute";
|
|
116
108
|
readonly seconds: number;
|
|
109
|
+
} | {
|
|
110
|
+
readonly type: "tokens";
|
|
111
|
+
readonly input?: number | undefined;
|
|
112
|
+
readonly output?: number | undefined;
|
|
113
|
+
readonly total?: number | undefined;
|
|
114
|
+
readonly details?: {
|
|
115
|
+
readonly [x: string]: unknown;
|
|
116
|
+
} | undefined;
|
|
117
117
|
} | undefined;
|
|
118
118
|
readonly notices?: readonly {
|
|
119
119
|
readonly type: "filtered" | "moderated" | "other";
|
|
@@ -134,14 +134,6 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
134
134
|
export declare const model: (input: MediaRoute.ModelInput) => TranscriptionModel<OpenAITranscriptionOptions>;
|
|
135
135
|
export declare const OpenAITranscription: {
|
|
136
136
|
readonly protocol: MediaProtocol.Streamed<Request, {
|
|
137
|
-
readonly type: "generation-queued";
|
|
138
|
-
readonly id: string;
|
|
139
|
-
readonly position?: number | undefined;
|
|
140
|
-
} | {
|
|
141
|
-
readonly type: "generation-progress";
|
|
142
|
-
readonly id: string;
|
|
143
|
-
readonly progress?: number | undefined;
|
|
144
|
-
} | {
|
|
145
137
|
readonly type: "text-delta";
|
|
146
138
|
readonly delta: string;
|
|
147
139
|
} | {
|
|
@@ -152,6 +144,14 @@ export declare const OpenAITranscription: {
|
|
|
152
144
|
readonly endSeconds: number;
|
|
153
145
|
readonly speaker?: string | undefined;
|
|
154
146
|
};
|
|
147
|
+
} | {
|
|
148
|
+
readonly type: "generation-queued";
|
|
149
|
+
readonly id: string;
|
|
150
|
+
readonly position?: number | undefined;
|
|
151
|
+
} | {
|
|
152
|
+
readonly type: "generation-progress";
|
|
153
|
+
readonly id: string;
|
|
154
|
+
readonly progress?: number | undefined;
|
|
155
155
|
} | {
|
|
156
156
|
readonly text: string;
|
|
157
157
|
readonly segments?: readonly {
|
|
@@ -170,14 +170,6 @@ export declare const OpenAITranscription: {
|
|
|
170
170
|
readonly language?: string | undefined;
|
|
171
171
|
readonly durationSeconds?: number | undefined;
|
|
172
172
|
readonly usage?: {
|
|
173
|
-
readonly type: "tokens";
|
|
174
|
-
readonly input?: number | undefined;
|
|
175
|
-
readonly output?: number | undefined;
|
|
176
|
-
readonly total?: number | undefined;
|
|
177
|
-
readonly details?: {
|
|
178
|
-
readonly [x: string]: unknown;
|
|
179
|
-
} | undefined;
|
|
180
|
-
} | {
|
|
181
173
|
readonly type: "seconds";
|
|
182
174
|
readonly seconds: number;
|
|
183
175
|
} | {
|
|
@@ -189,6 +181,14 @@ export declare const OpenAITranscription: {
|
|
|
189
181
|
} | {
|
|
190
182
|
readonly type: "compute";
|
|
191
183
|
readonly seconds: number;
|
|
184
|
+
} | {
|
|
185
|
+
readonly type: "tokens";
|
|
186
|
+
readonly input?: number | undefined;
|
|
187
|
+
readonly output?: number | undefined;
|
|
188
|
+
readonly total?: number | undefined;
|
|
189
|
+
readonly details?: {
|
|
190
|
+
readonly [x: string]: unknown;
|
|
191
|
+
} | undefined;
|
|
192
192
|
} | undefined;
|
|
193
193
|
readonly notices?: readonly {
|
|
194
194
|
readonly type: "filtered" | "moderated" | "other";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Effect, Schema, Stream } from "effect";
|
|
1
|
+
import { Effect, Schema, SchemaGetter, Stream } from "effect";
|
|
2
2
|
import { classifyProviderFailure } from "../provider-error.js";
|
|
3
3
|
import { Framing } from "../route/framing.js";
|
|
4
4
|
import { MediaProtocol } from "../route/media-protocol.js";
|
|
@@ -39,8 +39,14 @@ const transcriptFields = {
|
|
|
39
39
|
words: Schema.optional(Schema.Array(Schema.Struct({ word: Schema.String, start: Schema.Number, end: Schema.Number }))),
|
|
40
40
|
usage: Schema.optional(Usage),
|
|
41
41
|
};
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
const EVENT_TYPES = new Set(["transcript.text.delta", "transcript.text.segment", "transcript.text.done", "error"]);
|
|
43
|
+
/** OpenAI may add stream event types; frames outside `EVENT_TYPES` are ignored, while a malformed known type still fails decoding. */
|
|
44
|
+
const UnknownEvent = Schema.Struct({
|
|
45
|
+
type: Schema.String.check(Schema.makeFilter((type) => !EVENT_TYPES.has(type))),
|
|
46
|
+
}).pipe(Schema.decodeTo(Schema.Struct({ type: Schema.Literal("unknown"), rawType: Schema.String }), {
|
|
47
|
+
decode: SchemaGetter.transform((event) => ({ type: "unknown", rawType: event.type })),
|
|
48
|
+
encode: SchemaGetter.forbidden(() => "Unknown OpenAI Transcription stream events are decode-only"),
|
|
49
|
+
}));
|
|
44
50
|
const Event = Schema.Union([
|
|
45
51
|
Schema.Struct({ type: Schema.Literal("transcript.text.delta"), delta: Schema.String }),
|
|
46
52
|
Schema.Struct({ type: Schema.Literal("transcript.text.segment"), ...Segment.fields }),
|
|
@@ -50,10 +56,9 @@ const Event = Schema.Union([
|
|
|
50
56
|
message: Schema.optional(Schema.String),
|
|
51
57
|
error: Schema.optional(Schema.Struct({ message: Schema.optional(Schema.String) })),
|
|
52
58
|
}),
|
|
59
|
+
UnknownEvent,
|
|
53
60
|
]);
|
|
54
|
-
const EVENT_TYPES = new Set(["transcript.text.delta", "transcript.text.segment", "transcript.text.done", "error"]);
|
|
55
61
|
const Transcript = Schema.Struct(transcriptFields);
|
|
56
|
-
const decodeEventType = route.decodeFrame(EventType);
|
|
57
62
|
const decodeEvent = route.decodeFrame(Event);
|
|
58
63
|
const decodeTranscript = route.decodeFrame(Transcript);
|
|
59
64
|
const TRANSCRIBE = { stream: true, timestamps: [], diarize: false, languageField: "language" };
|
|
@@ -132,9 +137,9 @@ const segment = (value) => ({
|
|
|
132
137
|
speaker: value.speaker,
|
|
133
138
|
});
|
|
134
139
|
const onEvent = Effect.fnUntraced(function* (state, frame) {
|
|
135
|
-
if (!EVENT_TYPES.has((yield* decodeEventType(frame)).type))
|
|
136
|
-
return [state, []];
|
|
137
140
|
const event = yield* decodeEvent(frame);
|
|
141
|
+
if (event.type === "unknown")
|
|
142
|
+
return [state, []];
|
|
138
143
|
if (event.type === "error")
|
|
139
144
|
return yield* new AIError({
|
|
140
145
|
reason: classifyProviderFailure({
|
|
@@ -49,4 +49,3 @@ export const ALL = ATOM | COLLECTION;
|
|
|
49
49
|
* The default is to allow all types to be partially parsed, which in most cases is the best option.
|
|
50
50
|
*/
|
|
51
51
|
export const Allow = { STR, NUM, ARR, OBJ, NULL, BOOL, NAN, INFINITY, _INFINITY, INF, SPECIAL, ATOM, COLLECTION, ALL };
|
|
52
|
-
export default Allow;
|
|
@@ -299,8 +299,8 @@ export declare const finish: <K extends StreamKey>(route: string, tools: State<K
|
|
|
299
299
|
* arguments on `response.output_item.done`; the final value wins.
|
|
300
300
|
*/
|
|
301
301
|
export declare const finishWithInput: <K extends StreamKey>(route: string, tools: State<K>, key: K, input: string) => Effect.Effect<{
|
|
302
|
-
events?: undefined;
|
|
303
302
|
tools: Partial<Record<K, PendingTool>>;
|
|
303
|
+
events?: undefined;
|
|
304
304
|
} | {
|
|
305
305
|
tools: Partial<Record<K, PendingTool>>;
|
|
306
306
|
events: readonly ({
|
|
@@ -1,44 +1,43 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { Protocol } from "../route/protocol.js";
|
|
3
3
|
import { OpenAIChat } from "./openai-chat.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
readonly
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
import { OpenResponsesOptions } from "./utils/open-responses-options.js";
|
|
5
|
+
export type ReasoningEffort = OpenResponsesOptions.ReasoningEffort;
|
|
6
|
+
declare const Options: Schema.Struct<{
|
|
7
|
+
readonly reasoningEffort: Schema.optional<Schema.declare<OpenResponsesOptions.ReasoningEffort, OpenResponsesOptions.ReasoningEffort>>;
|
|
8
|
+
readonly reasoning: Schema.optional<Schema.Struct<{
|
|
9
|
+
readonly effort: Schema.optional<Schema.declare<OpenResponsesOptions.ReasoningEffort, OpenResponsesOptions.ReasoningEffort>>;
|
|
10
|
+
readonly enabled: Schema.optional<Schema.Boolean>;
|
|
11
|
+
readonly summary: Schema.optional<Schema.declare<import("../schema/options.js").OpenString<"auto" | "concise" | "detailed">, import("../schema/options.js").OpenString<"auto" | "concise" | "detailed">>>;
|
|
12
|
+
}>>;
|
|
13
|
+
readonly veniceParameters: Schema.optional<Schema.Struct<{
|
|
14
|
+
readonly enableWebSearch: Schema.optional<Schema.declare<import("../schema/options.js").OpenString<"auto" | "off" | "on">, import("../schema/options.js").OpenString<"auto" | "off" | "on">>>;
|
|
15
|
+
readonly enableWebScraping: Schema.optional<Schema.Boolean>;
|
|
16
|
+
readonly enableWebCitations: Schema.optional<Schema.Boolean>;
|
|
17
|
+
readonly enableXSearch: Schema.optional<Schema.Boolean>;
|
|
18
|
+
readonly stripThinkingResponse: Schema.optional<Schema.Boolean>;
|
|
19
|
+
readonly disableThinking: Schema.optional<Schema.Boolean>;
|
|
20
|
+
readonly includeVeniceSystemPrompt: Schema.optional<Schema.Boolean>;
|
|
21
|
+
readonly characterSlug: Schema.optional<Schema.String>;
|
|
22
|
+
readonly includeSearchResultsInStream: Schema.optional<Schema.Boolean>;
|
|
23
|
+
readonly returnSearchResultsAsDocuments: Schema.optional<Schema.Boolean>;
|
|
24
|
+
}>>;
|
|
25
|
+
readonly promptCacheKey: Schema.optional<Schema.String>;
|
|
26
|
+
readonly promptCacheRetention: Schema.optional<Schema.declare<import("../schema/options.js").OpenString<"24h" | "default" | "extended">, import("../schema/options.js").OpenString<"24h" | "default" | "extended">>>;
|
|
27
|
+
readonly parallelToolCalls: Schema.optional<Schema.Boolean>;
|
|
28
|
+
readonly maxCompletionTokens: Schema.optional<Schema.Number>;
|
|
29
|
+
readonly maxTokens: Schema.optional<Schema.Number>;
|
|
30
|
+
readonly minP: Schema.optional<Schema.Number>;
|
|
31
|
+
readonly repetitionPenalty: Schema.optional<Schema.Number>;
|
|
32
|
+
readonly stopTokenIds: Schema.optional<Schema.$Array<Schema.Number>>;
|
|
33
|
+
readonly logprobs: Schema.optional<Schema.Boolean>;
|
|
34
|
+
readonly topLogprobs: Schema.optional<Schema.Number>;
|
|
35
|
+
readonly maxTemp: Schema.optional<Schema.Number>;
|
|
36
|
+
readonly minTemp: Schema.optional<Schema.Number>;
|
|
37
|
+
readonly responseFormat: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
38
|
+
readonly user: Schema.optional<Schema.String>;
|
|
16
39
|
}>;
|
|
17
|
-
export type OptionsInput =
|
|
18
|
-
readonly reasoningEffort?: ReasoningEffort;
|
|
19
|
-
readonly reasoning?: {
|
|
20
|
-
readonly effort?: ReasoningEffort;
|
|
21
|
-
readonly enabled?: boolean;
|
|
22
|
-
readonly summary?: "auto" | "concise" | "detailed" | (string & {});
|
|
23
|
-
};
|
|
24
|
-
readonly veniceParameters?: Omit<typeof Parameters.Type, "enableWebSearch"> & {
|
|
25
|
-
readonly enableWebSearch?: "off" | "on" | "auto" | (string & {});
|
|
26
|
-
};
|
|
27
|
-
readonly promptCacheKey?: string;
|
|
28
|
-
readonly promptCacheRetention?: "default" | "extended" | "24h" | (string & {});
|
|
29
|
-
readonly parallelToolCalls?: boolean;
|
|
30
|
-
readonly maxCompletionTokens?: number;
|
|
31
|
-
readonly maxTokens?: number;
|
|
32
|
-
readonly minP?: number;
|
|
33
|
-
readonly repetitionPenalty?: number;
|
|
34
|
-
readonly stopTokenIds?: readonly number[];
|
|
35
|
-
readonly logprobs?: boolean;
|
|
36
|
-
readonly topLogprobs?: number;
|
|
37
|
-
readonly maxTemp?: number;
|
|
38
|
-
readonly minTemp?: number;
|
|
39
|
-
readonly responseFormat?: Readonly<Record<string, unknown>>;
|
|
40
|
-
readonly user?: string;
|
|
41
|
-
};
|
|
40
|
+
export type OptionsInput = typeof Options.Type;
|
|
42
41
|
interface State {
|
|
43
42
|
readonly shared: OpenAIChat.ParserState;
|
|
44
43
|
readonly pending: string;
|
|
@@ -80,7 +79,7 @@ export declare const protocol: Protocol<{
|
|
|
80
79
|
} | undefined;
|
|
81
80
|
readonly store?: boolean | undefined;
|
|
82
81
|
readonly prompt_cache_key?: string | undefined;
|
|
83
|
-
readonly reasoning_effort?:
|
|
82
|
+
readonly reasoning_effort?: OpenResponsesOptions.ReasoningEffort | undefined;
|
|
84
83
|
readonly tool_stream?: boolean | undefined;
|
|
85
84
|
readonly max_completion_tokens?: number | undefined;
|
|
86
85
|
readonly max_tokens?: number | undefined;
|
|
@@ -93,13 +92,6 @@ export declare const protocol: Protocol<{
|
|
|
93
92
|
readonly messages: readonly ({
|
|
94
93
|
readonly role: "system";
|
|
95
94
|
readonly content: string | readonly ({
|
|
96
|
-
readonly type: "text";
|
|
97
|
-
readonly text: string;
|
|
98
|
-
readonly cache_control?: {
|
|
99
|
-
readonly type: "ephemeral";
|
|
100
|
-
readonly ttl?: string | undefined;
|
|
101
|
-
} | undefined;
|
|
102
|
-
} | {
|
|
103
95
|
readonly type: "image_url";
|
|
104
96
|
readonly image_url: {
|
|
105
97
|
readonly url: string;
|
|
@@ -110,17 +102,17 @@ export declare const protocol: Protocol<{
|
|
|
110
102
|
readonly filename: string;
|
|
111
103
|
readonly file_data: string;
|
|
112
104
|
};
|
|
113
|
-
}
|
|
114
|
-
} | {
|
|
115
|
-
readonly role: "user";
|
|
116
|
-
readonly content: string | readonly ({
|
|
105
|
+
} | {
|
|
117
106
|
readonly type: "text";
|
|
118
107
|
readonly text: string;
|
|
119
108
|
readonly cache_control?: {
|
|
120
109
|
readonly type: "ephemeral";
|
|
121
110
|
readonly ttl?: string | undefined;
|
|
122
111
|
} | undefined;
|
|
123
|
-
}
|
|
112
|
+
})[];
|
|
113
|
+
} | {
|
|
114
|
+
readonly role: "user";
|
|
115
|
+
readonly content: string | readonly ({
|
|
124
116
|
readonly type: "image_url";
|
|
125
117
|
readonly image_url: {
|
|
126
118
|
readonly url: string;
|
|
@@ -131,6 +123,13 @@ export declare const protocol: Protocol<{
|
|
|
131
123
|
readonly filename: string;
|
|
132
124
|
readonly file_data: string;
|
|
133
125
|
};
|
|
126
|
+
} | {
|
|
127
|
+
readonly type: "text";
|
|
128
|
+
readonly text: string;
|
|
129
|
+
readonly cache_control?: {
|
|
130
|
+
readonly type: "ephemeral";
|
|
131
|
+
readonly ttl?: string | undefined;
|
|
132
|
+
} | undefined;
|
|
134
133
|
})[];
|
|
135
134
|
} | {
|
|
136
135
|
readonly role: "tool";
|
|
@@ -175,14 +174,14 @@ export declare const protocol: Protocol<{
|
|
|
175
174
|
readonly thought_signature?: string | undefined;
|
|
176
175
|
})[];
|
|
177
176
|
readonly reasoning?: {
|
|
178
|
-
readonly effort?:
|
|
177
|
+
readonly effort?: OpenResponsesOptions.ReasoningEffort | undefined;
|
|
179
178
|
readonly enabled?: boolean | undefined;
|
|
180
|
-
readonly summary?:
|
|
179
|
+
readonly summary?: import("../schema/options.js").OpenString<"auto" | "concise" | "detailed"> | undefined;
|
|
181
180
|
} | undefined;
|
|
182
181
|
readonly venice_parameters: {
|
|
183
182
|
readonly [x: string]: string | boolean;
|
|
184
183
|
};
|
|
185
|
-
readonly prompt_cache_retention?:
|
|
184
|
+
readonly prompt_cache_retention?: import("../schema/options.js").OpenString<"24h" | "default" | "extended"> | undefined;
|
|
186
185
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
187
186
|
readonly min_p?: number | undefined;
|
|
188
187
|
readonly top_k?: number | undefined;
|
|
@@ -5,8 +5,9 @@ import { classifyProviderFailure } from "../provider-error.js";
|
|
|
5
5
|
import { OpenAIChat } from "./openai-chat.js";
|
|
6
6
|
import { JsonObject, optionalArray, optionalNull, ProviderShared } from "./shared.js";
|
|
7
7
|
import { cacheControl } from "./utils/cache.js";
|
|
8
|
+
import { OpenResponsesOptions } from "./utils/open-responses-options.js";
|
|
8
9
|
const Parameters = Schema.Struct({
|
|
9
|
-
enableWebSearch: Schema.optional(
|
|
10
|
+
enableWebSearch: Schema.optional(ProviderShared.knownString()),
|
|
10
11
|
enableWebScraping: Schema.optional(Schema.Boolean),
|
|
11
12
|
enableWebCitations: Schema.optional(Schema.Boolean),
|
|
12
13
|
enableXSearch: Schema.optional(Schema.Boolean),
|
|
@@ -18,16 +19,16 @@ const Parameters = Schema.Struct({
|
|
|
18
19
|
returnSearchResultsAsDocuments: Schema.optional(Schema.Boolean),
|
|
19
20
|
});
|
|
20
21
|
const Reasoning = Schema.Struct({
|
|
21
|
-
effort: Schema.optional(
|
|
22
|
+
effort: Schema.optional(OpenResponsesOptions.ReasoningEffort),
|
|
22
23
|
enabled: Schema.optional(Schema.Boolean),
|
|
23
|
-
summary: Schema.optional(
|
|
24
|
+
summary: Schema.optional(ProviderShared.knownString()),
|
|
24
25
|
});
|
|
25
26
|
const Options = Schema.Struct({
|
|
26
|
-
reasoningEffort: Schema.optional(
|
|
27
|
+
reasoningEffort: Schema.optional(OpenResponsesOptions.ReasoningEffort),
|
|
27
28
|
reasoning: Schema.optional(Reasoning),
|
|
28
29
|
veniceParameters: Schema.optional(Parameters),
|
|
29
30
|
promptCacheKey: Schema.optional(Schema.String),
|
|
30
|
-
promptCacheRetention: Schema.optional(
|
|
31
|
+
promptCacheRetention: Schema.optional(ProviderShared.knownString()),
|
|
31
32
|
parallelToolCalls: Schema.optional(Schema.Boolean),
|
|
32
33
|
maxCompletionTokens: Schema.optional(Schema.Number),
|
|
33
34
|
maxTokens: Schema.optional(Schema.Number),
|