@opencode/ai 0.0.0-beta-19425 → 0.0.0-beta-19507
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/protocols/anthropic-messages.js +4 -1
- package/dist/protocols/open-responses-channel.d.ts +2 -0
- package/dist/protocols/open-responses-channel.js +2 -2
- package/dist/protocols/open-responses-continuation.d.ts +7 -3
- package/dist/protocols/open-responses-continuation.js +8 -6
- package/dist/protocols/open-responses.d.ts +137 -2
- package/dist/protocols/open-responses.js +24 -5
- package/dist/provider-package.d.ts +4 -0
- package/dist/providers/alibaba.d.ts +1 -2
- package/dist/providers/alibaba.js +12 -4
- package/dist/providers/amazon-bedrock-mantle.d.ts +4 -62
- package/dist/providers/amazon-bedrock-mantle.js +23 -20
- package/dist/providers/amazon-bedrock.js +3 -3
- package/dist/providers/anthropic-compatible.d.ts +1 -2
- package/dist/providers/anthropic-compatible.js +18 -12
- package/dist/providers/anthropic.d.ts +1 -2
- package/dist/providers/anthropic.js +12 -9
- package/dist/providers/azure.d.ts +1 -2
- package/dist/providers/azure.js +14 -14
- 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 +16 -10
- package/dist/providers/cloudflare-workers-ai.d.ts +1 -2
- package/dist/providers/cloudflare-workers-ai.js +15 -9
- 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 +12 -12
- package/dist/providers/google-vertex-messages.d.ts +2 -3
- package/dist/providers/google-vertex-messages.js +12 -12
- package/dist/providers/google-vertex-responses.d.ts +2 -3
- package/dist/providers/google-vertex-responses.js +12 -12
- package/dist/providers/google-vertex-shared.js +14 -3
- package/dist/providers/google-vertex.d.ts +1 -2
- package/dist/providers/google-vertex.js +18 -12
- 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 +10 -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/dist/route/client.js +5 -2
- package/dist/schema/errors.d.ts +12 -0
- package/dist/schema/errors.js +11 -0
- package/package.json +3 -3
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Effect, Redacted } from "effect";
|
|
2
2
|
import { Auth, MissingCredentialError } from "../route/auth.js";
|
|
3
|
+
import { ProviderConfigurationError, ProviderID } from "../schema/index.js";
|
|
3
4
|
const SCOPE = "https://www.googleapis.com/auth/cloud-platform";
|
|
5
|
+
const id = ProviderID.make("google-vertex");
|
|
4
6
|
export const project = (value) => value ??
|
|
5
7
|
process.env.GOOGLE_VERTEX_PROJECT ??
|
|
6
8
|
process.env.GOOGLE_CLOUD_PROJECT ??
|
|
@@ -22,11 +24,17 @@ export const host = (location) => {
|
|
|
22
24
|
export const requireProject = (value) => {
|
|
23
25
|
if (value)
|
|
24
26
|
return value;
|
|
25
|
-
throw new
|
|
27
|
+
throw new ProviderConfigurationError({
|
|
28
|
+
provider: id,
|
|
29
|
+
message: "Google Vertex requires a project when baseURL is not configured",
|
|
30
|
+
});
|
|
26
31
|
};
|
|
27
32
|
export const apiKey = (input) => {
|
|
28
33
|
if (input.apiKey !== undefined && (input.accessToken !== undefined || input.auth !== undefined))
|
|
29
|
-
throw new
|
|
34
|
+
throw new ProviderConfigurationError({
|
|
35
|
+
provider: id,
|
|
36
|
+
message: "Google Vertex apiKey cannot be combined with accessToken or auth",
|
|
37
|
+
});
|
|
30
38
|
if (input.accessToken !== undefined || input.auth !== undefined)
|
|
31
39
|
return undefined;
|
|
32
40
|
return input.apiKey ?? process.env.GOOGLE_VERTEX_API_KEY;
|
|
@@ -51,7 +59,10 @@ const adc = (project) => {
|
|
|
51
59
|
};
|
|
52
60
|
export const oauth = (input, project) => {
|
|
53
61
|
if (input.accessToken !== undefined && input.auth !== undefined)
|
|
54
|
-
throw new
|
|
62
|
+
throw new ProviderConfigurationError({
|
|
63
|
+
provider: id,
|
|
64
|
+
message: "Google Vertex accessToken cannot be combined with auth",
|
|
65
|
+
});
|
|
55
66
|
if (input.auth)
|
|
56
67
|
return input.auth;
|
|
57
68
|
if (input.accessToken !== undefined)
|
|
@@ -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 {
|
|
@@ -5,7 +5,7 @@ import { Auth } from "../route/auth.js";
|
|
|
5
5
|
import { Route } from "../route/client.js";
|
|
6
6
|
import { Endpoint } from "../route/endpoint.js";
|
|
7
7
|
import { Framing } from "../route/framing.js";
|
|
8
|
-
import { ProviderID } from "../schema/index.js";
|
|
8
|
+
import { ProviderConfigurationError, 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
|
const fromRequest = Effect.fn("GoogleVertex.fromRequest")(function* (request) {
|
|
@@ -53,7 +53,10 @@ const configuredRoute = (input, modelID) => {
|
|
|
53
53
|
const apiKey = GoogleVertexShared.apiKey(input);
|
|
54
54
|
const endpointModel = String(modelID).startsWith("endpoints/");
|
|
55
55
|
if (apiKey !== undefined && endpointModel)
|
|
56
|
-
throw new
|
|
56
|
+
throw new ProviderConfigurationError({
|
|
57
|
+
provider: id,
|
|
58
|
+
message: "Google Vertex tuned models do not support Express Mode API keys",
|
|
59
|
+
});
|
|
57
60
|
const location = GoogleVertexShared.location(inputLocation, "us-central1");
|
|
58
61
|
const project = GoogleVertexShared.project(inputProject);
|
|
59
62
|
const endpoint = baseURL ??
|
|
@@ -77,16 +80,19 @@ export const provider = {
|
|
|
77
80
|
id,
|
|
78
81
|
configure,
|
|
79
82
|
};
|
|
80
|
-
export const model = (modelID,
|
|
81
|
-
if (
|
|
82
|
-
throw new
|
|
83
|
+
export const model = (modelID, { accessToken, apiKey, baseURL, body, headers, location, project, ...providerOptions }) => {
|
|
84
|
+
if (apiKey !== undefined && accessToken !== undefined)
|
|
85
|
+
throw new ProviderConfigurationError({
|
|
86
|
+
provider: id,
|
|
87
|
+
message: "Google Vertex apiKey cannot be combined with accessToken or auth",
|
|
88
|
+
});
|
|
83
89
|
return configure({
|
|
84
|
-
...(
|
|
85
|
-
baseURL
|
|
86
|
-
headers:
|
|
87
|
-
http:
|
|
88
|
-
location
|
|
89
|
-
project
|
|
90
|
-
providerOptions
|
|
90
|
+
...(apiKey === undefined ? { accessToken: accessToken } : { apiKey: apiKey }),
|
|
91
|
+
baseURL,
|
|
92
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
93
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
94
|
+
location,
|
|
95
|
+
project,
|
|
96
|
+
providerOptions,
|
|
91
97
|
}).model(modelID);
|
|
92
98
|
};
|
|
@@ -89,11 +89,10 @@ export type Config = RouteDefaultsInput & ProviderAuthOption<"optional"> & {
|
|
|
89
89
|
readonly baseURL?: string;
|
|
90
90
|
readonly providerOptions?: Gemini.ProviderOptionsInput;
|
|
91
91
|
};
|
|
92
|
-
export
|
|
92
|
+
export type Settings = ProviderPackage.Settings & Gemini.ProviderOptionsInput & {
|
|
93
93
|
readonly apiKey?: string;
|
|
94
94
|
readonly baseURL?: string;
|
|
95
|
-
|
|
96
|
-
}
|
|
95
|
+
};
|
|
97
96
|
export declare const configure: (input?: Config) => {
|
|
98
97
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
99
98
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<Gemini.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
package/dist/providers/google.js
CHANGED
|
@@ -32,11 +32,11 @@ export const configure = (input = {}) => {
|
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
export const provider = configure();
|
|
35
|
-
export const model = (modelID,
|
|
36
|
-
apiKey
|
|
37
|
-
baseURL
|
|
38
|
-
headers:
|
|
39
|
-
http:
|
|
40
|
-
providerOptions
|
|
35
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
36
|
+
apiKey,
|
|
37
|
+
baseURL,
|
|
38
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
39
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
40
|
+
providerOptions,
|
|
41
41
|
}).model(modelID);
|
|
42
42
|
export const image = provider.image;
|
package/dist/providers/groq.d.ts
CHANGED
|
@@ -17,11 +17,10 @@ export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> &
|
|
|
17
17
|
readonly baseURL?: string;
|
|
18
18
|
readonly providerOptions?: ProviderOptions;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
20
|
+
export type Settings = ProviderPackage.Settings & ProviderOptions & {
|
|
21
21
|
readonly apiKey?: string;
|
|
22
22
|
readonly baseURL?: string;
|
|
23
|
-
|
|
24
|
-
}
|
|
23
|
+
};
|
|
25
24
|
export declare const protocol: Protocol<{
|
|
26
25
|
readonly model: string;
|
|
27
26
|
readonly messages: readonly ({
|
package/dist/providers/groq.js
CHANGED
|
@@ -71,11 +71,11 @@ export const configure = (input = {}) => {
|
|
|
71
71
|
};
|
|
72
72
|
};
|
|
73
73
|
export const provider = configure();
|
|
74
|
-
export const model = (modelID,
|
|
75
|
-
apiKey
|
|
76
|
-
baseURL
|
|
77
|
-
headers:
|
|
78
|
-
http:
|
|
79
|
-
providerOptions
|
|
74
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
75
|
+
apiKey,
|
|
76
|
+
baseURL,
|
|
77
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
78
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
79
|
+
providerOptions,
|
|
80
80
|
}).model(modelID);
|
|
81
81
|
export * as Groq from "./groq.js";
|
package/dist/providers/meta.d.ts
CHANGED
|
@@ -34,11 +34,10 @@ export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> &
|
|
|
34
34
|
readonly baseURL?: string;
|
|
35
35
|
readonly providerOptions?: ProviderOptionsInput;
|
|
36
36
|
};
|
|
37
|
-
export
|
|
37
|
+
export type Settings = ProviderPackage.Settings & ProviderOptionsInput & {
|
|
38
38
|
readonly apiKey?: string;
|
|
39
39
|
readonly baseURL?: string;
|
|
40
|
-
|
|
41
|
-
}
|
|
40
|
+
};
|
|
42
41
|
export declare const routes: (Route<{
|
|
43
42
|
readonly model: string;
|
|
44
43
|
readonly messages: readonly ({
|
package/dist/providers/meta.js
CHANGED
|
@@ -101,13 +101,13 @@ export const image = provider.image;
|
|
|
101
101
|
export const model = (modelID, settings) => fromSettings(settings).responses(modelID);
|
|
102
102
|
export const chatModel = (modelID, settings) => fromSettings(settings).chat(modelID);
|
|
103
103
|
export const messagesModel = (modelID, settings) => fromSettings(settings).messages(modelID);
|
|
104
|
-
function fromSettings(
|
|
104
|
+
function fromSettings({ apiKey, baseURL, body, headers, ...providerOptions }) {
|
|
105
105
|
return configure({
|
|
106
|
-
apiKey
|
|
107
|
-
baseURL
|
|
108
|
-
headers
|
|
109
|
-
http:
|
|
110
|
-
providerOptions
|
|
106
|
+
apiKey,
|
|
107
|
+
baseURL,
|
|
108
|
+
headers,
|
|
109
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
110
|
+
providerOptions,
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
export * as Meta from "./meta.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MiniMax } from "../minimax.js";
|
|
2
|
-
export const model = (modelID,
|
|
3
|
-
apiKey
|
|
4
|
-
baseURL
|
|
5
|
-
headers
|
|
6
|
-
http:
|
|
7
|
-
providerOptions
|
|
2
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => MiniMax.configure({
|
|
3
|
+
apiKey,
|
|
4
|
+
baseURL,
|
|
5
|
+
headers,
|
|
6
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
7
|
+
providerOptions,
|
|
8
8
|
}).chat(modelID);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MiniMax } from "../minimax.js";
|
|
2
|
-
export const model = (modelID,
|
|
3
|
-
apiKey
|
|
4
|
-
baseURL
|
|
5
|
-
headers
|
|
6
|
-
http:
|
|
7
|
-
providerOptions
|
|
2
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => MiniMax.configure({
|
|
3
|
+
apiKey,
|
|
4
|
+
baseURL,
|
|
5
|
+
headers,
|
|
6
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
7
|
+
providerOptions,
|
|
8
8
|
}).responses(modelID);
|
|
@@ -29,11 +29,10 @@ export type Config = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthO
|
|
|
29
29
|
readonly baseURL?: string;
|
|
30
30
|
readonly providerOptions?: ProviderOptionsInput;
|
|
31
31
|
};
|
|
32
|
-
export
|
|
32
|
+
export type Settings<Options = MessagesOptionsInput> = ProviderPackage.Settings & Options & {
|
|
33
33
|
readonly apiKey?: string;
|
|
34
34
|
readonly baseURL?: string;
|
|
35
|
-
|
|
36
|
-
}
|
|
35
|
+
};
|
|
37
36
|
export declare const routes: (Route<{
|
|
38
37
|
readonly max_tokens: number;
|
|
39
38
|
readonly model: string;
|
|
@@ -76,12 +76,12 @@ export const configure = (input = {}) => {
|
|
|
76
76
|
return { id, model: messages, messages, chat, responses, configure };
|
|
77
77
|
};
|
|
78
78
|
export const provider = configure();
|
|
79
|
-
export const model = (modelID,
|
|
80
|
-
apiKey
|
|
81
|
-
baseURL
|
|
82
|
-
headers
|
|
83
|
-
http:
|
|
84
|
-
providerOptions
|
|
79
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
80
|
+
apiKey,
|
|
81
|
+
baseURL,
|
|
82
|
+
headers,
|
|
83
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
84
|
+
providerOptions,
|
|
85
85
|
}).model(modelID);
|
|
86
86
|
export const messages = provider.messages;
|
|
87
87
|
export const chat = provider.chat;
|
|
@@ -9,11 +9,10 @@ export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> &
|
|
|
9
9
|
readonly baseURL?: string;
|
|
10
10
|
readonly providerOptions?: ProviderOptions;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type Settings = ProviderPackage.Settings & ProviderOptions & {
|
|
13
13
|
readonly apiKey?: string;
|
|
14
14
|
readonly baseURL?: string;
|
|
15
|
-
|
|
16
|
-
}
|
|
15
|
+
};
|
|
17
16
|
export declare const route: import("../route/client.js").Route<{
|
|
18
17
|
readonly model: string;
|
|
19
18
|
readonly messages: readonly ({
|
|
@@ -18,11 +18,11 @@ export const configure = (input = {}) => {
|
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
export const provider = configure();
|
|
21
|
-
export const model = (modelID,
|
|
22
|
-
apiKey
|
|
23
|
-
baseURL
|
|
24
|
-
headers:
|
|
25
|
-
http:
|
|
26
|
-
providerOptions
|
|
21
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
22
|
+
apiKey,
|
|
23
|
+
baseURL,
|
|
24
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
25
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
26
|
+
providerOptions,
|
|
27
27
|
}).model(modelID);
|
|
28
28
|
export * as Mistral from "./mistral.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Moonshot } from "../moonshot.js";
|
|
2
|
-
export const model = (modelID,
|
|
3
|
-
apiKey
|
|
4
|
-
baseURL
|
|
5
|
-
headers
|
|
6
|
-
http:
|
|
7
|
-
providerOptions
|
|
2
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => Moonshot.configure({
|
|
3
|
+
apiKey,
|
|
4
|
+
baseURL,
|
|
5
|
+
headers,
|
|
6
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
7
|
+
providerOptions,
|
|
8
8
|
}).messages(modelID);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Moonshot } from "../moonshot.js";
|
|
2
|
-
export const model = (modelID,
|
|
3
|
-
apiKey
|
|
4
|
-
baseURL
|
|
5
|
-
headers
|
|
6
|
-
http:
|
|
7
|
-
providerOptions
|
|
2
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => Moonshot.configure({
|
|
3
|
+
apiKey,
|
|
4
|
+
baseURL,
|
|
5
|
+
headers,
|
|
6
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
7
|
+
providerOptions,
|
|
8
8
|
}).responses(modelID);
|
|
@@ -27,11 +27,10 @@ export type Config = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthO
|
|
|
27
27
|
readonly baseURL?: string;
|
|
28
28
|
readonly providerOptions?: ChatOptionsInput | MessagesOptionsInput | ResponsesOptionsInput;
|
|
29
29
|
};
|
|
30
|
-
export
|
|
30
|
+
export type Settings<Options = ChatOptionsInput> = ProviderPackage.Settings & Options & {
|
|
31
31
|
readonly apiKey?: string;
|
|
32
32
|
readonly baseURL?: string;
|
|
33
|
-
|
|
34
|
-
}
|
|
33
|
+
};
|
|
35
34
|
export declare const routes: (Route<{
|
|
36
35
|
readonly max_tokens: number;
|
|
37
36
|
readonly model: string;
|
|
@@ -80,11 +80,11 @@ export const provider = configure();
|
|
|
80
80
|
export const chat = provider.chat;
|
|
81
81
|
export const messages = provider.messages;
|
|
82
82
|
export const responses = provider.responses;
|
|
83
|
-
export const model = (modelID,
|
|
84
|
-
apiKey
|
|
85
|
-
baseURL
|
|
86
|
-
headers
|
|
87
|
-
http:
|
|
88
|
-
providerOptions
|
|
83
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
84
|
+
apiKey,
|
|
85
|
+
baseURL,
|
|
86
|
+
headers,
|
|
87
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
88
|
+
providerOptions,
|
|
89
89
|
}).model(modelID);
|
|
90
90
|
export * as Moonshot from "./moonshot.js";
|
|
@@ -10,12 +10,11 @@ export type Config = RouteDefaultsInput & ProviderAuthOption<"optional"> & {
|
|
|
10
10
|
readonly baseURL: string;
|
|
11
11
|
readonly providerOptions?: OpenResponsesProviderOptionsInput;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type Settings = ProviderPackage.Settings & OpenResponsesProviderOptionsInput & {
|
|
14
14
|
readonly apiKey?: string;
|
|
15
15
|
readonly baseURL: string;
|
|
16
16
|
readonly provider?: string;
|
|
17
|
-
|
|
18
|
-
}
|
|
17
|
+
};
|
|
19
18
|
export declare const routes: import("../route/client.js").Route<{
|
|
20
19
|
readonly input: readonly ({
|
|
21
20
|
readonly [x: string]: unknown;
|
|
@@ -22,11 +22,11 @@ export const provider = {
|
|
|
22
22
|
id,
|
|
23
23
|
configure,
|
|
24
24
|
};
|
|
25
|
-
export const model = (modelID,
|
|
26
|
-
apiKey
|
|
27
|
-
baseURL
|
|
28
|
-
headers:
|
|
29
|
-
http:
|
|
30
|
-
provider
|
|
31
|
-
providerOptions
|
|
25
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, provider, ...providerOptions }) => configure({
|
|
26
|
+
apiKey,
|
|
27
|
+
baseURL,
|
|
28
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
29
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
30
|
+
provider,
|
|
31
|
+
providerOptions,
|
|
32
32
|
}).model(modelID);
|
|
@@ -9,12 +9,11 @@ type GenericModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & Provide
|
|
|
9
9
|
readonly baseURL: string;
|
|
10
10
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
|
|
13
13
|
readonly apiKey?: string;
|
|
14
14
|
readonly baseURL: string;
|
|
15
15
|
readonly provider?: string;
|
|
16
|
-
|
|
17
|
-
}
|
|
16
|
+
};
|
|
18
17
|
export declare const routes: import("../route/client.js").Route<{
|
|
19
18
|
readonly model: string;
|
|
20
19
|
readonly messages: readonly ({
|
|
@@ -22,12 +22,12 @@ export const provider = {
|
|
|
22
22
|
id,
|
|
23
23
|
configure,
|
|
24
24
|
};
|
|
25
|
-
export const model = (modelID,
|
|
26
|
-
apiKey
|
|
27
|
-
baseURL
|
|
28
|
-
headers:
|
|
29
|
-
http:
|
|
30
|
-
provider
|
|
31
|
-
providerOptions
|
|
25
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, provider, ...providerOptions }) => configure({
|
|
26
|
+
apiKey,
|
|
27
|
+
baseURL,
|
|
28
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
29
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
30
|
+
provider,
|
|
31
|
+
providerOptions,
|
|
32
32
|
}).model(modelID);
|
|
33
33
|
export * as OpenAICompatible from "./openai-compatible.js";
|
|
@@ -346,14 +346,13 @@ export interface ImageGenerationOptions {
|
|
|
346
346
|
readonly size?: OpenAIImageString<"auto" | "256x256" | "512x512" | "1024x1024" | "1536x1024" | "1024x1536" | "1792x1024" | "1024x1792">;
|
|
347
347
|
}
|
|
348
348
|
export declare const imageGeneration: (options?: ImageGenerationOptions) => ToolDefinition;
|
|
349
|
-
export
|
|
349
|
+
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
|
|
350
350
|
readonly apiKey?: string;
|
|
351
351
|
readonly baseURL?: string;
|
|
352
352
|
readonly organization?: string;
|
|
353
353
|
readonly project?: string;
|
|
354
354
|
readonly queryParams?: Readonly<Record<string, string>>;
|
|
355
|
-
|
|
356
|
-
}
|
|
355
|
+
};
|
|
357
356
|
export declare const configure: (input?: Config) => {
|
|
358
357
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
359
358
|
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, {
|
package/dist/providers/openai.js
CHANGED
|
@@ -58,19 +58,19 @@ export const configure = (input = {}) => {
|
|
|
58
58
|
};
|
|
59
59
|
};
|
|
60
60
|
export const provider = configure();
|
|
61
|
-
const config = (
|
|
61
|
+
const config = ({ apiKey, baseURL, body, headers: given, organization, project, queryParams, ...providerOptions }) => {
|
|
62
62
|
const headers = {
|
|
63
|
-
...(
|
|
64
|
-
...(
|
|
65
|
-
...
|
|
63
|
+
...(organization === undefined ? {} : { "OpenAI-Organization": organization }),
|
|
64
|
+
...(project === undefined ? {} : { "OpenAI-Project": project }),
|
|
65
|
+
...given,
|
|
66
66
|
};
|
|
67
67
|
return {
|
|
68
|
-
apiKey
|
|
69
|
-
baseURL
|
|
68
|
+
apiKey,
|
|
69
|
+
baseURL,
|
|
70
70
|
headers: Object.keys(headers).length === 0 ? undefined : headers,
|
|
71
|
-
http:
|
|
72
|
-
providerOptions
|
|
73
|
-
queryParams:
|
|
71
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
72
|
+
providerOptions,
|
|
73
|
+
queryParams: queryParams === undefined ? undefined : { ...queryParams },
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
76
|
export const model = (modelID, settings) => {
|
|
@@ -77,11 +77,10 @@ export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> &
|
|
|
77
77
|
readonly baseURL?: string;
|
|
78
78
|
readonly providerOptions?: OpenRouterProviderOptionsInput;
|
|
79
79
|
};
|
|
80
|
-
export
|
|
80
|
+
export type Settings = ProviderPackage.Settings & OpenRouterProviderOptionsInput & {
|
|
81
81
|
readonly apiKey?: string;
|
|
82
82
|
readonly baseURL?: string;
|
|
83
|
-
|
|
84
|
-
}
|
|
83
|
+
};
|
|
85
84
|
declare const OpenRouterBody: Schema.StructWithRest<Schema.Struct<{
|
|
86
85
|
model: Schema.String;
|
|
87
86
|
messages: Schema.$Array<Schema.toTaggedUnion<"role", readonly [Schema.Struct<{
|
|
@@ -105,10 +105,10 @@ export const configure = (input = {}) => {
|
|
|
105
105
|
};
|
|
106
106
|
};
|
|
107
107
|
export const provider = configure();
|
|
108
|
-
export const model = (modelID,
|
|
109
|
-
apiKey
|
|
110
|
-
baseURL
|
|
111
|
-
headers
|
|
112
|
-
http:
|
|
113
|
-
providerOptions
|
|
108
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
109
|
+
apiKey,
|
|
110
|
+
baseURL,
|
|
111
|
+
headers,
|
|
112
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
113
|
+
providerOptions,
|
|
114
114
|
}).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,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);
|
package/dist/providers/xai.d.ts
CHANGED
|
@@ -11,11 +11,10 @@ export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> &
|
|
|
11
11
|
readonly baseURL?: string;
|
|
12
12
|
readonly providerOptions?: XAIProviderOptionsInput;
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type Settings = ProviderPackage.Settings & XAIProviderOptionsInput & {
|
|
15
15
|
readonly apiKey?: string;
|
|
16
16
|
readonly baseURL?: string;
|
|
17
|
-
|
|
18
|
-
}
|
|
17
|
+
};
|
|
19
18
|
export type { XAIImageOptions } from "../protocols/xai-images.js";
|
|
20
19
|
declare const responsesRoute: Route<unknown, import("../protocols/open-responses-channel.js").Prepared, {
|
|
21
20
|
endpoint: import("../route/client.js").CompactOperation;
|
package/dist/providers/xai.js
CHANGED
|
@@ -20,6 +20,10 @@ const responsesRoute = Route.make({
|
|
|
20
20
|
id: "openai-responses",
|
|
21
21
|
name: "xAI Responses",
|
|
22
22
|
rotateAfterMs: RESPONSES_WEBSOCKET_ROTATE_AFTER_MS,
|
|
23
|
+
// xAI continues a chain only from stored responses: with `store: false` (the route default) `previous_response_id`
|
|
24
|
+
// fails with "Response with id=… not found", so those steps are sent in full over the reused connection. It also
|
|
25
|
+
// rejects `instructions` next to `previous_response_id` and keeps the instructions of the response it continues.
|
|
26
|
+
continuation: ({ instructions: _instructions, ...request }) => (request.store === false ? undefined : request),
|
|
23
27
|
}),
|
|
24
28
|
defaults: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } },
|
|
25
29
|
});
|
|
@@ -72,12 +76,12 @@ export const configure = (input = {}) => {
|
|
|
72
76
|
};
|
|
73
77
|
};
|
|
74
78
|
export const provider = configure();
|
|
75
|
-
export const model = (modelID,
|
|
76
|
-
apiKey
|
|
77
|
-
baseURL
|
|
78
|
-
headers
|
|
79
|
-
http:
|
|
80
|
-
providerOptions
|
|
79
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
80
|
+
apiKey,
|
|
81
|
+
baseURL,
|
|
82
|
+
headers,
|
|
83
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
84
|
+
providerOptions,
|
|
81
85
|
}).model(modelID);
|
|
82
86
|
export const responses = provider.responses;
|
|
83
87
|
export const chat = provider.chat;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ZAICodingPlan } from "../zai-coding-plan.js";
|
|
2
|
-
export const model = (modelID,
|
|
3
|
-
apiKey
|
|
4
|
-
baseURL
|
|
5
|
-
headers
|
|
6
|
-
http:
|
|
7
|
-
providerOptions
|
|
2
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => ZAICodingPlan.configure({
|
|
3
|
+
apiKey,
|
|
4
|
+
baseURL,
|
|
5
|
+
headers,
|
|
6
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
7
|
+
providerOptions,
|
|
8
8
|
}).messages(modelID);
|