@opencode/ai 2.2.4 → 2.2.6
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 +133 -69
- 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 +20 -125
- package/dist/decision.js +25 -15
- package/dist/effect.d.ts +4 -15
- package/dist/effect.js +2 -6
- package/dist/effort-updates.d.ts +3 -3
- package/dist/effort-updates.js +2 -2
- 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 -464
- package/dist/image.js +17 -15
- package/dist/index.d.ts +28 -465
- package/dist/index.js +18 -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 +5 -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 -185
- package/dist/protocols/assemblyai-transcription.d.ts +2 -2
- package/dist/protocols/bedrock-converse.js +11 -22
- 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 +56 -89
- package/dist/protocols/google-images.d.ts +2 -2
- package/dist/protocols/google-interactions.d.ts +3 -4
- package/dist/protocols/google-interactions.js +54 -32
- package/dist/protocols/google-speech.d.ts +2 -2
- package/dist/protocols/google-transcription.d.ts +2 -2
- package/dist/protocols/google-video.d.ts +2 -2
- 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 +14 -20
- 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 +1 -21
- package/dist/protocols/open-responses.js +10 -15
- package/dist/protocols/openai-chat.d.ts +3 -23
- package/dist/protocols/openai-chat.js +26 -47
- package/dist/protocols/openai-compatible-chat.d.ts +1 -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 +1 -1
- 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 +1 -4
- package/dist/protocols/shared.js +13 -11
- package/dist/protocols/system-one.d.ts +4 -4
- 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 +3 -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 +5 -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 +9 -80
- package/dist/providers/alibaba.d.ts +67 -4
- package/dist/providers/alibaba.js +6 -1
- package/dist/providers/amazon-bedrock-mantle.d.ts +6 -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/messages.d.ts +2 -0
- package/dist/providers/azure/messages.js +1 -0
- package/dist/providers/azure.d.ts +322 -7
- package/dist/providers/azure.js +25 -9
- package/dist/providers/baseten.d.ts +5 -5
- package/dist/providers/baseten.js +7 -21
- package/dist/providers/cartesia.d.ts +1 -1
- package/dist/providers/cerebras.d.ts +5 -5
- package/dist/providers/cerebras.js +4 -15
- package/dist/providers/cloudflare-ai-gateway.d.ts +21 -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 +4 -4
- package/dist/providers/cloudflare-workers-ai.js +4 -20
- package/dist/providers/cohere/chat.js +2 -7
- package/dist/providers/cohere.d.ts +6 -5
- package/dist/providers/cohere.js +7 -13
- package/dist/providers/deepgram.d.ts +2 -2
- package/dist/providers/deepgram.js +2 -7
- package/dist/providers/deepinfra.d.ts +5 -5
- package/dist/providers/deepinfra.js +5 -13
- package/dist/providers/deepseek.d.ts +5 -5
- package/dist/providers/deepseek.js +3 -14
- package/dist/providers/digitalocean.d.ts +8 -5
- package/dist/providers/digitalocean.js +13 -14
- package/dist/providers/elevenlabs.d.ts +2 -2
- package/dist/providers/elevenlabs.js +2 -7
- package/dist/providers/fireworks.d.ts +5 -5
- package/dist/providers/fireworks.js +4 -15
- package/dist/providers/google/interactions.d.ts +1 -1
- package/dist/providers/google/interactions.js +2 -7
- package/dist/providers/google-vertex-chat.d.ts +3 -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 +3 -3
- package/dist/providers/google.d.ts +15 -13
- package/dist/providers/google.js +9 -19
- package/dist/providers/groq.d.ts +5 -5
- package/dist/providers/groq.js +4 -15
- package/dist/providers/meta.d.ts +5 -5
- package/dist/providers/meta.js +10 -24
- package/dist/providers/minimax/chat.js +2 -7
- package/dist/providers/minimax/responses.js +2 -7
- package/dist/providers/minimax.d.ts +5 -5
- package/dist/providers/minimax.js +11 -23
- 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 +5 -5
- package/dist/providers/moonshot.js +4 -16
- 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 +6 -7
- package/dist/providers/openai-compatible.js +4 -10
- package/dist/providers/openai.d.ts +4 -4
- package/dist/providers/openai.js +3 -3
- package/dist/providers/opencode.d.ts +4 -4
- package/dist/providers/opencode.js +6 -2
- package/dist/providers/openrouter.d.ts +8 -5
- package/dist/providers/openrouter.js +16 -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 +5 -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 +4 -4
- package/dist/providers/venice.js +6 -2
- package/dist/providers/vercel-ai-gateway.d.ts +5 -5
- package/dist/providers/vercel-ai-gateway.js +15 -28
- package/dist/providers/xai.d.ts +4 -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 +5 -5
- package/dist/providers/zai-coding-plan.js +8 -15
- package/dist/providers/zai.d.ts +5 -5
- package/dist/providers/zai.js +10 -22
- package/dist/public.d.ts +12 -0
- package/dist/public.js +5 -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/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 +9 -9
- 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
|
@@ -3,12 +3,12 @@ import { OpenAIImages } from "../protocols/openai-images.js";
|
|
|
3
3
|
import { OpenResponses } from "../protocols/open-responses.js";
|
|
4
4
|
import { SystemOne } from "../protocols/system-one.js";
|
|
5
5
|
import { cacheControl } from "../protocols/utils/cache.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 { Protocol } from "../route/protocol.js";
|
|
11
10
|
import { ProviderID } from "../schema/index.js";
|
|
11
|
+
import { bearerRouteDefaults } from "./settings.js";
|
|
12
12
|
export const id = ProviderID.make("digitalocean");
|
|
13
13
|
const baseURL = "https://inference.do-ai.run/v1";
|
|
14
14
|
export const protocol = Protocol.make({
|
|
@@ -34,35 +34,33 @@ const responsesRoute = Route.make({
|
|
|
34
34
|
protocol: OpenResponses.protocol,
|
|
35
35
|
endpoint: Endpoint.path("/responses", { baseURL }),
|
|
36
36
|
transport: OpenResponses.httpTransport,
|
|
37
|
-
|
|
37
|
+
options: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } },
|
|
38
38
|
});
|
|
39
39
|
export const routes = [route, responsesRoute];
|
|
40
40
|
export const configure = (input = {}) => {
|
|
41
|
-
const
|
|
42
|
-
const auth = AuthOptions.bearer(input, ["DIGITALOCEAN_ACCESS_TOKEN", "DIGITALOCEAN_API_KEY", "DO_INFERENCE_API_KEY"]);
|
|
43
|
-
const options = { ...defaults, endpoint: { baseURL: endpoint ?? baseURL }, auth };
|
|
41
|
+
const options = bearerRouteDefaults(input, ["DIGITALOCEAN_ACCESS_TOKEN", "DIGITALOCEAN_API_KEY", "DO_INFERENCE_API_KEY"], baseURL);
|
|
44
42
|
const configured = route.with(options);
|
|
45
43
|
const configuredResponses = responsesRoute.with(options);
|
|
46
44
|
const decisionRoute = SystemOne.route.with({
|
|
47
45
|
provider: id,
|
|
48
46
|
providerMetadataKey: "digitalocean",
|
|
49
|
-
endpoint:
|
|
50
|
-
auth,
|
|
47
|
+
endpoint: options.endpoint,
|
|
48
|
+
auth: options.auth,
|
|
51
49
|
// DigitalOcean serves TypeSafe's Jev, which needs this header for images.
|
|
52
50
|
headers: { "TypeSafe-Danger-Zone-Images": "true", ...input.headers },
|
|
53
51
|
http: input.http,
|
|
54
52
|
});
|
|
55
53
|
const decision = (modelID, providerOptions) => decisionRoute.model({ id: modelID, providerOptions });
|
|
56
|
-
const media = MediaRoute.deployment({ ...input, baseURL: endpoint
|
|
54
|
+
const media = MediaRoute.deployment({ ...input, baseURL: options.endpoint.baseURL }, options.auth);
|
|
57
55
|
const image = (modelID, providerOptions) => OpenAIImages.model({ ...media, id: modelID, provider: id, providerOptions });
|
|
56
|
+
const chat = (modelID) => configured.model({
|
|
57
|
+
id: modelID,
|
|
58
|
+
capabilities: { promptCacheKey: true },
|
|
59
|
+
});
|
|
58
60
|
return {
|
|
59
61
|
id,
|
|
60
|
-
model:
|
|
61
|
-
|
|
62
|
-
compatibility: {
|
|
63
|
-
supportsPromptCacheKey: true,
|
|
64
|
-
},
|
|
65
|
-
}),
|
|
62
|
+
model: chat,
|
|
63
|
+
chat,
|
|
66
64
|
responses: (modelID) => configuredResponses.model({ id: modelID }),
|
|
67
65
|
image,
|
|
68
66
|
decision,
|
|
@@ -72,6 +70,7 @@ export const configure = (input = {}) => {
|
|
|
72
70
|
export const provider = configure();
|
|
73
71
|
export const decision = provider.decision;
|
|
74
72
|
export const image = provider.image;
|
|
73
|
+
export const chat = provider.chat;
|
|
75
74
|
export const responses = provider.responses;
|
|
76
75
|
export const model = (modelID, settings) => configure(config(settings)).model(modelID);
|
|
77
76
|
export const responsesModel = (modelID, settings) => configure(config(settings)).responses(modelID);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
2
2
|
import { type HttpOptions, type ModelID } from "../schema/index.js";
|
|
3
3
|
export type { ElevenLabsOutputFormat, ElevenLabsSpeechOptions } from "../protocols/elevenlabs-speech.js";
|
|
4
4
|
export type { ElevenLabsTranscriptionOptions } from "../protocols/elevenlabs-transcription.js";
|
|
@@ -6,7 +6,7 @@ export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
|
6
6
|
export type Config = ProviderAuthOption<"optional"> & {
|
|
7
7
|
readonly baseURL?: string;
|
|
8
8
|
readonly headers?: Record<string, string>;
|
|
9
|
-
readonly http?: HttpOptions
|
|
9
|
+
readonly http?: HttpOptions;
|
|
10
10
|
};
|
|
11
11
|
export declare const configure: (input?: Config) => {
|
|
12
12
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { Auth } from "../route/auth.js";
|
|
2
|
+
import { AuthOptions } from "../route/auth-options.js";
|
|
2
3
|
import { MediaRoute } from "../route/media.js";
|
|
3
4
|
import { ProviderID } from "../schema/index.js";
|
|
4
5
|
import { ElevenLabsSpeech } from "../protocols/elevenlabs-speech.js";
|
|
5
6
|
import { ElevenLabsTranscription } from "../protocols/elevenlabs-transcription.js";
|
|
6
7
|
export const id = ProviderID.make("elevenlabs");
|
|
7
|
-
const auth = (options) =>
|
|
8
|
-
if ("auth" in options && options.auth)
|
|
9
|
-
return options.auth;
|
|
10
|
-
return Auth.optional("apiKey" in options ? options.apiKey : undefined, "apiKey")
|
|
11
|
-
.orElse(Auth.config("ELEVENLABS_API_KEY"))
|
|
12
|
-
.pipe(Auth.header("xi-api-key"));
|
|
13
|
-
};
|
|
8
|
+
const auth = (options) => AuthOptions.apiKey(options, "ELEVENLABS_API_KEY", Auth.header("xi-api-key"));
|
|
14
9
|
export const configure = (input = {}) => {
|
|
15
10
|
const media = MediaRoute.deployment(input, auth(input));
|
|
16
11
|
const speech = (modelID) => ElevenLabsSpeech.model({ ...media, id: modelID });
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
|
-
import {
|
|
3
|
-
import { Route
|
|
4
|
-
import { type ModelID } from "../schema/index.js";
|
|
2
|
+
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
3
|
+
import { Route } from "../route/client.js";
|
|
4
|
+
import { type ModelID, type RequestOptions } from "../schema/index.js";
|
|
5
5
|
import type { OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
6
6
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
|
-
export type Config = Omit<
|
|
7
|
+
export type Config = Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
8
8
|
readonly baseURL?: string;
|
|
9
9
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
10
10
|
};
|
|
11
11
|
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
|
|
12
|
-
readonly apiKey?: string;
|
|
12
|
+
readonly apiKey?: string | false;
|
|
13
13
|
readonly baseURL?: string;
|
|
14
14
|
};
|
|
15
15
|
export declare const route: Route<{
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
2
|
-
import { AuthOptions } from "../route/auth-options.js";
|
|
3
2
|
import { Route } from "../route/client.js";
|
|
4
3
|
import { Endpoint } from "../route/endpoint.js";
|
|
5
4
|
import { ProviderID } from "../schema/index.js";
|
|
5
|
+
import { bearerRouteDefaults, toConfig } from "./settings.js";
|
|
6
6
|
export const id = ProviderID.make("fireworks");
|
|
7
7
|
const baseURL = "https://api.fireworks.ai/inference/v1";
|
|
8
8
|
export const route = Route.make({
|
|
@@ -15,24 +15,13 @@ export const route = Route.make({
|
|
|
15
15
|
});
|
|
16
16
|
export const routes = [route];
|
|
17
17
|
export const configure = (input = {}) => {
|
|
18
|
-
const
|
|
19
|
-
const configured = route.with({
|
|
20
|
-
...defaults,
|
|
21
|
-
endpoint: { baseURL: endpoint ?? baseURL },
|
|
22
|
-
auth: AuthOptions.bearer(input, "FIREWORKS_API_KEY"),
|
|
23
|
-
});
|
|
18
|
+
const configured = route.with(bearerRouteDefaults(input, "FIREWORKS_API_KEY", baseURL));
|
|
24
19
|
return {
|
|
25
20
|
id,
|
|
26
|
-
model: (modelID) => configured.model({ id: modelID,
|
|
21
|
+
model: (modelID) => configured.model({ id: modelID, capabilities: { promptCacheKey: true } }),
|
|
27
22
|
configure,
|
|
28
23
|
};
|
|
29
24
|
};
|
|
30
25
|
export const provider = configure();
|
|
31
|
-
export const model = (modelID,
|
|
32
|
-
apiKey,
|
|
33
|
-
baseURL,
|
|
34
|
-
headers,
|
|
35
|
-
http: body === undefined ? undefined : { body },
|
|
36
|
-
providerOptions,
|
|
37
|
-
}).model(modelID);
|
|
26
|
+
export const model = (modelID, settings) => configure(toConfig(settings)).model(modelID);
|
|
38
27
|
export * as Fireworks from "./fireworks.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../../provider-package.js";
|
|
2
2
|
import type { GoogleInteractions } from "../../protocols/google-interactions.js";
|
|
3
3
|
export type Settings = ProviderPackage.Settings & GoogleInteractions.ProviderOptionsInput & {
|
|
4
|
-
readonly apiKey?: string;
|
|
4
|
+
readonly apiKey?: string | false;
|
|
5
5
|
readonly baseURL?: string;
|
|
6
6
|
};
|
|
7
7
|
export declare const model: ProviderPackage.Model<Settings, GoogleInteractions.ProviderOptionsInput>;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import { configure } from "../google.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
baseURL,
|
|
5
|
-
headers,
|
|
6
|
-
http: body === undefined ? undefined : { body },
|
|
7
|
-
providerOptions,
|
|
8
|
-
}).interactions(modelID);
|
|
2
|
+
import { toConfig } from "../settings.js";
|
|
3
|
+
export const model = (modelID, settings) => configure(toConfig(settings)).interactions(modelID);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
|
-
import { Route
|
|
3
|
-
import { type ModelID } from "../schema/index.js";
|
|
2
|
+
import { Route } from "../route/client.js";
|
|
3
|
+
import { type ModelID, type RequestOptions } from "../schema/index.js";
|
|
4
4
|
import { GoogleVertexShared } from "./google-vertex-shared.js";
|
|
5
5
|
import type { OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
6
6
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
|
-
export type Config =
|
|
7
|
+
export type Config = RequestOptions & GoogleVertexShared.OAuthOptions & {
|
|
8
8
|
readonly baseURL?: string;
|
|
9
9
|
readonly location?: string;
|
|
10
10
|
readonly project?: string;
|
|
@@ -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,14 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
2
|
import { Gemini } from "../protocols/gemini.js";
|
|
3
|
-
import { Route
|
|
4
|
-
import { type ModelID, type ProviderOptions } from "../schema/index.js";
|
|
3
|
+
import { Route } from "../route/client.js";
|
|
4
|
+
import { type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js";
|
|
5
5
|
import { GoogleVertexShared } from "./google-vertex-shared.js";
|
|
6
6
|
export interface GeminiOptionsInput extends Gemini.OptionsInput {
|
|
7
7
|
readonly labels?: Readonly<Record<string, string>>;
|
|
8
8
|
}
|
|
9
9
|
export type GeminiProviderOptionsInput = GeminiOptionsInput;
|
|
10
10
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
11
|
-
export type Config =
|
|
11
|
+
export type Config = RequestOptions & GoogleVertexShared.ApiKeyOptions & {
|
|
12
12
|
readonly baseURL?: string;
|
|
13
13
|
readonly location?: string;
|
|
14
14
|
readonly project?: string;
|