@opencode/ai 2.2.6 → 2.3.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 +208 -98
- package/dist/ai-client.d.ts +2 -2
- package/dist/ai-client.js +2 -1
- package/dist/decision.d.ts +10 -0
- package/dist/decision.js +2 -0
- package/dist/effect.d.ts +14 -7
- package/dist/effect.js +6 -1
- package/dist/embedding-client.d.ts +21 -0
- package/dist/embedding-client.js +30 -0
- package/dist/embedding.d.ts +111 -0
- package/dist/embedding.js +75 -0
- package/dist/experimental.d.ts +0 -4
- package/dist/experimental.js +0 -3
- package/dist/image-client.d.ts +1 -1
- package/dist/image-client.js +2 -6
- package/dist/image.d.ts +0 -1
- package/dist/image.js +0 -3
- package/dist/index.d.ts +18 -50
- package/dist/index.js +35 -13
- package/dist/media-model.d.ts +2 -0
- package/dist/media-model.js +3 -1
- package/dist/media.d.ts +9 -3
- package/dist/media.js +27 -7
- package/dist/protocols/alibaba-chat.d.ts +4 -0
- package/dist/protocols/anthropic-messages.js +3 -3
- package/dist/protocols/google-decisions.d.ts +13 -0
- package/dist/protocols/google-decisions.js +133 -0
- package/dist/protocols/google-embed-content.d.ts +34 -0
- package/dist/protocols/google-embed-content.js +110 -0
- package/dist/protocols/google-interactions-video.d.ts +43 -0
- package/dist/protocols/google-interactions-video.js +186 -0
- package/dist/protocols/google-interactions.d.ts +14 -1
- package/dist/protocols/google-interactions.js +1 -1
- package/dist/protocols/google-vertex-predict-embeddings.d.ts +18 -0
- package/dist/protocols/google-vertex-predict-embeddings.js +74 -0
- package/dist/protocols/index.d.ts +4 -0
- package/dist/protocols/index.js +4 -0
- package/dist/protocols/minimax-video.d.ts +54 -0
- package/dist/protocols/minimax-video.js +292 -0
- package/dist/protocols/open-responses.d.ts +1 -1
- package/dist/protocols/open-responses.js +31 -8
- package/dist/protocols/openai-chat.d.ts +24 -0
- package/dist/protocols/openai-chat.js +37 -11
- package/dist/protocols/openai-compatible-chat.d.ts +1 -0
- package/dist/protocols/openai-decisions.js +14 -1
- package/dist/protocols/openai-embeddings.d.ts +16 -0
- package/dist/protocols/openai-embeddings.js +76 -0
- package/dist/protocols/openrouter-video.d.ts +41 -0
- package/dist/protocols/openrouter-video.js +138 -0
- package/dist/protocols/seedance-video.d.ts +50 -0
- package/dist/protocols/seedance-video.js +216 -0
- package/dist/protocols/shared.d.ts +13 -3
- package/dist/protocols/shared.js +27 -4
- package/dist/protocols/system-one.d.ts +45 -1
- package/dist/protocols/system-one.js +50 -8
- package/dist/protocols/utils/responses-compaction.js +1 -1
- package/dist/protocols/venice-chat.d.ts +4 -0
- package/dist/protocols/xai-video.d.ts +8 -2
- package/dist/protocols/xai-video.js +20 -15
- package/dist/protocols/zai-chat.d.ts +4 -0
- package/dist/provider-error.js +7 -1
- package/dist/providers/alibaba/embeddings.d.ts +2 -0
- package/dist/providers/alibaba/embeddings.js +1 -0
- package/dist/providers/alibaba.d.ts +3 -0
- package/dist/providers/alibaba.js +14 -1
- package/dist/providers/amazon-bedrock-mantle.d.ts +1 -0
- package/dist/providers/azure/embeddings.d.ts +2 -0
- package/dist/providers/azure/embeddings.js +1 -0
- package/dist/providers/azure.d.ts +3 -0
- package/dist/providers/azure.js +15 -0
- package/dist/providers/baseten.d.ts +2 -0
- package/dist/providers/byteplus/videos.d.ts +2 -0
- package/dist/providers/byteplus/videos.js +1 -0
- package/dist/providers/byteplus.d.ts +26 -0
- package/dist/providers/byteplus.js +21 -0
- package/dist/providers/cerebras.d.ts +2 -0
- package/dist/providers/cloudflare-ai-gateway.d.ts +2 -0
- package/dist/providers/cloudflare-workers-ai.d.ts +2 -0
- package/dist/providers/cohere/embeddings.d.ts +2 -0
- package/dist/providers/cohere/embeddings.js +1 -0
- package/dist/providers/cohere.d.ts +8 -0
- package/dist/providers/cohere.js +17 -1
- package/dist/providers/deepinfra/embeddings.d.ts +2 -0
- package/dist/providers/deepinfra/embeddings.js +1 -0
- package/dist/providers/deepinfra.d.ts +6 -1
- package/dist/providers/deepinfra.js +15 -1
- package/dist/providers/deepseek.d.ts +2 -0
- package/dist/providers/digitalocean/embeddings.d.ts +2 -0
- package/dist/providers/digitalocean/embeddings.js +1 -0
- package/dist/providers/digitalocean.d.ts +10 -0
- package/dist/providers/digitalocean.js +15 -0
- package/dist/providers/fireworks/embeddings.d.ts +2 -0
- package/dist/providers/fireworks/embeddings.js +1 -0
- package/dist/providers/fireworks.d.ts +6 -1
- package/dist/providers/fireworks.js +15 -1
- package/dist/providers/google/decisions.d.ts +2 -0
- package/dist/providers/google/decisions.js +1 -0
- package/dist/providers/google/embeddings.d.ts +2 -0
- package/dist/providers/google/embeddings.js +1 -0
- package/dist/providers/google/videos.d.ts +2 -0
- package/dist/providers/google/videos.js +1 -0
- package/dist/providers/google-vertex/embeddings.d.ts +2 -0
- package/dist/providers/google-vertex/embeddings.js +1 -0
- package/dist/providers/google-vertex-chat.d.ts +1 -0
- package/dist/providers/google-vertex.d.ts +7 -0
- package/dist/providers/google-vertex.js +52 -0
- package/dist/providers/google.d.ts +17 -4
- package/dist/providers/google.js +27 -3
- package/dist/providers/groq.d.ts +5 -0
- package/dist/providers/index.d.ts +2 -1
- package/dist/providers/index.js +2 -1
- package/dist/providers/meta.d.ts +1 -0
- package/dist/providers/minimax/videos.d.ts +3 -0
- package/dist/providers/minimax/videos.js +1 -0
- package/dist/providers/minimax.d.ts +7 -1
- package/dist/providers/minimax.js +10 -1
- package/dist/providers/moonshot.d.ts +1 -0
- package/dist/providers/openai/embeddings.d.ts +2 -0
- package/dist/providers/openai/embeddings.js +1 -0
- package/dist/providers/openai-compatible/decisions.d.ts +2 -0
- package/dist/providers/openai-compatible/decisions.js +1 -0
- package/dist/providers/openai-compatible/embeddings.d.ts +2 -0
- package/dist/providers/openai-compatible/embeddings.js +1 -0
- package/dist/providers/openai-compatible.d.ts +6 -0
- package/dist/providers/openai-compatible.js +27 -0
- package/dist/providers/openai.d.ts +7 -0
- package/dist/providers/openai.js +14 -0
- package/dist/providers/openrouter/embeddings.d.ts +2 -0
- package/dist/providers/openrouter/embeddings.js +1 -0
- package/dist/providers/openrouter/videos.d.ts +2 -0
- package/dist/providers/openrouter/videos.js +1 -0
- package/dist/providers/openrouter.d.ts +21 -0
- package/dist/providers/openrouter.js +23 -0
- package/dist/providers/togetherai.d.ts +2 -0
- package/dist/providers/venice.d.ts +1 -0
- package/dist/providers/vercel-ai-gateway/embeddings.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/embeddings.js +1 -0
- package/dist/providers/vercel-ai-gateway.d.ts +4 -0
- package/dist/providers/vercel-ai-gateway.js +15 -1
- package/dist/providers/volcengine/videos.d.ts +2 -0
- package/dist/providers/volcengine/videos.js +1 -0
- package/dist/providers/volcengine.d.ts +26 -0
- package/dist/providers/volcengine.js +21 -0
- package/dist/providers/xai.d.ts +1 -0
- package/dist/providers/zai-coding-plan.d.ts +1 -0
- package/dist/providers/zai.d.ts +1 -0
- package/dist/public.d.ts +4 -0
- package/dist/public.js +2 -0
- package/dist/route/embedding.d.ts +61 -0
- package/dist/route/embedding.js +88 -0
- package/dist/route/executor-service.d.ts +6 -0
- package/dist/route/executor-service.js +7 -0
- package/dist/route/executor.d.ts +7 -1
- package/dist/route/executor.js +7 -2
- package/dist/route/media-protocol.d.ts +12 -11
- package/dist/route/media.d.ts +2 -0
- package/dist/route/media.js +31 -22
- package/dist/route/transport/http.js +1 -1
- package/dist/schema/messages.d.ts +1 -1
- package/dist/schema/messages.js +1 -5
- package/dist/schema/options.d.ts +8 -0
- package/dist/schema/options.js +1 -0
- package/dist/speech-client.d.ts +1 -1
- package/dist/speech-client.js +4 -4
- package/dist/transcription-client.d.ts +1 -1
- package/dist/transcription-client.js +1 -2
- package/dist/video-client.d.ts +16 -84
- package/dist/video-client.js +28 -13
- package/dist/video.d.ts +56 -1072
- package/dist/video.js +28 -65
- package/package.json +355 -255
- package/dist/protocols/google-video.d.ts +0 -26
- package/dist/protocols/google-video.js +0 -146
- package/dist/protocols/runway-video.d.ts +0 -38
- package/dist/protocols/runway-video.js +0 -141
- package/dist/providers/runway.d.ts +0 -20
- package/dist/providers/runway.js +0 -17
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { mergeProviderOptions, ProviderID, } from "../schema/index.js";
|
|
2
2
|
import { OpenAICompatibleChat } from "../protocols/openai-compatible-chat.js";
|
|
3
|
+
import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js";
|
|
3
4
|
import { OpenAIImages } from "../protocols/openai-images.js";
|
|
5
|
+
import { SystemOne } from "../protocols/system-one.js";
|
|
4
6
|
import { MediaRoute } from "../route/media.js";
|
|
5
7
|
import { AuthOptions } from "../route/auth-options.js";
|
|
6
8
|
import { toConfig } from "./settings.js";
|
|
@@ -17,6 +19,20 @@ export const configure = (input) => {
|
|
|
17
19
|
auth,
|
|
18
20
|
});
|
|
19
21
|
const media = MediaRoute.deployment(input, auth);
|
|
22
|
+
const embeddingRoute = OpenAIEmbeddings.route.with({
|
|
23
|
+
provider,
|
|
24
|
+
endpoint: { baseURL },
|
|
25
|
+
auth,
|
|
26
|
+
headers: input.headers,
|
|
27
|
+
http: input.http,
|
|
28
|
+
});
|
|
29
|
+
const decisionRoute = SystemOne.route.with({
|
|
30
|
+
provider,
|
|
31
|
+
endpoint: { baseURL },
|
|
32
|
+
auth,
|
|
33
|
+
headers: input.headers,
|
|
34
|
+
http: input.http,
|
|
35
|
+
});
|
|
20
36
|
return {
|
|
21
37
|
id: ProviderID.make(provider),
|
|
22
38
|
model: (modelID) => route.model({ id: modelID }),
|
|
@@ -28,6 +44,9 @@ export const configure = (input) => {
|
|
|
28
44
|
provider,
|
|
29
45
|
providerOptions: mergeProviderOptions(/gpt-image|chatgpt-image/.test(modelID) ? undefined : { response_format: "b64_json" }, providerOptions),
|
|
30
46
|
}),
|
|
47
|
+
embedding: (modelID, providerOptions) => embeddingRoute.model({ id: modelID, providerOptions }),
|
|
48
|
+
// Compatible hosts follow llama.cpp's System One API, which takes inline media in root `images` (alias of `files`).
|
|
49
|
+
decision: (modelID, providerOptions) => decisionRoute.model({ id: modelID, compatibility: { mediaInput: "root" }, providerOptions }),
|
|
31
50
|
configure,
|
|
32
51
|
};
|
|
33
52
|
};
|
|
@@ -40,6 +59,14 @@ export const imageModel = (modelID, settings) => {
|
|
|
40
59
|
const input = config(settings);
|
|
41
60
|
return configure(input).image(modelID, input.providerOptions);
|
|
42
61
|
};
|
|
62
|
+
export const embeddingModel = (modelID, settings) => {
|
|
63
|
+
const input = config(settings);
|
|
64
|
+
return configure(input).embedding(modelID, input.providerOptions);
|
|
65
|
+
};
|
|
66
|
+
export const decisionModel = (modelID, settings) => {
|
|
67
|
+
const input = config(settings);
|
|
68
|
+
return configure(input).decision(modelID, input.providerOptions);
|
|
69
|
+
};
|
|
43
70
|
function config({ provider, ...settings }) {
|
|
44
71
|
return { ...toConfig(settings), provider };
|
|
45
72
|
}
|
|
@@ -5,11 +5,13 @@ import { ToolDefinition, type ModelID, type OpenString, type ProviderOptions, ty
|
|
|
5
5
|
import * as OpenAIResponses from "../protocols/openai-responses.js";
|
|
6
6
|
import { type OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
7
7
|
import { type OptionsInput as OpenAIDecisionOptionsInput } from "../protocols/openai-decisions.js";
|
|
8
|
+
import { type OptionsInput as OpenAIEmbeddingOptionsInput } from "../protocols/openai-embeddings.js";
|
|
8
9
|
export type { OpenAIOptionsInput, OpenAIResponseIncludable, OpenAIServiceTier } from "./openai-options.js";
|
|
9
10
|
export type { OpenAIImageOptions } from "../protocols/openai-images.js";
|
|
10
11
|
export type { OpenAISpeechOptions } from "../protocols/openai-speech.js";
|
|
11
12
|
export type { OpenAITranscriptionOptions } from "../protocols/openai-transcription.js";
|
|
12
13
|
export type { OptionsInput as OpenAIDecisionOptions } from "../protocols/openai-decisions.js";
|
|
14
|
+
export type { OptionsInput as OpenAIEmbeddingOptions } from "../protocols/openai-embeddings.js";
|
|
13
15
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
14
16
|
export declare const routes: (Route<{
|
|
15
17
|
readonly model: string;
|
|
@@ -111,6 +113,7 @@ export declare const routes: (Route<{
|
|
|
111
113
|
readonly reasoning?: string | undefined;
|
|
112
114
|
readonly reasoning_text?: string | undefined;
|
|
113
115
|
readonly reasoning_details?: unknown;
|
|
116
|
+
readonly reasoning_opaque?: string | undefined;
|
|
114
117
|
})[];
|
|
115
118
|
readonly tools?: readonly ({
|
|
116
119
|
readonly type: "function";
|
|
@@ -455,6 +458,7 @@ export declare const configure: (input?: Config) => {
|
|
|
455
458
|
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/openai-speech.js").OpenAISpeechOptions>;
|
|
456
459
|
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/openai-transcription.js").OpenAITranscriptionOptions>;
|
|
457
460
|
decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<OpenAIDecisionOptionsInput>;
|
|
461
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<OpenAIEmbeddingOptionsInput>;
|
|
458
462
|
configure: typeof configure;
|
|
459
463
|
};
|
|
460
464
|
export declare const provider: {
|
|
@@ -472,12 +476,14 @@ export declare const provider: {
|
|
|
472
476
|
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/openai-speech.js").OpenAISpeechOptions>;
|
|
473
477
|
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/openai-transcription.js").OpenAITranscriptionOptions>;
|
|
474
478
|
decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<OpenAIDecisionOptionsInput>;
|
|
479
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<OpenAIEmbeddingOptionsInput>;
|
|
475
480
|
configure: typeof configure;
|
|
476
481
|
};
|
|
477
482
|
export declare const model: ProviderPackage.Model<Settings, OpenAIProviderOptionsInput, typeof OpenAIResponses.route.compact>;
|
|
478
483
|
export declare const chatModel: ProviderPackage.Model<Settings, OpenAIProviderOptionsInput>;
|
|
479
484
|
export declare const imageModel: (modelID: string, settings?: Settings) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
480
485
|
export declare const decisionModel: (modelID: string, settings?: Settings) => import("../decision.js").DecisionModel<OpenAIDecisionOptionsInput>;
|
|
486
|
+
export declare const embeddingModel: (modelID: string, settings?: Settings) => import("../embedding.js").EmbeddingModel<OpenAIEmbeddingOptionsInput>;
|
|
481
487
|
export declare const responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, {
|
|
482
488
|
endpoint: import("../route/client.js").CompactOperation;
|
|
483
489
|
trigger: import("../route/client.js").TriggerCompactOperation;
|
|
@@ -487,3 +493,4 @@ export declare const image: (modelID: string | ModelID, providerOptions?: Provid
|
|
|
487
493
|
export declare const speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/openai-speech.js").OpenAISpeechOptions>;
|
|
488
494
|
export declare const transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/openai-transcription.js").OpenAITranscriptionOptions>;
|
|
489
495
|
export declare const decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<OpenAIDecisionOptionsInput>;
|
|
496
|
+
export declare const embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<OpenAIEmbeddingOptionsInput>;
|
package/dist/providers/openai.js
CHANGED
|
@@ -8,6 +8,7 @@ import { OpenAIImages } from "../protocols/openai-images.js";
|
|
|
8
8
|
import { OpenAISpeech } from "../protocols/openai-speech.js";
|
|
9
9
|
import { OpenAITranscription } from "../protocols/openai-transcription.js";
|
|
10
10
|
import { OpenAIDecisions } from "../protocols/openai-decisions.js";
|
|
11
|
+
import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js";
|
|
11
12
|
export const id = ProviderID.make("openai");
|
|
12
13
|
export const routes = [OpenAIResponses.route, OpenAIChat.route];
|
|
13
14
|
export const imageGeneration = (options = {}) => ToolDefinition.make({
|
|
@@ -63,6 +64,13 @@ export const configure = (input = {}) => {
|
|
|
63
64
|
http: media.http,
|
|
64
65
|
});
|
|
65
66
|
const decision = (modelID, providerOptions) => decisionRoute.model({ id: modelID, providerOptions });
|
|
67
|
+
const embeddingRoute = OpenAIEmbeddings.route.with({
|
|
68
|
+
endpoint: { baseURL: media.baseURL },
|
|
69
|
+
auth: media.auth,
|
|
70
|
+
headers: media.headers,
|
|
71
|
+
http: media.http,
|
|
72
|
+
});
|
|
73
|
+
const embedding = (modelID, providerOptions) => embeddingRoute.model({ id: modelID, providerOptions });
|
|
66
74
|
return {
|
|
67
75
|
id,
|
|
68
76
|
model: responses,
|
|
@@ -72,6 +80,7 @@ export const configure = (input = {}) => {
|
|
|
72
80
|
speech,
|
|
73
81
|
transcription,
|
|
74
82
|
decision,
|
|
83
|
+
embedding,
|
|
75
84
|
configure,
|
|
76
85
|
};
|
|
77
86
|
};
|
|
@@ -103,9 +112,14 @@ export const decisionModel = (modelID, settings) => {
|
|
|
103
112
|
const input = config(settings);
|
|
104
113
|
return configure(input).decision(modelID, input.providerOptions);
|
|
105
114
|
};
|
|
115
|
+
export const embeddingModel = (modelID, settings) => {
|
|
116
|
+
const input = config(settings);
|
|
117
|
+
return configure(input).embedding(modelID, input.providerOptions);
|
|
118
|
+
};
|
|
106
119
|
export const responses = provider.responses;
|
|
107
120
|
export const chat = provider.chat;
|
|
108
121
|
export const image = provider.image;
|
|
109
122
|
export const speech = provider.speech;
|
|
110
123
|
export const transcription = provider.transcription;
|
|
111
124
|
export const decision = provider.decision;
|
|
125
|
+
export const embedding = provider.embedding;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { embeddingModel as model } from "../openrouter.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { videoModel as model } from "../openrouter.js";
|
|
@@ -7,6 +7,7 @@ import type { ProviderPackage } from "../provider-package.js";
|
|
|
7
7
|
import { HttpTransport } from "../route/transport/index.js";
|
|
8
8
|
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
9
9
|
import type { OpenResponsesProviderOptionsInput } from "./open-responses-options.js";
|
|
10
|
+
export type { OpenRouterVideoOptions } from "../protocols/openrouter-video.js";
|
|
10
11
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
11
12
|
export interface OpenRouterProviderRouting {
|
|
12
13
|
readonly [key: string]: unknown;
|
|
@@ -82,6 +83,11 @@ export interface OpenRouterDecisionOptions {
|
|
|
82
83
|
readonly trace?: Readonly<Record<string, unknown>>;
|
|
83
84
|
readonly user?: string;
|
|
84
85
|
}
|
|
86
|
+
export interface OpenRouterEmbeddingOptions {
|
|
87
|
+
readonly [key: string]: unknown;
|
|
88
|
+
readonly provider?: OpenRouterProviderRouting;
|
|
89
|
+
readonly user?: string;
|
|
90
|
+
}
|
|
85
91
|
export type Config = Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
86
92
|
readonly baseURL?: string;
|
|
87
93
|
readonly providerOptions?: OpenRouterProviderOptionsInput | OpenRouterResponsesProviderOptionsInput;
|
|
@@ -178,6 +184,7 @@ declare const OpenRouterBody: Schema.StructWithRest<Schema.Struct<{
|
|
|
178
184
|
readonly reasoning: Schema.optional<Schema.String>;
|
|
179
185
|
readonly reasoning_text: Schema.optional<Schema.String>;
|
|
180
186
|
readonly reasoning_details: Schema.optional<Schema.Unknown>;
|
|
187
|
+
readonly reasoning_opaque: Schema.optional<Schema.String>;
|
|
181
188
|
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.Struct<{
|
|
182
189
|
readonly role: Schema.Literal<"tool">;
|
|
183
190
|
readonly tool_call_id: Schema.String;
|
|
@@ -368,6 +375,7 @@ export declare const protocol: Protocol<{
|
|
|
368
375
|
readonly reasoning?: string | undefined;
|
|
369
376
|
readonly reasoning_text?: string | undefined;
|
|
370
377
|
readonly reasoning_details?: unknown;
|
|
378
|
+
readonly reasoning_opaque?: string | undefined;
|
|
371
379
|
})[];
|
|
372
380
|
tools?: readonly ({
|
|
373
381
|
readonly type: "function";
|
|
@@ -471,6 +479,7 @@ export declare const protocol: Protocol<{
|
|
|
471
479
|
readonly reasoning?: string | null | undefined;
|
|
472
480
|
readonly reasoning_text?: string | null | undefined;
|
|
473
481
|
readonly reasoning_details?: unknown;
|
|
482
|
+
readonly reasoning_opaque?: string | null | undefined;
|
|
474
483
|
readonly tool_calls?: readonly {
|
|
475
484
|
readonly index?: number | null | undefined;
|
|
476
485
|
readonly id?: string | null | undefined;
|
|
@@ -496,6 +505,7 @@ export declare const protocol: Protocol<{
|
|
|
496
505
|
readonly prompt_cache_hit_tokens?: number | null | undefined;
|
|
497
506
|
readonly cache_read_input_tokens?: number | null | undefined;
|
|
498
507
|
readonly cache_created_input_tokens?: number | null | undefined;
|
|
508
|
+
readonly reasoning_tokens?: number | null | undefined;
|
|
499
509
|
readonly prompt_tokens_details?: {
|
|
500
510
|
readonly [x: string]: unknown;
|
|
501
511
|
readonly cached_tokens?: number | null | undefined;
|
|
@@ -518,6 +528,7 @@ export declare const protocol: Protocol<{
|
|
|
518
528
|
readonly prompt_cache_hit_tokens?: number | null | undefined;
|
|
519
529
|
readonly cache_read_input_tokens?: number | null | undefined;
|
|
520
530
|
readonly cache_created_input_tokens?: number | null | undefined;
|
|
531
|
+
readonly reasoning_tokens?: number | null | undefined;
|
|
521
532
|
readonly prompt_tokens_details?: {
|
|
522
533
|
readonly [x: string]: unknown;
|
|
523
534
|
readonly cached_tokens?: number | null | undefined;
|
|
@@ -636,6 +647,7 @@ export declare const route: Route<{
|
|
|
636
647
|
readonly reasoning?: string | undefined;
|
|
637
648
|
readonly reasoning_text?: string | undefined;
|
|
638
649
|
readonly reasoning_details?: unknown;
|
|
650
|
+
readonly reasoning_opaque?: string | undefined;
|
|
639
651
|
})[];
|
|
640
652
|
tools?: readonly ({
|
|
641
653
|
readonly type: "function";
|
|
@@ -1036,6 +1048,7 @@ export declare const routes: (Route<{
|
|
|
1036
1048
|
readonly reasoning?: string | undefined;
|
|
1037
1049
|
readonly reasoning_text?: string | undefined;
|
|
1038
1050
|
readonly reasoning_details?: unknown;
|
|
1051
|
+
readonly reasoning_opaque?: string | undefined;
|
|
1039
1052
|
})[];
|
|
1040
1053
|
tools?: readonly ({
|
|
1041
1054
|
readonly type: "function";
|
|
@@ -1134,7 +1147,9 @@ export declare const configure: (input?: Config) => {
|
|
|
1134
1147
|
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenRouterOptions, import("../route/client.js").CompactionOperations | undefined>;
|
|
1135
1148
|
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenRouterResponsesProviderOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
1136
1149
|
image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
1150
|
+
video: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../video.js").VideoModel<import("./openrouter.js").OpenRouterVideoOptions>;
|
|
1137
1151
|
decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<OpenRouterDecisionOptions>;
|
|
1152
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<OpenRouterEmbeddingOptions>;
|
|
1138
1153
|
configure: typeof configure;
|
|
1139
1154
|
};
|
|
1140
1155
|
export declare const provider: {
|
|
@@ -1143,15 +1158,21 @@ export declare const provider: {
|
|
|
1143
1158
|
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenRouterOptions, import("../route/client.js").CompactionOperations | undefined>;
|
|
1144
1159
|
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenRouterResponsesProviderOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
1145
1160
|
image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
1161
|
+
video: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../video.js").VideoModel<import("./openrouter.js").OpenRouterVideoOptions>;
|
|
1146
1162
|
decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<OpenRouterDecisionOptions>;
|
|
1163
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<OpenRouterEmbeddingOptions>;
|
|
1147
1164
|
configure: typeof configure;
|
|
1148
1165
|
};
|
|
1149
1166
|
export declare const decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<OpenRouterDecisionOptions>;
|
|
1167
|
+
export declare const embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<OpenRouterEmbeddingOptions>;
|
|
1150
1168
|
export declare const image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
1169
|
+
export declare const video: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../video.js").VideoModel<import("./openrouter.js").OpenRouterVideoOptions>;
|
|
1151
1170
|
export declare const chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenRouterOptions, import("../route/client.js").CompactionOperations | undefined>;
|
|
1152
1171
|
export declare const responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenRouterResponsesProviderOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
1153
1172
|
export declare const model: ProviderPackage.Model<Settings, OpenRouterProviderOptionsInput>;
|
|
1154
1173
|
export declare const responsesModel: ProviderPackage.Model<Settings<OpenRouterResponsesProviderOptionsInput>, OpenRouterResponsesProviderOptionsInput>;
|
|
1155
1174
|
export declare const imageModel: (modelID: string, settings?: Settings) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
1175
|
+
export declare const videoModel: (modelID: string, settings?: Settings) => import("../video.js").VideoModel<import("./openrouter.js").OpenRouterVideoOptions>;
|
|
1156
1176
|
export declare const decisionModel: (modelID: string, settings?: Settings) => import("../decision.js").DecisionModel<OpenRouterDecisionOptions>;
|
|
1177
|
+
export declare const embeddingModel: (modelID: string, settings?: Settings) => import("../embedding.js").EmbeddingModel<OpenRouterEmbeddingOptions>;
|
|
1157
1178
|
export * as OpenRouter from "./openrouter.js";
|
|
@@ -4,7 +4,9 @@ import { Endpoint } from "../route/endpoint.js";
|
|
|
4
4
|
import { Protocol } from "../route/protocol.js";
|
|
5
5
|
import { ProviderID, } from "../schema/index.js";
|
|
6
6
|
import { SystemOne } from "../protocols/system-one.js";
|
|
7
|
+
import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js";
|
|
7
8
|
import { OpenAIImages } from "../protocols/openai-images.js";
|
|
9
|
+
import { OpenRouterVideo } from "../protocols/openrouter-video.js";
|
|
8
10
|
import { MediaRoute } from "../route/media.js";
|
|
9
11
|
import { HttpTransport } from "../route/transport/index.js";
|
|
10
12
|
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
@@ -154,11 +156,20 @@ export const configure = (input = {}) => {
|
|
|
154
156
|
sizing: imageSizing,
|
|
155
157
|
imageInput: "references",
|
|
156
158
|
});
|
|
159
|
+
const video = (modelID, providerOptions) => OpenRouterVideo.model({ ...media, id: modelID, providerOptions });
|
|
157
160
|
const decision = (modelID, providerOptions) => decisionRoute.model({
|
|
158
161
|
id: modelID,
|
|
159
162
|
compatibility: { mediaInput: "state" },
|
|
160
163
|
providerOptions,
|
|
161
164
|
});
|
|
165
|
+
const embeddingRoute = OpenAIEmbeddings.route.with({
|
|
166
|
+
provider: id,
|
|
167
|
+
endpoint: options.endpoint,
|
|
168
|
+
auth: options.auth,
|
|
169
|
+
headers: input.headers,
|
|
170
|
+
http: input.http,
|
|
171
|
+
});
|
|
172
|
+
const embedding = (modelID, providerOptions) => embeddingRoute.model({ id: modelID, providerOptions });
|
|
162
173
|
const chat = (modelID) => chatRoute.model({ id: modelID, capabilities: { promptCacheKey: true } });
|
|
163
174
|
return {
|
|
164
175
|
id,
|
|
@@ -166,13 +177,17 @@ export const configure = (input = {}) => {
|
|
|
166
177
|
chat,
|
|
167
178
|
responses: (modelID) => configuredResponses.model({ id: modelID }),
|
|
168
179
|
image,
|
|
180
|
+
video,
|
|
169
181
|
decision,
|
|
182
|
+
embedding,
|
|
170
183
|
configure,
|
|
171
184
|
};
|
|
172
185
|
};
|
|
173
186
|
export const provider = configure();
|
|
174
187
|
export const decision = provider.decision;
|
|
188
|
+
export const embedding = provider.embedding;
|
|
175
189
|
export const image = provider.image;
|
|
190
|
+
export const video = provider.video;
|
|
176
191
|
export const chat = provider.chat;
|
|
177
192
|
export const responses = provider.responses;
|
|
178
193
|
export const model = (modelID, settings) => configure(toConfig(settings)).model(modelID);
|
|
@@ -181,8 +196,16 @@ export const imageModel = (modelID, settings) => {
|
|
|
181
196
|
const input = toConfig(settings);
|
|
182
197
|
return configure(input).image(modelID, input.providerOptions);
|
|
183
198
|
};
|
|
199
|
+
export const videoModel = (modelID, settings) => {
|
|
200
|
+
const input = toConfig(settings);
|
|
201
|
+
return configure(input).video(modelID, input.providerOptions);
|
|
202
|
+
};
|
|
184
203
|
export const decisionModel = (modelID, settings) => {
|
|
185
204
|
const input = toConfig(settings);
|
|
186
205
|
return configure(input).decision(modelID, input.providerOptions);
|
|
187
206
|
};
|
|
207
|
+
export const embeddingModel = (modelID, settings) => {
|
|
208
|
+
const input = toConfig(settings);
|
|
209
|
+
return configure(input).embedding(modelID, input.providerOptions);
|
|
210
|
+
};
|
|
188
211
|
export * as OpenRouter from "./openrouter.js";
|
|
@@ -112,6 +112,7 @@ export declare const route: Route<{
|
|
|
112
112
|
readonly reasoning?: string | undefined;
|
|
113
113
|
readonly reasoning_text?: string | undefined;
|
|
114
114
|
readonly reasoning_details?: unknown;
|
|
115
|
+
readonly reasoning_opaque?: string | undefined;
|
|
115
116
|
})[];
|
|
116
117
|
readonly tools?: readonly ({
|
|
117
118
|
readonly type: "function";
|
|
@@ -286,6 +287,7 @@ export declare const routes: Route<{
|
|
|
286
287
|
readonly reasoning?: string | undefined;
|
|
287
288
|
readonly reasoning_text?: string | undefined;
|
|
288
289
|
readonly reasoning_details?: unknown;
|
|
290
|
+
readonly reasoning_opaque?: string | undefined;
|
|
289
291
|
})[];
|
|
290
292
|
readonly tools?: readonly ({
|
|
291
293
|
readonly type: "function";
|
|
@@ -363,6 +363,7 @@ export declare const routes: (Route<{
|
|
|
363
363
|
readonly reasoning?: string | undefined;
|
|
364
364
|
readonly reasoning_text?: string | undefined;
|
|
365
365
|
readonly reasoning_details?: unknown;
|
|
366
|
+
readonly reasoning_opaque?: string | undefined;
|
|
366
367
|
readonly tool_calls?: readonly ({
|
|
367
368
|
readonly id: string;
|
|
368
369
|
readonly type: "custom";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { embeddingModel as model } from "../vercel-ai-gateway.js";
|
|
@@ -81,6 +81,7 @@ export declare const configure: (input?: Config) => {
|
|
|
81
81
|
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ProviderOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
82
82
|
image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
83
83
|
decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
84
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
84
85
|
configure: typeof configure;
|
|
85
86
|
};
|
|
86
87
|
export declare const provider: {
|
|
@@ -91,9 +92,11 @@ export declare const provider: {
|
|
|
91
92
|
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ProviderOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
92
93
|
image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
93
94
|
decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
95
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
94
96
|
configure: typeof configure;
|
|
95
97
|
};
|
|
96
98
|
export declare const decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
99
|
+
export declare const embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
97
100
|
export declare const messages: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ProviderOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
98
101
|
export declare const responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ProviderOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
99
102
|
export declare const chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ProviderOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
@@ -104,4 +107,5 @@ export declare const responsesModel: ProviderPackage.Model<Settings, ProviderOpt
|
|
|
104
107
|
export declare const chatModel: ProviderPackage.Model<Settings, ProviderOptionsInput>;
|
|
105
108
|
export declare const imageModel: (modelID: string, settings?: Settings) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
106
109
|
export declare const decisionModel: (modelID: string, settings?: Settings) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
110
|
+
export declare const embeddingModel: (modelID: string, settings?: Settings) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
107
111
|
export * as VercelAIGateway from "./vercel-ai-gateway.js";
|
|
@@ -3,6 +3,7 @@ import { AnthropicMessages } from "../protocols/anthropic-messages.js";
|
|
|
3
3
|
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
4
4
|
import { OpenResponses } from "../protocols/open-responses.js";
|
|
5
5
|
import { OpenAIDecisions } from "../protocols/openai-decisions.js";
|
|
6
|
+
import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js";
|
|
6
7
|
import { OpenAIImages } from "../protocols/openai-images.js";
|
|
7
8
|
import { XAIImages } from "../protocols/xai-images.js";
|
|
8
9
|
import { ProviderShared } from "../protocols/shared.js";
|
|
@@ -146,10 +147,19 @@ export const configure = (input = {}) => {
|
|
|
146
147
|
http: input.http,
|
|
147
148
|
});
|
|
148
149
|
const decision = (modelID, providerOptions) => decisionRoute.model({ id: modelID, providerOptions });
|
|
149
|
-
|
|
150
|
+
const embeddingRoute = OpenAIEmbeddings.route.with({
|
|
151
|
+
provider: id,
|
|
152
|
+
endpoint: { baseURL: configured.endpoint.baseURL },
|
|
153
|
+
auth: configured.auth,
|
|
154
|
+
headers: input.headers,
|
|
155
|
+
http: input.http,
|
|
156
|
+
});
|
|
157
|
+
const embedding = (modelID, providerOptions) => embeddingRoute.model({ id: modelID, providerOptions });
|
|
158
|
+
return { id, model, messages, responses, chat, image, decision, embedding, configure };
|
|
150
159
|
};
|
|
151
160
|
export const provider = configure();
|
|
152
161
|
export const decision = provider.decision;
|
|
162
|
+
export const embedding = provider.embedding;
|
|
153
163
|
export const messages = provider.messages;
|
|
154
164
|
export const responses = provider.responses;
|
|
155
165
|
export const chat = provider.chat;
|
|
@@ -166,4 +176,8 @@ export const decisionModel = (modelID, settings) => {
|
|
|
166
176
|
const input = toConfig(settings);
|
|
167
177
|
return configure(input).decision(modelID, input.providerOptions);
|
|
168
178
|
};
|
|
179
|
+
export const embeddingModel = (modelID, settings) => {
|
|
180
|
+
const input = toConfig(settings);
|
|
181
|
+
return configure(input).embedding(modelID, input.providerOptions);
|
|
182
|
+
};
|
|
169
183
|
export * as VercelAIGateway from "./vercel-ai-gateway.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { videoModel as model } from "../volcengine.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ProviderPackage } from "../provider-package.js";
|
|
2
|
+
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
3
|
+
import { type HttpOptions, type ModelID, type ProviderOptions } from "../schema/index.js";
|
|
4
|
+
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
5
|
+
export type Config = ProviderAuthOption<"optional"> & {
|
|
6
|
+
readonly baseURL?: string;
|
|
7
|
+
readonly headers?: Record<string, string>;
|
|
8
|
+
readonly http?: HttpOptions;
|
|
9
|
+
};
|
|
10
|
+
export type Settings = ProviderPackage.Settings & {
|
|
11
|
+
readonly apiKey?: string | false;
|
|
12
|
+
readonly baseURL?: string;
|
|
13
|
+
};
|
|
14
|
+
export type { SeedanceVideoOptions } from "../protocols/seedance-video.js";
|
|
15
|
+
export declare const configure: (input?: Config) => {
|
|
16
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
17
|
+
video: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../video.js").VideoModel<import("../protocols/seedance-video.js").SeedanceVideoOptions>;
|
|
18
|
+
configure: typeof configure;
|
|
19
|
+
};
|
|
20
|
+
export declare const provider: {
|
|
21
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
22
|
+
video: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../video.js").VideoModel<import("../protocols/seedance-video.js").SeedanceVideoOptions>;
|
|
23
|
+
configure: typeof configure;
|
|
24
|
+
};
|
|
25
|
+
export declare const videoModel: (modelID: string, settings?: Settings) => import("../video.js").VideoModel<import("../protocols/seedance-video.js").SeedanceVideoOptions>;
|
|
26
|
+
export declare const video: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../video.js").VideoModel<import("../protocols/seedance-video.js").SeedanceVideoOptions>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SeedanceVideo } from "../protocols/seedance-video.js";
|
|
2
|
+
import { AuthOptions } from "../route/auth-options.js";
|
|
3
|
+
import { MediaRoute } from "../route/media.js";
|
|
4
|
+
import { ProviderID } from "../schema/index.js";
|
|
5
|
+
import { toConfig } from "./settings.js";
|
|
6
|
+
export const id = ProviderID.make("volcengine");
|
|
7
|
+
const auth = (options) => AuthOptions.bearer(options, "ARK_API_KEY");
|
|
8
|
+
export const configure = (input = {}) => {
|
|
9
|
+
const media = MediaRoute.deployment(input, auth(input));
|
|
10
|
+
return {
|
|
11
|
+
id,
|
|
12
|
+
video: (modelID, providerOptions) => SeedanceVideo.volcengine.model({ ...media, id: modelID, providerOptions }),
|
|
13
|
+
configure,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export const provider = configure();
|
|
17
|
+
export const videoModel = (modelID, settings) => {
|
|
18
|
+
const input = toConfig(settings);
|
|
19
|
+
return configure(input).video(modelID, input.providerOptions);
|
|
20
|
+
};
|
|
21
|
+
export const video = provider.video;
|
package/dist/providers/xai.d.ts
CHANGED
|
@@ -123,6 +123,7 @@ export declare const routes: (Route<unknown, import("../protocols/open-responses
|
|
|
123
123
|
readonly reasoning?: string | undefined;
|
|
124
124
|
readonly reasoning_text?: string | undefined;
|
|
125
125
|
readonly reasoning_details?: unknown;
|
|
126
|
+
readonly reasoning_opaque?: string | undefined;
|
|
126
127
|
})[];
|
|
127
128
|
readonly tools?: readonly ({
|
|
128
129
|
readonly type: "function";
|
|
@@ -316,6 +316,7 @@ export declare const routes: (Route<{
|
|
|
316
316
|
readonly reasoning?: string | undefined;
|
|
317
317
|
readonly reasoning_text?: string | undefined;
|
|
318
318
|
readonly reasoning_details?: unknown;
|
|
319
|
+
readonly reasoning_opaque?: string | undefined;
|
|
319
320
|
})[];
|
|
320
321
|
readonly tools?: readonly ({
|
|
321
322
|
readonly type: "function";
|
package/dist/providers/zai.d.ts
CHANGED
|
@@ -114,6 +114,7 @@ export declare const routes: Route<{
|
|
|
114
114
|
readonly reasoning?: string | undefined;
|
|
115
115
|
readonly reasoning_text?: string | undefined;
|
|
116
116
|
readonly reasoning_details?: unknown;
|
|
117
|
+
readonly reasoning_opaque?: string | undefined;
|
|
117
118
|
})[];
|
|
118
119
|
readonly tools?: readonly ({
|
|
119
120
|
readonly type: "function";
|
package/dist/public.d.ts
CHANGED
|
@@ -3,8 +3,12 @@ export { ProtocolID, RouteID, ModelID, ProviderID, ResponseID, ContentBlockID, T
|
|
|
3
3
|
export type { BaseRequest, ContentPartInput, GenerationOptionsFields, HttpOptions, RequestOptions, LanguageModelInput, LanguageModelProviderOptions, LLMRequest, MediaPartInput, RequestTimeout, TimeoutConfig, ToolDefinitionInput, ToolNamespaceInput, ToolNamespaceEntryInput, ToolEntryInput, TransportOptions, UsageInput, } from "./schema/index.js";
|
|
4
4
|
export { ImageAspectRatio, ImageEvent, ImageModel, ImageModelSchema, ImageResponse } from "./image.js";
|
|
5
5
|
export type { ImageModelOptions, ImageOptions, ImageRequest, ImageRequestInput, ImageResolution, ImageRoute, } from "./image.js";
|
|
6
|
+
export { VideoAspectRatio, VideoDuration, VideoModel, VideoModelSchema, VideoResponse } from "./video.js";
|
|
7
|
+
export type { VideoJob, VideoModelOptions, VideoOptions, VideoRequest, VideoRequestInput, VideoResolution, VideoRoute, VideoStatus, } from "./video.js";
|
|
6
8
|
export { ChoiceAnswer, ChoiceQuestion, ChoiceValue, DecisionAnswer, DecisionJsonPart, DecisionMediaPart, DecisionModel, DecisionModelCompatibility, DecisionModelSchema, DecisionPart, DecisionQuestion, DecisionResponse, DecisionTextPart, DecisionUsage, ErrorAnswer, ErrorReason, PredicateAnswer, PredicateQuestion, ScoreAnswer, ScoreQuestion, } from "./decision.js";
|
|
7
9
|
export type { AnswerFor, AnswersFor, DecisionInput, DecisionMediaPartInput, DecisionModelOptions, DecisionOptions, DecisionPartInput, DecisionQuestions, DecisionRequest, DecisionRequestInput, DecisionResponseFor, DecisionModelRoute, } from "./decision.js";
|
|
10
|
+
export { EmbeddingModel, EmbeddingModelSchema, EmbeddingResponse, EmbeddingUsage, EmbeddingValue } from "./embedding.js";
|
|
11
|
+
export type { EmbeddingInputType, EmbeddingModelOptions, EmbeddingModelRoute, EmbeddingOptions, EmbeddingRequest, EmbeddingRequestInput, EmbeddingValueInput, } from "./embedding.js";
|
|
8
12
|
export { Media } from "./media.js";
|
|
9
13
|
export type { AwaitOptions as GenerationAwaitOptions, Event as GenerationEvent, Poll, Route as GenerationRoute, Snapshot as GenerationSnapshot, Status as GenerationStatus, } from "./generation.js";
|
|
10
14
|
export type { ExecutableTool, Tool, ToolExecute, ToolExecuteContext, ToolInput, ToolInputType, ToolModelOutputInput, ToolOptions, ToolSchema, ToolToModelOutput, } from "./tool.js";
|
package/dist/public.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { isContextOverflow, isContextOverflowFailure, isRetryable } from "./provider-error.js";
|
|
2
2
|
export { ProtocolID, RouteID, ModelID, ProviderID, ResponseID, ContentBlockID, ToolCallID, JsonSchema, ProviderOptions, ProviderMetadata, HttpTimeout, RequestEncoding, GENERATION_KEYS, ReasoningEfforts, ReasoningEffort, LanguageModelCompatibility, LanguageModel, LanguageModelSchema, CacheTTL, CacheHint, CachePolicyObject, CachePolicy, MessageRole, SystemPart, TextPart, MediaPart, ToolResultValue, ToolOutput, ToolCallPart, ToolResultPart, ReasoningPart, CompactionPart, EffortPart, ContentPart, Message, SystemMessage, UserMessage, AssistantMessage, ToolMessage, Freeform, ToolDefinition, ToolNamespace, ToolEntry, ToolChoice, FinishReason, Usage, MediaUsage, CompactionResponse, CompactionCheckpointResponse, StepStart, TextStart, TextDelta, TextEnd, ReasoningStart, ReasoningDelta, ReasoningEnd, ToolInputStart, ToolInputDelta, ToolInputEnd, ToolInputError, ToolCall, ToolResult, FinishReasonDetails, StepFinish, Finish, MediaEvent, RawEvent, LLMEvent, LLMResponse, HttpContext, HttpRateLimitDetails, InvalidRequestError, UnsupportedOperationError, ProviderConfigurationError, AuthenticationError, RateLimitError, QuotaExceededError, ContentPolicyError, ProviderInternalError, TransportType, TransportOperation, TransportError, InvalidProviderOutputError, UnknownProviderError, TimeoutError, AIErrorReason, AIError, } from "./schema/index.js";
|
|
3
3
|
export { ImageAspectRatio, ImageEvent, ImageModel, ImageModelSchema, ImageResponse } from "./image.js";
|
|
4
|
+
export { VideoAspectRatio, VideoDuration, VideoModel, VideoModelSchema, VideoResponse } from "./video.js";
|
|
4
5
|
export { ChoiceAnswer, ChoiceQuestion, ChoiceValue, DecisionAnswer, DecisionJsonPart, DecisionMediaPart, DecisionModel, DecisionModelCompatibility, DecisionModelSchema, DecisionPart, DecisionQuestion, DecisionResponse, DecisionTextPart, DecisionUsage, ErrorAnswer, ErrorReason, PredicateAnswer, PredicateQuestion, ScoreAnswer, ScoreQuestion, } from "./decision.js";
|
|
6
|
+
export { EmbeddingModel, EmbeddingModelSchema, EmbeddingResponse, EmbeddingUsage, EmbeddingValue } from "./embedding.js";
|
|
5
7
|
export { Media } from "./media.js";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { HttpClientResponse } from "effect/http";
|
|
3
|
+
import { EmbeddingModel, EmbeddingResponse, type EmbeddingOptions, type EmbeddingRequest } from "../embedding.js";
|
|
4
|
+
import { ProviderID, type HttpOptions, type AIError, type ProviderOptions } from "../schema/index.js";
|
|
5
|
+
import { Auth } from "./auth.js";
|
|
6
|
+
import { Endpoint } from "./endpoint.js";
|
|
7
|
+
import { MediaProtocol } from "./media-protocol.js";
|
|
8
|
+
/** One embedding API: how a request becomes its JSON body and how its response becomes an `EmbeddingResponse`. */
|
|
9
|
+
export interface Protocol {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly body: {
|
|
13
|
+
readonly from: (request: EmbeddingRequest) => Effect.Effect<Record<string, unknown>, AIError>;
|
|
14
|
+
};
|
|
15
|
+
readonly response: {
|
|
16
|
+
readonly decode: (response: HttpClientResponse.HttpClientResponse, context: {
|
|
17
|
+
readonly request: EmbeddingRequest;
|
|
18
|
+
readonly providerMetadataKey: string;
|
|
19
|
+
}) => Effect.Effect<EmbeddingResponse, AIError>;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export declare const protocol: (input: Protocol) => Protocol;
|
|
23
|
+
export interface Patch {
|
|
24
|
+
readonly id?: string;
|
|
25
|
+
readonly provider?: string | ProviderID;
|
|
26
|
+
/** ProviderMetadata namespace for responses; defaults to the provider. */
|
|
27
|
+
readonly providerMetadataKey?: string;
|
|
28
|
+
readonly endpoint?: Endpoint.EndpointPatch<MediaProtocol.Body, EmbeddingRequest>;
|
|
29
|
+
readonly auth?: Auth.Definition;
|
|
30
|
+
readonly headers?: Record<string, string>;
|
|
31
|
+
readonly http?: HttpOptions;
|
|
32
|
+
/**
|
|
33
|
+
* Most values one HTTP request may carry. Longer requests are split into requests of this size, sent a few at a
|
|
34
|
+
* time, and joined back in value order.
|
|
35
|
+
*/
|
|
36
|
+
readonly maxValues?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface Route {
|
|
39
|
+
readonly id: string;
|
|
40
|
+
readonly provider: ProviderID;
|
|
41
|
+
readonly providerMetadataKey: string;
|
|
42
|
+
readonly protocol: Protocol;
|
|
43
|
+
readonly endpoint: Endpoint.Definition<MediaProtocol.Body, EmbeddingRequest>;
|
|
44
|
+
readonly auth: Auth.Definition;
|
|
45
|
+
readonly headers?: Record<string, string>;
|
|
46
|
+
readonly http?: HttpOptions;
|
|
47
|
+
readonly maxValues?: number;
|
|
48
|
+
readonly with: (patch: Patch) => Route;
|
|
49
|
+
readonly model: <Options extends EmbeddingOptions = EmbeddingOptions>(input: {
|
|
50
|
+
readonly id: string;
|
|
51
|
+
readonly providerOptions?: ProviderOptions;
|
|
52
|
+
}) => EmbeddingModel<Options>;
|
|
53
|
+
}
|
|
54
|
+
export interface MakeInput extends Omit<Patch, "endpoint"> {
|
|
55
|
+
readonly id: string;
|
|
56
|
+
readonly provider: string | ProviderID;
|
|
57
|
+
readonly protocol: Protocol;
|
|
58
|
+
readonly endpoint: Endpoint.Definition<MediaProtocol.Body, EmbeddingRequest>;
|
|
59
|
+
}
|
|
60
|
+
export declare const make: (input: MakeInput) => Route;
|
|
61
|
+
export * as EmbeddingRoute from "./embedding.js";
|