@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,7 +1,7 @@
|
|
|
1
1
|
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
2
2
|
import { Route } from "../route/client.js";
|
|
3
3
|
import { Endpoint } from "../route/endpoint.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ProviderID } from "../schema/index.js";
|
|
5
5
|
import { GoogleVertexShared } from "./google-vertex-shared.js";
|
|
6
6
|
export const id = ProviderID.make("google-vertex");
|
|
7
7
|
const route = Route.make({
|
|
@@ -13,21 +13,7 @@ const route = Route.make({
|
|
|
13
13
|
framing: OpenAIChat.framing,
|
|
14
14
|
});
|
|
15
15
|
export const routes = [route];
|
|
16
|
-
const configuredRoute = (input) => {
|
|
17
|
-
if ("apiKey" in input && input.apiKey !== undefined)
|
|
18
|
-
throw new ProviderConfigurationError({ provider: id, message: "Google Vertex Chat does not support API keys" });
|
|
19
|
-
const { accessToken: _accessToken, auth: _auth, baseURL, location: inputLocation, project: inputProject, ...rest } = input;
|
|
20
|
-
const location = GoogleVertexShared.location(inputLocation);
|
|
21
|
-
const project = GoogleVertexShared.project(inputProject);
|
|
22
|
-
return route.with({
|
|
23
|
-
...rest,
|
|
24
|
-
endpoint: {
|
|
25
|
-
baseURL: baseURL ??
|
|
26
|
-
`https://aiplatform.googleapis.com/v1/projects/${GoogleVertexShared.requireProject(project)}/locations/${location}/endpoints/openapi`,
|
|
27
|
-
},
|
|
28
|
-
auth: GoogleVertexShared.oauth(input, project),
|
|
29
|
-
});
|
|
30
|
-
};
|
|
16
|
+
const configuredRoute = (input) => GoogleVertexShared.oauthRoute(route, "Chat", input, (project, location) => `https://aiplatform.googleapis.com/v1/projects/${project}/locations/${location}/endpoints/openapi`);
|
|
31
17
|
export const configure = (input = {}) => {
|
|
32
18
|
const route = configuredRoute(input);
|
|
33
19
|
return {
|
|
@@ -40,16 +26,4 @@ export const provider = {
|
|
|
40
26
|
id,
|
|
41
27
|
configure,
|
|
42
28
|
};
|
|
43
|
-
export const model = (modelID,
|
|
44
|
-
if (apiKey !== undefined)
|
|
45
|
-
throw new ProviderConfigurationError({ provider: id, message: "Google Vertex Chat does not support API keys" });
|
|
46
|
-
return configure({
|
|
47
|
-
accessToken,
|
|
48
|
-
baseURL,
|
|
49
|
-
headers,
|
|
50
|
-
http: body === undefined ? undefined : { body },
|
|
51
|
-
location,
|
|
52
|
-
project,
|
|
53
|
-
providerOptions,
|
|
54
|
-
}).model(modelID);
|
|
55
|
-
};
|
|
29
|
+
export const model = (modelID, settings = {}) => configure(GoogleVertexShared.oauthSettings("Chat", settings)).model(modelID);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
2
|
import { GoogleInteractions } from "../protocols/google-interactions.js";
|
|
3
|
-
import { Route
|
|
4
|
-
import { type ModelID } from "../schema/index.js";
|
|
3
|
+
import { Route } from "../route/client.js";
|
|
4
|
+
import { type ModelID, type RequestOptions } from "../schema/index.js";
|
|
5
5
|
import { GoogleVertexShared } from "./google-vertex-shared.js";
|
|
6
6
|
export type GoogleInteractionsOptionsInput = GoogleInteractions.OptionsInput;
|
|
7
7
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
8
|
-
export type Config =
|
|
8
|
+
export type Config = RequestOptions & GoogleVertexShared.ApiKeyOptions & {
|
|
9
9
|
readonly baseURL?: string;
|
|
10
10
|
readonly location?: string;
|
|
11
11
|
readonly project?: string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
2
|
import { AnthropicMessages } from "../protocols/anthropic-messages.js";
|
|
3
|
-
import { Route
|
|
4
|
-
import { type ModelID } from "../schema/index.js";
|
|
3
|
+
import { Route } from "../route/client.js";
|
|
4
|
+
import { type ModelID, type RequestOptions } from "../schema/index.js";
|
|
5
5
|
import { GoogleVertexShared } from "./google-vertex-shared.js";
|
|
6
6
|
export type AnthropicOptionsInput = AnthropicMessages.OptionsInput;
|
|
7
7
|
export type AnthropicProviderOptionsInput = AnthropicMessages.ProviderOptionsInput;
|
|
8
8
|
export type AnthropicThinkingInput = AnthropicMessages.ThinkingInput;
|
|
9
9
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
10
|
-
export type Config =
|
|
10
|
+
export type Config = RequestOptions & GoogleVertexShared.OAuthOptions & {
|
|
11
11
|
readonly baseURL?: string;
|
|
12
12
|
readonly location?: string;
|
|
13
13
|
readonly project?: string;
|
|
@@ -4,7 +4,7 @@ import { Auth } from "../route/auth.js";
|
|
|
4
4
|
import { Route } from "../route/client.js";
|
|
5
5
|
import { Endpoint } from "../route/endpoint.js";
|
|
6
6
|
import { Protocol } from "../route/protocol.js";
|
|
7
|
-
import {
|
|
7
|
+
import { ProviderID } from "../schema/index.js";
|
|
8
8
|
import { GoogleVertexShared } from "./google-vertex-shared.js";
|
|
9
9
|
const VERSION = "vertex-2023-10-16";
|
|
10
10
|
const HEADER_VERSION = "2023-06-01";
|
|
@@ -34,21 +34,7 @@ const route = Route.make({
|
|
|
34
34
|
headers: () => ({ "anthropic-version": HEADER_VERSION }),
|
|
35
35
|
});
|
|
36
36
|
export const routes = [route];
|
|
37
|
-
const configuredRoute = (input) => {
|
|
38
|
-
if ("apiKey" in input && input.apiKey !== undefined)
|
|
39
|
-
throw new ProviderConfigurationError({ provider: id, message: "Google Vertex Messages does not support API keys" });
|
|
40
|
-
const { accessToken: _accessToken, auth: _auth, baseURL, location: inputLocation, project: inputProject, ...rest } = input;
|
|
41
|
-
const location = GoogleVertexShared.location(inputLocation);
|
|
42
|
-
const project = GoogleVertexShared.project(inputProject);
|
|
43
|
-
return route.with({
|
|
44
|
-
...rest,
|
|
45
|
-
endpoint: {
|
|
46
|
-
baseURL: baseURL ??
|
|
47
|
-
`https://${GoogleVertexShared.host(location)}/v1/projects/${GoogleVertexShared.requireProject(project)}/locations/${location}/publishers/anthropic/models`,
|
|
48
|
-
},
|
|
49
|
-
auth: GoogleVertexShared.oauth(input, project),
|
|
50
|
-
});
|
|
51
|
-
};
|
|
37
|
+
const configuredRoute = (input) => GoogleVertexShared.oauthRoute(route, "Messages", input, (project, location) => `https://${GoogleVertexShared.host(location)}/v1/projects/${project}/locations/${location}/publishers/anthropic/models`);
|
|
52
38
|
export const configure = (input = {}) => {
|
|
53
39
|
const route = configuredRoute(input);
|
|
54
40
|
return {
|
|
@@ -61,16 +47,4 @@ export const provider = {
|
|
|
61
47
|
id,
|
|
62
48
|
configure,
|
|
63
49
|
};
|
|
64
|
-
export const model = (modelID,
|
|
65
|
-
if (apiKey !== undefined)
|
|
66
|
-
throw new ProviderConfigurationError({ provider: id, message: "Google Vertex Messages does not support API keys" });
|
|
67
|
-
return configure({
|
|
68
|
-
accessToken,
|
|
69
|
-
baseURL,
|
|
70
|
-
headers,
|
|
71
|
-
http: body === undefined ? undefined : { body },
|
|
72
|
-
location,
|
|
73
|
-
project,
|
|
74
|
-
providerOptions,
|
|
75
|
-
}).model(modelID);
|
|
76
|
-
};
|
|
50
|
+
export const model = (modelID, settings = {}) => configure(GoogleVertexShared.oauthSettings("Messages", settings)).model(modelID);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
2
|
import { MistralChat } from "../protocols/mistral-chat.js";
|
|
3
|
-
import { Route
|
|
3
|
+
import { Route } from "../route/client.js";
|
|
4
4
|
import { HttpTransport } from "../route/transport/index.js";
|
|
5
|
-
import { type ModelID } from "../schema/index.js";
|
|
5
|
+
import { type ModelID, type RequestOptions } from "../schema/index.js";
|
|
6
6
|
import { GoogleVertexShared } from "./google-vertex-shared.js";
|
|
7
7
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
8
|
-
export type Config =
|
|
8
|
+
export type Config = RequestOptions & GoogleVertexShared.OAuthOptions & {
|
|
9
9
|
readonly baseURL?: string;
|
|
10
10
|
readonly location?: string;
|
|
11
11
|
readonly project?: string;
|
|
@@ -5,7 +5,7 @@ import { Route } from "../route/client.js";
|
|
|
5
5
|
import { Endpoint } from "../route/endpoint.js";
|
|
6
6
|
import { Protocol } from "../route/protocol.js";
|
|
7
7
|
import { HttpTransport } from "../route/transport/index.js";
|
|
8
|
-
import {
|
|
8
|
+
import { ProviderID } from "../schema/index.js";
|
|
9
9
|
import { GoogleVertexShared } from "./google-vertex-shared.js";
|
|
10
10
|
export const id = ProviderID.make("google-vertex");
|
|
11
11
|
// Mistral on Vertex takes the Mistral chat body, model included, through the publisher's streamRawPredict method.
|
|
@@ -27,21 +27,7 @@ const route = Route.make({
|
|
|
27
27
|
transport: HttpTransport.sseJson.with().with({ framing: MistralChat.framing }),
|
|
28
28
|
});
|
|
29
29
|
export const routes = [route];
|
|
30
|
-
const configuredRoute = (input) => {
|
|
31
|
-
if ("apiKey" in input && input.apiKey !== undefined)
|
|
32
|
-
throw new ProviderConfigurationError({ provider: id, message: "Google Vertex Mistral does not support API keys" });
|
|
33
|
-
const { accessToken: _accessToken, auth: _auth, baseURL, location: inputLocation, project: inputProject, ...rest } = input;
|
|
34
|
-
const location = GoogleVertexShared.location(inputLocation);
|
|
35
|
-
const project = GoogleVertexShared.project(inputProject);
|
|
36
|
-
return route.with({
|
|
37
|
-
...rest,
|
|
38
|
-
endpoint: {
|
|
39
|
-
baseURL: baseURL ??
|
|
40
|
-
`https://${GoogleVertexShared.host(location)}/v1/projects/${GoogleVertexShared.requireProject(project)}/locations/${location}/publishers/mistralai/models`,
|
|
41
|
-
},
|
|
42
|
-
auth: GoogleVertexShared.oauth(input, project),
|
|
43
|
-
});
|
|
44
|
-
};
|
|
30
|
+
const configuredRoute = (input) => GoogleVertexShared.oauthRoute(route, "Mistral", input, (project, location) => `https://${GoogleVertexShared.host(location)}/v1/projects/${project}/locations/${location}/publishers/mistralai/models`);
|
|
45
31
|
export const configure = (input = {}) => {
|
|
46
32
|
const route = configuredRoute(input);
|
|
47
33
|
return {
|
|
@@ -54,16 +40,4 @@ export const provider = {
|
|
|
54
40
|
id,
|
|
55
41
|
configure,
|
|
56
42
|
};
|
|
57
|
-
export const model = (modelID,
|
|
58
|
-
if (apiKey !== undefined)
|
|
59
|
-
throw new ProviderConfigurationError({ provider: id, message: "Google Vertex Mistral does not support API keys" });
|
|
60
|
-
return configure({
|
|
61
|
-
accessToken,
|
|
62
|
-
baseURL,
|
|
63
|
-
headers,
|
|
64
|
-
http: body === undefined ? undefined : { body },
|
|
65
|
-
location,
|
|
66
|
-
project,
|
|
67
|
-
providerOptions,
|
|
68
|
-
}).model(modelID);
|
|
69
|
-
};
|
|
43
|
+
export const model = (modelID, settings = {}) => configure(GoogleVertexShared.oauthSettings("Mistral", settings)).model(modelID);
|
|
@@ -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 { OpenResponsesProviderOptionsInput } from "./open-responses-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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenResponses } from "../protocols/open-responses.js";
|
|
2
2
|
import { Route } from "../route/client.js";
|
|
3
3
|
import { Endpoint } from "../route/endpoint.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ProviderID } from "../schema/index.js";
|
|
5
5
|
import { GoogleVertexShared } from "./google-vertex-shared.js";
|
|
6
6
|
export const id = ProviderID.make("google-vertex");
|
|
7
7
|
const route = Route.make({
|
|
@@ -11,24 +11,10 @@ const route = Route.make({
|
|
|
11
11
|
protocol: OpenResponses.protocol,
|
|
12
12
|
endpoint: Endpoint.path(OpenResponses.PATH),
|
|
13
13
|
transport: OpenResponses.httpTransport,
|
|
14
|
-
|
|
14
|
+
options: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } },
|
|
15
15
|
});
|
|
16
16
|
export const routes = [route];
|
|
17
|
-
const configuredRoute = (input) => {
|
|
18
|
-
if ("apiKey" in input && input.apiKey !== undefined)
|
|
19
|
-
throw new ProviderConfigurationError({ provider: id, message: "Google Vertex Responses does not support API keys" });
|
|
20
|
-
const { accessToken: _accessToken, auth: _auth, baseURL, location: inputLocation, project: inputProject, ...rest } = input;
|
|
21
|
-
const location = GoogleVertexShared.location(inputLocation);
|
|
22
|
-
const project = GoogleVertexShared.project(inputProject);
|
|
23
|
-
return route.with({
|
|
24
|
-
...rest,
|
|
25
|
-
endpoint: {
|
|
26
|
-
baseURL: baseURL ??
|
|
27
|
-
`https://aiplatform.googleapis.com/v1/projects/${GoogleVertexShared.requireProject(project)}/locations/${location}/endpoints/openapi`,
|
|
28
|
-
},
|
|
29
|
-
auth: GoogleVertexShared.oauth(input, project),
|
|
30
|
-
});
|
|
31
|
-
};
|
|
17
|
+
const configuredRoute = (input) => GoogleVertexShared.oauthRoute(route, "Responses", input, (project, location) => `https://aiplatform.googleapis.com/v1/projects/${project}/locations/${location}/endpoints/openapi`);
|
|
32
18
|
export const configure = (input = {}) => {
|
|
33
19
|
const route = configuredRoute(input);
|
|
34
20
|
return {
|
|
@@ -41,16 +27,4 @@ export const provider = {
|
|
|
41
27
|
id,
|
|
42
28
|
configure,
|
|
43
29
|
};
|
|
44
|
-
export const model = (modelID,
|
|
45
|
-
if (apiKey !== undefined)
|
|
46
|
-
throw new ProviderConfigurationError({ provider: id, message: "Google Vertex Responses does not support API keys" });
|
|
47
|
-
return configure({
|
|
48
|
-
accessToken,
|
|
49
|
-
baseURL,
|
|
50
|
-
headers,
|
|
51
|
-
http: body === undefined ? undefined : { body },
|
|
52
|
-
location,
|
|
53
|
-
project,
|
|
54
|
-
providerOptions,
|
|
55
|
-
}).model(modelID);
|
|
56
|
-
};
|
|
30
|
+
export const model = (modelID, settings = {}) => configure(GoogleVertexShared.oauthSettings("Responses", settings)).model(modelID);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { AnyAuthClient } from "google-auth-library";
|
|
2
|
+
import type { ProviderPackage } from "../provider-package.js";
|
|
2
3
|
import { Auth } from "../route/auth.js";
|
|
4
|
+
import type { CompactionOperations, Route } from "../route/client.js";
|
|
5
|
+
import { type RequestOptions } from "../schema/index.js";
|
|
3
6
|
export declare const loadADCClient: (project?: string) => Promise<AnyAuthClient>;
|
|
4
7
|
export type OAuthOptions = {
|
|
5
8
|
readonly accessToken?: string;
|
|
@@ -24,4 +27,32 @@ export declare const apiKey: (input: ApiKeyOptions & {
|
|
|
24
27
|
readonly location?: string;
|
|
25
28
|
}) => string | undefined;
|
|
26
29
|
export declare const oauth: (input: OAuthOptions, project?: string) => Auth.Definition;
|
|
30
|
+
export declare const oauthRoute: <Body, Prepared, Compact extends CompactionOperations | undefined>(route: Route<Body, Prepared, Compact>, label: string, input: RequestOptions & OAuthOptions & {
|
|
31
|
+
readonly baseURL?: string;
|
|
32
|
+
readonly location?: string;
|
|
33
|
+
readonly project?: string;
|
|
34
|
+
}, url: (project: string, location: string) => string) => Route<Body, Prepared, Compact>;
|
|
35
|
+
export declare const oauthSettings: <Options>(label: string, { accessToken, apiKey, baseURL, body, headers, location, project, ...providerOptions }: ProviderPackage.Settings & Options & {
|
|
36
|
+
readonly accessToken?: string;
|
|
37
|
+
readonly apiKey?: never;
|
|
38
|
+
readonly baseURL?: string;
|
|
39
|
+
readonly location?: string;
|
|
40
|
+
readonly project?: string;
|
|
41
|
+
}) => {
|
|
42
|
+
accessToken: string | undefined;
|
|
43
|
+
baseURL: string | undefined;
|
|
44
|
+
headers: Readonly<Record<string, string>> | undefined;
|
|
45
|
+
http: {
|
|
46
|
+
body: Readonly<Record<string, unknown>>;
|
|
47
|
+
} | undefined;
|
|
48
|
+
location: string | undefined;
|
|
49
|
+
project: string | undefined;
|
|
50
|
+
providerOptions: Omit<ProviderPackage.Settings & Options & {
|
|
51
|
+
readonly accessToken?: string;
|
|
52
|
+
readonly apiKey?: never;
|
|
53
|
+
readonly baseURL?: string;
|
|
54
|
+
readonly location?: string;
|
|
55
|
+
readonly project?: string;
|
|
56
|
+
}, "accessToken" | "apiKey" | "baseURL" | "body" | "headers" | "location" | "project">;
|
|
57
|
+
};
|
|
27
58
|
export * as GoogleVertexShared from "./google-vertex-shared.js";
|
|
@@ -101,4 +101,29 @@ export const oauth = (input, project) => {
|
|
|
101
101
|
return Auth.bearer(input.accessToken);
|
|
102
102
|
return adc(project);
|
|
103
103
|
};
|
|
104
|
+
export const oauthRoute = (route, label, input, url) => {
|
|
105
|
+
if ("apiKey" in input && input.apiKey !== undefined)
|
|
106
|
+
throw new ProviderConfigurationError({ provider: id, message: `Google Vertex ${label} does not support API keys` });
|
|
107
|
+
const { accessToken: _accessToken, auth: _auth, baseURL, location: inputLocation, project: inputProject, ...rest } = input;
|
|
108
|
+
const resolvedLocation = location(inputLocation);
|
|
109
|
+
const resolvedProject = project(inputProject);
|
|
110
|
+
return route.with({
|
|
111
|
+
...rest,
|
|
112
|
+
endpoint: { baseURL: baseURL ?? url(requireProject(resolvedProject), resolvedLocation) },
|
|
113
|
+
auth: oauth(input, resolvedProject),
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
export const oauthSettings = (label, { accessToken, apiKey, baseURL, body, headers, location, project, ...providerOptions }) => {
|
|
117
|
+
if (apiKey !== undefined)
|
|
118
|
+
throw new ProviderConfigurationError({ provider: id, message: `Google Vertex ${label} does not support API keys` });
|
|
119
|
+
return {
|
|
120
|
+
accessToken,
|
|
121
|
+
baseURL,
|
|
122
|
+
headers,
|
|
123
|
+
http: body === undefined ? undefined : { body },
|
|
124
|
+
location,
|
|
125
|
+
project,
|
|
126
|
+
providerOptions,
|
|
127
|
+
};
|
|
128
|
+
};
|
|
104
129
|
export * as GoogleVertexShared from "./google-vertex-shared.js";
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
2
|
import { Gemini } from "../protocols/gemini.js";
|
|
3
|
-
import {
|
|
4
|
-
import { type
|
|
3
|
+
import { type VertexOptionsInput } from "../protocols/google-embed-content.js";
|
|
4
|
+
import { type OptionsInput as PredictOptionsInput } from "../protocols/google-vertex-predict-embeddings.js";
|
|
5
|
+
import { Route } from "../route/client.js";
|
|
6
|
+
import { type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js";
|
|
5
7
|
import { GoogleVertexShared } from "./google-vertex-shared.js";
|
|
6
8
|
export interface GeminiOptionsInput extends Gemini.OptionsInput {
|
|
7
9
|
readonly labels?: Readonly<Record<string, string>>;
|
|
8
10
|
}
|
|
9
11
|
export type GeminiProviderOptionsInput = GeminiOptionsInput;
|
|
10
12
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
11
|
-
export type Config =
|
|
13
|
+
export type Config = RequestOptions & GoogleVertexShared.ApiKeyOptions & {
|
|
12
14
|
readonly baseURL?: string;
|
|
13
15
|
readonly location?: string;
|
|
14
16
|
readonly project?: string;
|
|
@@ -111,10 +113,14 @@ export declare const routes: Route<{
|
|
|
111
113
|
} | undefined;
|
|
112
114
|
readonly continuationToken?: string | undefined;
|
|
113
115
|
}, Gemini.Prepared, import("../route/client.js").CompactionOperations | undefined>[];
|
|
116
|
+
export type { VertexOptionsInput as GoogleVertexEmbeddingOptions } from "../protocols/google-embed-content.js";
|
|
117
|
+
export type { OptionsInput as GoogleVertexPredictEmbeddingOptions } from "../protocols/google-vertex-predict-embeddings.js";
|
|
114
118
|
export declare const configure: (input?: Config) => {
|
|
115
119
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
116
120
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<GeminiOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
117
121
|
image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/google-images.js").GoogleImageOptions>;
|
|
122
|
+
/** `gemini-embedding-2*` through `embedContent`, other models through `:predict`; see `embeddingTarget`. */
|
|
123
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<VertexOptionsInput & PredictOptionsInput>;
|
|
118
124
|
configure: typeof configure;
|
|
119
125
|
};
|
|
120
126
|
export declare const provider: {
|
|
@@ -123,3 +129,4 @@ export declare const provider: {
|
|
|
123
129
|
};
|
|
124
130
|
export declare const model: ProviderPackage.Model<Settings, GeminiProviderOptionsInput>;
|
|
125
131
|
export declare const imageModel: (modelID: string, settings?: Settings) => import("../image.js").ImageModel<import("../protocols/google-images.js").GoogleImageOptions>;
|
|
132
|
+
export declare const embeddingModel: (modelID: string, settings?: Settings) => import("../embedding.js").EmbeddingModel<VertexOptionsInput & PredictOptionsInput>;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { Gemini } from "../protocols/gemini.js";
|
|
3
|
+
import { GoogleEmbedContent } from "../protocols/google-embed-content.js";
|
|
3
4
|
import { GoogleImages } from "../protocols/google-images.js";
|
|
5
|
+
import { GoogleVertexPredictEmbeddings, MAX_INSTANCES, } from "../protocols/google-vertex-predict-embeddings.js";
|
|
4
6
|
import { ProviderShared } from "../protocols/shared.js";
|
|
5
7
|
import { Auth } from "../route/auth.js";
|
|
6
8
|
import { Route } from "../route/client.js";
|
|
9
|
+
import { EmbeddingRoute } from "../route/embedding.js";
|
|
7
10
|
import { Endpoint } from "../route/endpoint.js";
|
|
8
11
|
import { MediaRoute } from "../route/media.js";
|
|
9
12
|
import { ProviderConfigurationError, ProviderID, } from "../schema/index.js";
|
|
@@ -41,6 +44,38 @@ const route = Route.make({
|
|
|
41
44
|
transport: Gemini.transport,
|
|
42
45
|
});
|
|
43
46
|
export const routes = [route];
|
|
47
|
+
const embedContentRoute = EmbeddingRoute.make({
|
|
48
|
+
id: "google-vertex-embed-content",
|
|
49
|
+
provider: id,
|
|
50
|
+
providerMetadataKey: "vertex",
|
|
51
|
+
protocol: GoogleEmbedContent.vertexProtocol,
|
|
52
|
+
endpoint: Endpoint.path(({ request }) => `/models/${request.model.id}:embedContent`),
|
|
53
|
+
// Vertex embedContent embeds one content per request.
|
|
54
|
+
maxValues: 1,
|
|
55
|
+
});
|
|
56
|
+
const predictRoute = EmbeddingRoute.make({
|
|
57
|
+
id: "google-vertex-predict-embeddings",
|
|
58
|
+
provider: id,
|
|
59
|
+
providerMetadataKey: "vertex",
|
|
60
|
+
protocol: GoogleVertexPredictEmbeddings.protocol,
|
|
61
|
+
// Tuned embedding models are deployed to `endpoints/{id}`, which serve `:predict` outside `publishers/google`.
|
|
62
|
+
endpoint: Endpoint.path(({ request }) => {
|
|
63
|
+
const model = request.model.id;
|
|
64
|
+
return `/${model.startsWith("endpoints/") ? model : `models/${model}`}:predict`;
|
|
65
|
+
}),
|
|
66
|
+
maxValues: MAX_INSTANCES,
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* `gemini-embedding-2*` models use `embedContent`, which takes media; every other embedding model uses the older
|
|
70
|
+
* text-only `:predict` API. `gemini-embedding-001` takes one text per `:predict` request.
|
|
71
|
+
*/
|
|
72
|
+
const embeddingTarget = (modelID) => {
|
|
73
|
+
if (modelID.startsWith("gemini-embedding-2"))
|
|
74
|
+
return { route: embedContentRoute, embedContent: true };
|
|
75
|
+
if (modelID.startsWith("gemini-embedding-001"))
|
|
76
|
+
return { route: predictRoute.with({ maxValues: 1 }), embedContent: false };
|
|
77
|
+
return { route: predictRoute, embedContent: false };
|
|
78
|
+
};
|
|
44
79
|
const configuredRoute = (input, modelID) => {
|
|
45
80
|
const { accessToken: _accessToken, apiKey: _apiKey, auth: _auth, baseURL: _baseURL, location: _location, project: _project, ...rest } = input;
|
|
46
81
|
return route.with({ ...rest, ...connection(input, modelID) });
|
|
@@ -76,6 +111,19 @@ export const configure = (input = {}) => {
|
|
|
76
111
|
providerOptions,
|
|
77
112
|
});
|
|
78
113
|
},
|
|
114
|
+
/** `gemini-embedding-2*` through `embedContent`, other models through `:predict`; see `embeddingTarget`. */
|
|
115
|
+
embedding: (modelID, providerOptions) => {
|
|
116
|
+
const target = connection(input, modelID);
|
|
117
|
+
const selected = embeddingTarget(modelID);
|
|
118
|
+
if (selected.embedContent && GoogleVertexShared.apiKey(input) !== undefined && input.baseURL === undefined)
|
|
119
|
+
throw new ProviderConfigurationError({
|
|
120
|
+
provider: id,
|
|
121
|
+
message: "Google Vertex embedContent does not support Express Mode API keys; use project credentials",
|
|
122
|
+
});
|
|
123
|
+
return selected.route
|
|
124
|
+
.with({ endpoint: target.endpoint, auth: target.auth, headers: input.headers, http: input.http })
|
|
125
|
+
.model({ id: modelID, providerOptions });
|
|
126
|
+
},
|
|
79
127
|
configure,
|
|
80
128
|
};
|
|
81
129
|
};
|
|
@@ -88,6 +136,10 @@ export const imageModel = (modelID, settings) => {
|
|
|
88
136
|
const input = config(settings);
|
|
89
137
|
return configure(input).image(modelID, input.providerOptions);
|
|
90
138
|
};
|
|
139
|
+
export const embeddingModel = (modelID, settings) => {
|
|
140
|
+
const input = config(settings);
|
|
141
|
+
return configure(input).embedding(modelID, input.providerOptions);
|
|
142
|
+
};
|
|
91
143
|
function config({ accessToken, apiKey, baseURL, body, headers, location, project, ...providerOptions } = {}) {
|
|
92
144
|
if (apiKey !== undefined && accessToken !== undefined)
|
|
93
145
|
throw new ProviderConfigurationError({
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
1
|
+
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
3
2
|
import type { ProviderPackage } from "../provider-package.js";
|
|
4
|
-
import { type ModelID, type ProviderOptions } from "../schema/index.js";
|
|
3
|
+
import { type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js";
|
|
5
4
|
import { Gemini } from "../protocols/gemini.js";
|
|
5
|
+
import { type OptionsInput as GoogleEmbeddingOptionsInput } from "../protocols/google-embed-content.js";
|
|
6
6
|
import { GoogleInteractions } from "../protocols/google-interactions.js";
|
|
7
|
+
export type { OptionsInput as GoogleEmbeddingOptions } from "../protocols/google-embed-content.js";
|
|
7
8
|
export type { GoogleImageOptions } from "../protocols/google-images.js";
|
|
8
9
|
export type { GoogleSpeechOptions } from "../protocols/google-speech.js";
|
|
9
10
|
export type { GoogleTranscriptionOptions } from "../protocols/google-transcription.js";
|
|
@@ -12,7 +13,7 @@ export type GeminiOptionsInput = Gemini.OptionsInput;
|
|
|
12
13
|
export type GeminiProviderOptionsInput = Gemini.ProviderOptionsInput;
|
|
13
14
|
export type GoogleInteractionsOptionsInput = GoogleInteractions.OptionsInput;
|
|
14
15
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
15
|
-
export declare const routes: (import("../route
|
|
16
|
+
export declare const routes: (import("../route.js").Route<{
|
|
16
17
|
readonly cachedContent?: string | undefined;
|
|
17
18
|
readonly contents: readonly {
|
|
18
19
|
readonly role?: "model" | "user" | null | undefined;
|
|
@@ -97,7 +98,7 @@ export declare const routes: (import("../route/client.js").Route<{
|
|
|
97
98
|
} | undefined;
|
|
98
99
|
} | undefined;
|
|
99
100
|
readonly continuationToken?: string | undefined;
|
|
100
|
-
}, Gemini.Prepared, import("../route
|
|
101
|
+
}, Gemini.Prepared, import("../route.js").CompactionOperations | undefined> | import("../route.js").Route<{
|
|
101
102
|
readonly model: string;
|
|
102
103
|
readonly input: readonly ({
|
|
103
104
|
readonly type: "model_output" | "user_input";
|
|
@@ -158,57 +159,64 @@ export declare const routes: (import("../route/client.js").Route<{
|
|
|
158
159
|
};
|
|
159
160
|
} | undefined;
|
|
160
161
|
};
|
|
161
|
-
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route
|
|
162
|
-
export type Config =
|
|
162
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route.js").CompactionOperations | undefined>)[];
|
|
163
|
+
export type Config = RequestOptions & ProviderAuthOption<"optional"> & {
|
|
163
164
|
readonly baseURL?: string;
|
|
164
165
|
readonly providerOptions?: Gemini.ProviderOptionsInput & GoogleInteractions.ProviderOptionsInput;
|
|
165
166
|
};
|
|
166
167
|
export type Settings = ProviderPackage.Settings & Gemini.ProviderOptionsInput & {
|
|
167
|
-
readonly apiKey?: string;
|
|
168
|
+
readonly apiKey?: string | false;
|
|
168
169
|
readonly baseURL?: string;
|
|
169
170
|
};
|
|
170
171
|
export declare const configure: (input?: Config) => {
|
|
171
172
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
172
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<Gemini.OptionsInput, import("../route
|
|
173
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<Gemini.OptionsInput, import("../route.js").CompactionOperations | undefined>;
|
|
174
|
+
gemini: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<Gemini.OptionsInput, import("../route.js").CompactionOperations | undefined>;
|
|
173
175
|
interactions: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<{
|
|
174
176
|
readonly previousInteractionId?: string | undefined;
|
|
175
177
|
readonly store?: boolean | undefined;
|
|
176
178
|
readonly thinkingLevel?: import("../schema/options.js").OpenString<"high" | "low" | "medium" | "minimal"> | undefined;
|
|
177
179
|
readonly thinkingSummaries?: import("../schema/options.js").OpenString<"auto" | "none"> | undefined;
|
|
178
180
|
readonly serviceTier?: import("../schema/options.js").OpenString<"deferred" | "flex" | "priority" | "standard"> | undefined;
|
|
179
|
-
}, import("../route
|
|
181
|
+
}, import("../route.js").CompactionOperations | undefined>;
|
|
180
182
|
image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/google-images.js").GoogleImageOptions>;
|
|
181
183
|
video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/google-video.js").GoogleVideoOptions>;
|
|
182
184
|
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/google-speech.js").GoogleSpeechOptions>;
|
|
183
185
|
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/google-transcription.js").GoogleTranscriptionOptions>;
|
|
186
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<GoogleEmbeddingOptionsInput>;
|
|
184
187
|
configure: typeof configure;
|
|
185
188
|
};
|
|
186
189
|
export declare const provider: {
|
|
187
190
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
188
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<Gemini.OptionsInput, import("../route
|
|
191
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<Gemini.OptionsInput, import("../route.js").CompactionOperations | undefined>;
|
|
192
|
+
gemini: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<Gemini.OptionsInput, import("../route.js").CompactionOperations | undefined>;
|
|
189
193
|
interactions: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<{
|
|
190
194
|
readonly previousInteractionId?: string | undefined;
|
|
191
195
|
readonly store?: boolean | undefined;
|
|
192
196
|
readonly thinkingLevel?: import("../schema/options.js").OpenString<"high" | "low" | "medium" | "minimal"> | undefined;
|
|
193
197
|
readonly thinkingSummaries?: import("../schema/options.js").OpenString<"auto" | "none"> | undefined;
|
|
194
198
|
readonly serviceTier?: import("../schema/options.js").OpenString<"deferred" | "flex" | "priority" | "standard"> | undefined;
|
|
195
|
-
}, import("../route
|
|
199
|
+
}, import("../route.js").CompactionOperations | undefined>;
|
|
196
200
|
image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/google-images.js").GoogleImageOptions>;
|
|
197
201
|
video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/google-video.js").GoogleVideoOptions>;
|
|
198
202
|
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/google-speech.js").GoogleSpeechOptions>;
|
|
199
203
|
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/google-transcription.js").GoogleTranscriptionOptions>;
|
|
204
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<GoogleEmbeddingOptionsInput>;
|
|
200
205
|
configure: typeof configure;
|
|
201
206
|
};
|
|
202
207
|
export declare const model: ProviderPackage.Model<Settings, Gemini.ProviderOptionsInput>;
|
|
203
208
|
export declare const imageModel: (modelID: string, settings?: Settings) => import("../image.js").ImageModel<import("../protocols/google-images.js").GoogleImageOptions>;
|
|
209
|
+
export declare const embeddingModel: (modelID: string, settings?: Settings) => import("../embedding.js").EmbeddingModel<GoogleEmbeddingOptionsInput>;
|
|
204
210
|
export declare const image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/google-images.js").GoogleImageOptions>;
|
|
211
|
+
export declare const embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<GoogleEmbeddingOptionsInput>;
|
|
212
|
+
export declare const gemini: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<Gemini.OptionsInput, import("../route.js").CompactionOperations | undefined>;
|
|
205
213
|
export declare const interactions: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<{
|
|
206
214
|
readonly previousInteractionId?: string | undefined;
|
|
207
215
|
readonly store?: boolean | undefined;
|
|
208
216
|
readonly thinkingLevel?: import("../schema/options.js").OpenString<"high" | "low" | "medium" | "minimal"> | undefined;
|
|
209
217
|
readonly thinkingSummaries?: import("../schema/options.js").OpenString<"auto" | "none"> | undefined;
|
|
210
218
|
readonly serviceTier?: import("../schema/options.js").OpenString<"deferred" | "flex" | "priority" | "standard"> | undefined;
|
|
211
|
-
}, import("../route
|
|
219
|
+
}, import("../route.js").CompactionOperations | undefined>;
|
|
212
220
|
export declare const video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/google-video.js").GoogleVideoOptions>;
|
|
213
221
|
export declare const speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/google-speech.js").GoogleSpeechOptions>;
|
|
214
222
|
export declare const transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/google-transcription.js").GoogleTranscriptionOptions>;
|