@opencode/ai 2.1.3 → 2.2.0
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 +283 -114
- package/dist/ai-client.d.ts +2 -2
- package/dist/ai-client.js +2 -1
- package/dist/cache-policy.d.ts +4 -0
- package/dist/cache-policy.js +20 -6
- package/dist/decision-client.d.ts +21 -0
- package/dist/decision-client.js +55 -0
- package/dist/decision.d.ts +472 -0
- package/dist/decision.js +158 -0
- package/dist/effect.d.ts +38 -0
- package/dist/effect.js +27 -0
- package/dist/effort-updates.d.ts +2 -2
- package/dist/experimental/cloudflare-run-extraction.d.ts +13 -0
- package/dist/experimental/cloudflare-run-extraction.js +83 -0
- package/dist/experimental/extraction.d.ts +183 -0
- package/dist/experimental/extraction.js +102 -0
- package/dist/experimental/realtime.d.ts +7 -2
- package/dist/experimental/realtime.js +5 -5
- package/dist/experimental.d.ts +2 -3
- package/dist/experimental.js +1 -2
- package/dist/image-client.d.ts +13 -22
- package/dist/image-client.js +0 -1
- package/dist/image.d.ts +154 -324
- package/dist/image.js +4 -11
- package/dist/index.d.ts +1426 -34
- package/dist/index.js +127 -24
- package/dist/llm.d.ts +16 -1
- package/dist/llm.js +34 -0
- package/dist/media-client.d.ts +2 -1
- package/dist/media-model.d.ts +3 -0
- package/dist/media-model.js +4 -1
- package/dist/media.d.ts +0 -7
- package/dist/media.js +0 -6
- package/dist/protocols/alibaba-chat.d.ts +32 -12
- package/dist/protocols/alibaba-images.d.ts +22 -0
- package/dist/protocols/alibaba-images.js +77 -0
- package/dist/protocols/alibaba-messages.d.ts +62 -27
- package/dist/protocols/alibaba-responses.d.ts +41 -38
- package/dist/protocols/anthropic-messages.d.ts +196 -94
- package/dist/protocols/anthropic-messages.js +47 -16
- package/dist/protocols/bedrock-converse.d.ts +140 -47
- package/dist/protocols/bedrock-converse.js +114 -18
- package/dist/protocols/bedrock-event-stream.js +1 -0
- package/dist/protocols/bfl-images.d.ts +9 -0
- package/dist/protocols/bfl-images.js +17 -15
- package/dist/protocols/cartesia-speech.d.ts +32 -50
- package/dist/protocols/cloudflare-run-decisions.d.ts +9 -0
- package/dist/protocols/cloudflare-run-decisions.js +36 -0
- package/dist/protocols/cloudflare-workers-ai-images.d.ts +23 -0
- package/dist/protocols/cloudflare-workers-ai-images.js +80 -0
- package/dist/protocols/cohere-chat.d.ts +7 -8
- package/dist/protocols/deepgram-speech.d.ts +32 -50
- package/dist/protocols/elevenlabs-speech.d.ts +32 -50
- package/dist/protocols/fal-images.d.ts +10 -1
- package/dist/protocols/fal-images.js +16 -25
- package/dist/protocols/fal-video.js +1 -1
- package/dist/protocols/gemini.d.ts +37 -34
- package/dist/protocols/gemini.js +13 -8
- package/dist/protocols/google-images.d.ts +2 -2
- package/dist/protocols/google-images.js +8 -37
- package/dist/protocols/google-interactions.d.ts +18 -14
- package/dist/protocols/google-interactions.js +14 -7
- package/dist/protocols/google-speech.d.ts +32 -50
- package/dist/protocols/google-speech.js +0 -1
- package/dist/protocols/google-transcription.d.ts +32 -50
- package/dist/protocols/google-transcription.js +0 -1
- package/dist/protocols/google-video.d.ts +1 -1
- package/dist/protocols/google-video.js +2 -7
- package/dist/protocols/index.d.ts +3 -0
- package/dist/protocols/index.js +3 -0
- package/dist/protocols/meta-images.d.ts +7 -1
- package/dist/protocols/meta-images.js +10 -8
- package/dist/protocols/meta-messages.d.ts +73 -38
- package/dist/protocols/meta-messages.js +14 -1
- package/dist/protocols/meta-responses.d.ts +84 -78
- package/dist/protocols/meta-responses.js +29 -1
- 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 +426 -396
- package/dist/protocols/open-responses.js +16 -25
- package/dist/protocols/openai-chat.d.ts +764 -52
- package/dist/protocols/openai-chat.js +38 -25
- package/dist/protocols/openai-compatible-chat.d.ts +35 -15
- package/dist/protocols/openai-compatible-responses.d.ts +44 -42
- package/dist/protocols/openai-decisions.d.ts +22 -0
- package/dist/protocols/openai-decisions.js +128 -0
- package/dist/protocols/openai-images.d.ts +53 -56
- package/dist/protocols/openai-images.js +100 -34
- package/dist/protocols/openai-responses.d.ts +322 -264
- package/dist/protocols/openai-responses.js +33 -3
- package/dist/protocols/openai-speech.d.ts +32 -50
- package/dist/protocols/openai-speech.js +15 -5
- package/dist/protocols/openai-transcription.d.ts +32 -50
- package/dist/protocols/openai-transcription.js +15 -11
- package/dist/protocols/replicate-images.js +1 -1
- package/dist/protocols/runway-video.d.ts +1 -1
- package/dist/protocols/runway-video.js +1 -1
- package/dist/protocols/shared.d.ts +9 -1
- package/dist/protocols/shared.js +13 -2
- package/dist/protocols/stability-images.d.ts +5 -0
- package/dist/protocols/stability-images.js +4 -9
- package/dist/protocols/system-one.d.ts +101 -0
- package/dist/protocols/system-one.js +230 -0
- package/dist/protocols/utils/bedrock-cache.d.ts +2 -2
- package/dist/protocols/utils/bedrock-cache.js +7 -6
- package/dist/protocols/utils/cache.d.ts +14 -3
- package/dist/protocols/utils/cache.js +11 -4
- package/dist/protocols/utils/gemini-generate-content.d.ts +3 -3
- package/dist/protocols/utils/gemini-generate-content.js +10 -16
- package/dist/protocols/utils/gemini-json-schema.d.ts +5 -0
- package/dist/protocols/utils/gemini-json-schema.js +3 -3
- package/dist/protocols/utils/image-sizing.d.ts +31 -0
- package/dist/protocols/utils/image-sizing.js +73 -0
- package/dist/protocols/utils/media-input.d.ts +4 -5
- package/dist/protocols/utils/media-input.js +8 -5
- 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/speech-stream.d.ts +0 -1
- package/dist/protocols/utils/speech-stream.js +0 -1
- package/dist/protocols/utils/tool-schema.js +15 -5
- package/dist/protocols/utils/tool-stream.d.ts +10 -1
- package/dist/protocols/venice-chat.d.ts +71 -53
- package/dist/protocols/venice-chat.js +7 -6
- package/dist/protocols/xai-images.d.ts +1 -2
- package/dist/protocols/xai-images.js +9 -2
- package/dist/protocols/xai-responses.d.ts +88 -78
- package/dist/protocols/xai-responses.js +28 -2
- package/dist/protocols/xai-video.d.ts +1 -1
- package/dist/protocols/xai-video.js +11 -8
- package/dist/protocols/zai-chat.d.ts +54 -30
- package/dist/protocols/zai-chat.js +8 -3
- package/dist/protocols/zai-images.d.ts +3 -1
- package/dist/protocols/zai-images.js +12 -11
- package/dist/protocols/zai-messages.d.ts +72 -35
- package/dist/protocols/zai-messages.js +3 -2
- package/dist/provider-error.js +24 -7
- package/dist/providers/alibaba/images.d.ts +2 -0
- package/dist/providers/alibaba/images.js +1 -0
- package/dist/providers/alibaba.d.ts +146 -85
- package/dist/providers/alibaba.js +16 -8
- package/dist/providers/amazon-bedrock-mantle.d.ts +277 -218
- package/dist/providers/amazon-bedrock.d.ts +48 -28
- package/dist/providers/amazon-bedrock.js +11 -11
- package/dist/providers/anthropic-compatible.d.ts +64 -29
- package/dist/providers/anthropic.d.ts +64 -29
- package/dist/providers/azure/images.d.ts +2 -0
- package/dist/providers/azure/images.js +1 -0
- package/dist/providers/azure.d.ts +156 -115
- package/dist/providers/azure.js +19 -1
- package/dist/providers/baseten/decisions.d.ts +2 -0
- package/dist/providers/baseten/decisions.js +1 -0
- package/dist/providers/baseten.d.ts +75 -25
- package/dist/providers/baseten.js +41 -8
- package/dist/providers/cerebras.d.ts +66 -24
- package/dist/providers/cloudflare-ai-gateway/decisions.d.ts +2 -0
- package/dist/providers/cloudflare-ai-gateway/decisions.js +1 -0
- package/dist/providers/cloudflare-ai-gateway.d.ts +409 -272
- package/dist/providers/cloudflare-ai-gateway.js +33 -6
- package/dist/providers/cloudflare-workers-ai/decisions.d.ts +2 -0
- package/dist/providers/cloudflare-workers-ai/decisions.js +1 -0
- package/dist/providers/cloudflare-workers-ai/images.d.ts +2 -0
- package/dist/providers/cloudflare-workers-ai/images.js +1 -0
- package/dist/providers/cloudflare-workers-ai.d.ts +79 -25
- package/dist/providers/cloudflare-workers-ai.js +45 -9
- package/dist/providers/cohere.d.ts +117 -75
- package/dist/providers/deepinfra.d.ts +66 -24
- package/dist/providers/deepseek.d.ts +66 -24
- package/dist/providers/digitalocean/decisions.d.ts +2 -0
- package/dist/providers/digitalocean/decisions.js +1 -0
- package/dist/providers/digitalocean/images.d.ts +2 -0
- package/dist/providers/digitalocean/images.js +1 -0
- package/dist/providers/digitalocean.d.ts +108 -37
- package/dist/providers/digitalocean.js +39 -8
- package/dist/providers/fireworks.d.ts +66 -24
- package/dist/providers/google/images.d.ts +2 -0
- package/dist/providers/google/images.js +1 -0
- package/dist/providers/google-vertex/images.d.ts +2 -0
- package/dist/providers/google-vertex/images.js +1 -0
- package/dist/providers/google-vertex-chat.d.ts +33 -12
- package/dist/providers/google-vertex-messages.d.ts +64 -29
- package/dist/providers/google-vertex-mistral.d.ts +17 -17
- package/dist/providers/google-vertex-responses.d.ts +38 -35
- package/dist/providers/google-vertex.d.ts +20 -18
- package/dist/providers/google-vertex.js +32 -15
- package/dist/providers/google.d.ts +22 -21
- package/dist/providers/google.js +15 -8
- package/dist/providers/groq.d.ts +66 -28
- package/dist/providers/groq.js +0 -6
- package/dist/providers/meta.d.ts +144 -85
- package/dist/providers/minimax.d.ts +145 -86
- package/dist/providers/mistral.d.ts +28 -28
- package/dist/providers/moonshot.d.ts +277 -218
- package/dist/providers/open-responses-options.d.ts +0 -1
- package/dist/providers/open-responses-options.js +1 -1
- package/dist/providers/openai/images.d.ts +2 -0
- package/dist/providers/openai/images.js +1 -0
- package/dist/providers/openai-compatible/images.d.ts +2 -0
- package/dist/providers/openai-compatible/images.js +1 -0
- package/dist/providers/openai-compatible-responses.d.ts +38 -35
- package/dist/providers/openai-compatible.d.ts +36 -13
- package/dist/providers/openai-compatible.js +22 -10
- package/dist/providers/openai-options.d.ts +3 -2
- package/dist/providers/openai-options.js +0 -1
- package/dist/providers/openai.d.ts +146 -109
- package/dist/providers/openai.js +20 -4
- package/dist/providers/opencode/decisions.d.ts +2 -0
- package/dist/providers/opencode/decisions.js +1 -0
- package/dist/providers/opencode.d.ts +9 -10
- package/dist/providers/opencode.js +10 -8
- package/dist/providers/openrouter/decisions.d.ts +2 -0
- package/dist/providers/openrouter/decisions.js +1 -0
- package/dist/providers/openrouter/images.d.ts +2 -0
- package/dist/providers/openrouter/images.js +1 -0
- package/dist/providers/openrouter.d.ts +128 -47
- package/dist/providers/openrouter.js +38 -16
- package/dist/providers/togetherai.d.ts +66 -24
- package/dist/providers/typesafe-ai/decisions.d.ts +2 -0
- package/dist/providers/typesafe-ai/decisions.js +1 -0
- package/dist/providers/typesafe-ai.d.ts +9 -10
- package/dist/providers/typesafe-ai.js +10 -8
- package/dist/providers/venice.d.ts +214 -20
- package/dist/providers/vercel-ai-gateway/decisions.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/decisions.js +1 -0
- package/dist/providers/vercel-ai-gateway/images.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/images.js +1 -0
- package/dist/providers/vercel-ai-gateway.d.ts +10 -16
- package/dist/providers/vercel-ai-gateway.js +31 -85
- package/dist/providers/xai/images.d.ts +2 -0
- package/dist/providers/xai/images.js +1 -0
- package/dist/providers/xai.d.ts +40 -17
- package/dist/providers/xai.js +15 -8
- package/dist/providers/zai/images.d.ts +2 -0
- package/dist/providers/zai/images.js +1 -0
- package/dist/providers/zai-coding-plan.d.ts +224 -85
- package/dist/providers/zai.d.ts +110 -23
- package/dist/providers/zai.js +15 -8
- 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 +2 -4
- package/dist/route/client.js +29 -8
- package/dist/route/decision.d.ts +58 -0
- package/dist/route/decision.js +75 -0
- package/dist/route/executor-service.js +1 -1
- package/dist/route/executor.d.ts +1 -1
- package/dist/route/framing.d.ts +2 -0
- package/dist/route/index.d.ts +3 -0
- package/dist/route/index.js +3 -0
- package/dist/route/media-protocol.d.ts +1 -0
- package/dist/route/media-protocol.js +12 -8
- package/dist/route/media.d.ts +5 -1
- package/dist/route/media.js +6 -2
- package/dist/route/transport/http.js +1 -0
- package/dist/route/transport/index.d.ts +1 -0
- package/dist/schema/events.d.ts +148 -6
- package/dist/schema/events.js +20 -0
- package/dist/schema/messages.d.ts +6 -2
- package/dist/schema/messages.js +3 -0
- package/dist/schema/options.d.ts +5 -3
- package/dist/schema/options.js +8 -3
- package/dist/speech-client.d.ts +13 -22
- package/dist/speech-client.js +0 -1
- package/dist/speech.d.ts +148 -283
- package/dist/speech.js +2 -4
- package/dist/testing.d.ts +25 -24
- package/dist/testing.js +3 -21
- package/dist/transcription-client.d.ts +13 -22
- package/dist/transcription.d.ts +148 -283
- package/dist/transcription.js +1 -1
- package/dist/utils/media-type.js +22 -1
- package/dist/video-client.d.ts +13 -22
- package/dist/video-client.js +0 -1
- package/dist/video.d.ts +115 -250
- package/dist/video.js +3 -5
- package/package.json +516 -13
- package/dist/experimental/evaluation-client.d.ts +0 -21
- package/dist/experimental/evaluation-client.js +0 -64
- package/dist/experimental/evaluation.d.ts +0 -242
- package/dist/experimental/evaluation.js +0 -115
- package/dist/experimental/system-one.d.ts +0 -16
- package/dist/experimental/system-one.js +0 -135
- package/dist/promise.d.ts +0 -1021
- package/dist/promise.js +0 -101
- package/dist/provider.d.ts +0 -23
- package/dist/provider.js +0 -2
|
@@ -7,15 +7,14 @@ export declare const inlineBytes: (route: string, asset: Media.Asset) => Effect.
|
|
|
7
7
|
/** Copied because `BlobPart` requires a plain `ArrayBuffer`. */
|
|
8
8
|
export declare const blob: (data: Uint8Array, mediaType: string) => Blob;
|
|
9
9
|
export declare const query: (route: string, values: Record<string, unknown>) => Effect.Effect<MediaProtocol.Query, AIError>;
|
|
10
|
-
export declare const dimensions: (size: string) => {
|
|
11
|
-
width: number;
|
|
12
|
-
height: number;
|
|
13
|
-
};
|
|
14
10
|
/** Provider file handle when the ref belongs to this provider; refs from other providers are never forwarded. */
|
|
15
11
|
export declare const refID: (asset: Media.Asset, provider: ProviderID) => string | undefined;
|
|
16
12
|
/** Decode a provider's base64 output once into an owned `bytes` asset, sniffing the type when it is not declared. */
|
|
17
13
|
export declare const decodedAsset: (invalid: (message: string, cause?: unknown) => AIError, label: string, data: string, mediaType: string | undefined, options?: Media.AssetOptions) => Effect.Effect<Media.Asset, AIError, never>;
|
|
18
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* One image of an OpenAI-shaped `data` array, which carries `b64_json`, a `url`, or both. `b64_json` wins; a `data:`
|
|
16
|
+
* URL decodes inline with its own media type, and any other URL stays a URL asset for the caller to download.
|
|
17
|
+
*/
|
|
19
18
|
export declare const imageOutput: (invalid: (message: string, cause?: unknown) => AIError, label: string, item: {
|
|
20
19
|
readonly b64_json?: string | null;
|
|
21
20
|
readonly url?: string | null;
|
|
@@ -27,18 +27,21 @@ export const query = (route, values) => {
|
|
|
27
27
|
return Effect.fail(ProviderShared.invalidRequest(`${route} cannot send "${invalid[0]}" as a query parameter`));
|
|
28
28
|
return Effect.succeed(Object.fromEntries(entries.map(([key, value]) => [key, Array.isArray(value) ? value.map(String) : String(value)])));
|
|
29
29
|
};
|
|
30
|
-
export const dimensions = (size) => {
|
|
31
|
-
const [width, height] = size.split("x").map(Number);
|
|
32
|
-
return { width, height };
|
|
33
|
-
};
|
|
34
30
|
/** Provider file handle when the ref belongs to this provider; refs from other providers are never forwarded. */
|
|
35
31
|
export const refID = (asset, provider) => asset.source.type === "ref" && asset.source.provider === provider ? asset.source.id : undefined;
|
|
36
32
|
/** Decode a provider's base64 output once into an owned `bytes` asset, sniffing the type when it is not declared. */
|
|
37
33
|
export const decodedAsset = (invalid, label, data, mediaType, options) => Effect.fromResult(Base64.decode(data)).pipe(Effect.mapError((cause) => invalid(`${label} contains invalid base64 data`, cause)), Effect.map((bytes) => Media.bytes(bytes, mediaType, options)));
|
|
38
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* One image of an OpenAI-shaped `data` array, which carries `b64_json`, a `url`, or both. `b64_json` wins; a `data:`
|
|
36
|
+
* URL decodes inline with its own media type, and any other URL stays a URL asset for the caller to download.
|
|
37
|
+
*/
|
|
39
38
|
export const imageOutput = (invalid, label, item, mediaType, options) => {
|
|
40
39
|
if (item.b64_json)
|
|
41
40
|
return decodedAsset(invalid, label, item.b64_json, mediaType, options);
|
|
41
|
+
if (item.url?.startsWith("data:")) {
|
|
42
|
+
const asset = Media.parseDataUrl(item.url, options);
|
|
43
|
+
return asset === undefined ? Effect.fail(invalid(`${label} has an invalid data URL`)) : Effect.succeed(asset);
|
|
44
|
+
}
|
|
42
45
|
if (item.url)
|
|
43
46
|
return Effect.succeed(Media.url(item.url, { ...options, mediaType }));
|
|
44
47
|
return Effect.fail(invalid(`${label} has neither image data nor a URL`));
|
|
@@ -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;
|
|
@@ -42,7 +42,6 @@ export declare const finish: (route: MediaProtocol.Identity, state: Audio, outpu
|
|
|
42
42
|
readonly mediaType: string | undefined;
|
|
43
43
|
readonly info?: Media.Info;
|
|
44
44
|
readonly usage?: MediaUsage;
|
|
45
|
-
readonly notices?: ReadonlyArray<Media.Notice>;
|
|
46
45
|
readonly providerMetadata?: ProviderMetadata;
|
|
47
46
|
readonly detail?: string;
|
|
48
47
|
}) => Effect.Effect<ReadonlyArray<SpeechEvent>, AIError>;
|
|
@@ -51,7 +51,6 @@ export const finish = (route, state, output) => {
|
|
|
51
51
|
SpeechFinishEvent.make({
|
|
52
52
|
audio: Media.bytes(concatBytes(state.chunks), output.mediaType, { info: output.info }),
|
|
53
53
|
usage: output.usage,
|
|
54
|
-
notices: output.notices,
|
|
55
54
|
providerMetadata: output.providerMetadata,
|
|
56
55
|
}),
|
|
57
56
|
]);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ToolDefinition } from "../../schema/index.js";
|
|
2
2
|
import { isRecord } from "../../utils/record.js";
|
|
3
3
|
import { GeminiJsonSchema } from "./gemini-json-schema.js";
|
|
4
|
+
const { SCHEMA_MAPS, VALUES, mapValues } = GeminiJsonSchema;
|
|
4
5
|
const tupleItemsSchema = (items) => {
|
|
5
6
|
const projected = items.map(moonshotNode);
|
|
6
7
|
if (projected.length === 0)
|
|
@@ -31,12 +32,21 @@ const moonshotNode = (schema) => {
|
|
|
31
32
|
return Object.fromEntries([
|
|
32
33
|
...(type === undefined ? [] : [["type", type]]),
|
|
33
34
|
...Object.entries(schema).flatMap(([key, value]) => {
|
|
34
|
-
if (
|
|
35
|
-
return [[key,
|
|
36
|
-
if (key
|
|
37
|
-
|
|
35
|
+
if (VALUES.has(key))
|
|
36
|
+
return [[key, value]];
|
|
37
|
+
if (SCHEMA_MAPS.has(key) && isRecord(value))
|
|
38
|
+
return [[key, mapValues(value, moonshotNode)]];
|
|
39
|
+
if (key === "items") {
|
|
40
|
+
if (Array.isArray(schema.prefixItems))
|
|
38
41
|
return [];
|
|
39
|
-
|
|
42
|
+
if (Array.isArray(value))
|
|
43
|
+
return [[key, tupleItemsSchema(value)]];
|
|
44
|
+
}
|
|
45
|
+
if (key === "prefixItems") {
|
|
46
|
+
if (!Array.isArray(value))
|
|
47
|
+
return "items" in schema ? [] : [["items", {}]];
|
|
48
|
+
const rest = isRecord(schema.items) ? [schema.items] : Array.isArray(schema.items) ? schema.items : [];
|
|
49
|
+
return [["items", tupleItemsSchema([...value, ...rest])]];
|
|
40
50
|
}
|
|
41
51
|
if (key === "unevaluatedItems")
|
|
42
52
|
return [];
|
|
@@ -79,6 +79,9 @@ export declare const finish: <K extends StreamKey>(route: string, tools: State<K
|
|
|
79
79
|
events: readonly ({
|
|
80
80
|
readonly type: "step-start";
|
|
81
81
|
readonly index: number;
|
|
82
|
+
} | {
|
|
83
|
+
readonly type: "raw";
|
|
84
|
+
readonly data: unknown;
|
|
82
85
|
} | {
|
|
83
86
|
readonly type: "text-start";
|
|
84
87
|
readonly id: string;
|
|
@@ -299,13 +302,16 @@ export declare const finish: <K extends StreamKey>(route: string, tools: State<K
|
|
|
299
302
|
* arguments on `response.output_item.done`; the final value wins.
|
|
300
303
|
*/
|
|
301
304
|
export declare const finishWithInput: <K extends StreamKey>(route: string, tools: State<K>, key: K, input: string) => Effect.Effect<{
|
|
302
|
-
events?: undefined;
|
|
303
305
|
tools: Partial<Record<K, PendingTool>>;
|
|
306
|
+
events?: undefined;
|
|
304
307
|
} | {
|
|
305
308
|
tools: Partial<Record<K, PendingTool>>;
|
|
306
309
|
events: readonly ({
|
|
307
310
|
readonly type: "step-start";
|
|
308
311
|
readonly index: number;
|
|
312
|
+
} | {
|
|
313
|
+
readonly type: "raw";
|
|
314
|
+
readonly data: unknown;
|
|
309
315
|
} | {
|
|
310
316
|
readonly type: "text-start";
|
|
311
317
|
readonly id: string;
|
|
@@ -530,6 +536,9 @@ export declare const finishAll: <K extends StreamKey>(route: string, tools: Stat
|
|
|
530
536
|
events: ({
|
|
531
537
|
readonly type: "step-start";
|
|
532
538
|
readonly index: number;
|
|
539
|
+
} | {
|
|
540
|
+
readonly type: "raw";
|
|
541
|
+
readonly data: unknown;
|
|
533
542
|
} | {
|
|
534
543
|
readonly type: "text-start";
|
|
535
544
|
readonly id: string;
|
|
@@ -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,16 @@ export declare const protocol: Protocol<{
|
|
|
80
79
|
} | undefined;
|
|
81
80
|
readonly store?: boolean | undefined;
|
|
82
81
|
readonly prompt_cache_key?: string | undefined;
|
|
83
|
-
readonly
|
|
82
|
+
readonly prompt_cache_options?: {
|
|
83
|
+
readonly ttl?: string | undefined;
|
|
84
|
+
} | undefined;
|
|
85
|
+
readonly reasoning_effort?: OpenResponsesOptions.ReasoningEffort | undefined;
|
|
86
|
+
readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
|
|
87
|
+
readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
|
|
88
|
+
readonly metadata?: {
|
|
89
|
+
readonly [x: string]: string;
|
|
90
|
+
} | undefined;
|
|
91
|
+
readonly safety_identifier?: string | undefined;
|
|
84
92
|
readonly tool_stream?: boolean | undefined;
|
|
85
93
|
readonly max_completion_tokens?: number | undefined;
|
|
86
94
|
readonly max_tokens?: number | undefined;
|
|
@@ -93,44 +101,54 @@ export declare const protocol: Protocol<{
|
|
|
93
101
|
readonly messages: readonly ({
|
|
94
102
|
readonly role: "system";
|
|
95
103
|
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
104
|
readonly type: "image_url";
|
|
104
105
|
readonly image_url: {
|
|
105
106
|
readonly url: string;
|
|
106
107
|
};
|
|
108
|
+
} | {
|
|
109
|
+
readonly type: "video_url";
|
|
110
|
+
readonly video_url: {
|
|
111
|
+
readonly url: string;
|
|
112
|
+
};
|
|
107
113
|
} | {
|
|
108
114
|
readonly type: "file";
|
|
109
115
|
readonly file: {
|
|
110
116
|
readonly filename: string;
|
|
111
117
|
readonly file_data: string;
|
|
112
118
|
};
|
|
113
|
-
}
|
|
114
|
-
} | {
|
|
115
|
-
readonly role: "user";
|
|
116
|
-
readonly content: string | readonly ({
|
|
119
|
+
} | {
|
|
117
120
|
readonly type: "text";
|
|
118
121
|
readonly text: string;
|
|
119
122
|
readonly cache_control?: {
|
|
120
123
|
readonly type: "ephemeral";
|
|
121
124
|
readonly ttl?: string | undefined;
|
|
122
125
|
} | undefined;
|
|
123
|
-
}
|
|
126
|
+
})[];
|
|
127
|
+
} | {
|
|
128
|
+
readonly role: "user";
|
|
129
|
+
readonly content: string | readonly ({
|
|
124
130
|
readonly type: "image_url";
|
|
125
131
|
readonly image_url: {
|
|
126
132
|
readonly url: string;
|
|
127
133
|
};
|
|
134
|
+
} | {
|
|
135
|
+
readonly type: "video_url";
|
|
136
|
+
readonly video_url: {
|
|
137
|
+
readonly url: string;
|
|
138
|
+
};
|
|
128
139
|
} | {
|
|
129
140
|
readonly type: "file";
|
|
130
141
|
readonly file: {
|
|
131
142
|
readonly filename: string;
|
|
132
143
|
readonly file_data: string;
|
|
133
144
|
};
|
|
145
|
+
} | {
|
|
146
|
+
readonly type: "text";
|
|
147
|
+
readonly text: string;
|
|
148
|
+
readonly cache_control?: {
|
|
149
|
+
readonly type: "ephemeral";
|
|
150
|
+
readonly ttl?: string | undefined;
|
|
151
|
+
} | undefined;
|
|
134
152
|
})[];
|
|
135
153
|
} | {
|
|
136
154
|
readonly role: "tool";
|
|
@@ -175,14 +193,14 @@ export declare const protocol: Protocol<{
|
|
|
175
193
|
readonly thought_signature?: string | undefined;
|
|
176
194
|
})[];
|
|
177
195
|
readonly reasoning?: {
|
|
178
|
-
readonly effort?:
|
|
196
|
+
readonly effort?: OpenResponsesOptions.ReasoningEffort | undefined;
|
|
179
197
|
readonly enabled?: boolean | undefined;
|
|
180
|
-
readonly summary?:
|
|
198
|
+
readonly summary?: import("../schema/options.js").OpenString<"auto" | "concise" | "detailed"> | undefined;
|
|
181
199
|
} | undefined;
|
|
182
200
|
readonly venice_parameters: {
|
|
183
201
|
readonly [x: string]: string | boolean;
|
|
184
202
|
};
|
|
185
|
-
readonly prompt_cache_retention?:
|
|
203
|
+
readonly prompt_cache_retention?: import("../schema/options.js").OpenString<"24h" | "default" | "extended"> | undefined;
|
|
186
204
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
187
205
|
readonly min_p?: number | undefined;
|
|
188
206
|
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),
|
|
@@ -149,7 +150,7 @@ const fromRequest = Effect.fn("VeniceChat.fromRequest")(function* (request) {
|
|
|
149
150
|
})
|
|
150
151
|
.filter(([, value]) => value !== undefined)
|
|
151
152
|
.map(([key, value]) => [key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`), value])),
|
|
152
|
-
prompt_cache_retention: options.promptCacheRetention,
|
|
153
|
+
prompt_cache_retention: options.promptCacheRetention ?? body.prompt_cache_retention,
|
|
153
154
|
parallel_tool_calls: options.parallelToolCalls,
|
|
154
155
|
min_p: options.minP,
|
|
155
156
|
top_k: request.generation?.topK,
|
|
@@ -5,9 +5,8 @@ import { type OpenString } from "../schema/index.js";
|
|
|
5
5
|
export declare const DEFAULT_BASE_URL = "https://api.x.ai/v1";
|
|
6
6
|
export declare const PATH = "/images/generations";
|
|
7
7
|
export declare const EDIT_PATH = "/images/edits";
|
|
8
|
-
/** Provider-native options. Common fields (`n`, `
|
|
8
|
+
/** Provider-native options. Common fields (`n`, `aspect`, `resolution`, `images`) live on the request. */
|
|
9
9
|
export type XAIImageOptions = {
|
|
10
|
-
readonly resolution?: OpenString<"1k" | "2k">;
|
|
11
10
|
readonly responseFormat?: OpenString<"url" | "b64_json">;
|
|
12
11
|
readonly response_format?: OpenString<"url" | "b64_json">;
|
|
13
12
|
} & Record<string, unknown>;
|
|
@@ -5,6 +5,7 @@ import { MediaProtocol } from "../route/media-protocol.js";
|
|
|
5
5
|
import { MediaRoute } from "../route/media.js";
|
|
6
6
|
import { mergeJsonRecords } from "../schema/index.js";
|
|
7
7
|
import { JsonObject, ProviderShared, lenient, optionalNull } from "./shared.js";
|
|
8
|
+
import { ImageSizing } from "./utils/image-sizing.js";
|
|
8
9
|
import { MediaInput } from "./utils/media-input.js";
|
|
9
10
|
const route = MediaProtocol.identity({ id: "xai-images", name: "xAI Images", provider: "xai" });
|
|
10
11
|
export const DEFAULT_BASE_URL = "https://api.x.ai/v1";
|
|
@@ -31,6 +32,12 @@ const nativeOptions = (options) => {
|
|
|
31
32
|
const { responseFormat, ...native } = options;
|
|
32
33
|
return { response_format: responseFormat, ...native };
|
|
33
34
|
};
|
|
35
|
+
/** xAI renders `1k` or `2k`; other tiers use the nearest one. */
|
|
36
|
+
const resolution = (request) => {
|
|
37
|
+
if (request.resolution === undefined)
|
|
38
|
+
return undefined;
|
|
39
|
+
return (ImageSizing.tier(request.resolution) ?? 1) < 1.5 ? "1k" : "2k";
|
|
40
|
+
};
|
|
34
41
|
const isEdit = (request) => (request.images?.length ?? 0) > 0;
|
|
35
42
|
const reference = (asset) => ProviderShared.mediaReference(asset, route.provider, route.name).pipe(Effect.map((item) => item.type === "ref" ? { file_id: item.value } : { url: item.value, type: "image_url" }));
|
|
36
43
|
const fromRequest = Effect.fn("XAIImages.fromRequest")(function* (request) {
|
|
@@ -42,7 +49,8 @@ const fromRequest = Effect.fn("XAIImages.fromRequest")(function* (request) {
|
|
|
42
49
|
image: references.length === 1 ? references[0] : undefined,
|
|
43
50
|
images: references.length > 1 ? references : undefined,
|
|
44
51
|
n: request.n,
|
|
45
|
-
aspect_ratio: request.
|
|
52
|
+
aspect_ratio: request.aspect,
|
|
53
|
+
resolution: resolution(request),
|
|
46
54
|
}, nativeOptions(request.providerOptions), request.http?.body) ?? {});
|
|
47
55
|
});
|
|
48
56
|
// ---------------------------------------------------------------------------
|
|
@@ -70,7 +78,6 @@ const decodeResponse = Effect.fn("XAIImages.decodeResponse")(function* (response
|
|
|
70
78
|
// 7. Protocol and route
|
|
71
79
|
// ---------------------------------------------------------------------------
|
|
72
80
|
export const protocol = MediaProtocol.inline(route, {
|
|
73
|
-
unsupported: ["mask", "size", "seed", "format"],
|
|
74
81
|
body: { from: fromRequest },
|
|
75
82
|
response: { decode: decodeResponse },
|
|
76
83
|
});
|
|
@@ -1,57 +1,17 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
1
2
|
import { Protocol } from "../route/protocol.js";
|
|
2
3
|
import { OpenResponses } from "./open-responses.js";
|
|
4
|
+
declare const Options: Schema.Struct<{
|
|
5
|
+
readonly minP: Schema.optional<Schema.Number>;
|
|
6
|
+
}>;
|
|
7
|
+
export type OptionsInput = typeof Options.Type;
|
|
3
8
|
export declare const protocol: Protocol<{
|
|
4
9
|
readonly model: string;
|
|
5
10
|
readonly input: readonly ({
|
|
6
|
-
readonly [x: string]: unknown;
|
|
7
|
-
readonly type: "web_search_call";
|
|
8
|
-
readonly id: string;
|
|
9
|
-
readonly status?: string | undefined;
|
|
10
|
-
readonly action?: {
|
|
11
|
-
readonly [x: string]: unknown;
|
|
12
|
-
} | null | undefined;
|
|
13
|
-
} | {
|
|
14
|
-
readonly [x: string]: unknown;
|
|
15
|
-
readonly type: "file_search_call";
|
|
16
|
-
readonly id: string;
|
|
17
|
-
readonly status?: string | undefined;
|
|
18
|
-
readonly queries?: readonly string[] | undefined;
|
|
19
|
-
readonly results?: readonly {
|
|
20
|
-
readonly [x: string]: unknown;
|
|
21
|
-
}[] | null | undefined;
|
|
22
|
-
} | {
|
|
23
|
-
readonly [x: string]: unknown;
|
|
24
|
-
readonly type: "code_interpreter_call";
|
|
25
|
-
readonly id: string;
|
|
26
|
-
readonly status?: string | undefined;
|
|
27
|
-
readonly code?: string | null | undefined;
|
|
28
|
-
readonly container_id?: string | null | undefined;
|
|
29
|
-
readonly outputs?: readonly {
|
|
30
|
-
readonly [x: string]: unknown;
|
|
31
|
-
}[] | null | undefined;
|
|
32
|
-
} | {
|
|
33
|
-
readonly [x: string]: unknown;
|
|
34
|
-
readonly type: "mcp_call";
|
|
35
|
-
readonly id: string;
|
|
36
|
-
readonly status?: string | undefined;
|
|
37
|
-
readonly server_label?: string | undefined;
|
|
38
|
-
readonly name?: string | undefined;
|
|
39
|
-
readonly arguments?: string | undefined;
|
|
40
|
-
readonly output?: string | null | undefined;
|
|
41
|
-
readonly error?: unknown;
|
|
42
|
-
} | {
|
|
43
11
|
readonly type: "configuration_update";
|
|
44
12
|
readonly reasoning: {
|
|
45
13
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
46
14
|
};
|
|
47
|
-
} | {
|
|
48
|
-
readonly [x: string]: unknown;
|
|
49
|
-
readonly type: string;
|
|
50
|
-
readonly id: string;
|
|
51
|
-
} | {
|
|
52
|
-
readonly type: "compaction";
|
|
53
|
-
readonly id?: string | null | undefined;
|
|
54
|
-
readonly encrypted_content: string;
|
|
55
15
|
} | {
|
|
56
16
|
readonly type: "message";
|
|
57
17
|
readonly role: "system";
|
|
@@ -60,10 +20,48 @@ export declare const protocol: Protocol<{
|
|
|
60
20
|
readonly type: "message";
|
|
61
21
|
readonly role: "developer";
|
|
62
22
|
readonly content: string;
|
|
23
|
+
} | {
|
|
24
|
+
readonly type: "function_call_output";
|
|
25
|
+
readonly call_id: string;
|
|
26
|
+
readonly output: string | readonly ({
|
|
27
|
+
readonly type: "input_text";
|
|
28
|
+
readonly text: string;
|
|
29
|
+
} | {
|
|
30
|
+
readonly type: "input_video";
|
|
31
|
+
readonly video_url: string;
|
|
32
|
+
} | {
|
|
33
|
+
readonly type: "input_image";
|
|
34
|
+
readonly image_url: string;
|
|
35
|
+
readonly detail?: string | undefined;
|
|
36
|
+
} | {
|
|
37
|
+
readonly type: "input_file";
|
|
38
|
+
readonly filename: string;
|
|
39
|
+
readonly detail?: string | undefined;
|
|
40
|
+
readonly file_data?: string | undefined;
|
|
41
|
+
readonly file_url?: string | undefined;
|
|
42
|
+
})[];
|
|
43
|
+
} | {
|
|
44
|
+
readonly type: "reasoning";
|
|
45
|
+
readonly id?: string | undefined;
|
|
46
|
+
readonly summary: readonly {
|
|
47
|
+
readonly type: "summary_text";
|
|
48
|
+
readonly text: string;
|
|
49
|
+
}[];
|
|
50
|
+
readonly encrypted_content?: string | null | undefined;
|
|
51
|
+
} | {
|
|
52
|
+
readonly type: "compaction";
|
|
53
|
+
readonly id?: string | null | undefined;
|
|
54
|
+
readonly encrypted_content: string;
|
|
63
55
|
} | {
|
|
64
56
|
readonly type: "message";
|
|
65
57
|
readonly role: "user";
|
|
66
58
|
readonly content: readonly ({
|
|
59
|
+
readonly type: "input_text";
|
|
60
|
+
readonly text: string;
|
|
61
|
+
} | {
|
|
62
|
+
readonly type: "input_video";
|
|
63
|
+
readonly video_url: string;
|
|
64
|
+
} | {
|
|
67
65
|
readonly type: "input_image";
|
|
68
66
|
readonly image_url: string;
|
|
69
67
|
readonly detail?: string | undefined;
|
|
@@ -73,9 +71,6 @@ export declare const protocol: Protocol<{
|
|
|
73
71
|
readonly detail?: string | undefined;
|
|
74
72
|
readonly file_data?: string | undefined;
|
|
75
73
|
readonly file_url?: string | undefined;
|
|
76
|
-
} | {
|
|
77
|
-
readonly type: "input_text";
|
|
78
|
-
readonly text: string;
|
|
79
74
|
})[];
|
|
80
75
|
readonly id?: string | undefined;
|
|
81
76
|
readonly status?: string | undefined;
|
|
@@ -89,14 +84,6 @@ export declare const protocol: Protocol<{
|
|
|
89
84
|
}[];
|
|
90
85
|
readonly phase?: "commentary" | "final_answer" | null | undefined;
|
|
91
86
|
readonly status?: string | undefined;
|
|
92
|
-
} | {
|
|
93
|
-
readonly type: "reasoning";
|
|
94
|
-
readonly id?: string | undefined;
|
|
95
|
-
readonly summary: readonly {
|
|
96
|
-
readonly type: "summary_text";
|
|
97
|
-
readonly text: string;
|
|
98
|
-
}[];
|
|
99
|
-
readonly encrypted_content?: string | null | undefined;
|
|
100
87
|
} | {
|
|
101
88
|
readonly type: "function_call";
|
|
102
89
|
readonly id?: string | undefined;
|
|
@@ -105,31 +92,49 @@ export declare const protocol: Protocol<{
|
|
|
105
92
|
readonly namespace?: string | undefined;
|
|
106
93
|
readonly arguments: string;
|
|
107
94
|
} | {
|
|
108
|
-
readonly
|
|
109
|
-
readonly
|
|
110
|
-
readonly
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
readonly
|
|
114
|
-
} |
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
readonly
|
|
123
|
-
} |
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
95
|
+
readonly [x: string]: unknown;
|
|
96
|
+
readonly type: "web_search_call";
|
|
97
|
+
readonly id: string;
|
|
98
|
+
readonly status?: string | undefined;
|
|
99
|
+
readonly action?: {
|
|
100
|
+
readonly [x: string]: unknown;
|
|
101
|
+
} | null | undefined;
|
|
102
|
+
} | {
|
|
103
|
+
readonly [x: string]: unknown;
|
|
104
|
+
readonly type: "file_search_call";
|
|
105
|
+
readonly id: string;
|
|
106
|
+
readonly status?: string | undefined;
|
|
107
|
+
readonly queries?: readonly string[] | undefined;
|
|
108
|
+
readonly results?: readonly {
|
|
109
|
+
readonly [x: string]: unknown;
|
|
110
|
+
}[] | null | undefined;
|
|
111
|
+
} | {
|
|
112
|
+
readonly [x: string]: unknown;
|
|
113
|
+
readonly type: "code_interpreter_call";
|
|
114
|
+
readonly id: string;
|
|
115
|
+
readonly status?: string | undefined;
|
|
116
|
+
readonly code?: string | null | undefined;
|
|
117
|
+
readonly container_id?: string | null | undefined;
|
|
118
|
+
readonly outputs?: readonly {
|
|
119
|
+
readonly [x: string]: unknown;
|
|
120
|
+
}[] | null | undefined;
|
|
121
|
+
} | {
|
|
122
|
+
readonly [x: string]: unknown;
|
|
123
|
+
readonly type: "mcp_call";
|
|
124
|
+
readonly id: string;
|
|
125
|
+
readonly status?: string | undefined;
|
|
126
|
+
readonly server_label?: string | undefined;
|
|
127
|
+
readonly name?: string | undefined;
|
|
128
|
+
readonly arguments?: string | undefined;
|
|
129
|
+
readonly output?: string | null | undefined;
|
|
130
|
+
readonly error?: unknown;
|
|
131
|
+
} | {
|
|
132
|
+
readonly [x: string]: unknown;
|
|
133
|
+
readonly type: string;
|
|
134
|
+
readonly id: string;
|
|
127
135
|
})[];
|
|
128
136
|
readonly instructions?: string | undefined;
|
|
129
137
|
readonly tools?: readonly ({
|
|
130
|
-
readonly [x: string]: unknown;
|
|
131
|
-
readonly type: string;
|
|
132
|
-
} | {
|
|
133
138
|
readonly type: "function";
|
|
134
139
|
readonly name: string;
|
|
135
140
|
readonly description: string;
|
|
@@ -137,6 +142,9 @@ export declare const protocol: Protocol<{
|
|
|
137
142
|
readonly [x: string]: unknown;
|
|
138
143
|
};
|
|
139
144
|
readonly strict?: boolean | undefined;
|
|
145
|
+
} | {
|
|
146
|
+
readonly [x: string]: unknown;
|
|
147
|
+
readonly type: string;
|
|
140
148
|
})[] | undefined;
|
|
141
149
|
readonly tool_choice?: "auto" | "none" | "required" | {
|
|
142
150
|
readonly type: "function";
|
|
@@ -177,6 +185,8 @@ export declare const protocol: Protocol<{
|
|
|
177
185
|
readonly presence_penalty?: number | undefined;
|
|
178
186
|
readonly frequency_penalty?: number | undefined;
|
|
179
187
|
readonly stream: true;
|
|
188
|
+
readonly top_k?: number | undefined;
|
|
189
|
+
readonly min_p?: number | undefined;
|
|
180
190
|
}, string, {
|
|
181
191
|
readonly [x: string]: unknown;
|
|
182
192
|
readonly type: string;
|