@opencode/ai 2.2.6 → 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 +96 -4
- package/dist/ai-client.d.ts +2 -2
- package/dist/ai-client.js +2 -1
- package/dist/decision.d.ts +10 -0
- package/dist/decision.js +2 -0
- package/dist/effect.d.ts +6 -0
- package/dist/effect.js +4 -0
- 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/image.d.ts +0 -1
- package/dist/image.js +0 -3
- package/dist/index.d.ts +7 -2
- package/dist/index.js +5 -0
- package/dist/protocols/alibaba-chat.d.ts +4 -0
- package/dist/protocols/anthropic-messages.js +3 -3
- package/dist/protocols/google-embed-content.d.ts +34 -0
- package/dist/protocols/google-embed-content.js +110 -0
- package/dist/protocols/google-vertex-predict-embeddings.d.ts +18 -0
- package/dist/protocols/google-vertex-predict-embeddings.js +74 -0
- package/dist/protocols/index.d.ts +3 -0
- package/dist/protocols/index.js +3 -0
- package/dist/protocols/open-responses.d.ts +1 -1
- package/dist/protocols/open-responses.js +31 -8
- package/dist/protocols/openai-chat.d.ts +24 -0
- package/dist/protocols/openai-chat.js +37 -11
- package/dist/protocols/openai-compatible-chat.d.ts +1 -0
- package/dist/protocols/openai-decisions.js +14 -1
- package/dist/protocols/openai-embeddings.d.ts +16 -0
- package/dist/protocols/openai-embeddings.js +76 -0
- package/dist/protocols/shared.d.ts +13 -3
- package/dist/protocols/shared.js +27 -4
- package/dist/protocols/system-one.js +8 -1
- package/dist/protocols/venice-chat.d.ts +4 -0
- package/dist/protocols/zai-chat.d.ts +4 -0
- package/dist/providers/alibaba/embeddings.d.ts +2 -0
- package/dist/providers/alibaba/embeddings.js +1 -0
- package/dist/providers/alibaba.d.ts +3 -0
- package/dist/providers/alibaba.js +14 -1
- package/dist/providers/amazon-bedrock-mantle.d.ts +1 -0
- package/dist/providers/azure/embeddings.d.ts +2 -0
- package/dist/providers/azure/embeddings.js +1 -0
- package/dist/providers/azure.d.ts +3 -0
- package/dist/providers/azure.js +15 -0
- package/dist/providers/baseten.d.ts +2 -0
- package/dist/providers/cerebras.d.ts +2 -0
- package/dist/providers/cloudflare-ai-gateway.d.ts +2 -0
- package/dist/providers/cloudflare-workers-ai.d.ts +2 -0
- package/dist/providers/cohere/embeddings.d.ts +2 -0
- package/dist/providers/cohere/embeddings.js +1 -0
- package/dist/providers/cohere.d.ts +8 -0
- package/dist/providers/cohere.js +17 -1
- package/dist/providers/deepinfra/embeddings.d.ts +2 -0
- package/dist/providers/deepinfra/embeddings.js +1 -0
- package/dist/providers/deepinfra.d.ts +6 -1
- package/dist/providers/deepinfra.js +15 -1
- package/dist/providers/deepseek.d.ts +2 -0
- package/dist/providers/digitalocean/embeddings.d.ts +2 -0
- package/dist/providers/digitalocean/embeddings.js +1 -0
- package/dist/providers/digitalocean.d.ts +10 -0
- package/dist/providers/digitalocean.js +15 -0
- package/dist/providers/fireworks/embeddings.d.ts +2 -0
- package/dist/providers/fireworks/embeddings.js +1 -0
- package/dist/providers/fireworks.d.ts +6 -1
- package/dist/providers/fireworks.js +15 -1
- package/dist/providers/google/embeddings.d.ts +2 -0
- package/dist/providers/google/embeddings.js +1 -0
- package/dist/providers/google-vertex/embeddings.d.ts +2 -0
- package/dist/providers/google-vertex/embeddings.js +1 -0
- package/dist/providers/google-vertex-chat.d.ts +1 -0
- package/dist/providers/google-vertex.d.ts +7 -0
- package/dist/providers/google-vertex.js +52 -0
- package/dist/providers/google.d.ts +6 -0
- package/dist/providers/google.js +14 -0
- package/dist/providers/groq.d.ts +5 -0
- package/dist/providers/meta.d.ts +1 -0
- package/dist/providers/minimax.d.ts +1 -0
- package/dist/providers/moonshot.d.ts +1 -0
- package/dist/providers/openai/embeddings.d.ts +2 -0
- package/dist/providers/openai/embeddings.js +1 -0
- package/dist/providers/openai-compatible/embeddings.d.ts +2 -0
- package/dist/providers/openai-compatible/embeddings.js +1 -0
- package/dist/providers/openai-compatible.d.ts +4 -0
- package/dist/providers/openai-compatible.js +13 -0
- package/dist/providers/openai.d.ts +7 -0
- package/dist/providers/openai.js +14 -0
- package/dist/providers/openrouter/embeddings.d.ts +2 -0
- package/dist/providers/openrouter/embeddings.js +1 -0
- package/dist/providers/openrouter.d.ts +16 -0
- package/dist/providers/openrouter.js +15 -0
- package/dist/providers/togetherai.d.ts +2 -0
- package/dist/providers/venice.d.ts +1 -0
- package/dist/providers/vercel-ai-gateway/embeddings.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/embeddings.js +1 -0
- package/dist/providers/vercel-ai-gateway.d.ts +4 -0
- package/dist/providers/vercel-ai-gateway.js +15 -1
- package/dist/providers/xai.d.ts +1 -0
- package/dist/providers/zai-coding-plan.d.ts +1 -0
- package/dist/providers/zai.d.ts +1 -0
- package/dist/public.d.ts +2 -0
- package/dist/public.js +1 -0
- package/dist/route/embedding.d.ts +61 -0
- package/dist/route/embedding.js +88 -0
- package/package.json +305 -253
|
@@ -119,6 +119,7 @@ export declare const route: Route<{
|
|
|
119
119
|
readonly reasoning?: string | undefined;
|
|
120
120
|
readonly reasoning_text?: string | undefined;
|
|
121
121
|
readonly reasoning_details?: unknown;
|
|
122
|
+
readonly reasoning_opaque?: string | undefined;
|
|
122
123
|
})[];
|
|
123
124
|
readonly tools?: readonly ({
|
|
124
125
|
readonly type: "function";
|
|
@@ -293,6 +294,7 @@ export declare const routes: Route<{
|
|
|
293
294
|
readonly reasoning?: string | undefined;
|
|
294
295
|
readonly reasoning_text?: string | undefined;
|
|
295
296
|
readonly reasoning_details?: unknown;
|
|
297
|
+
readonly reasoning_opaque?: string | undefined;
|
|
296
298
|
})[];
|
|
297
299
|
readonly tools?: readonly ({
|
|
298
300
|
readonly type: "function";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { embeddingModel as model } from "../cohere.js";
|
|
@@ -168,6 +168,7 @@ export declare const chatRoute: Route<{
|
|
|
168
168
|
readonly reasoning?: string | undefined;
|
|
169
169
|
readonly reasoning_text?: string | undefined;
|
|
170
170
|
readonly reasoning_details?: unknown;
|
|
171
|
+
readonly reasoning_opaque?: string | undefined;
|
|
171
172
|
})[];
|
|
172
173
|
readonly tools?: readonly ({
|
|
173
174
|
readonly type: "function";
|
|
@@ -393,6 +394,7 @@ export declare const routes: (Route<{
|
|
|
393
394
|
readonly reasoning?: string | undefined;
|
|
394
395
|
readonly reasoning_text?: string | undefined;
|
|
395
396
|
readonly reasoning_details?: unknown;
|
|
397
|
+
readonly reasoning_opaque?: string | undefined;
|
|
396
398
|
})[];
|
|
397
399
|
readonly tools?: readonly ({
|
|
398
400
|
readonly type: "function";
|
|
@@ -476,6 +478,8 @@ export declare const configure: (input?: Config) => {
|
|
|
476
478
|
} | undefined;
|
|
477
479
|
}, import("../route/client.js").CompactionOperations | undefined>;
|
|
478
480
|
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ChatOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
481
|
+
/** Embeddings through the OpenAI-compatible API; the native `/v2/embed` API is not wired up. */
|
|
482
|
+
embedding: (modelID: string | ModelID, providerOptions?: Readonly<Record<string, unknown>>) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
479
483
|
configure: typeof configure;
|
|
480
484
|
};
|
|
481
485
|
export declare const provider: {
|
|
@@ -487,8 +491,12 @@ export declare const provider: {
|
|
|
487
491
|
} | undefined;
|
|
488
492
|
}, import("../route/client.js").CompactionOperations | undefined>;
|
|
489
493
|
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ChatOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
494
|
+
/** Embeddings through the OpenAI-compatible API; the native `/v2/embed` API is not wired up. */
|
|
495
|
+
embedding: (modelID: string | ModelID, providerOptions?: Readonly<Record<string, unknown>>) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
490
496
|
configure: typeof configure;
|
|
491
497
|
};
|
|
492
498
|
export declare const chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ChatOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
499
|
+
export declare const embedding: (modelID: string | ModelID, providerOptions?: Readonly<Record<string, unknown>>) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
493
500
|
export declare const model: ProviderPackage.Model<Settings, CohereChat.ProviderOptionsInput>;
|
|
501
|
+
export declare const embeddingModel: (modelID: string, settings?: Settings<Readonly<Record<string, unknown>>>) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
494
502
|
export * as Cohere from "./cohere.js";
|
package/dist/providers/cohere.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CohereChat } from "../protocols/cohere-chat.js";
|
|
2
2
|
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
3
|
+
import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js";
|
|
3
4
|
import { Route } from "../route/client.js";
|
|
4
5
|
import { Endpoint } from "../route/endpoint.js";
|
|
5
6
|
import { ProviderID } from "../schema/index.js";
|
|
@@ -19,7 +20,15 @@ export const routes = [route, chatRoute];
|
|
|
19
20
|
export const configure = (input = {}) => {
|
|
20
21
|
const options = bearerRouteDefaults(input, "COHERE_API_KEY", CohereChat.DEFAULT_BASE_URL);
|
|
21
22
|
const native = route.with(options);
|
|
22
|
-
const
|
|
23
|
+
const compatibility = { ...options, endpoint: { baseURL: input.baseURL ?? COMPATIBILITY_BASE_URL } };
|
|
24
|
+
const chat = chatRoute.with(compatibility);
|
|
25
|
+
const embeddingRoute = OpenAIEmbeddings.route.with({
|
|
26
|
+
provider: id,
|
|
27
|
+
endpoint: compatibility.endpoint,
|
|
28
|
+
auth: options.auth,
|
|
29
|
+
headers: input.headers,
|
|
30
|
+
http: input.http,
|
|
31
|
+
});
|
|
23
32
|
return {
|
|
24
33
|
id,
|
|
25
34
|
model: (modelID) => native.model({ id: modelID }),
|
|
@@ -31,10 +40,17 @@ export const configure = (input = {}) => {
|
|
|
31
40
|
},
|
|
32
41
|
capabilities: { tools: { strict: false } },
|
|
33
42
|
}),
|
|
43
|
+
/** Embeddings through the OpenAI-compatible API; the native `/v2/embed` API is not wired up. */
|
|
44
|
+
embedding: (modelID, providerOptions) => embeddingRoute.model({ id: modelID, providerOptions }),
|
|
34
45
|
configure,
|
|
35
46
|
};
|
|
36
47
|
};
|
|
37
48
|
export const provider = configure();
|
|
38
49
|
export const chat = provider.chat;
|
|
50
|
+
export const embedding = provider.embedding;
|
|
39
51
|
export const model = (modelID, settings) => configure(toConfig(settings)).model(modelID);
|
|
52
|
+
export const embeddingModel = (modelID, settings) => {
|
|
53
|
+
const input = toConfig(settings);
|
|
54
|
+
return configure(input).embedding(modelID, input.providerOptions);
|
|
55
|
+
};
|
|
40
56
|
export * as Cohere from "./cohere.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { embeddingModel as model } from "../deepinfra.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
2
|
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
3
3
|
import { Route } from "../route/client.js";
|
|
4
|
-
import { type ModelID, type RequestOptions } from "../schema/index.js";
|
|
4
|
+
import { type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js";
|
|
5
5
|
import type { OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
6
6
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
7
|
export type Config = Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
@@ -112,6 +112,7 @@ export declare const route: Route<{
|
|
|
112
112
|
readonly reasoning?: string | undefined;
|
|
113
113
|
readonly reasoning_text?: string | undefined;
|
|
114
114
|
readonly reasoning_details?: unknown;
|
|
115
|
+
readonly reasoning_opaque?: string | undefined;
|
|
115
116
|
})[];
|
|
116
117
|
readonly tools?: readonly ({
|
|
117
118
|
readonly type: "function";
|
|
@@ -286,6 +287,7 @@ export declare const routes: Route<{
|
|
|
286
287
|
readonly reasoning?: string | undefined;
|
|
287
288
|
readonly reasoning_text?: string | undefined;
|
|
288
289
|
readonly reasoning_details?: unknown;
|
|
290
|
+
readonly reasoning_opaque?: string | undefined;
|
|
289
291
|
})[];
|
|
290
292
|
readonly tools?: readonly ({
|
|
291
293
|
readonly type: "function";
|
|
@@ -363,11 +365,14 @@ export declare const routes: Route<{
|
|
|
363
365
|
export declare const configure: (input?: Config) => {
|
|
364
366
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
365
367
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
368
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
366
369
|
configure: typeof configure;
|
|
367
370
|
};
|
|
368
371
|
export declare const provider: {
|
|
369
372
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
370
373
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
374
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
371
375
|
configure: typeof configure;
|
|
372
376
|
};
|
|
373
377
|
export declare const model: ProviderPackage.Model<Settings, OpenAIProviderOptionsInput>;
|
|
378
|
+
export declare const embeddingModel: (modelID: string, settings?: Settings) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
2
|
+
import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js";
|
|
2
3
|
import { Route } from "../route/client.js";
|
|
3
4
|
import { Endpoint } from "../route/endpoint.js";
|
|
4
5
|
import { ProviderID } from "../schema/index.js";
|
|
@@ -16,11 +17,19 @@ export const route = Route.make({
|
|
|
16
17
|
export const routes = [route];
|
|
17
18
|
export const configure = (input = {}) => {
|
|
18
19
|
const root = input.baseURL?.replace(/\/+$/, "");
|
|
19
|
-
const
|
|
20
|
+
const options = {
|
|
20
21
|
...bearerRouteDefaults(input, "DEEPINFRA_API_KEY"),
|
|
21
22
|
endpoint: {
|
|
22
23
|
baseURL: root === undefined ? baseURL : root.endsWith("/openai") ? root : `${root}/openai`,
|
|
23
24
|
},
|
|
25
|
+
};
|
|
26
|
+
const configured = route.with(options);
|
|
27
|
+
const embeddingRoute = OpenAIEmbeddings.route.with({
|
|
28
|
+
provider: id,
|
|
29
|
+
endpoint: options.endpoint,
|
|
30
|
+
auth: options.auth,
|
|
31
|
+
headers: input.headers,
|
|
32
|
+
http: input.http,
|
|
24
33
|
});
|
|
25
34
|
return {
|
|
26
35
|
id,
|
|
@@ -32,8 +41,13 @@ export const configure = (input = {}) => {
|
|
|
32
41
|
},
|
|
33
42
|
capabilities: { promptCacheKey: true },
|
|
34
43
|
}),
|
|
44
|
+
embedding: (modelID, providerOptions) => embeddingRoute.model({ id: modelID, providerOptions }),
|
|
35
45
|
configure,
|
|
36
46
|
};
|
|
37
47
|
};
|
|
38
48
|
export const provider = configure();
|
|
39
49
|
export const model = (modelID, settings) => configure(toConfig(settings)).model(modelID);
|
|
50
|
+
export const embeddingModel = (modelID, settings) => {
|
|
51
|
+
const input = toConfig(settings);
|
|
52
|
+
return configure(input).embedding(modelID, input.providerOptions);
|
|
53
|
+
};
|
|
@@ -112,6 +112,7 @@ export declare const route: Route<{
|
|
|
112
112
|
readonly reasoning?: string | undefined;
|
|
113
113
|
readonly reasoning_text?: string | undefined;
|
|
114
114
|
readonly reasoning_details?: unknown;
|
|
115
|
+
readonly reasoning_opaque?: string | undefined;
|
|
115
116
|
})[];
|
|
116
117
|
readonly tools?: readonly ({
|
|
117
118
|
readonly type: "function";
|
|
@@ -286,6 +287,7 @@ export declare const routes: Route<{
|
|
|
286
287
|
readonly reasoning?: string | undefined;
|
|
287
288
|
readonly reasoning_text?: string | undefined;
|
|
288
289
|
readonly reasoning_details?: unknown;
|
|
290
|
+
readonly reasoning_opaque?: string | undefined;
|
|
289
291
|
})[];
|
|
290
292
|
readonly tools?: readonly ({
|
|
291
293
|
readonly type: "function";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { embeddingModel as model } from "../digitalocean.js";
|
|
@@ -114,6 +114,7 @@ export declare const protocol: Protocol<{
|
|
|
114
114
|
readonly reasoning?: string | undefined;
|
|
115
115
|
readonly reasoning_text?: string | undefined;
|
|
116
116
|
readonly reasoning_details?: unknown;
|
|
117
|
+
readonly reasoning_opaque?: string | undefined;
|
|
117
118
|
})[];
|
|
118
119
|
readonly tools?: readonly ({
|
|
119
120
|
readonly type: "function";
|
|
@@ -199,6 +200,7 @@ export declare const protocol: Protocol<{
|
|
|
199
200
|
readonly reasoning?: string | null | undefined;
|
|
200
201
|
readonly reasoning_text?: string | null | undefined;
|
|
201
202
|
readonly reasoning_details?: unknown;
|
|
203
|
+
readonly reasoning_opaque?: string | null | undefined;
|
|
202
204
|
readonly tool_calls?: readonly {
|
|
203
205
|
readonly index?: number | null | undefined;
|
|
204
206
|
readonly id?: string | null | undefined;
|
|
@@ -224,6 +226,7 @@ export declare const protocol: Protocol<{
|
|
|
224
226
|
readonly prompt_cache_hit_tokens?: number | null | undefined;
|
|
225
227
|
readonly cache_read_input_tokens?: number | null | undefined;
|
|
226
228
|
readonly cache_created_input_tokens?: number | null | undefined;
|
|
229
|
+
readonly reasoning_tokens?: number | null | undefined;
|
|
227
230
|
readonly prompt_tokens_details?: {
|
|
228
231
|
readonly [x: string]: unknown;
|
|
229
232
|
readonly cached_tokens?: number | null | undefined;
|
|
@@ -246,6 +249,7 @@ export declare const protocol: Protocol<{
|
|
|
246
249
|
readonly prompt_cache_hit_tokens?: number | null | undefined;
|
|
247
250
|
readonly cache_read_input_tokens?: number | null | undefined;
|
|
248
251
|
readonly cache_created_input_tokens?: number | null | undefined;
|
|
252
|
+
readonly reasoning_tokens?: number | null | undefined;
|
|
249
253
|
readonly prompt_tokens_details?: {
|
|
250
254
|
readonly [x: string]: unknown;
|
|
251
255
|
readonly cached_tokens?: number | null | undefined;
|
|
@@ -364,6 +368,7 @@ export declare const route: Route<{
|
|
|
364
368
|
readonly reasoning?: string | undefined;
|
|
365
369
|
readonly reasoning_text?: string | undefined;
|
|
366
370
|
readonly reasoning_details?: unknown;
|
|
371
|
+
readonly reasoning_opaque?: string | undefined;
|
|
367
372
|
})[];
|
|
368
373
|
readonly tools?: readonly ({
|
|
369
374
|
readonly type: "function";
|
|
@@ -735,6 +740,7 @@ export declare const routes: (Route<{
|
|
|
735
740
|
readonly reasoning?: string | undefined;
|
|
736
741
|
readonly reasoning_text?: string | undefined;
|
|
737
742
|
readonly reasoning_details?: unknown;
|
|
743
|
+
readonly reasoning_opaque?: string | undefined;
|
|
738
744
|
})[];
|
|
739
745
|
readonly tools?: readonly ({
|
|
740
746
|
readonly type: "function";
|
|
@@ -816,6 +822,7 @@ export declare const configure: (input?: Config) => {
|
|
|
816
822
|
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
817
823
|
image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
818
824
|
decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
825
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
819
826
|
configure: typeof configure;
|
|
820
827
|
};
|
|
821
828
|
export declare const provider: {
|
|
@@ -825,9 +832,11 @@ export declare const provider: {
|
|
|
825
832
|
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
826
833
|
image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
827
834
|
decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
835
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
828
836
|
configure: typeof configure;
|
|
829
837
|
};
|
|
830
838
|
export declare const decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
839
|
+
export declare const embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
831
840
|
export declare const image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
832
841
|
export declare const chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
833
842
|
export declare const responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
@@ -835,4 +844,5 @@ export declare const model: ProviderPackage.Model<Settings, OpenAIProviderOption
|
|
|
835
844
|
export declare const responsesModel: ProviderPackage.Model<Settings<OpenResponsesProviderOptionsInput>, OpenResponsesProviderOptionsInput>;
|
|
836
845
|
export declare const imageModel: (modelID: string, settings?: Settings) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
837
846
|
export declare const decisionModel: (modelID: string, settings?: Settings) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
847
|
+
export declare const embeddingModel: (modelID: string, settings?: Settings) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
838
848
|
export * as DigitalOcean from "./digitalocean.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
2
|
+
import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js";
|
|
2
3
|
import { OpenAIImages } from "../protocols/openai-images.js";
|
|
3
4
|
import { OpenResponses } from "../protocols/open-responses.js";
|
|
4
5
|
import { SystemOne } from "../protocols/system-one.js";
|
|
@@ -53,6 +54,14 @@ export const configure = (input = {}) => {
|
|
|
53
54
|
const decision = (modelID, providerOptions) => decisionRoute.model({ id: modelID, providerOptions });
|
|
54
55
|
const media = MediaRoute.deployment({ ...input, baseURL: options.endpoint.baseURL }, options.auth);
|
|
55
56
|
const image = (modelID, providerOptions) => OpenAIImages.model({ ...media, id: modelID, provider: id, providerOptions });
|
|
57
|
+
const embeddingRoute = OpenAIEmbeddings.route.with({
|
|
58
|
+
provider: id,
|
|
59
|
+
endpoint: options.endpoint,
|
|
60
|
+
auth: options.auth,
|
|
61
|
+
headers: input.headers,
|
|
62
|
+
http: input.http,
|
|
63
|
+
});
|
|
64
|
+
const embedding = (modelID, providerOptions) => embeddingRoute.model({ id: modelID, providerOptions });
|
|
56
65
|
const chat = (modelID) => configured.model({
|
|
57
66
|
id: modelID,
|
|
58
67
|
capabilities: { promptCacheKey: true },
|
|
@@ -64,11 +73,13 @@ export const configure = (input = {}) => {
|
|
|
64
73
|
responses: (modelID) => configuredResponses.model({ id: modelID }),
|
|
65
74
|
image,
|
|
66
75
|
decision,
|
|
76
|
+
embedding,
|
|
67
77
|
configure,
|
|
68
78
|
};
|
|
69
79
|
};
|
|
70
80
|
export const provider = configure();
|
|
71
81
|
export const decision = provider.decision;
|
|
82
|
+
export const embedding = provider.embedding;
|
|
72
83
|
export const image = provider.image;
|
|
73
84
|
export const chat = provider.chat;
|
|
74
85
|
export const responses = provider.responses;
|
|
@@ -82,6 +93,10 @@ export const decisionModel = (modelID, settings) => {
|
|
|
82
93
|
const input = config(settings);
|
|
83
94
|
return configure(input).decision(modelID, input.providerOptions);
|
|
84
95
|
};
|
|
96
|
+
export const embeddingModel = (modelID, settings) => {
|
|
97
|
+
const input = config(settings);
|
|
98
|
+
return configure(input).embedding(modelID, input.providerOptions);
|
|
99
|
+
};
|
|
85
100
|
function config({ apiKey, baseURL, body, headers, ...providerOptions } = {}) {
|
|
86
101
|
return {
|
|
87
102
|
apiKey,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { embeddingModel as model } from "../fireworks.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
2
|
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
3
3
|
import { Route } from "../route/client.js";
|
|
4
|
-
import { type ModelID, type RequestOptions } from "../schema/index.js";
|
|
4
|
+
import { type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js";
|
|
5
5
|
import type { OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
6
6
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
7
|
export type Config = Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
@@ -112,6 +112,7 @@ export declare const route: Route<{
|
|
|
112
112
|
readonly reasoning?: string | undefined;
|
|
113
113
|
readonly reasoning_text?: string | undefined;
|
|
114
114
|
readonly reasoning_details?: unknown;
|
|
115
|
+
readonly reasoning_opaque?: string | undefined;
|
|
115
116
|
})[];
|
|
116
117
|
readonly tools?: readonly ({
|
|
117
118
|
readonly type: "function";
|
|
@@ -286,6 +287,7 @@ export declare const routes: Route<{
|
|
|
286
287
|
readonly reasoning?: string | undefined;
|
|
287
288
|
readonly reasoning_text?: string | undefined;
|
|
288
289
|
readonly reasoning_details?: unknown;
|
|
290
|
+
readonly reasoning_opaque?: string | undefined;
|
|
289
291
|
})[];
|
|
290
292
|
readonly tools?: readonly ({
|
|
291
293
|
readonly type: "function";
|
|
@@ -363,12 +365,15 @@ export declare const routes: Route<{
|
|
|
363
365
|
export declare const configure: (input?: Config) => {
|
|
364
366
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
365
367
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
368
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
366
369
|
configure: typeof configure;
|
|
367
370
|
};
|
|
368
371
|
export declare const provider: {
|
|
369
372
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
370
373
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
374
|
+
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
371
375
|
configure: typeof configure;
|
|
372
376
|
};
|
|
373
377
|
export declare const model: ProviderPackage.Model<Settings, OpenAIProviderOptionsInput>;
|
|
378
|
+
export declare const embeddingModel: (modelID: string, settings?: Settings) => import("../embedding.js").EmbeddingModel<import("../embedding.js").EmbeddingOptions>;
|
|
374
379
|
export * as Fireworks from "./fireworks.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
2
|
+
import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js";
|
|
2
3
|
import { Route } from "../route/client.js";
|
|
3
4
|
import { Endpoint } from "../route/endpoint.js";
|
|
4
5
|
import { ProviderID } from "../schema/index.js";
|
|
@@ -15,13 +16,26 @@ export const route = Route.make({
|
|
|
15
16
|
});
|
|
16
17
|
export const routes = [route];
|
|
17
18
|
export const configure = (input = {}) => {
|
|
18
|
-
const
|
|
19
|
+
const options = bearerRouteDefaults(input, "FIREWORKS_API_KEY", baseURL);
|
|
20
|
+
const configured = route.with(options);
|
|
21
|
+
const embeddingRoute = OpenAIEmbeddings.route.with({
|
|
22
|
+
provider: id,
|
|
23
|
+
endpoint: options.endpoint,
|
|
24
|
+
auth: options.auth,
|
|
25
|
+
headers: input.headers,
|
|
26
|
+
http: input.http,
|
|
27
|
+
});
|
|
19
28
|
return {
|
|
20
29
|
id,
|
|
21
30
|
model: (modelID) => configured.model({ id: modelID, capabilities: { promptCacheKey: true } }),
|
|
31
|
+
embedding: (modelID, providerOptions) => embeddingRoute.model({ id: modelID, providerOptions }),
|
|
22
32
|
configure,
|
|
23
33
|
};
|
|
24
34
|
};
|
|
25
35
|
export const provider = configure();
|
|
26
36
|
export const model = (modelID, settings) => configure(toConfig(settings)).model(modelID);
|
|
37
|
+
export const embeddingModel = (modelID, settings) => {
|
|
38
|
+
const input = toConfig(settings);
|
|
39
|
+
return configure(input).embedding(modelID, input.providerOptions);
|
|
40
|
+
};
|
|
27
41
|
export * as Fireworks from "./fireworks.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { embeddingModel as model } from "../google.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { embeddingModel as model } from "../google-vertex.js";
|
|
@@ -117,6 +117,7 @@ export declare const routes: Route<{
|
|
|
117
117
|
readonly reasoning?: string | undefined;
|
|
118
118
|
readonly reasoning_text?: string | undefined;
|
|
119
119
|
readonly reasoning_details?: unknown;
|
|
120
|
+
readonly reasoning_opaque?: string | undefined;
|
|
120
121
|
})[];
|
|
121
122
|
readonly tools?: readonly ({
|
|
122
123
|
readonly type: "function";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
2
|
import { Gemini } from "../protocols/gemini.js";
|
|
3
|
+
import { type VertexOptionsInput } from "../protocols/google-embed-content.js";
|
|
4
|
+
import { type OptionsInput as PredictOptionsInput } from "../protocols/google-vertex-predict-embeddings.js";
|
|
3
5
|
import { Route } from "../route/client.js";
|
|
4
6
|
import { type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js";
|
|
5
7
|
import { GoogleVertexShared } from "./google-vertex-shared.js";
|
|
@@ -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({
|
|
@@ -2,7 +2,9 @@ import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
|
2
2
|
import type { ProviderPackage } from "../provider-package.js";
|
|
3
3
|
import { type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js";
|
|
4
4
|
import { Gemini } from "../protocols/gemini.js";
|
|
5
|
+
import { type OptionsInput as GoogleEmbeddingOptionsInput } from "../protocols/google-embed-content.js";
|
|
5
6
|
import { GoogleInteractions } from "../protocols/google-interactions.js";
|
|
7
|
+
export type { OptionsInput as GoogleEmbeddingOptions } from "../protocols/google-embed-content.js";
|
|
6
8
|
export type { GoogleImageOptions } from "../protocols/google-images.js";
|
|
7
9
|
export type { GoogleSpeechOptions } from "../protocols/google-speech.js";
|
|
8
10
|
export type { GoogleTranscriptionOptions } from "../protocols/google-transcription.js";
|
|
@@ -181,6 +183,7 @@ export declare const configure: (input?: Config) => {
|
|
|
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: {
|
|
@@ -198,11 +201,14 @@ export declare const provider: {
|
|
|
198
201
|
video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/google-video.js").GoogleVideoOptions>;
|
|
199
202
|
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/google-speech.js").GoogleSpeechOptions>;
|
|
200
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>;
|
|
201
205
|
configure: typeof configure;
|
|
202
206
|
};
|
|
203
207
|
export declare const model: ProviderPackage.Model<Settings, Gemini.ProviderOptionsInput>;
|
|
204
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>;
|
|
205
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>;
|
|
206
212
|
export declare const gemini: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<Gemini.OptionsInput, import("../route.js").CompactionOperations | undefined>;
|
|
207
213
|
export declare const interactions: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<{
|
|
208
214
|
readonly previousInteractionId?: string | undefined;
|
package/dist/providers/google.js
CHANGED
|
@@ -3,6 +3,7 @@ import { AuthOptions } from "../route/auth-options.js";
|
|
|
3
3
|
import { MediaRoute } from "../route/media.js";
|
|
4
4
|
import { ProviderID } from "../schema/index.js";
|
|
5
5
|
import { Gemini } from "../protocols/gemini.js";
|
|
6
|
+
import { GoogleEmbedContent, } from "../protocols/google-embed-content.js";
|
|
6
7
|
import { GoogleInteractions } from "../protocols/google-interactions.js";
|
|
7
8
|
import { GoogleImages } from "../protocols/google-images.js";
|
|
8
9
|
import { GoogleSpeech } from "../protocols/google-speech.js";
|
|
@@ -24,6 +25,13 @@ export const configure = (input = {}) => {
|
|
|
24
25
|
const route = configuredRoute(input);
|
|
25
26
|
const media = MediaRoute.deployment(input, auth(input));
|
|
26
27
|
const gemini = (modelID) => route.model({ id: modelID });
|
|
28
|
+
const embeddingRoute = GoogleEmbedContent.route.with({
|
|
29
|
+
provider: id,
|
|
30
|
+
endpoint: { baseURL: input.baseURL },
|
|
31
|
+
auth: auth(input),
|
|
32
|
+
headers: input.headers,
|
|
33
|
+
http: input.http,
|
|
34
|
+
});
|
|
27
35
|
return {
|
|
28
36
|
id,
|
|
29
37
|
model: gemini,
|
|
@@ -33,6 +41,7 @@ export const configure = (input = {}) => {
|
|
|
33
41
|
video: (modelID) => GoogleVideo.model({ ...media, id: modelID }),
|
|
34
42
|
speech: (modelID) => GoogleSpeech.model({ ...media, id: modelID }),
|
|
35
43
|
transcription: (modelID) => GoogleTranscription.model({ ...media, id: modelID }),
|
|
44
|
+
embedding: (modelID, providerOptions) => embeddingRoute.model({ id: modelID, providerOptions }),
|
|
36
45
|
configure,
|
|
37
46
|
};
|
|
38
47
|
};
|
|
@@ -42,7 +51,12 @@ export const imageModel = (modelID, settings) => {
|
|
|
42
51
|
const input = toConfig(settings);
|
|
43
52
|
return configure(input).image(modelID, input.providerOptions);
|
|
44
53
|
};
|
|
54
|
+
export const embeddingModel = (modelID, settings) => {
|
|
55
|
+
const input = toConfig(settings);
|
|
56
|
+
return configure(input).embedding(modelID, input.providerOptions);
|
|
57
|
+
};
|
|
45
58
|
export const image = provider.image;
|
|
59
|
+
export const embedding = provider.embedding;
|
|
46
60
|
export const gemini = provider.gemini;
|
|
47
61
|
export const interactions = provider.interactions;
|
|
48
62
|
export const video = provider.video;
|