@opencode/ai 2.2.5 → 2.2.7
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 +228 -72
- package/dist/ai-client.d.ts +2 -2
- package/dist/ai-client.js +2 -1
- package/dist/cache-policy.d.ts +1 -1
- package/dist/cache-policy.js +16 -4
- package/dist/decision-client.d.ts +3 -3
- package/dist/decision.d.ts +30 -125
- package/dist/decision.js +27 -15
- package/dist/effect.d.ts +10 -15
- package/dist/effect.js +6 -6
- package/dist/effort-updates.d.ts +3 -3
- package/dist/effort-updates.js +2 -2
- 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/cloudflare-run-extraction.d.ts +7 -3
- package/dist/experimental/cloudflare-run-extraction.js +4 -1
- package/dist/experimental/extraction.d.ts +10 -40
- package/dist/experimental/extraction.js +14 -13
- package/dist/experimental.d.ts +8 -8
- package/dist/experimental.js +4 -4
- package/dist/generation.d.ts +0 -2
- package/dist/generation.js +2 -2
- package/dist/image-client.d.ts +13 -7
- package/dist/image-client.js +1 -1
- package/dist/image.d.ts +357 -465
- package/dist/image.js +17 -18
- package/dist/index.d.ts +35 -467
- package/dist/index.js +23 -17
- package/dist/llm.d.ts +65 -266
- package/dist/llm.js +101 -92
- package/dist/loop.d.ts +38 -0
- package/dist/loop.js +136 -0
- package/dist/media-model.d.ts +1 -1
- package/dist/media-model.js +8 -6
- package/dist/media.d.ts +9 -0
- package/dist/media.js +37 -2
- package/dist/protocols/alibaba-chat.d.ts +9 -1
- package/dist/protocols/alibaba-chat.js +3 -3
- package/dist/protocols/alibaba-images.d.ts +2 -2
- package/dist/protocols/alibaba-messages.js +3 -3
- package/dist/protocols/alibaba-responses.js +8 -20
- package/dist/protocols/anthropic-messages.d.ts +1 -1
- package/dist/protocols/anthropic-messages.js +57 -176
- package/dist/protocols/assemblyai-transcription.d.ts +2 -2
- package/dist/protocols/bedrock-converse.js +10 -16
- package/dist/protocols/cartesia-speech.d.ts +2 -2
- package/dist/protocols/cloudflare-workers-ai-images.d.ts +2 -2
- package/dist/protocols/cohere-chat.js +9 -12
- package/dist/protocols/deepgram-speech.d.ts +2 -2
- package/dist/protocols/deepgram-transcription.d.ts +2 -2
- package/dist/protocols/elevenlabs-speech.d.ts +2 -2
- package/dist/protocols/elevenlabs-transcription.d.ts +2 -2
- package/dist/protocols/gemini.d.ts +3 -0
- package/dist/protocols/gemini.js +54 -72
- package/dist/protocols/google-embed-content.d.ts +34 -0
- package/dist/protocols/google-embed-content.js +110 -0
- package/dist/protocols/google-images.d.ts +2 -2
- package/dist/protocols/google-interactions.d.ts +3 -4
- package/dist/protocols/google-interactions.js +44 -30
- package/dist/protocols/google-speech.d.ts +2 -2
- package/dist/protocols/google-transcription.d.ts +2 -2
- package/dist/protocols/google-vertex-predict-embeddings.d.ts +18 -0
- package/dist/protocols/google-vertex-predict-embeddings.js +74 -0
- package/dist/protocols/google-video.d.ts +2 -2
- package/dist/protocols/index.d.ts +3 -0
- package/dist/protocols/index.js +3 -0
- package/dist/protocols/meta-images.d.ts +2 -2
- package/dist/protocols/meta-responses.js +26 -23
- package/dist/protocols/minimax-images.d.ts +2 -2
- package/dist/protocols/mistral-chat.js +7 -10
- package/dist/protocols/open-responses-channel.js +6 -19
- package/dist/protocols/open-responses-continuation.d.ts +1 -5
- package/dist/protocols/open-responses-continuation.js +1 -3
- package/dist/protocols/open-responses.d.ts +2 -22
- package/dist/protocols/open-responses.js +41 -23
- package/dist/protocols/openai-chat.d.ts +27 -23
- package/dist/protocols/openai-chat.js +62 -57
- package/dist/protocols/openai-compatible-chat.d.ts +2 -1
- package/dist/protocols/openai-compatible-responses.d.ts +2 -2
- package/dist/protocols/openai-compatible-responses.js +1 -1
- package/dist/protocols/openai-decisions.js +15 -2
- package/dist/protocols/openai-embeddings.d.ts +16 -0
- package/dist/protocols/openai-embeddings.js +76 -0
- package/dist/protocols/openai-images.d.ts +2 -2
- package/dist/protocols/openai-responses.js +10 -29
- package/dist/protocols/openai-speech.d.ts +2 -2
- package/dist/protocols/openai-transcription.d.ts +2 -2
- package/dist/protocols/runway-video.d.ts +2 -2
- package/dist/protocols/shared.d.ts +14 -7
- package/dist/protocols/shared.js +40 -15
- package/dist/protocols/system-one.d.ts +4 -4
- package/dist/protocols/system-one.js +8 -1
- package/dist/protocols/utils/bedrock-cache.js +2 -5
- package/dist/protocols/utils/bedrock-media.d.ts +0 -3
- package/dist/protocols/utils/cache.d.ts +3 -0
- package/dist/protocols/utils/cache.js +15 -2
- package/dist/protocols/utils/image-sizing.d.ts +1 -1
- package/dist/protocols/utils/responses-checkpoint.js +1 -1
- package/dist/protocols/utils/responses-compaction.d.ts +1 -1
- package/dist/protocols/utils/responses-compaction.js +6 -5
- package/dist/protocols/utils/responses-hosted-tools.d.ts +97 -1
- package/dist/protocols/utils/responses-hosted-tools.js +31 -0
- package/dist/protocols/utils/tool-stream.d.ts +5 -271
- package/dist/protocols/utils/tool-stream.js +3 -13
- package/dist/protocols/venice-chat.d.ts +7 -1
- package/dist/protocols/venice-chat.js +4 -4
- package/dist/protocols/xai-images.d.ts +2 -2
- package/dist/protocols/xai-responses.js +5 -25
- package/dist/protocols/xai-video.d.ts +2 -2
- package/dist/protocols/zai-chat.d.ts +9 -1
- package/dist/protocols/zai-chat.js +1 -1
- package/dist/protocols/zai-images.d.ts +2 -2
- package/dist/protocols/zai-messages.js +3 -3
- package/dist/provider-error.d.ts +0 -1
- package/dist/provider-error.js +7 -80
- package/dist/providers/alibaba/embeddings.d.ts +2 -0
- package/dist/providers/alibaba/embeddings.js +1 -0
- package/dist/providers/alibaba.d.ts +70 -4
- package/dist/providers/alibaba.js +20 -2
- package/dist/providers/amazon-bedrock-mantle.d.ts +7 -3
- package/dist/providers/amazon-bedrock-mantle.js +6 -3
- package/dist/providers/amazon-bedrock.d.ts +6 -7
- package/dist/providers/amazon-bedrock.js +1 -1
- package/dist/providers/anthropic-compatible.d.ts +7 -8
- package/dist/providers/anthropic-compatible.js +2 -5
- package/dist/providers/anthropic.d.ts +8 -9
- package/dist/providers/anthropic.js +2 -7
- package/dist/providers/assemblyai.d.ts +2 -2
- package/dist/providers/assemblyai.js +2 -7
- package/dist/providers/azure/embeddings.d.ts +2 -0
- package/dist/providers/azure/embeddings.js +1 -0
- package/dist/providers/azure/messages.d.ts +2 -0
- package/dist/providers/azure/messages.js +1 -0
- package/dist/providers/azure.d.ts +325 -7
- package/dist/providers/azure.js +40 -9
- package/dist/providers/baseten.d.ts +7 -5
- package/dist/providers/baseten.js +7 -21
- package/dist/providers/cartesia.d.ts +1 -1
- package/dist/providers/cerebras.d.ts +7 -5
- package/dist/providers/cerebras.js +4 -15
- package/dist/providers/cloudflare-ai-gateway.d.ts +23 -13
- package/dist/providers/cloudflare-ai-gateway.js +28 -40
- package/dist/providers/cloudflare-shared.d.ts +9 -0
- package/dist/providers/cloudflare-shared.js +25 -0
- package/dist/providers/cloudflare-workers-ai.d.ts +6 -4
- package/dist/providers/cloudflare-workers-ai.js +4 -20
- package/dist/providers/cohere/chat.js +2 -7
- package/dist/providers/cohere/embeddings.d.ts +2 -0
- package/dist/providers/cohere/embeddings.js +1 -0
- package/dist/providers/cohere.d.ts +14 -5
- package/dist/providers/cohere.js +23 -13
- package/dist/providers/deepgram.d.ts +2 -2
- package/dist/providers/deepgram.js +2 -7
- package/dist/providers/deepinfra/embeddings.d.ts +2 -0
- package/dist/providers/deepinfra/embeddings.js +1 -0
- package/dist/providers/deepinfra.d.ts +10 -5
- package/dist/providers/deepinfra.js +20 -14
- package/dist/providers/deepseek.d.ts +7 -5
- package/dist/providers/deepseek.js +3 -14
- package/dist/providers/digitalocean/embeddings.d.ts +2 -0
- package/dist/providers/digitalocean/embeddings.js +1 -0
- package/dist/providers/digitalocean.d.ts +18 -5
- package/dist/providers/digitalocean.js +28 -14
- package/dist/providers/elevenlabs.d.ts +2 -2
- package/dist/providers/elevenlabs.js +2 -7
- package/dist/providers/fireworks/embeddings.d.ts +2 -0
- package/dist/providers/fireworks/embeddings.js +1 -0
- package/dist/providers/fireworks.d.ts +10 -5
- package/dist/providers/fireworks.js +17 -14
- package/dist/providers/google/embeddings.d.ts +2 -0
- package/dist/providers/google/embeddings.js +1 -0
- package/dist/providers/google/interactions.d.ts +1 -1
- package/dist/providers/google/interactions.js +2 -7
- 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 +4 -3
- package/dist/providers/google-vertex-chat.js +3 -29
- package/dist/providers/google-vertex-interactions.d.ts +3 -3
- package/dist/providers/google-vertex-messages.d.ts +3 -3
- package/dist/providers/google-vertex-messages.js +3 -29
- package/dist/providers/google-vertex-mistral.d.ts +3 -3
- package/dist/providers/google-vertex-mistral.js +3 -29
- package/dist/providers/google-vertex-responses.d.ts +3 -3
- package/dist/providers/google-vertex-responses.js +4 -30
- package/dist/providers/google-vertex-shared.d.ts +31 -0
- package/dist/providers/google-vertex-shared.js +25 -0
- package/dist/providers/google-vertex.d.ts +10 -3
- package/dist/providers/google-vertex.js +52 -0
- package/dist/providers/google.d.ts +21 -13
- package/dist/providers/google.js +23 -19
- package/dist/providers/groq.d.ts +10 -5
- package/dist/providers/groq.js +4 -15
- package/dist/providers/meta.d.ts +6 -5
- package/dist/providers/meta.js +10 -23
- package/dist/providers/minimax/chat.js +2 -7
- package/dist/providers/minimax/responses.js +2 -7
- package/dist/providers/minimax.d.ts +6 -5
- package/dist/providers/minimax.js +7 -22
- package/dist/providers/mistral.d.ts +10 -11
- package/dist/providers/mistral.js +3 -14
- package/dist/providers/moonshot/messages.js +2 -7
- package/dist/providers/moonshot/responses.js +2 -7
- package/dist/providers/moonshot.d.ts +6 -5
- package/dist/providers/moonshot.js +4 -16
- package/dist/providers/openai/embeddings.d.ts +2 -0
- package/dist/providers/openai/embeddings.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-responses.d.ts +6 -7
- package/dist/providers/openai-compatible-responses.js +2 -8
- package/dist/providers/openai-compatible.d.ts +10 -7
- package/dist/providers/openai-compatible.js +17 -10
- package/dist/providers/openai.d.ts +11 -4
- package/dist/providers/openai.js +17 -3
- package/dist/providers/opencode.d.ts +4 -4
- package/dist/providers/opencode.js +6 -2
- package/dist/providers/openrouter/embeddings.d.ts +2 -0
- package/dist/providers/openrouter/embeddings.js +1 -0
- package/dist/providers/openrouter.d.ts +24 -5
- package/dist/providers/openrouter.js +31 -24
- package/dist/providers/runway.d.ts +1 -1
- package/dist/providers/settings.d.ts +40 -0
- package/dist/providers/settings.js +19 -0
- package/dist/providers/togetherai.d.ts +7 -5
- package/dist/providers/togetherai.js +5 -15
- package/dist/providers/typesafe-ai.d.ts +4 -4
- package/dist/providers/typesafe-ai.js +6 -2
- package/dist/providers/venice.d.ts +5 -4
- package/dist/providers/venice.js +6 -2
- 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 +9 -5
- package/dist/providers/vercel-ai-gateway.js +30 -29
- package/dist/providers/xai.d.ts +5 -4
- package/dist/providers/xai.js +4 -12
- package/dist/providers/zai-coding-plan/messages.js +2 -7
- package/dist/providers/zai-coding-plan/responses.js +2 -7
- package/dist/providers/zai-coding-plan.d.ts +6 -5
- package/dist/providers/zai-coding-plan.js +8 -15
- package/dist/providers/zai.d.ts +6 -5
- package/dist/providers/zai.js +10 -22
- package/dist/public.d.ts +14 -0
- package/dist/public.js +6 -0
- package/dist/route/auth-options.d.ts +9 -5
- package/dist/route/auth-options.js +10 -7
- package/dist/route/client.d.ts +50 -37
- package/dist/route/client.js +42 -53
- package/dist/route/decision.d.ts +8 -8
- package/dist/route/decision.js +3 -3
- package/dist/route/embedding.d.ts +61 -0
- package/dist/route/embedding.js +88 -0
- package/dist/route/executor.d.ts +5 -0
- package/dist/route/executor.js +10 -0
- package/dist/route/index.d.ts +5 -7
- package/dist/route/index.js +1 -1
- package/dist/route/media.d.ts +7 -11
- package/dist/route/media.js +22 -26
- package/dist/route/transport/http.js +6 -5
- package/dist/route/transport/websocket.js +7 -1
- package/dist/schema/errors.d.ts +16 -17
- package/dist/schema/errors.js +63 -12
- package/dist/schema/events.d.ts +2563 -2954
- package/dist/schema/events.js +54 -109
- package/dist/schema/messages.d.ts +194 -137
- package/dist/schema/messages.js +66 -83
- package/dist/schema/options.d.ts +112 -65
- package/dist/schema/options.js +52 -101
- package/dist/speech-client.d.ts +7 -7
- package/dist/speech.d.ts +306 -316
- package/dist/speech.js +16 -14
- package/dist/testing.d.ts +31 -175
- package/dist/testing.js +60 -5
- package/dist/tool-history.d.ts +1 -1
- package/dist/tool-history.js +3 -10
- package/dist/tool-runtime.d.ts +9 -2
- package/dist/tool-runtime.js +17 -31
- package/dist/tool.d.ts +39 -43
- package/dist/tool.js +16 -26
- package/dist/transcription-client.d.ts +7 -7
- package/dist/transcription.d.ts +314 -265
- package/dist/transcription.js +16 -14
- package/dist/utils/provider-codes.d.ts +3 -0
- package/dist/utils/provider-codes.js +41 -0
- package/dist/video-client.d.ts +7 -7
- package/dist/video-client.js +1 -1
- package/dist/video.d.ts +269 -287
- package/dist/video.js +16 -14
- package/package.json +309 -257
- package/dist/experimental/testing.d.ts +0 -3
- package/dist/experimental/testing.js +0 -3
- package/dist/testing/decision.d.ts +0 -16
- package/dist/testing/decision.js +0 -20
- package/dist/testing/image.d.ts +0 -14
- package/dist/testing/image.js +0 -12
- package/dist/testing/media.d.ts +0 -18
- package/dist/testing/media.js +0 -36
- package/dist/testing/script.d.ts +0 -28
- package/dist/testing/script.js +0 -60
- package/dist/testing/speech.d.ts +0 -14
- package/dist/testing/speech.js +0 -12
- package/dist/testing/transcription.d.ts +0 -14
- package/dist/testing/transcription.js +0 -12
- package/dist/testing/video.d.ts +0 -14
- package/dist/testing/video.js +0 -12
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
|
-
import {
|
|
3
|
-
import { Route
|
|
4
|
-
import { type ModelID } from "../schema/index.js";
|
|
2
|
+
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
3
|
+
import { Route } from "../route/client.js";
|
|
4
|
+
import { type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js";
|
|
5
5
|
import type { OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
6
6
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
|
-
export type Config = Omit<
|
|
7
|
+
export type Config = Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
8
8
|
readonly baseURL?: string;
|
|
9
9
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
10
10
|
};
|
|
11
11
|
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
|
|
12
|
-
readonly apiKey?: string;
|
|
12
|
+
readonly apiKey?: string | false;
|
|
13
13
|
readonly baseURL?: string;
|
|
14
14
|
};
|
|
15
15
|
export declare const route: Route<{
|
|
@@ -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,11 +365,14 @@ export declare const routes: Route<{
|
|
|
363
365
|
export declare const configure: (input?: Config) => {
|
|
364
366
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
365
367
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
368
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
366
369
|
configure: typeof configure;
|
|
367
370
|
};
|
|
368
371
|
export declare const provider: {
|
|
369
372
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
370
373
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
374
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
371
375
|
configure: typeof configure;
|
|
372
376
|
};
|
|
373
377
|
export declare const model: ProviderPackage.Model<Settings, OpenAIProviderOptionsInput>;
|
|
378
|
+
export declare const embeddingModel: (modelID: string, settings?: Settings) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
2
|
-
import {
|
|
2
|
+
import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js";
|
|
3
3
|
import { Route } from "../route/client.js";
|
|
4
4
|
import { Endpoint } from "../route/endpoint.js";
|
|
5
5
|
import { ProviderID } from "../schema/index.js";
|
|
6
|
+
import { bearerRouteDefaults, toConfig } from "./settings.js";
|
|
6
7
|
export const id = ProviderID.make("deepinfra");
|
|
7
8
|
const baseURL = "https://api.deepinfra.com/v1/openai";
|
|
8
9
|
export const route = Route.make({
|
|
@@ -15,14 +16,20 @@ export const route = Route.make({
|
|
|
15
16
|
});
|
|
16
17
|
export const routes = [route];
|
|
17
18
|
export const configure = (input = {}) => {
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
...defaults,
|
|
19
|
+
const root = input.baseURL?.replace(/\/+$/, "");
|
|
20
|
+
const options = {
|
|
21
|
+
...bearerRouteDefaults(input, "DEEPINFRA_API_KEY"),
|
|
22
22
|
endpoint: {
|
|
23
23
|
baseURL: root === undefined ? baseURL : root.endsWith("/openai") ? root : `${root}/openai`,
|
|
24
24
|
},
|
|
25
|
-
|
|
25
|
+
};
|
|
26
|
+
const configured = route.with(options);
|
|
27
|
+
const embeddingRoute = OpenAIEmbeddings.route.with({
|
|
28
|
+
provider: id,
|
|
29
|
+
endpoint: options.endpoint,
|
|
30
|
+
auth: options.auth,
|
|
31
|
+
headers: input.headers,
|
|
32
|
+
http: input.http,
|
|
26
33
|
});
|
|
27
34
|
return {
|
|
28
35
|
id,
|
|
@@ -31,17 +38,16 @@ export const configure = (input = {}) => {
|
|
|
31
38
|
compatibility: {
|
|
32
39
|
maxTokensField: "max_tokens",
|
|
33
40
|
reasoningField: "reasoning_content",
|
|
34
|
-
supportsPromptCacheKey: true,
|
|
35
41
|
},
|
|
42
|
+
capabilities: { promptCacheKey: true },
|
|
36
43
|
}),
|
|
44
|
+
embedding: (modelID, providerOptions) => embeddingRoute.model({ id: modelID, providerOptions }),
|
|
37
45
|
configure,
|
|
38
46
|
};
|
|
39
47
|
};
|
|
40
48
|
export const provider = configure();
|
|
41
|
-
export const model = (modelID,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
providerOptions,
|
|
47
|
-
}).model(modelID);
|
|
49
|
+
export const model = (modelID, settings) => configure(toConfig(settings)).model(modelID);
|
|
50
|
+
export const embeddingModel = (modelID, settings) => {
|
|
51
|
+
const input = toConfig(settings);
|
|
52
|
+
return configure(input).embedding(modelID, input.providerOptions);
|
|
53
|
+
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
|
-
import {
|
|
3
|
-
import { Route
|
|
4
|
-
import { type ModelID } from "../schema/index.js";
|
|
2
|
+
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
3
|
+
import { Route } from "../route/client.js";
|
|
4
|
+
import { type ModelID, type RequestOptions } from "../schema/index.js";
|
|
5
5
|
import type { OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
6
6
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
|
-
export type Config = Omit<
|
|
7
|
+
export type Config = Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
8
8
|
readonly baseURL?: string;
|
|
9
9
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
10
10
|
};
|
|
11
11
|
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
|
|
12
|
-
readonly apiKey?: string;
|
|
12
|
+
readonly apiKey?: string | false;
|
|
13
13
|
readonly baseURL?: string;
|
|
14
14
|
};
|
|
15
15
|
export declare const route: Route<{
|
|
@@ -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";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
2
|
-
import { AuthOptions } from "../route/auth-options.js";
|
|
3
2
|
import { Route } from "../route/client.js";
|
|
4
3
|
import { Endpoint } from "../route/endpoint.js";
|
|
5
4
|
import { ProviderID } from "../schema/index.js";
|
|
5
|
+
import { bearerRouteDefaults, toConfig } from "./settings.js";
|
|
6
6
|
export const id = ProviderID.make("deepseek");
|
|
7
7
|
const baseURL = "https://api.deepseek.com/v1";
|
|
8
8
|
export const route = Route.make({
|
|
@@ -15,12 +15,7 @@ export const route = Route.make({
|
|
|
15
15
|
});
|
|
16
16
|
export const routes = [route];
|
|
17
17
|
export const configure = (input = {}) => {
|
|
18
|
-
const
|
|
19
|
-
const configured = route.with({
|
|
20
|
-
...defaults,
|
|
21
|
-
endpoint: { baseURL: endpoint ?? baseURL },
|
|
22
|
-
auth: AuthOptions.bearer(input, "DEEPSEEK_API_KEY"),
|
|
23
|
-
});
|
|
18
|
+
const configured = route.with(bearerRouteDefaults(input, "DEEPSEEK_API_KEY", baseURL));
|
|
24
19
|
return {
|
|
25
20
|
id,
|
|
26
21
|
model: (modelID) => configured.model({
|
|
@@ -31,11 +26,5 @@ export const configure = (input = {}) => {
|
|
|
31
26
|
};
|
|
32
27
|
};
|
|
33
28
|
export const provider = configure();
|
|
34
|
-
export const model = (modelID,
|
|
35
|
-
apiKey,
|
|
36
|
-
baseURL,
|
|
37
|
-
headers,
|
|
38
|
-
http: body === undefined ? undefined : { body },
|
|
39
|
-
providerOptions,
|
|
40
|
-
}).model(modelID);
|
|
29
|
+
export const model = (modelID, settings) => configure(toConfig(settings)).model(modelID);
|
|
41
30
|
export * as DeepSeek from "./deepseek.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { embeddingModel as model } from "../digitalocean.js";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
2
|
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
3
|
-
import {
|
|
4
|
-
import { Route
|
|
3
|
+
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
4
|
+
import { Route } from "../route/client.js";
|
|
5
5
|
import { Protocol } from "../route/protocol.js";
|
|
6
|
-
import { type ModelID, type ProviderOptions } from "../schema/index.js";
|
|
6
|
+
import { type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js";
|
|
7
7
|
import type { OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
8
8
|
import type { OpenResponsesProviderOptionsInput } from "./open-responses-options.js";
|
|
9
9
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
10
|
-
export type Config = Omit<
|
|
10
|
+
export type Config = Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
11
11
|
readonly baseURL?: string;
|
|
12
12
|
readonly providerOptions?: OpenAIProviderOptionsInput | OpenResponsesProviderOptionsInput;
|
|
13
13
|
};
|
|
14
14
|
export type Settings<Options = OpenAIProviderOptionsInput> = ProviderPackage.Settings & Options & {
|
|
15
|
-
readonly apiKey?: string;
|
|
15
|
+
readonly apiKey?: string | false;
|
|
16
16
|
};
|
|
17
17
|
export declare const protocol: Protocol<{
|
|
18
18
|
readonly model: string;
|
|
@@ -114,6 +114,7 @@ export declare const protocol: Protocol<{
|
|
|
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";
|
|
@@ -199,6 +200,7 @@ export declare const protocol: Protocol<{
|
|
|
199
200
|
readonly reasoning?: string | null | undefined;
|
|
200
201
|
readonly reasoning_text?: string | null | undefined;
|
|
201
202
|
readonly reasoning_details?: unknown;
|
|
203
|
+
readonly reasoning_opaque?: string | null | undefined;
|
|
202
204
|
readonly tool_calls?: readonly {
|
|
203
205
|
readonly index?: number | null | undefined;
|
|
204
206
|
readonly id?: string | null | undefined;
|
|
@@ -224,6 +226,7 @@ export declare const protocol: Protocol<{
|
|
|
224
226
|
readonly prompt_cache_hit_tokens?: number | null | undefined;
|
|
225
227
|
readonly cache_read_input_tokens?: number | null | undefined;
|
|
226
228
|
readonly cache_created_input_tokens?: number | null | undefined;
|
|
229
|
+
readonly reasoning_tokens?: number | null | undefined;
|
|
227
230
|
readonly prompt_tokens_details?: {
|
|
228
231
|
readonly [x: string]: unknown;
|
|
229
232
|
readonly cached_tokens?: number | null | undefined;
|
|
@@ -246,6 +249,7 @@ export declare const protocol: Protocol<{
|
|
|
246
249
|
readonly prompt_cache_hit_tokens?: number | null | undefined;
|
|
247
250
|
readonly cache_read_input_tokens?: number | null | undefined;
|
|
248
251
|
readonly cache_created_input_tokens?: number | null | undefined;
|
|
252
|
+
readonly reasoning_tokens?: number | null | undefined;
|
|
249
253
|
readonly prompt_tokens_details?: {
|
|
250
254
|
readonly [x: string]: unknown;
|
|
251
255
|
readonly cached_tokens?: number | null | undefined;
|
|
@@ -364,6 +368,7 @@ export declare const route: Route<{
|
|
|
364
368
|
readonly reasoning?: string | undefined;
|
|
365
369
|
readonly reasoning_text?: string | undefined;
|
|
366
370
|
readonly reasoning_details?: unknown;
|
|
371
|
+
readonly reasoning_opaque?: string | undefined;
|
|
367
372
|
})[];
|
|
368
373
|
readonly tools?: readonly ({
|
|
369
374
|
readonly type: "function";
|
|
@@ -735,6 +740,7 @@ export declare const routes: (Route<{
|
|
|
735
740
|
readonly reasoning?: string | undefined;
|
|
736
741
|
readonly reasoning_text?: string | undefined;
|
|
737
742
|
readonly reasoning_details?: unknown;
|
|
743
|
+
readonly reasoning_opaque?: string | undefined;
|
|
738
744
|
})[];
|
|
739
745
|
readonly tools?: readonly ({
|
|
740
746
|
readonly type: "function";
|
|
@@ -812,24 +818,31 @@ export declare const routes: (Route<{
|
|
|
812
818
|
export declare const configure: (input?: Config) => {
|
|
813
819
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
814
820
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
821
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
815
822
|
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
816
823
|
image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
817
824
|
decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
825
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
818
826
|
configure: typeof configure;
|
|
819
827
|
};
|
|
820
828
|
export declare const provider: {
|
|
821
829
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
822
830
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
831
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
823
832
|
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
824
833
|
image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
825
834
|
decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
835
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
826
836
|
configure: typeof configure;
|
|
827
837
|
};
|
|
828
838
|
export declare const decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
839
|
+
export declare const embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
829
840
|
export declare const image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
841
|
+
export declare const chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
830
842
|
export declare const responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
831
843
|
export declare const model: ProviderPackage.Model<Settings, OpenAIProviderOptionsInput>;
|
|
832
844
|
export declare const responsesModel: ProviderPackage.Model<Settings<OpenResponsesProviderOptionsInput>, OpenResponsesProviderOptionsInput>;
|
|
833
845
|
export declare const imageModel: (modelID: string, settings?: Settings) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
834
846
|
export declare const decisionModel: (modelID: string, settings?: Settings) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
847
|
+
export declare const embeddingModel: (modelID: string, settings?: Settings) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
835
848
|
export * as DigitalOcean from "./digitalocean.js";
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
2
|
+
import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js";
|
|
2
3
|
import { OpenAIImages } from "../protocols/openai-images.js";
|
|
3
4
|
import { OpenResponses } from "../protocols/open-responses.js";
|
|
4
5
|
import { SystemOne } from "../protocols/system-one.js";
|
|
5
6
|
import { cacheControl } from "../protocols/utils/cache.js";
|
|
6
|
-
import { AuthOptions } from "../route/auth-options.js";
|
|
7
7
|
import { Route } from "../route/client.js";
|
|
8
8
|
import { Endpoint } from "../route/endpoint.js";
|
|
9
9
|
import { MediaRoute } from "../route/media.js";
|
|
10
10
|
import { Protocol } from "../route/protocol.js";
|
|
11
11
|
import { ProviderID } from "../schema/index.js";
|
|
12
|
+
import { bearerRouteDefaults } from "./settings.js";
|
|
12
13
|
export const id = ProviderID.make("digitalocean");
|
|
13
14
|
const baseURL = "https://inference.do-ai.run/v1";
|
|
14
15
|
export const protocol = Protocol.make({
|
|
@@ -34,44 +35,53 @@ const responsesRoute = Route.make({
|
|
|
34
35
|
protocol: OpenResponses.protocol,
|
|
35
36
|
endpoint: Endpoint.path("/responses", { baseURL }),
|
|
36
37
|
transport: OpenResponses.httpTransport,
|
|
37
|
-
|
|
38
|
+
options: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } },
|
|
38
39
|
});
|
|
39
40
|
export const routes = [route, responsesRoute];
|
|
40
41
|
export const configure = (input = {}) => {
|
|
41
|
-
const
|
|
42
|
-
const auth = AuthOptions.bearer(input, ["DIGITALOCEAN_ACCESS_TOKEN", "DIGITALOCEAN_API_KEY", "DO_INFERENCE_API_KEY"]);
|
|
43
|
-
const options = { ...defaults, endpoint: { baseURL: endpoint ?? baseURL }, auth };
|
|
42
|
+
const options = bearerRouteDefaults(input, ["DIGITALOCEAN_ACCESS_TOKEN", "DIGITALOCEAN_API_KEY", "DO_INFERENCE_API_KEY"], baseURL);
|
|
44
43
|
const configured = route.with(options);
|
|
45
44
|
const configuredResponses = responsesRoute.with(options);
|
|
46
45
|
const decisionRoute = SystemOne.route.with({
|
|
47
46
|
provider: id,
|
|
48
47
|
providerMetadataKey: "digitalocean",
|
|
49
|
-
endpoint:
|
|
50
|
-
auth,
|
|
48
|
+
endpoint: options.endpoint,
|
|
49
|
+
auth: options.auth,
|
|
51
50
|
// DigitalOcean serves TypeSafe's Jev, which needs this header for images.
|
|
52
51
|
headers: { "TypeSafe-Danger-Zone-Images": "true", ...input.headers },
|
|
53
52
|
http: input.http,
|
|
54
53
|
});
|
|
55
54
|
const decision = (modelID, providerOptions) => decisionRoute.model({ id: modelID, providerOptions });
|
|
56
|
-
const media = MediaRoute.deployment({ ...input, baseURL: endpoint
|
|
55
|
+
const media = MediaRoute.deployment({ ...input, baseURL: options.endpoint.baseURL }, options.auth);
|
|
57
56
|
const image = (modelID, providerOptions) => OpenAIImages.model({ ...media, id: modelID, provider: id, providerOptions });
|
|
57
|
+
const embeddingRoute = OpenAIEmbeddings.route.with({
|
|
58
|
+
provider: id,
|
|
59
|
+
endpoint: options.endpoint,
|
|
60
|
+
auth: options.auth,
|
|
61
|
+
headers: input.headers,
|
|
62
|
+
http: input.http,
|
|
63
|
+
});
|
|
64
|
+
const embedding = (modelID, providerOptions) => embeddingRoute.model({ id: modelID, providerOptions });
|
|
65
|
+
const chat = (modelID) => configured.model({
|
|
66
|
+
id: modelID,
|
|
67
|
+
capabilities: { promptCacheKey: true },
|
|
68
|
+
});
|
|
58
69
|
return {
|
|
59
70
|
id,
|
|
60
|
-
model:
|
|
61
|
-
|
|
62
|
-
compatibility: {
|
|
63
|
-
supportsPromptCacheKey: true,
|
|
64
|
-
},
|
|
65
|
-
}),
|
|
71
|
+
model: chat,
|
|
72
|
+
chat,
|
|
66
73
|
responses: (modelID) => configuredResponses.model({ id: modelID }),
|
|
67
74
|
image,
|
|
68
75
|
decision,
|
|
76
|
+
embedding,
|
|
69
77
|
configure,
|
|
70
78
|
};
|
|
71
79
|
};
|
|
72
80
|
export const provider = configure();
|
|
73
81
|
export const decision = provider.decision;
|
|
82
|
+
export const embedding = provider.embedding;
|
|
74
83
|
export const image = provider.image;
|
|
84
|
+
export const chat = provider.chat;
|
|
75
85
|
export const responses = provider.responses;
|
|
76
86
|
export const model = (modelID, settings) => configure(config(settings)).model(modelID);
|
|
77
87
|
export const responsesModel = (modelID, settings) => configure(config(settings)).responses(modelID);
|
|
@@ -83,6 +93,10 @@ export const decisionModel = (modelID, settings) => {
|
|
|
83
93
|
const input = config(settings);
|
|
84
94
|
return configure(input).decision(modelID, input.providerOptions);
|
|
85
95
|
};
|
|
96
|
+
export const embeddingModel = (modelID, settings) => {
|
|
97
|
+
const input = config(settings);
|
|
98
|
+
return configure(input).embedding(modelID, input.providerOptions);
|
|
99
|
+
};
|
|
86
100
|
function config({ apiKey, baseURL, body, headers, ...providerOptions } = {}) {
|
|
87
101
|
return {
|
|
88
102
|
apiKey,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
2
2
|
import { type HttpOptions, type ModelID } from "../schema/index.js";
|
|
3
3
|
export type { ElevenLabsOutputFormat, ElevenLabsSpeechOptions } from "../protocols/elevenlabs-speech.js";
|
|
4
4
|
export type { ElevenLabsTranscriptionOptions } from "../protocols/elevenlabs-transcription.js";
|
|
@@ -6,7 +6,7 @@ export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
|
6
6
|
export type Config = ProviderAuthOption<"optional"> & {
|
|
7
7
|
readonly baseURL?: string;
|
|
8
8
|
readonly headers?: Record<string, string>;
|
|
9
|
-
readonly http?: HttpOptions
|
|
9
|
+
readonly http?: HttpOptions;
|
|
10
10
|
};
|
|
11
11
|
export declare const configure: (input?: Config) => {
|
|
12
12
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { Auth } from "../route/auth.js";
|
|
2
|
+
import { AuthOptions } from "../route/auth-options.js";
|
|
2
3
|
import { MediaRoute } from "../route/media.js";
|
|
3
4
|
import { ProviderID } from "../schema/index.js";
|
|
4
5
|
import { ElevenLabsSpeech } from "../protocols/elevenlabs-speech.js";
|
|
5
6
|
import { ElevenLabsTranscription } from "../protocols/elevenlabs-transcription.js";
|
|
6
7
|
export const id = ProviderID.make("elevenlabs");
|
|
7
|
-
const auth = (options) =>
|
|
8
|
-
if ("auth" in options && options.auth)
|
|
9
|
-
return options.auth;
|
|
10
|
-
return Auth.optional("apiKey" in options ? options.apiKey : undefined, "apiKey")
|
|
11
|
-
.orElse(Auth.config("ELEVENLABS_API_KEY"))
|
|
12
|
-
.pipe(Auth.header("xi-api-key"));
|
|
13
|
-
};
|
|
8
|
+
const auth = (options) => AuthOptions.apiKey(options, "ELEVENLABS_API_KEY", Auth.header("xi-api-key"));
|
|
14
9
|
export const configure = (input = {}) => {
|
|
15
10
|
const media = MediaRoute.deployment(input, auth(input));
|
|
16
11
|
const speech = (modelID) => ElevenLabsSpeech.model({ ...media, id: modelID });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { embeddingModel as model } from "../fireworks.js";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
|
-
import {
|
|
3
|
-
import { Route
|
|
4
|
-
import { type ModelID } from "../schema/index.js";
|
|
2
|
+
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
3
|
+
import { Route } from "../route/client.js";
|
|
4
|
+
import { type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js";
|
|
5
5
|
import type { OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
6
6
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
|
-
export type Config = Omit<
|
|
7
|
+
export type Config = Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
8
8
|
readonly baseURL?: string;
|
|
9
9
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
10
10
|
};
|
|
11
11
|
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
|
|
12
|
-
readonly apiKey?: string;
|
|
12
|
+
readonly apiKey?: string | false;
|
|
13
13
|
readonly baseURL?: string;
|
|
14
14
|
};
|
|
15
15
|
export declare const route: Route<{
|
|
@@ -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,12 +365,15 @@ export declare const routes: Route<{
|
|
|
363
365
|
export declare const configure: (input?: Config) => {
|
|
364
366
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
365
367
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
368
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
366
369
|
configure: typeof configure;
|
|
367
370
|
};
|
|
368
371
|
export declare const provider: {
|
|
369
372
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
370
373
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
374
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
371
375
|
configure: typeof configure;
|
|
372
376
|
};
|
|
373
377
|
export declare const model: ProviderPackage.Model<Settings, OpenAIProviderOptionsInput>;
|
|
378
|
+
export declare const embeddingModel: (modelID: string, settings?: Settings) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
374
379
|
export * as Fireworks from "./fireworks.js";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
2
|
-
import {
|
|
2
|
+
import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js";
|
|
3
3
|
import { Route } from "../route/client.js";
|
|
4
4
|
import { Endpoint } from "../route/endpoint.js";
|
|
5
5
|
import { ProviderID } from "../schema/index.js";
|
|
6
|
+
import { bearerRouteDefaults, toConfig } from "./settings.js";
|
|
6
7
|
export const id = ProviderID.make("fireworks");
|
|
7
8
|
const baseURL = "https://api.fireworks.ai/inference/v1";
|
|
8
9
|
export const route = Route.make({
|
|
@@ -15,24 +16,26 @@ export const route = Route.make({
|
|
|
15
16
|
});
|
|
16
17
|
export const routes = [route];
|
|
17
18
|
export const configure = (input = {}) => {
|
|
18
|
-
const
|
|
19
|
-
const configured = route.with(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
const options = bearerRouteDefaults(input, "FIREWORKS_API_KEY", baseURL);
|
|
20
|
+
const configured = route.with(options);
|
|
21
|
+
const embeddingRoute = OpenAIEmbeddings.route.with({
|
|
22
|
+
provider: id,
|
|
23
|
+
endpoint: options.endpoint,
|
|
24
|
+
auth: options.auth,
|
|
25
|
+
headers: input.headers,
|
|
26
|
+
http: input.http,
|
|
23
27
|
});
|
|
24
28
|
return {
|
|
25
29
|
id,
|
|
26
|
-
model: (modelID) => configured.model({ id: modelID,
|
|
30
|
+
model: (modelID) => configured.model({ id: modelID, capabilities: { promptCacheKey: true } }),
|
|
31
|
+
embedding: (modelID, providerOptions) => embeddingRoute.model({ id: modelID, providerOptions }),
|
|
27
32
|
configure,
|
|
28
33
|
};
|
|
29
34
|
};
|
|
30
35
|
export const provider = configure();
|
|
31
|
-
export const model = (modelID,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
providerOptions,
|
|
37
|
-
}).model(modelID);
|
|
36
|
+
export const model = (modelID, settings) => configure(toConfig(settings)).model(modelID);
|
|
37
|
+
export const embeddingModel = (modelID, settings) => {
|
|
38
|
+
const input = toConfig(settings);
|
|
39
|
+
return configure(input).embedding(modelID, input.providerOptions);
|
|
40
|
+
};
|
|
38
41
|
export * as Fireworks from "./fireworks.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { embeddingModel as model } from "../google.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../../provider-package.js";
|
|
2
2
|
import type { GoogleInteractions } from "../../protocols/google-interactions.js";
|
|
3
3
|
export type Settings = ProviderPackage.Settings & GoogleInteractions.ProviderOptionsInput & {
|
|
4
|
-
readonly apiKey?: string;
|
|
4
|
+
readonly apiKey?: string | false;
|
|
5
5
|
readonly baseURL?: string;
|
|
6
6
|
};
|
|
7
7
|
export declare const model: ProviderPackage.Model<Settings, GoogleInteractions.ProviderOptionsInput>;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import { configure } from "../google.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
baseURL,
|
|
5
|
-
headers,
|
|
6
|
-
http: body === undefined ? undefined : { body },
|
|
7
|
-
providerOptions,
|
|
8
|
-
}).interactions(modelID);
|
|
2
|
+
import { toConfig } from "../settings.js";
|
|
3
|
+
export const model = (modelID, settings) => configure(toConfig(settings)).interactions(modelID);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { embeddingModel as model } from "../google-vertex.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
|
-
import { Route
|
|
3
|
-
import { type ModelID } from "../schema/index.js";
|
|
2
|
+
import { Route } from "../route/client.js";
|
|
3
|
+
import { type ModelID, type RequestOptions } from "../schema/index.js";
|
|
4
4
|
import { GoogleVertexShared } from "./google-vertex-shared.js";
|
|
5
5
|
import type { OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
6
6
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
|
-
export type Config =
|
|
7
|
+
export type Config = RequestOptions & GoogleVertexShared.OAuthOptions & {
|
|
8
8
|
readonly baseURL?: string;
|
|
9
9
|
readonly location?: string;
|
|
10
10
|
readonly project?: string;
|
|
@@ -117,6 +117,7 @@ export declare const routes: Route<{
|
|
|
117
117
|
readonly reasoning?: string | undefined;
|
|
118
118
|
readonly reasoning_text?: string | undefined;
|
|
119
119
|
readonly reasoning_details?: unknown;
|
|
120
|
+
readonly reasoning_opaque?: string | undefined;
|
|
120
121
|
})[];
|
|
121
122
|
readonly tools?: readonly ({
|
|
122
123
|
readonly type: "function";
|