@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
package/dist/providers/google.js
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
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 { Gemini } from "../protocols/gemini.js";
|
|
6
|
+
import { GoogleEmbedContent, } from "../protocols/google-embed-content.js";
|
|
5
7
|
import { GoogleInteractions } from "../protocols/google-interactions.js";
|
|
6
8
|
import { GoogleImages } from "../protocols/google-images.js";
|
|
7
9
|
import { GoogleSpeech } from "../protocols/google-speech.js";
|
|
8
10
|
import { GoogleTranscription } from "../protocols/google-transcription.js";
|
|
9
11
|
import { GoogleVideo } from "../protocols/google-video.js";
|
|
12
|
+
import { toConfig } from "./settings.js";
|
|
10
13
|
export const id = ProviderID.make("google");
|
|
11
14
|
export const routes = [Gemini.route, GoogleInteractions.route];
|
|
12
|
-
const auth = (options) =>
|
|
13
|
-
if ("auth" in options && options.auth)
|
|
14
|
-
return options.auth;
|
|
15
|
-
return Auth.optional("apiKey" in options ? options.apiKey : undefined, "apiKey")
|
|
16
|
-
.orElse(Auth.config("GOOGLE_GENERATIVE_AI_API_KEY"))
|
|
17
|
-
.pipe(Auth.header("x-goog-api-key"));
|
|
18
|
-
};
|
|
15
|
+
const auth = (options) => AuthOptions.apiKey(options, "GOOGLE_GENERATIVE_AI_API_KEY", Auth.header("x-goog-api-key"));
|
|
19
16
|
const configuredRoute = (input) => {
|
|
20
17
|
const { apiKey: _, auth: _auth, baseURL, ...rest } = input;
|
|
21
18
|
return Gemini.route.with({ ...rest, endpoint: { baseURL }, auth: auth(input) });
|
|
@@ -27,33 +24,40 @@ const interactionsRoute = (input) => {
|
|
|
27
24
|
export const configure = (input = {}) => {
|
|
28
25
|
const route = configuredRoute(input);
|
|
29
26
|
const media = MediaRoute.deployment(input, auth(input));
|
|
27
|
+
const gemini = (modelID) => route.model({ id: modelID });
|
|
28
|
+
const embeddingRoute = GoogleEmbedContent.route.with({
|
|
29
|
+
provider: id,
|
|
30
|
+
endpoint: { baseURL: input.baseURL },
|
|
31
|
+
auth: auth(input),
|
|
32
|
+
headers: input.headers,
|
|
33
|
+
http: input.http,
|
|
34
|
+
});
|
|
30
35
|
return {
|
|
31
36
|
id,
|
|
32
|
-
model:
|
|
37
|
+
model: gemini,
|
|
38
|
+
gemini,
|
|
33
39
|
interactions: (modelID) => interactionsRoute(input).model({ id: modelID }),
|
|
34
40
|
image: (modelID, providerOptions) => GoogleImages.model({ ...media, id: modelID, providerOptions }),
|
|
35
41
|
video: (modelID) => GoogleVideo.model({ ...media, id: modelID }),
|
|
36
42
|
speech: (modelID) => GoogleSpeech.model({ ...media, id: modelID }),
|
|
37
43
|
transcription: (modelID) => GoogleTranscription.model({ ...media, id: modelID }),
|
|
44
|
+
embedding: (modelID, providerOptions) => embeddingRoute.model({ id: modelID, providerOptions }),
|
|
38
45
|
configure,
|
|
39
46
|
};
|
|
40
47
|
};
|
|
41
48
|
export const provider = configure();
|
|
42
|
-
export const model = (modelID, settings) => configure(
|
|
49
|
+
export const model = (modelID, settings) => configure(toConfig(settings)).model(modelID);
|
|
43
50
|
export const imageModel = (modelID, settings) => {
|
|
44
|
-
const input =
|
|
51
|
+
const input = toConfig(settings);
|
|
45
52
|
return configure(input).image(modelID, input.providerOptions);
|
|
46
53
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
headers,
|
|
52
|
-
http: body === undefined ? undefined : { body },
|
|
53
|
-
providerOptions,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
54
|
+
export const embeddingModel = (modelID, settings) => {
|
|
55
|
+
const input = toConfig(settings);
|
|
56
|
+
return configure(input).embedding(modelID, input.providerOptions);
|
|
57
|
+
};
|
|
56
58
|
export const image = provider.image;
|
|
59
|
+
export const embedding = provider.embedding;
|
|
60
|
+
export const gemini = provider.gemini;
|
|
57
61
|
export const interactions = provider.interactions;
|
|
58
62
|
export const video = provider.video;
|
|
59
63
|
export const speech = provider.speech;
|
package/dist/providers/groq.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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 } from "../schema/index.js";
|
|
6
|
+
import { type ModelID, type RequestOptions } from "../schema/index.js";
|
|
7
7
|
import type { OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
8
8
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
9
9
|
export type ProviderOptions = Pick<OpenAIProviderOptionsInput, "reasoningEffort"> & {
|
|
@@ -13,12 +13,12 @@ export type ProviderOptions = Pick<OpenAIProviderOptionsInput, "reasoningEffort"
|
|
|
13
13
|
readonly serviceTier?: "on_demand" | "flex" | "auto" | "performance" | (string & {});
|
|
14
14
|
readonly user?: string;
|
|
15
15
|
};
|
|
16
|
-
export type Config = Omit<
|
|
16
|
+
export type Config = Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
17
17
|
readonly baseURL?: string;
|
|
18
18
|
readonly providerOptions?: ProviderOptions;
|
|
19
19
|
};
|
|
20
20
|
export type Settings = ProviderPackage.Settings & ProviderOptions & {
|
|
21
|
-
readonly apiKey?: string;
|
|
21
|
+
readonly apiKey?: string | false;
|
|
22
22
|
readonly baseURL?: string;
|
|
23
23
|
};
|
|
24
24
|
export declare const protocol: Protocol<{
|
|
@@ -121,6 +121,7 @@ export declare const protocol: Protocol<{
|
|
|
121
121
|
readonly reasoning?: string | undefined;
|
|
122
122
|
readonly reasoning_text?: string | undefined;
|
|
123
123
|
readonly reasoning_details?: unknown;
|
|
124
|
+
readonly reasoning_opaque?: string | undefined;
|
|
124
125
|
})[];
|
|
125
126
|
readonly tools?: readonly ({
|
|
126
127
|
readonly type: "function";
|
|
@@ -209,6 +210,7 @@ export declare const protocol: Protocol<{
|
|
|
209
210
|
readonly reasoning?: string | null | undefined;
|
|
210
211
|
readonly reasoning_text?: string | null | undefined;
|
|
211
212
|
readonly reasoning_details?: unknown;
|
|
213
|
+
readonly reasoning_opaque?: string | null | undefined;
|
|
212
214
|
readonly tool_calls?: readonly {
|
|
213
215
|
readonly index?: number | null | undefined;
|
|
214
216
|
readonly id?: string | null | undefined;
|
|
@@ -234,6 +236,7 @@ export declare const protocol: Protocol<{
|
|
|
234
236
|
readonly prompt_cache_hit_tokens?: number | null | undefined;
|
|
235
237
|
readonly cache_read_input_tokens?: number | null | undefined;
|
|
236
238
|
readonly cache_created_input_tokens?: number | null | undefined;
|
|
239
|
+
readonly reasoning_tokens?: number | null | undefined;
|
|
237
240
|
readonly prompt_tokens_details?: {
|
|
238
241
|
readonly [x: string]: unknown;
|
|
239
242
|
readonly cached_tokens?: number | null | undefined;
|
|
@@ -256,6 +259,7 @@ export declare const protocol: Protocol<{
|
|
|
256
259
|
readonly prompt_cache_hit_tokens?: number | null | undefined;
|
|
257
260
|
readonly cache_read_input_tokens?: number | null | undefined;
|
|
258
261
|
readonly cache_created_input_tokens?: number | null | undefined;
|
|
262
|
+
readonly reasoning_tokens?: number | null | undefined;
|
|
259
263
|
readonly prompt_tokens_details?: {
|
|
260
264
|
readonly [x: string]: unknown;
|
|
261
265
|
readonly cached_tokens?: number | null | undefined;
|
|
@@ -374,6 +378,7 @@ export declare const route: Route<{
|
|
|
374
378
|
readonly reasoning?: string | undefined;
|
|
375
379
|
readonly reasoning_text?: string | undefined;
|
|
376
380
|
readonly reasoning_details?: unknown;
|
|
381
|
+
readonly reasoning_opaque?: string | undefined;
|
|
377
382
|
})[];
|
|
378
383
|
readonly tools?: readonly ({
|
|
379
384
|
readonly type: "function";
|
package/dist/providers/groq.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
2
|
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
3
3
|
import { ProviderShared } from "../protocols/shared.js";
|
|
4
|
-
import { AuthOptions } from "../route/auth-options.js";
|
|
5
4
|
import { Route } from "../route/client.js";
|
|
6
5
|
import { Endpoint } from "../route/endpoint.js";
|
|
7
6
|
import { Protocol } from "../route/protocol.js";
|
|
8
7
|
import { ProviderID } from "../schema/index.js";
|
|
8
|
+
import { bearerRouteDefaults, toConfig } from "./settings.js";
|
|
9
9
|
export const id = ProviderID.make("groq");
|
|
10
10
|
const baseURL = "https://api.groq.com/openai/v1";
|
|
11
11
|
const Options = Schema.Struct({
|
|
@@ -43,12 +43,7 @@ export const route = Route.make({
|
|
|
43
43
|
framing: OpenAIChat.framing,
|
|
44
44
|
});
|
|
45
45
|
export const configure = (input = {}) => {
|
|
46
|
-
const
|
|
47
|
-
const configured = route.with({
|
|
48
|
-
...defaults,
|
|
49
|
-
endpoint: { baseURL: endpoint ?? baseURL },
|
|
50
|
-
auth: AuthOptions.bearer(input, "GROQ_API_KEY"),
|
|
51
|
-
});
|
|
46
|
+
const configured = route.with(bearerRouteDefaults(input, "GROQ_API_KEY", baseURL));
|
|
52
47
|
return {
|
|
53
48
|
id,
|
|
54
49
|
model: (modelID) => configured.model({
|
|
@@ -57,18 +52,12 @@ export const configure = (input = {}) => {
|
|
|
57
52
|
maxTokensField: "max_completion_tokens",
|
|
58
53
|
reasoningField: "reasoning",
|
|
59
54
|
requireReasoning: false,
|
|
60
|
-
supportsStrictMode: false,
|
|
61
55
|
},
|
|
56
|
+
capabilities: { tools: { strict: false } },
|
|
62
57
|
}),
|
|
63
58
|
configure,
|
|
64
59
|
};
|
|
65
60
|
};
|
|
66
61
|
export const provider = configure();
|
|
67
|
-
export const model = (modelID,
|
|
68
|
-
apiKey,
|
|
69
|
-
baseURL,
|
|
70
|
-
headers,
|
|
71
|
-
http: body === undefined ? undefined : { body },
|
|
72
|
-
providerOptions,
|
|
73
|
-
}).model(modelID);
|
|
62
|
+
export const model = (modelID, settings) => configure(toConfig(settings)).model(modelID);
|
|
74
63
|
export * as Groq from "./groq.js";
|
package/dist/providers/meta.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
2
|
import { AnthropicMessages } from "../protocols/anthropic-messages.js";
|
|
3
3
|
import { MetaImages } from "../protocols/meta-images.js";
|
|
4
|
-
import {
|
|
5
|
-
import { Route
|
|
6
|
-
import { ToolDefinition, type ModelID, type OpenString } from "../schema/index.js";
|
|
4
|
+
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
5
|
+
import { Route } from "../route/client.js";
|
|
6
|
+
import { ToolDefinition, type ModelID, type OpenString, type RequestOptions } from "../schema/index.js";
|
|
7
7
|
import type { OpenResponsesProviderOptionsInput } from "./open-responses-options.js";
|
|
8
8
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
9
9
|
export type ProviderOptionsInput = OpenResponsesProviderOptionsInput & Pick<AnthropicMessages.OptionsInput, "thinking" | "effort">;
|
|
@@ -30,12 +30,12 @@ export interface ImageGenerationOptions {
|
|
|
30
30
|
readonly enableShell?: boolean;
|
|
31
31
|
}
|
|
32
32
|
export declare const imageGeneration: (options?: ImageGenerationOptions) => ToolDefinition;
|
|
33
|
-
export type Config = Omit<
|
|
33
|
+
export type Config = Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
34
34
|
readonly baseURL?: string;
|
|
35
35
|
readonly providerOptions?: ProviderOptionsInput;
|
|
36
36
|
};
|
|
37
37
|
export type Settings = ProviderPackage.Settings & ProviderOptionsInput & {
|
|
38
|
-
readonly apiKey?: string;
|
|
38
|
+
readonly apiKey?: string | false;
|
|
39
39
|
readonly baseURL?: string;
|
|
40
40
|
};
|
|
41
41
|
export declare const routes: (Route<{
|
|
@@ -335,6 +335,7 @@ export declare const routes: (Route<{
|
|
|
335
335
|
readonly reasoning?: string | undefined;
|
|
336
336
|
readonly reasoning_text?: string | undefined;
|
|
337
337
|
readonly reasoning_details?: unknown;
|
|
338
|
+
readonly reasoning_opaque?: string | undefined;
|
|
338
339
|
})[];
|
|
339
340
|
readonly tools?: readonly ({
|
|
340
341
|
readonly type: "function";
|
package/dist/providers/meta.js
CHANGED
|
@@ -3,11 +3,11 @@ import { AnthropicMessages } from "../protocols/anthropic-messages.js";
|
|
|
3
3
|
import { MetaResponses } from "../protocols/meta-responses.js";
|
|
4
4
|
import { MetaMessages } from "../protocols/meta-messages.js";
|
|
5
5
|
import { MetaImages } from "../protocols/meta-images.js";
|
|
6
|
-
import { AuthOptions } from "../route/auth-options.js";
|
|
7
6
|
import { Route } from "../route/client.js";
|
|
8
7
|
import { Endpoint } from "../route/endpoint.js";
|
|
9
8
|
import { MediaRoute } from "../route/media.js";
|
|
10
9
|
import { ProviderID, ToolDefinition } from "../schema/index.js";
|
|
10
|
+
import { bearerRouteDefaults, toConfig } from "./settings.js";
|
|
11
11
|
export const id = ProviderID.make("meta");
|
|
12
12
|
const baseURL = "https://api.meta.ai/v1";
|
|
13
13
|
export const webSearch = (options = {}) => ToolDefinition.make({
|
|
@@ -46,7 +46,7 @@ const responsesRoute = Route.make({
|
|
|
46
46
|
endpoint: Endpoint.path("/responses", { baseURL }),
|
|
47
47
|
// Meta Responses does not support WebSocket upgrades; always use HTTP/SSE.
|
|
48
48
|
transport: MetaResponses.httpTransport,
|
|
49
|
-
|
|
49
|
+
options: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } },
|
|
50
50
|
});
|
|
51
51
|
const chatRoute = Route.make({
|
|
52
52
|
id: "meta-chat",
|
|
@@ -63,23 +63,19 @@ const messagesRoute = Route.make({
|
|
|
63
63
|
protocol: MetaMessages.protocol,
|
|
64
64
|
endpoint: Endpoint.path("/messages", { baseURL }),
|
|
65
65
|
framing: AnthropicMessages.framing,
|
|
66
|
-
|
|
66
|
+
options: { providerOptions: { thinking: { type: "adaptive", display: "omitted" } } },
|
|
67
67
|
});
|
|
68
68
|
export const routes = [responsesRoute, chatRoute, messagesRoute];
|
|
69
69
|
export const configure = (input = {}) => {
|
|
70
|
-
const
|
|
71
|
-
const options = {
|
|
72
|
-
...defaults,
|
|
73
|
-
endpoint: { baseURL: endpoint ?? baseURL },
|
|
74
|
-
auth: AuthOptions.bearer(input, "META_API_KEY"),
|
|
75
|
-
};
|
|
70
|
+
const options = bearerRouteDefaults(input, "META_API_KEY", baseURL);
|
|
76
71
|
const configuredResponses = responsesRoute.with(options);
|
|
77
72
|
const configuredChat = chatRoute.with(options);
|
|
78
73
|
const configuredMessages = messagesRoute.with(options);
|
|
79
74
|
const responses = (modelID) => configuredResponses.model({ id: modelID });
|
|
80
75
|
const chat = (modelID) => configuredChat.model({
|
|
81
76
|
id: modelID,
|
|
82
|
-
compatibility: { maxTokensField: "max_completion_tokens"
|
|
77
|
+
compatibility: { maxTokensField: "max_completion_tokens" },
|
|
78
|
+
capabilities: { promptCacheKey: true },
|
|
83
79
|
});
|
|
84
80
|
const messages = (modelID) => configuredMessages.model({
|
|
85
81
|
id: modelID,
|
|
@@ -93,17 +89,8 @@ export const responses = provider.responses;
|
|
|
93
89
|
export const chat = provider.chat;
|
|
94
90
|
export const messages = provider.messages;
|
|
95
91
|
export const image = provider.image;
|
|
96
|
-
export const model = (modelID, settings) =>
|
|
97
|
-
export const chatModel = (modelID, settings) =>
|
|
98
|
-
export const messagesModel = (modelID, settings) =>
|
|
99
|
-
export const imageModel = (modelID, settings) =>
|
|
100
|
-
function fromSettings({ apiKey, baseURL, body, headers, ...providerOptions } = {}) {
|
|
101
|
-
return configure({
|
|
102
|
-
apiKey,
|
|
103
|
-
baseURL,
|
|
104
|
-
headers,
|
|
105
|
-
http: body === undefined ? undefined : { body },
|
|
106
|
-
providerOptions,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
92
|
+
export const model = (modelID, settings) => configure(toConfig(settings)).responses(modelID);
|
|
93
|
+
export const chatModel = (modelID, settings) => configure(toConfig(settings)).chat(modelID);
|
|
94
|
+
export const messagesModel = (modelID, settings) => configure(toConfig(settings)).messages(modelID);
|
|
95
|
+
export const imageModel = (modelID, settings) => configure(toConfig(settings)).image(modelID);
|
|
109
96
|
export * as Meta from "./meta.js";
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import { MiniMax } from "../minimax.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
baseURL,
|
|
5
|
-
headers,
|
|
6
|
-
http: body === undefined ? undefined : { body },
|
|
7
|
-
providerOptions,
|
|
8
|
-
}).chat(modelID);
|
|
2
|
+
import { toConfig } from "../settings.js";
|
|
3
|
+
export const model = (modelID, settings) => MiniMax.configure(toConfig(settings)).chat(modelID);
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import { MiniMax } from "../minimax.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
baseURL,
|
|
5
|
-
headers,
|
|
6
|
-
http: body === undefined ? undefined : { body },
|
|
7
|
-
providerOptions,
|
|
8
|
-
}).responses(modelID);
|
|
2
|
+
import { toConfig } from "../settings.js";
|
|
3
|
+
export const model = (modelID, settings) => MiniMax.configure(toConfig(settings)).responses(modelID);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
2
|
import { AnthropicMessages } from "../protocols/anthropic-messages.js";
|
|
3
3
|
import { type MiniMaxImageOptions } from "../protocols/minimax-images.js";
|
|
4
|
-
import {
|
|
5
|
-
import { Route
|
|
6
|
-
import { type ModelID, type ProviderOptions } from "../schema/index.js";
|
|
4
|
+
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
5
|
+
import { Route } from "../route/client.js";
|
|
6
|
+
import { type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js";
|
|
7
7
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
8
8
|
export type MessagesOptionsInput = {
|
|
9
9
|
/** M3 defaults to disabled; M2.x always thinks. */
|
|
@@ -25,13 +25,13 @@ export type ResponsesOptionsInput = {
|
|
|
25
25
|
readonly reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | (string & {});
|
|
26
26
|
};
|
|
27
27
|
export type ProviderOptionsInput = MessagesOptionsInput | ChatOptionsInput | ResponsesOptionsInput;
|
|
28
|
-
export type Config = Omit<
|
|
28
|
+
export type Config = Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
29
29
|
/** Overrides the selected API's base URL, including its version prefix. */
|
|
30
30
|
readonly baseURL?: string;
|
|
31
31
|
readonly providerOptions?: ProviderOptionsInput;
|
|
32
32
|
};
|
|
33
33
|
export type Settings<Options = MessagesOptionsInput> = ProviderPackage.Settings & Options & {
|
|
34
|
-
readonly apiKey?: string;
|
|
34
|
+
readonly apiKey?: string | false;
|
|
35
35
|
readonly baseURL?: string;
|
|
36
36
|
};
|
|
37
37
|
export type { MiniMaxImageOptions };
|
|
@@ -639,6 +639,7 @@ export declare const routes: (Route<{
|
|
|
639
639
|
readonly reasoning?: string | undefined;
|
|
640
640
|
readonly reasoning_text?: string | undefined;
|
|
641
641
|
readonly reasoning_details?: unknown;
|
|
642
|
+
readonly reasoning_opaque?: string | undefined;
|
|
642
643
|
})[];
|
|
643
644
|
readonly tools?: readonly ({
|
|
644
645
|
readonly type: "function";
|
|
@@ -4,13 +4,13 @@ import { MiniMaxImages } from "../protocols/minimax-images.js";
|
|
|
4
4
|
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
5
5
|
import { OpenResponses } from "../protocols/open-responses.js";
|
|
6
6
|
import { ProviderShared } from "../protocols/shared.js";
|
|
7
|
-
import { AuthOptions } from "../route/auth-options.js";
|
|
8
7
|
import { Route } from "../route/client.js";
|
|
9
8
|
import { Endpoint } from "../route/endpoint.js";
|
|
10
9
|
import { Framing } from "../route/framing.js";
|
|
11
10
|
import { MediaRoute } from "../route/media.js";
|
|
12
11
|
import { Protocol } from "../route/protocol.js";
|
|
13
|
-
import { ProviderID } from "../schema/index.js";
|
|
12
|
+
import { ProviderID, } from "../schema/index.js";
|
|
13
|
+
import { bearerRouteDefaults, toConfig } from "./settings.js";
|
|
14
14
|
export const id = ProviderID.make("minimax");
|
|
15
15
|
const ChatOptions = Schema.Struct({
|
|
16
16
|
thinking: Schema.optional(Schema.Struct({ type: Schema.String })),
|
|
@@ -63,43 +63,28 @@ const responsesRoute = Route.make({
|
|
|
63
63
|
});
|
|
64
64
|
export const routes = [messagesRoute, chatRoute, responsesRoute];
|
|
65
65
|
export const configure = (input = {}) => {
|
|
66
|
-
const
|
|
67
|
-
const auth = AuthOptions.bearer(input, "MINIMAX_API_KEY");
|
|
68
|
-
const defaults = {
|
|
69
|
-
...rest,
|
|
70
|
-
endpoint: baseURL === undefined ? undefined : { baseURL },
|
|
71
|
-
auth,
|
|
72
|
-
};
|
|
66
|
+
const defaults = bearerRouteDefaults(input, "MINIMAX_API_KEY");
|
|
73
67
|
const messages = (modelID) => messagesRoute.with(defaults).model({
|
|
74
68
|
id: modelID,
|
|
75
69
|
compatibility: { requireSignature: false },
|
|
76
70
|
});
|
|
77
71
|
const chat = (modelID) => chatRoute.with(defaults).model({
|
|
78
72
|
id: modelID,
|
|
79
|
-
|
|
73
|
+
capabilities: { tools: { strict: false } },
|
|
80
74
|
});
|
|
81
75
|
const responses = (modelID) => responsesRoute.with(defaults).model({ id: modelID });
|
|
82
|
-
const media = MediaRoute.deployment(input, auth);
|
|
76
|
+
const media = MediaRoute.deployment(input, defaults.auth);
|
|
83
77
|
const image = (modelID, providerOptions) => MiniMaxImages.model({ ...media, id: modelID, providerOptions });
|
|
84
78
|
return { id, model: messages, messages, chat, responses, image, configure };
|
|
85
79
|
};
|
|
86
80
|
export const provider = configure();
|
|
87
|
-
export const model = (modelID, settings) => configure(
|
|
81
|
+
export const model = (modelID, settings) => configure(toConfig(settings)).model(modelID);
|
|
88
82
|
export const imageModel = (modelID, settings) => {
|
|
89
|
-
const input =
|
|
83
|
+
const input = toConfig(settings);
|
|
90
84
|
return configure(input).image(modelID, input.providerOptions);
|
|
91
85
|
};
|
|
92
86
|
export const messages = provider.messages;
|
|
93
87
|
export const chat = provider.chat;
|
|
94
88
|
export const responses = provider.responses;
|
|
95
89
|
export const image = provider.image;
|
|
96
|
-
function config({ apiKey, baseURL, body, headers, ...providerOptions } = {}) {
|
|
97
|
-
return {
|
|
98
|
-
apiKey,
|
|
99
|
-
baseURL,
|
|
100
|
-
headers,
|
|
101
|
-
http: body === undefined ? undefined : { body },
|
|
102
|
-
providerOptions,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
90
|
export * as MiniMax from "./minimax.js";
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
2
|
import { MistralChat } from "../protocols/mistral-chat.js";
|
|
3
|
-
import {
|
|
4
|
-
import type
|
|
5
|
-
import { type ModelID } from "../schema/index.js";
|
|
3
|
+
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
4
|
+
import { type ModelID, type RequestOptions } from "../schema/index.js";
|
|
6
5
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
6
|
export type ProviderOptions = MistralChat.ProviderOptionsInput;
|
|
8
|
-
export type Config = Omit<
|
|
7
|
+
export type Config = Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
9
8
|
readonly baseURL?: string;
|
|
10
9
|
readonly providerOptions?: ProviderOptions;
|
|
11
10
|
};
|
|
12
11
|
export type Settings = ProviderPackage.Settings & ProviderOptions & {
|
|
13
|
-
readonly apiKey?: string;
|
|
12
|
+
readonly apiKey?: string | false;
|
|
14
13
|
readonly baseURL?: string;
|
|
15
14
|
};
|
|
16
|
-
export declare const route: import("../route
|
|
15
|
+
export declare const route: import("../route.js").Route<{
|
|
17
16
|
readonly model: string;
|
|
18
17
|
readonly messages: readonly ({
|
|
19
18
|
readonly role: "system";
|
|
@@ -103,8 +102,8 @@ export declare const route: import("../route/client.js").Route<{
|
|
|
103
102
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
104
103
|
readonly reasoning_effort?: string | undefined;
|
|
105
104
|
readonly prompt_mode?: "reasoning" | undefined;
|
|
106
|
-
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route
|
|
107
|
-
export declare const routes: import("../route
|
|
105
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route.js").CompactionOperations | undefined>;
|
|
106
|
+
export declare const routes: import("../route.js").Route<{
|
|
108
107
|
readonly model: string;
|
|
109
108
|
readonly messages: readonly ({
|
|
110
109
|
readonly role: "system";
|
|
@@ -194,15 +193,15 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
194
193
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
195
194
|
readonly reasoning_effort?: string | undefined;
|
|
196
195
|
readonly prompt_mode?: "reasoning" | undefined;
|
|
197
|
-
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route
|
|
196
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route.js").CompactionOperations | undefined>[];
|
|
198
197
|
export declare const configure: (input?: Config) => {
|
|
199
198
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
200
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<MistralChat.ProviderOptionsInput, import("../route
|
|
199
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<MistralChat.ProviderOptionsInput, import("../route.js").CompactionOperations | undefined>;
|
|
201
200
|
configure: typeof configure;
|
|
202
201
|
};
|
|
203
202
|
export declare const provider: {
|
|
204
203
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
205
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<MistralChat.ProviderOptionsInput, import("../route
|
|
204
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<MistralChat.ProviderOptionsInput, import("../route.js").CompactionOperations | undefined>;
|
|
206
205
|
configure: typeof configure;
|
|
207
206
|
};
|
|
208
207
|
export declare const model: ProviderPackage.Model<Settings, ProviderOptions>;
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { MistralChat } from "../protocols/mistral-chat.js";
|
|
2
|
-
import { AuthOptions } from "../route/auth-options.js";
|
|
3
2
|
import { ProviderID } from "../schema/index.js";
|
|
3
|
+
import { bearerRouteDefaults, toConfig } from "./settings.js";
|
|
4
4
|
export const id = ProviderID.make("mistral");
|
|
5
5
|
export const route = MistralChat.route;
|
|
6
6
|
export const routes = [route];
|
|
7
7
|
export const configure = (input = {}) => {
|
|
8
|
-
const
|
|
9
|
-
const configured = route.with({
|
|
10
|
-
...defaults,
|
|
11
|
-
endpoint: { baseURL: baseURL ?? MistralChat.DEFAULT_BASE_URL },
|
|
12
|
-
auth: AuthOptions.bearer(input, "MISTRAL_API_KEY"),
|
|
13
|
-
});
|
|
8
|
+
const configured = route.with(bearerRouteDefaults(input, "MISTRAL_API_KEY", MistralChat.DEFAULT_BASE_URL));
|
|
14
9
|
return {
|
|
15
10
|
id,
|
|
16
11
|
model: (modelID) => configured.model({ id: modelID }),
|
|
@@ -18,11 +13,5 @@ export const configure = (input = {}) => {
|
|
|
18
13
|
};
|
|
19
14
|
};
|
|
20
15
|
export const provider = configure();
|
|
21
|
-
export const model = (modelID,
|
|
22
|
-
apiKey,
|
|
23
|
-
baseURL,
|
|
24
|
-
headers,
|
|
25
|
-
http: body === undefined ? undefined : { body },
|
|
26
|
-
providerOptions,
|
|
27
|
-
}).model(modelID);
|
|
16
|
+
export const model = (modelID, settings) => configure(toConfig(settings)).model(modelID);
|
|
28
17
|
export * as Mistral from "./mistral.js";
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import { Moonshot } from "../moonshot.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
baseURL,
|
|
5
|
-
headers,
|
|
6
|
-
http: body === undefined ? undefined : { body },
|
|
7
|
-
providerOptions,
|
|
8
|
-
}).messages(modelID);
|
|
2
|
+
import { toConfig } from "../settings.js";
|
|
3
|
+
export const model = (modelID, settings) => Moonshot.configure(toConfig(settings)).messages(modelID);
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import { Moonshot } from "../moonshot.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
baseURL,
|
|
5
|
-
headers,
|
|
6
|
-
http: body === undefined ? undefined : { body },
|
|
7
|
-
providerOptions,
|
|
8
|
-
}).responses(modelID);
|
|
2
|
+
import { toConfig } from "../settings.js";
|
|
3
|
+
export const model = (modelID, settings) => Moonshot.configure(toConfig(settings)).responses(modelID);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
2
|
import { AnthropicMessages } from "../protocols/anthropic-messages.js";
|
|
3
|
-
import {
|
|
4
|
-
import { Route
|
|
5
|
-
import { type ModelID } from "../schema/index.js";
|
|
3
|
+
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
4
|
+
import { Route } from "../route/client.js";
|
|
5
|
+
import { type ModelID, type RequestOptions } from "../schema/index.js";
|
|
6
6
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
7
|
export type ReasoningEffort = "low" | "high" | "max" | (string & {});
|
|
8
8
|
export type ChatOptionsInput = {
|
|
@@ -22,13 +22,13 @@ export type ResponsesOptionsInput = {
|
|
|
22
22
|
readonly reasoningEffort?: ReasoningEffort;
|
|
23
23
|
readonly safetyIdentifier?: string;
|
|
24
24
|
};
|
|
25
|
-
export type Config = Omit<
|
|
25
|
+
export type Config = Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
26
26
|
/** Overrides the selected API's base URL, including its version prefix. */
|
|
27
27
|
readonly baseURL?: string;
|
|
28
28
|
readonly providerOptions?: ChatOptionsInput | MessagesOptionsInput | ResponsesOptionsInput;
|
|
29
29
|
};
|
|
30
30
|
export type Settings<Options = ChatOptionsInput> = ProviderPackage.Settings & Options & {
|
|
31
|
-
readonly apiKey?: string;
|
|
31
|
+
readonly apiKey?: string | false;
|
|
32
32
|
readonly baseURL?: string;
|
|
33
33
|
};
|
|
34
34
|
export declare const routes: (Route<{
|
|
@@ -635,6 +635,7 @@ export declare const routes: (Route<{
|
|
|
635
635
|
readonly reasoning?: string | undefined;
|
|
636
636
|
readonly reasoning_text?: string | undefined;
|
|
637
637
|
readonly reasoning_details?: unknown;
|
|
638
|
+
readonly reasoning_opaque?: string | undefined;
|
|
638
639
|
})[];
|
|
639
640
|
readonly tools?: readonly ({
|
|
640
641
|
readonly type: "function";
|
|
@@ -3,12 +3,12 @@ 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 { ProviderShared } from "../protocols/shared.js";
|
|
6
|
-
import { AuthOptions } from "../route/auth-options.js";
|
|
7
6
|
import { Route } from "../route/client.js";
|
|
8
7
|
import { Endpoint } from "../route/endpoint.js";
|
|
9
8
|
import { Framing } from "../route/framing.js";
|
|
10
9
|
import { Protocol } from "../route/protocol.js";
|
|
11
10
|
import { ProviderID } from "../schema/index.js";
|
|
11
|
+
import { bearerRouteDefaults, toConfig } from "./settings.js";
|
|
12
12
|
export const id = ProviderID.make("moonshotai");
|
|
13
13
|
const ChatOptions = Schema.Struct({
|
|
14
14
|
reasoningEffort: Schema.optional(Schema.String),
|
|
@@ -51,21 +51,15 @@ const responsesRoute = Route.make({
|
|
|
51
51
|
});
|
|
52
52
|
export const routes = [chatRoute, messagesRoute, responsesRoute];
|
|
53
53
|
export const configure = (input = {}) => {
|
|
54
|
-
const
|
|
55
|
-
const defaults = {
|
|
56
|
-
...rest,
|
|
57
|
-
endpoint: baseURL === undefined ? undefined : { baseURL },
|
|
58
|
-
auth: AuthOptions.bearer(input, ["MOONSHOT_API_KEY", "MOONSHOTAI_API_KEY"]),
|
|
59
|
-
};
|
|
54
|
+
const defaults = bearerRouteDefaults(input, ["MOONSHOT_API_KEY", "MOONSHOTAI_API_KEY"]);
|
|
60
55
|
const chat = (modelID) => chatRoute.with(defaults).model({
|
|
61
56
|
id: modelID,
|
|
62
57
|
compatibility: {
|
|
63
58
|
maxTokensField: "max_tokens",
|
|
64
|
-
supportsStrictMode: false,
|
|
65
|
-
supportsPromptCacheKey: true,
|
|
66
59
|
sanitizer: "moonshot",
|
|
67
60
|
reasoningField: "reasoning_content",
|
|
68
61
|
},
|
|
62
|
+
capabilities: { tools: { strict: false }, promptCacheKey: true },
|
|
69
63
|
});
|
|
70
64
|
const messages = (modelID) => messagesRoute.with(defaults).model({
|
|
71
65
|
id: modelID,
|
|
@@ -80,11 +74,5 @@ export const provider = configure();
|
|
|
80
74
|
export const chat = provider.chat;
|
|
81
75
|
export const messages = provider.messages;
|
|
82
76
|
export const responses = provider.responses;
|
|
83
|
-
export const model = (modelID,
|
|
84
|
-
apiKey,
|
|
85
|
-
baseURL,
|
|
86
|
-
headers,
|
|
87
|
-
http: body === undefined ? undefined : { body },
|
|
88
|
-
providerOptions,
|
|
89
|
-
}).model(modelID);
|
|
77
|
+
export const model = (modelID, settings) => configure(toConfig(settings)).model(modelID);
|
|
90
78
|
export * as Moonshot from "./moonshot.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { embeddingModel as model } from "../openai.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { embeddingModel as model } from "../openai-compatible.js";
|