@opencode/ai 0.0.0-dev-19485 → 0.0.0-dev-19487
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/dist/provider-package.d.ts +4 -0
- package/dist/providers/alibaba.d.ts +1 -2
- package/dist/providers/alibaba.js +6 -1
- package/dist/providers/amazon-bedrock-mantle.d.ts +2 -3
- package/dist/providers/amazon-bedrock-mantle.js +11 -11
- package/dist/providers/anthropic-compatible.d.ts +1 -2
- package/dist/providers/anthropic-compatible.js +9 -11
- package/dist/providers/anthropic.d.ts +1 -2
- package/dist/providers/anthropic.js +7 -7
- package/dist/providers/azure.d.ts +1 -2
- package/dist/providers/azure.js +12 -12
- package/dist/providers/baseten.d.ts +2 -3
- package/dist/providers/baseten.js +6 -6
- package/dist/providers/cerebras.d.ts +2 -3
- package/dist/providers/cerebras.js +6 -6
- package/dist/providers/cloudflare-ai-gateway.d.ts +1 -2
- package/dist/providers/cloudflare-ai-gateway.js +11 -8
- package/dist/providers/cloudflare-workers-ai.d.ts +1 -2
- package/dist/providers/cloudflare-workers-ai.js +10 -7
- package/dist/providers/deepinfra.d.ts +2 -3
- package/dist/providers/deepinfra.js +6 -6
- package/dist/providers/deepseek.d.ts +2 -3
- package/dist/providers/deepseek.js +6 -6
- package/dist/providers/fireworks.d.ts +2 -3
- package/dist/providers/fireworks.js +6 -6
- package/dist/providers/google-vertex-chat.d.ts +2 -3
- package/dist/providers/google-vertex-chat.js +9 -9
- package/dist/providers/google-vertex-messages.d.ts +2 -3
- package/dist/providers/google-vertex-messages.js +9 -9
- package/dist/providers/google-vertex-responses.d.ts +2 -3
- package/dist/providers/google-vertex-responses.js +9 -9
- package/dist/providers/google-vertex.d.ts +1 -2
- package/dist/providers/google-vertex.js +9 -9
- package/dist/providers/google.d.ts +2 -3
- package/dist/providers/google.js +6 -6
- package/dist/providers/groq.d.ts +2 -3
- package/dist/providers/groq.js +6 -6
- package/dist/providers/meta.d.ts +2 -3
- package/dist/providers/meta.js +6 -6
- package/dist/providers/minimax/chat.js +6 -6
- package/dist/providers/minimax/responses.js +6 -6
- package/dist/providers/minimax.d.ts +2 -3
- package/dist/providers/minimax.js +6 -6
- package/dist/providers/mistral.d.ts +2 -3
- package/dist/providers/mistral.js +6 -6
- package/dist/providers/moonshot/messages.js +6 -6
- package/dist/providers/moonshot/responses.js +6 -6
- package/dist/providers/moonshot.d.ts +2 -3
- package/dist/providers/moonshot.js +6 -6
- package/dist/providers/openai-compatible-responses.d.ts +2 -3
- package/dist/providers/openai-compatible-responses.js +7 -7
- package/dist/providers/openai-compatible.d.ts +2 -3
- package/dist/providers/openai-compatible.js +7 -7
- package/dist/providers/openai.d.ts +2 -3
- package/dist/providers/openai.js +9 -9
- package/dist/providers/openrouter.d.ts +2 -3
- package/dist/providers/openrouter.js +6 -6
- package/dist/providers/togetherai.d.ts +2 -3
- package/dist/providers/togetherai.js +6 -6
- package/dist/providers/xai.d.ts +2 -3
- package/dist/providers/xai.js +6 -6
- package/dist/providers/zai-coding-plan/messages.js +6 -6
- package/dist/providers/zai-coding-plan/responses.js +6 -6
- package/dist/providers/zai-coding-plan.d.ts +2 -3
- package/dist/providers/zai-coding-plan.js +6 -6
- package/dist/providers/zai.d.ts +2 -3
- package/dist/providers/zai.js +6 -6
- package/package.json +3 -3
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { LanguageModel, ProviderOptions } from "./schema/index.js";
|
|
2
2
|
import type { CompactionOperations } from "./route/client.js";
|
|
3
|
+
/**
|
|
4
|
+
* Flat, serializable settings for `model(modelID, settings)`. Each entrypoint declares the connection keys it
|
|
5
|
+
* reads; every other key is a request option for the route's protocol.
|
|
6
|
+
*/
|
|
3
7
|
export interface Settings extends Readonly<Record<string, unknown>> {
|
|
4
8
|
readonly baseURL?: string;
|
|
5
9
|
readonly headers?: Readonly<Record<string, string>>;
|
|
@@ -20,9 +20,8 @@ type Location = AtLeastOne<{
|
|
|
20
20
|
export type Config = Location & Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
21
21
|
readonly providerOptions?: ChatOptionsInput | MessagesOptionsInput | ResponsesOptionsInput;
|
|
22
22
|
};
|
|
23
|
-
export type Settings<Options = ChatOptionsInput> = Location & ProviderPackage.Settings & {
|
|
23
|
+
export type Settings<Options = ChatOptionsInput> = Location & ProviderPackage.Settings & Options & {
|
|
24
24
|
readonly apiKey?: string;
|
|
25
|
-
readonly providerOptions?: Options;
|
|
26
25
|
};
|
|
27
26
|
export declare const routes: (Route<{
|
|
28
27
|
readonly model: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Struct } from "effect";
|
|
1
2
|
import { AlibabaChat } from "../protocols/alibaba-chat.js";
|
|
2
3
|
import { AlibabaMessages } from "../protocols/alibaba-messages.js";
|
|
3
4
|
import { AlibabaResponses } from "../protocols/alibaba-responses.js";
|
|
@@ -73,7 +74,11 @@ export const messagesModel = (id, input) => fromSettings(input).messages(id);
|
|
|
73
74
|
export const responsesModel = (id, input) => fromSettings(input).responses(id);
|
|
74
75
|
function fromSettings(input) {
|
|
75
76
|
const { body, ...rest } = input;
|
|
76
|
-
return configure({
|
|
77
|
+
return configure({
|
|
78
|
+
...rest,
|
|
79
|
+
http: body === undefined ? undefined : { body },
|
|
80
|
+
providerOptions: Struct.omit(rest, ["apiKey", "baseURL", "headers", "region", "workspaceID"]),
|
|
81
|
+
});
|
|
77
82
|
}
|
|
78
83
|
export const webSearch = () => hostedTool("web_search", "Search the web with Alibaba's hosted search tool.");
|
|
79
84
|
export const webExtractor = () => hostedTool("web_extractor", "Extract web page content with Alibaba's hosted tool.");
|
|
@@ -17,7 +17,7 @@ export type Config = RouteDefaultsInput & {
|
|
|
17
17
|
readonly region?: string;
|
|
18
18
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
20
|
+
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
|
|
21
21
|
readonly apiKey?: string;
|
|
22
22
|
readonly auth?: "bearer" | "sigv4";
|
|
23
23
|
readonly baseURL?: string;
|
|
@@ -25,8 +25,7 @@ export interface Settings extends ProviderPackage.Settings {
|
|
|
25
25
|
readonly profile?: string;
|
|
26
26
|
readonly region?: string;
|
|
27
27
|
readonly topP?: number;
|
|
28
|
-
|
|
29
|
-
}
|
|
28
|
+
};
|
|
30
29
|
export declare const routes: (Route<{
|
|
31
30
|
readonly model: string;
|
|
32
31
|
readonly messages: readonly ({
|
|
@@ -62,17 +62,17 @@ export const configure = (input = {}) => {
|
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
64
|
export const provider = configure();
|
|
65
|
-
const fromSettings = (
|
|
66
|
-
apiKey
|
|
67
|
-
auth
|
|
68
|
-
baseURL
|
|
69
|
-
credentials
|
|
70
|
-
generation:
|
|
71
|
-
headers:
|
|
72
|
-
http:
|
|
73
|
-
profile
|
|
74
|
-
providerOptions
|
|
75
|
-
region
|
|
65
|
+
const fromSettings = ({ apiKey, auth, baseURL, body, credentials, headers, profile, region, topP, ...providerOptions }) => configure({
|
|
66
|
+
apiKey,
|
|
67
|
+
auth,
|
|
68
|
+
baseURL,
|
|
69
|
+
credentials,
|
|
70
|
+
generation: topP === undefined ? undefined : { topP },
|
|
71
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
72
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
73
|
+
profile,
|
|
74
|
+
providerOptions,
|
|
75
|
+
region,
|
|
76
76
|
});
|
|
77
77
|
export const chatModel = (modelID, settings) => fromSettings(settings).chat(modelID);
|
|
78
78
|
export const responsesModel = (modelID, settings) => fromSettings(settings).responses(modelID);
|
|
@@ -12,7 +12,7 @@ export type Config = RouteDefaultsInput & ProviderAuthOption<"optional"> & {
|
|
|
12
12
|
readonly baseURL: string;
|
|
13
13
|
readonly providerOptions?: AnthropicMessages.ProviderOptionsInput;
|
|
14
14
|
};
|
|
15
|
-
export type Settings = ProviderPackage.Settings & ({
|
|
15
|
+
export type Settings = ProviderPackage.Settings & AnthropicMessages.ProviderOptionsInput & ({
|
|
16
16
|
readonly apiKey?: string;
|
|
17
17
|
readonly authToken?: never;
|
|
18
18
|
} | {
|
|
@@ -21,7 +21,6 @@ export type Settings = ProviderPackage.Settings & ({
|
|
|
21
21
|
}) & {
|
|
22
22
|
readonly baseURL: string;
|
|
23
23
|
readonly provider?: string;
|
|
24
|
-
readonly providerOptions?: AnthropicMessages.ProviderOptionsInput;
|
|
25
24
|
};
|
|
26
25
|
export declare const routes: import("../route/client.js").Route<{
|
|
27
26
|
readonly max_tokens: number;
|
|
@@ -32,21 +32,19 @@ export const provider = {
|
|
|
32
32
|
id,
|
|
33
33
|
configure,
|
|
34
34
|
};
|
|
35
|
-
export const model = (modelID,
|
|
36
|
-
|
|
37
|
-
const provider = ProviderID.make(settings.provider ?? id);
|
|
38
|
-
if (settings.apiKey !== undefined && settings.authToken !== undefined)
|
|
35
|
+
export const model = (modelID, { apiKey, authToken, baseURL, body, headers, provider, ...providerOptions }) => {
|
|
36
|
+
if (apiKey !== undefined && authToken !== undefined)
|
|
39
37
|
throw new ProviderConfigurationError({
|
|
40
|
-
provider,
|
|
38
|
+
provider: ProviderID.make(provider ?? id),
|
|
41
39
|
message: "Anthropic-compatible apiKey cannot be combined with authToken",
|
|
42
40
|
});
|
|
43
41
|
return configure({
|
|
44
|
-
...(
|
|
45
|
-
baseURL
|
|
46
|
-
headers:
|
|
47
|
-
http:
|
|
48
|
-
provider
|
|
49
|
-
providerOptions
|
|
42
|
+
...(authToken === undefined ? { apiKey: apiKey } : { auth: Auth.bearer(authToken) }),
|
|
43
|
+
baseURL,
|
|
44
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
45
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
46
|
+
provider,
|
|
47
|
+
providerOptions,
|
|
50
48
|
}).model(modelID);
|
|
51
49
|
};
|
|
52
50
|
export * as AnthropicCompatible from "./anthropic-compatible.js";
|
|
@@ -281,7 +281,7 @@ export type Config = RouteDefaultsInput & ProviderAuthOption<"optional"> & {
|
|
|
281
281
|
readonly baseURL?: string;
|
|
282
282
|
readonly providerOptions?: AnthropicMessages.ProviderOptionsInput;
|
|
283
283
|
};
|
|
284
|
-
export type Settings = ProviderPackage.Settings & ({
|
|
284
|
+
export type Settings = ProviderPackage.Settings & AnthropicMessages.ProviderOptionsInput & ({
|
|
285
285
|
readonly apiKey?: string;
|
|
286
286
|
readonly authToken?: never;
|
|
287
287
|
} | {
|
|
@@ -289,7 +289,6 @@ export type Settings = ProviderPackage.Settings & ({
|
|
|
289
289
|
readonly authToken?: string;
|
|
290
290
|
}) & {
|
|
291
291
|
readonly baseURL?: string;
|
|
292
|
-
readonly providerOptions?: AnthropicMessages.ProviderOptionsInput;
|
|
293
292
|
};
|
|
294
293
|
export declare const configure: (input?: Config) => {
|
|
295
294
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
@@ -26,17 +26,17 @@ export const configure = (input = {}) => {
|
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
export const provider = configure();
|
|
29
|
-
export const model = (modelID,
|
|
30
|
-
if (
|
|
29
|
+
export const model = (modelID, { apiKey, authToken, baseURL, body, headers, ...providerOptions }) => {
|
|
30
|
+
if (apiKey !== undefined && authToken !== undefined)
|
|
31
31
|
throw new ProviderConfigurationError({
|
|
32
32
|
provider: id,
|
|
33
33
|
message: "Anthropic apiKey cannot be combined with authToken",
|
|
34
34
|
});
|
|
35
35
|
return configure({
|
|
36
|
-
...(
|
|
37
|
-
baseURL
|
|
38
|
-
headers:
|
|
39
|
-
http:
|
|
40
|
-
providerOptions
|
|
36
|
+
...(authToken === undefined ? { apiKey: apiKey } : { auth: Auth.bearer(authToken) }),
|
|
37
|
+
baseURL,
|
|
38
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
39
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
40
|
+
providerOptions,
|
|
41
41
|
}).model(modelID);
|
|
42
42
|
};
|
|
@@ -15,12 +15,11 @@ export type LanguageModelOptions = AzureURL & RouteDefaultsInput & ProviderAuthO
|
|
|
15
15
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
16
16
|
};
|
|
17
17
|
export type Config = LanguageModelOptions;
|
|
18
|
-
export type Settings = ProviderPackage.Settings & AzureURL & {
|
|
18
|
+
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & AzureURL & {
|
|
19
19
|
readonly apiKey?: string;
|
|
20
20
|
readonly apiVersion?: string;
|
|
21
21
|
readonly queryParams?: Readonly<Record<string, string>>;
|
|
22
22
|
readonly useDeploymentBasedUrls?: boolean;
|
|
23
|
-
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
24
23
|
};
|
|
25
24
|
declare const responsesRoute: Route<{
|
|
26
25
|
readonly input: readonly ({
|
package/dist/providers/azure.js
CHANGED
|
@@ -94,20 +94,20 @@ export const provider = {
|
|
|
94
94
|
id,
|
|
95
95
|
configure,
|
|
96
96
|
};
|
|
97
|
-
const config = (
|
|
97
|
+
const config = ({ apiKey, apiVersion, baseURL, body, headers, queryParams, resourceName, useDeploymentBasedUrls, ...providerOptions }) => {
|
|
98
98
|
const common = {
|
|
99
|
-
apiKey
|
|
100
|
-
apiVersion
|
|
101
|
-
headers:
|
|
102
|
-
http:
|
|
103
|
-
providerOptions
|
|
104
|
-
queryParams:
|
|
105
|
-
useDeploymentBasedUrls
|
|
99
|
+
apiKey,
|
|
100
|
+
apiVersion,
|
|
101
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
102
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
103
|
+
providerOptions,
|
|
104
|
+
queryParams: queryParams === undefined ? undefined : { ...queryParams },
|
|
105
|
+
useDeploymentBasedUrls,
|
|
106
106
|
};
|
|
107
|
-
if (
|
|
108
|
-
return { ...common, baseURL
|
|
109
|
-
if (
|
|
110
|
-
return { ...common, resourceName
|
|
107
|
+
if (baseURL !== undefined)
|
|
108
|
+
return { ...common, baseURL };
|
|
109
|
+
if (resourceName !== undefined)
|
|
110
|
+
return { ...common, resourceName };
|
|
111
111
|
throw new ProviderConfigurationError({ provider: id, message: "Azure requires resourceName or baseURL" });
|
|
112
112
|
};
|
|
113
113
|
export const responsesModel = (modelID, settings) => configure(config(settings)).responses(modelID);
|
|
@@ -8,11 +8,10 @@ export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> &
|
|
|
8
8
|
readonly baseURL?: string;
|
|
9
9
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
|
|
12
12
|
readonly apiKey?: string;
|
|
13
13
|
readonly baseURL?: string;
|
|
14
|
-
|
|
15
|
-
}
|
|
14
|
+
};
|
|
16
15
|
export declare const route: Route<{
|
|
17
16
|
readonly model: string;
|
|
18
17
|
readonly messages: readonly ({
|
|
@@ -28,11 +28,11 @@ export const configure = (input = {}) => {
|
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
export const provider = configure();
|
|
31
|
-
export const model = (modelID,
|
|
32
|
-
apiKey
|
|
33
|
-
baseURL
|
|
34
|
-
headers:
|
|
35
|
-
http:
|
|
36
|
-
providerOptions
|
|
31
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
32
|
+
apiKey,
|
|
33
|
+
baseURL,
|
|
34
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
35
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
36
|
+
providerOptions,
|
|
37
37
|
}).model(modelID);
|
|
38
38
|
export * as Baseten from "./baseten.js";
|
|
@@ -8,11 +8,10 @@ export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> &
|
|
|
8
8
|
readonly baseURL?: string;
|
|
9
9
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
|
|
12
12
|
readonly apiKey?: string;
|
|
13
13
|
readonly baseURL?: string;
|
|
14
|
-
|
|
15
|
-
}
|
|
14
|
+
};
|
|
16
15
|
export declare const route: Route<{
|
|
17
16
|
readonly model: string;
|
|
18
17
|
readonly messages: readonly ({
|
|
@@ -31,10 +31,10 @@ export const configure = (input = {}) => {
|
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
export const provider = configure();
|
|
34
|
-
export const model = (modelID,
|
|
35
|
-
apiKey
|
|
36
|
-
baseURL
|
|
37
|
-
headers:
|
|
38
|
-
http:
|
|
39
|
-
providerOptions
|
|
34
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
35
|
+
apiKey,
|
|
36
|
+
baseURL,
|
|
37
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
38
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
39
|
+
providerOptions,
|
|
40
40
|
}).model(modelID);
|
|
@@ -17,10 +17,9 @@ export type LanguageModelOptions = GatewayURL & Omit<RouteDefaultsInput, "provid
|
|
|
17
17
|
readonly gatewayApiKey?: string | Redacted.Redacted | Config.Config<string | Redacted.Redacted>;
|
|
18
18
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
19
19
|
};
|
|
20
|
-
export type Settings = ProviderPackage.Settings & GatewayURL & {
|
|
20
|
+
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & GatewayURL & {
|
|
21
21
|
readonly apiKey?: string;
|
|
22
22
|
readonly gatewayApiKey?: string;
|
|
23
|
-
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
24
23
|
};
|
|
25
24
|
export declare const baseURL: (input: GatewayURL) => string;
|
|
26
25
|
export declare const route: Route<{
|
|
@@ -51,12 +51,15 @@ export const configure = (input) => {
|
|
|
51
51
|
};
|
|
52
52
|
};
|
|
53
53
|
export const provider = { id, configure };
|
|
54
|
-
export const model = (modelID, settings) =>
|
|
55
|
-
apiKey: settings
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
54
|
+
export const model = (modelID, settings) => {
|
|
55
|
+
const { accountId: _, apiKey, baseURL: _url, body, gatewayApiKey, gatewayId: _id, headers, ...providerOptions } = settings;
|
|
56
|
+
return configure({
|
|
57
|
+
apiKey,
|
|
58
|
+
gatewayApiKey,
|
|
59
|
+
baseURL: baseURL(settings),
|
|
60
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
61
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
62
|
+
providerOptions,
|
|
63
|
+
}).model(modelID);
|
|
64
|
+
};
|
|
62
65
|
export * as CloudflareAIGateway from "./cloudflare-ai-gateway.js";
|
|
@@ -12,9 +12,8 @@ type WorkersAIURL = AtLeastOne<{
|
|
|
12
12
|
export type LanguageModelOptions = WorkersAIURL & Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
13
13
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
14
14
|
};
|
|
15
|
-
export type Settings = ProviderPackage.Settings & WorkersAIURL & {
|
|
15
|
+
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & WorkersAIURL & {
|
|
16
16
|
readonly apiKey?: string;
|
|
17
|
-
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
18
17
|
};
|
|
19
18
|
export declare const baseURL: (input: WorkersAIURL) => string;
|
|
20
19
|
export declare const route: Route<{
|
|
@@ -38,11 +38,14 @@ export const configure = (input) => {
|
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
40
|
export const provider = { id, configure };
|
|
41
|
-
export const model = (modelID, settings) =>
|
|
42
|
-
apiKey: settings
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
41
|
+
export const model = (modelID, settings) => {
|
|
42
|
+
const { accountId: _, apiKey, baseURL: _url, body, headers, ...providerOptions } = settings;
|
|
43
|
+
return configure({
|
|
44
|
+
apiKey,
|
|
45
|
+
baseURL: baseURL(settings),
|
|
46
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
47
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
48
|
+
providerOptions,
|
|
49
|
+
}).model(modelID);
|
|
50
|
+
};
|
|
48
51
|
export * as CloudflareWorkersAI from "./cloudflare-workers-ai.js";
|
|
@@ -8,11 +8,10 @@ export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> &
|
|
|
8
8
|
readonly baseURL?: string;
|
|
9
9
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
|
|
12
12
|
readonly apiKey?: string;
|
|
13
13
|
readonly baseURL?: string;
|
|
14
|
-
|
|
15
|
-
}
|
|
14
|
+
};
|
|
16
15
|
export declare const route: Route<{
|
|
17
16
|
readonly model: string;
|
|
18
17
|
readonly messages: readonly ({
|
|
@@ -34,10 +34,10 @@ export const configure = (input = {}) => {
|
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
export const provider = configure();
|
|
37
|
-
export const model = (modelID,
|
|
38
|
-
apiKey
|
|
39
|
-
baseURL
|
|
40
|
-
headers:
|
|
41
|
-
http:
|
|
42
|
-
providerOptions
|
|
37
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
38
|
+
apiKey,
|
|
39
|
+
baseURL,
|
|
40
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
41
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
42
|
+
providerOptions,
|
|
43
43
|
}).model(modelID);
|
|
@@ -8,11 +8,10 @@ export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> &
|
|
|
8
8
|
readonly baseURL?: string;
|
|
9
9
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
|
|
12
12
|
readonly apiKey?: string;
|
|
13
13
|
readonly baseURL?: string;
|
|
14
|
-
|
|
15
|
-
}
|
|
14
|
+
};
|
|
16
15
|
export declare const route: Route<{
|
|
17
16
|
readonly model: string;
|
|
18
17
|
readonly messages: readonly ({
|
|
@@ -31,11 +31,11 @@ export const configure = (input = {}) => {
|
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
export const provider = configure();
|
|
34
|
-
export const model = (modelID,
|
|
35
|
-
apiKey
|
|
36
|
-
baseURL
|
|
37
|
-
headers:
|
|
38
|
-
http:
|
|
39
|
-
providerOptions
|
|
34
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
35
|
+
apiKey,
|
|
36
|
+
baseURL,
|
|
37
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
38
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
39
|
+
providerOptions,
|
|
40
40
|
}).model(modelID);
|
|
41
41
|
export * as DeepSeek from "./deepseek.js";
|
|
@@ -8,11 +8,10 @@ export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> &
|
|
|
8
8
|
readonly baseURL?: string;
|
|
9
9
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
|
|
12
12
|
readonly apiKey?: string;
|
|
13
13
|
readonly baseURL?: string;
|
|
14
|
-
|
|
15
|
-
}
|
|
14
|
+
};
|
|
16
15
|
export declare const route: Route<{
|
|
17
16
|
readonly model: string;
|
|
18
17
|
readonly messages: readonly ({
|
|
@@ -28,11 +28,11 @@ export const configure = (input = {}) => {
|
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
export const provider = configure();
|
|
31
|
-
export const model = (modelID,
|
|
32
|
-
apiKey
|
|
33
|
-
baseURL
|
|
34
|
-
headers:
|
|
35
|
-
http:
|
|
36
|
-
providerOptions
|
|
31
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
32
|
+
apiKey,
|
|
33
|
+
baseURL,
|
|
34
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
35
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
36
|
+
providerOptions,
|
|
37
37
|
}).model(modelID);
|
|
38
38
|
export * as Fireworks from "./fireworks.js";
|
|
@@ -10,14 +10,13 @@ export type Config = RouteDefaultsInput & GoogleVertexShared.OAuthOptions & {
|
|
|
10
10
|
readonly project?: string;
|
|
11
11
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
|
|
14
14
|
readonly accessToken?: string;
|
|
15
15
|
readonly apiKey?: never;
|
|
16
16
|
readonly baseURL?: string;
|
|
17
17
|
readonly location?: string;
|
|
18
18
|
readonly project?: string;
|
|
19
|
-
|
|
20
|
-
}
|
|
19
|
+
};
|
|
21
20
|
export declare const routes: Route<{
|
|
22
21
|
readonly model: string;
|
|
23
22
|
readonly messages: readonly ({
|
|
@@ -40,16 +40,16 @@ export const provider = {
|
|
|
40
40
|
id,
|
|
41
41
|
configure,
|
|
42
42
|
};
|
|
43
|
-
export const model = (modelID,
|
|
44
|
-
if (
|
|
43
|
+
export const model = (modelID, { accessToken, apiKey, baseURL, body, headers, location, project, ...providerOptions }) => {
|
|
44
|
+
if (apiKey !== undefined)
|
|
45
45
|
throw new ProviderConfigurationError({ provider: id, message: "Google Vertex Chat does not support API keys" });
|
|
46
46
|
return configure({
|
|
47
|
-
accessToken
|
|
48
|
-
baseURL
|
|
49
|
-
headers:
|
|
50
|
-
http:
|
|
51
|
-
location
|
|
52
|
-
project
|
|
53
|
-
providerOptions
|
|
47
|
+
accessToken,
|
|
48
|
+
baseURL,
|
|
49
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
50
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
51
|
+
location,
|
|
52
|
+
project,
|
|
53
|
+
providerOptions,
|
|
54
54
|
}).model(modelID);
|
|
55
55
|
};
|
|
@@ -13,14 +13,13 @@ export type Config = RouteDefaultsInput & GoogleVertexShared.OAuthOptions & {
|
|
|
13
13
|
readonly project?: string;
|
|
14
14
|
readonly providerOptions?: AnthropicMessages.ProviderOptionsInput;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export type Settings = ProviderPackage.Settings & AnthropicMessages.ProviderOptionsInput & {
|
|
17
17
|
readonly accessToken?: string;
|
|
18
18
|
readonly apiKey?: never;
|
|
19
19
|
readonly baseURL?: string;
|
|
20
20
|
readonly location?: string;
|
|
21
21
|
readonly project?: string;
|
|
22
|
-
|
|
23
|
-
}
|
|
22
|
+
};
|
|
24
23
|
export declare const routes: Route<{
|
|
25
24
|
anthropic_version: "vertex-2023-10-16";
|
|
26
25
|
metadata?: {
|
|
@@ -60,16 +60,16 @@ export const provider = {
|
|
|
60
60
|
id,
|
|
61
61
|
configure,
|
|
62
62
|
};
|
|
63
|
-
export const model = (modelID,
|
|
64
|
-
if (
|
|
63
|
+
export const model = (modelID, { accessToken, apiKey, baseURL, body, headers, location, project, ...providerOptions }) => {
|
|
64
|
+
if (apiKey !== undefined)
|
|
65
65
|
throw new ProviderConfigurationError({ provider: id, message: "Google Vertex Messages does not support API keys" });
|
|
66
66
|
return configure({
|
|
67
|
-
accessToken
|
|
68
|
-
baseURL
|
|
69
|
-
headers:
|
|
70
|
-
http:
|
|
71
|
-
location
|
|
72
|
-
project
|
|
73
|
-
providerOptions
|
|
67
|
+
accessToken,
|
|
68
|
+
baseURL,
|
|
69
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
70
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
71
|
+
location,
|
|
72
|
+
project,
|
|
73
|
+
providerOptions,
|
|
74
74
|
}).model(modelID);
|
|
75
75
|
};
|
|
@@ -10,14 +10,13 @@ export type Config = RouteDefaultsInput & GoogleVertexShared.OAuthOptions & {
|
|
|
10
10
|
readonly project?: string;
|
|
11
11
|
readonly providerOptions?: OpenResponsesProviderOptionsInput;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type Settings = ProviderPackage.Settings & OpenResponsesProviderOptionsInput & {
|
|
14
14
|
readonly accessToken?: string;
|
|
15
15
|
readonly apiKey?: never;
|
|
16
16
|
readonly baseURL?: string;
|
|
17
17
|
readonly location?: string;
|
|
18
18
|
readonly project?: string;
|
|
19
|
-
|
|
20
|
-
}
|
|
19
|
+
};
|
|
21
20
|
export declare const routes: Route<{
|
|
22
21
|
readonly input: readonly ({
|
|
23
22
|
readonly [x: string]: unknown;
|
|
@@ -41,16 +41,16 @@ export const provider = {
|
|
|
41
41
|
id,
|
|
42
42
|
configure,
|
|
43
43
|
};
|
|
44
|
-
export const model = (modelID,
|
|
45
|
-
if (
|
|
44
|
+
export const model = (modelID, { accessToken, apiKey, baseURL, body, headers, location, project, ...providerOptions }) => {
|
|
45
|
+
if (apiKey !== undefined)
|
|
46
46
|
throw new ProviderConfigurationError({ provider: id, message: "Google Vertex Responses does not support API keys" });
|
|
47
47
|
return configure({
|
|
48
|
-
accessToken
|
|
49
|
-
baseURL
|
|
50
|
-
headers:
|
|
51
|
-
http:
|
|
52
|
-
location
|
|
53
|
-
project
|
|
54
|
-
providerOptions
|
|
48
|
+
accessToken,
|
|
49
|
+
baseURL,
|
|
50
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
51
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
52
|
+
location,
|
|
53
|
+
project,
|
|
54
|
+
providerOptions,
|
|
55
55
|
}).model(modelID);
|
|
56
56
|
};
|
|
@@ -14,7 +14,7 @@ export type Config = RouteDefaultsInput & GoogleVertexShared.ApiKeyOptions & {
|
|
|
14
14
|
readonly project?: string;
|
|
15
15
|
readonly providerOptions?: GeminiProviderOptionsInput;
|
|
16
16
|
};
|
|
17
|
-
export type Settings = ProviderPackage.Settings & ({
|
|
17
|
+
export type Settings = ProviderPackage.Settings & GeminiProviderOptionsInput & ({
|
|
18
18
|
readonly accessToken?: string;
|
|
19
19
|
readonly apiKey?: never;
|
|
20
20
|
} | {
|
|
@@ -24,7 +24,6 @@ export type Settings = ProviderPackage.Settings & ({
|
|
|
24
24
|
readonly baseURL?: string;
|
|
25
25
|
readonly location?: string;
|
|
26
26
|
readonly project?: string;
|
|
27
|
-
readonly providerOptions?: GeminiProviderOptionsInput;
|
|
28
27
|
};
|
|
29
28
|
export declare const routes: Route<{
|
|
30
29
|
readonly contents: readonly {
|