@opencode-ai/ai 0.0.0-beta-17595 → 0.0.0-beta-17727
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 +17 -6
- package/dist/cache-policy.js +3 -5
- package/dist/protocols/anthropic-messages.d.ts +26 -28
- package/dist/protocols/anthropic-messages.js +21 -9
- package/dist/protocols/gemini.d.ts +5 -9
- package/dist/protocols/gemini.js +5 -4
- package/dist/protocols/open-responses.d.ts +200 -38
- package/dist/protocols/open-responses.js +115 -42
- package/dist/protocols/openai-chat.d.ts +17 -15
- package/dist/protocols/openai-chat.js +8 -2
- package/dist/protocols/openai-compatible-chat.d.ts +3 -3
- package/dist/protocols/openai-compatible-responses.d.ts +31 -5
- package/dist/protocols/openai-responses.d.ts +171 -33
- package/dist/protocols/openai-responses.js +4 -2
- package/dist/protocols/shared.d.ts +8 -14
- package/dist/protocols/shared.js +8 -14
- package/dist/protocols/utils/bedrock-cache.js +3 -4
- package/dist/protocols/utils/cache.js +3 -6
- package/dist/protocols/utils/open-responses-options.d.ts +49 -14
- package/dist/protocols/utils/open-responses-options.js +40 -22
- package/dist/protocols/utils/openai-options.d.ts +7 -5
- package/dist/protocols/utils/openai-options.js +3 -3
- package/dist/provider-package.d.ts +0 -5
- package/dist/providers/amazon-bedrock-mantle.d.ts +47 -19
- package/dist/providers/amazon-bedrock-mantle.js +0 -1
- package/dist/providers/amazon-bedrock.d.ts +3 -9
- package/dist/providers/amazon-bedrock.js +0 -1
- package/dist/providers/anthropic-compatible.d.ts +11 -11
- package/dist/providers/anthropic-compatible.js +0 -1
- package/dist/providers/anthropic.d.ts +12 -12
- package/dist/providers/anthropic.js +0 -1
- package/dist/providers/azure.d.ts +44 -16
- package/dist/providers/azure.js +0 -1
- package/dist/providers/cloudflare.d.ts +11 -11
- package/dist/providers/google-vertex-chat.d.ts +5 -5
- package/dist/providers/google-vertex-chat.js +0 -1
- package/dist/providers/google-vertex-messages.d.ts +11 -11
- package/dist/providers/google-vertex-messages.js +0 -1
- package/dist/providers/google-vertex-responses.d.ts +33 -7
- package/dist/providers/google-vertex-responses.js +1 -2
- package/dist/providers/google-vertex.d.ts +5 -7
- package/dist/providers/google-vertex.js +1 -2
- package/dist/providers/google.d.ts +4 -4
- package/dist/providers/google.js +0 -1
- package/dist/providers/open-responses-options.d.ts +3 -13
- package/dist/providers/openai-compatible-responses.d.ts +33 -7
- package/dist/providers/openai-compatible-responses.js +0 -1
- package/dist/providers/openai-compatible.d.ts +13 -12
- package/dist/providers/openai-compatible.js +1 -1
- package/dist/providers/openai-options.d.ts +2 -4
- package/dist/providers/openai-options.js +3 -3
- package/dist/providers/openai.d.ts +48 -20
- package/dist/providers/openai.js +0 -1
- package/dist/providers/openrouter.d.ts +16 -17
- package/dist/providers/openrouter.js +1 -2
- package/dist/providers/xai.d.ts +50 -24
- package/dist/providers/xai.js +1 -2
- package/dist/route/client.d.ts +2 -6
- package/dist/route/client.js +1 -2
- package/dist/route/framing.d.ts +2 -2
- package/dist/route/protocol.d.ts +1 -2
- package/dist/route/protocol.js +1 -2
- package/dist/schema/errors.js +2 -1
- package/dist/schema/events.d.ts +5 -3
- package/dist/schema/events.js +5 -2
- package/dist/schema/ids.d.ts +0 -13
- package/dist/schema/ids.js +0 -9
- package/dist/schema/messages.d.ts +7 -7
- package/dist/schema/messages.js +5 -2
- package/dist/schema/options.d.ts +6 -22
- package/dist/schema/options.js +6 -30
- package/dist/testing.d.ts +2 -1
- package/dist/testing.js +7 -2
- package/package.json +5 -5
|
@@ -31,6 +31,9 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
31
31
|
} | {
|
|
32
32
|
readonly role: "system";
|
|
33
33
|
readonly content: string;
|
|
34
|
+
} | {
|
|
35
|
+
readonly role: "developer";
|
|
36
|
+
readonly content: string;
|
|
34
37
|
} | {
|
|
35
38
|
readonly role: "user";
|
|
36
39
|
readonly content: readonly ({
|
|
@@ -46,17 +49,20 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
46
49
|
readonly text: string;
|
|
47
50
|
})[];
|
|
48
51
|
} | {
|
|
52
|
+
readonly type: "message";
|
|
49
53
|
readonly content: readonly {
|
|
50
54
|
readonly type: "output_text";
|
|
51
55
|
readonly text: string;
|
|
52
56
|
}[];
|
|
53
57
|
readonly role: "assistant";
|
|
58
|
+
readonly id?: string | undefined;
|
|
54
59
|
readonly phase?: "commentary" | "final_answer" | undefined;
|
|
55
60
|
} | {
|
|
56
61
|
readonly type: "function_call";
|
|
57
|
-
readonly call_id: string;
|
|
58
62
|
readonly name: string;
|
|
59
63
|
readonly arguments: string;
|
|
64
|
+
readonly call_id: string;
|
|
65
|
+
readonly id?: string | undefined;
|
|
60
66
|
} | {
|
|
61
67
|
readonly type: "function_call_output";
|
|
62
68
|
readonly call_id: string;
|
|
@@ -75,10 +81,13 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
75
81
|
})[];
|
|
76
82
|
readonly model: string;
|
|
77
83
|
readonly stream: true;
|
|
84
|
+
readonly metadata?: {
|
|
85
|
+
readonly [x: string]: string;
|
|
86
|
+
} | undefined;
|
|
78
87
|
readonly instructions?: string | undefined;
|
|
79
88
|
readonly reasoning?: {
|
|
80
89
|
readonly summary?: "auto" | "concise" | "detailed" | undefined;
|
|
81
|
-
readonly effort?:
|
|
90
|
+
readonly effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
|
|
82
91
|
} | undefined;
|
|
83
92
|
readonly tools?: readonly {
|
|
84
93
|
readonly type: "function";
|
|
@@ -90,30 +99,47 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
90
99
|
readonly strict?: boolean | undefined;
|
|
91
100
|
}[] | undefined;
|
|
92
101
|
readonly text?: {
|
|
93
|
-
readonly verbosity?: "
|
|
102
|
+
readonly verbosity?: import("../protocols/utils/open-responses-options.js").TextVerbosity | undefined;
|
|
94
103
|
} | undefined;
|
|
95
104
|
readonly temperature?: number | undefined;
|
|
96
|
-
readonly tool_choice?: "required" | "
|
|
105
|
+
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
97
106
|
readonly type: "function";
|
|
98
107
|
readonly name: string;
|
|
108
|
+
} | {
|
|
109
|
+
readonly type: "allowed_tools";
|
|
110
|
+
readonly mode: "required" | "auto" | "none";
|
|
111
|
+
readonly tools: readonly {
|
|
112
|
+
readonly type: "function";
|
|
113
|
+
readonly name: string;
|
|
114
|
+
}[];
|
|
99
115
|
} | undefined;
|
|
100
116
|
readonly top_p?: number | undefined;
|
|
101
|
-
readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
|
|
102
117
|
readonly store?: boolean | undefined;
|
|
118
|
+
readonly include?: readonly import("../protocols/utils/open-responses-options.js").ResponseIncludable[] | undefined;
|
|
119
|
+
readonly truncation?: "auto" | "disabled" | undefined;
|
|
120
|
+
readonly stream_options?: {
|
|
121
|
+
readonly include_obfuscation?: boolean | undefined;
|
|
122
|
+
} | undefined;
|
|
103
123
|
readonly prompt_cache_key?: string | undefined;
|
|
124
|
+
readonly frequency_penalty?: number | undefined;
|
|
125
|
+
readonly presence_penalty?: number | undefined;
|
|
126
|
+
readonly safety_identifier?: string | undefined;
|
|
127
|
+
readonly top_logprobs?: number | undefined;
|
|
104
128
|
readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
105
129
|
readonly max_output_tokens?: number | undefined;
|
|
130
|
+
readonly max_tool_calls?: number | undefined;
|
|
131
|
+
readonly parallel_tool_calls?: boolean | undefined;
|
|
106
132
|
}, import("../route/transport/http.js").HttpPrepared<string>>[];
|
|
107
133
|
export declare const configure: (input: Config) => {
|
|
108
134
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
109
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
135
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
110
136
|
configure: (input: Config) => /*elided*/ any;
|
|
111
137
|
};
|
|
112
138
|
export declare const provider: {
|
|
113
139
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
114
140
|
configure: (input: Config) => {
|
|
115
141
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
116
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
142
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
117
143
|
configure: /*elided*/ any;
|
|
118
144
|
};
|
|
119
145
|
};
|
|
@@ -27,7 +27,6 @@ export const model = (modelID, settings) => configure({
|
|
|
27
27
|
baseURL: settings.baseURL,
|
|
28
28
|
headers: settings.headers === undefined ? undefined : { ...settings.headers },
|
|
29
29
|
http: settings.body === undefined ? undefined : { body: { ...settings.body } },
|
|
30
|
-
limits: settings.limits,
|
|
31
30
|
provider: settings.provider,
|
|
32
31
|
providerOptions: settings.providerOptions,
|
|
33
32
|
}).model(modelID);
|
|
@@ -13,6 +13,7 @@ export interface Settings extends ProviderPackage.Settings {
|
|
|
13
13
|
readonly apiKey?: string;
|
|
14
14
|
readonly baseURL: string;
|
|
15
15
|
readonly provider?: string;
|
|
16
|
+
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
16
17
|
}
|
|
17
18
|
export type FamilyModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
18
19
|
readonly baseURL?: string;
|
|
@@ -80,7 +81,6 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
80
81
|
} | undefined;
|
|
81
82
|
})[];
|
|
82
83
|
readonly stream: true;
|
|
83
|
-
readonly stop?: readonly string[] | undefined;
|
|
84
84
|
readonly max_completion_tokens?: number | undefined;
|
|
85
85
|
readonly max_tokens?: number | undefined;
|
|
86
86
|
readonly tools?: readonly {
|
|
@@ -97,9 +97,10 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
97
97
|
readonly ttl?: string | undefined;
|
|
98
98
|
} | undefined;
|
|
99
99
|
}[] | undefined;
|
|
100
|
+
readonly stop?: readonly string[] | undefined;
|
|
100
101
|
readonly temperature?: number | undefined;
|
|
101
102
|
readonly seed?: number | undefined;
|
|
102
|
-
readonly tool_choice?: "required" | "
|
|
103
|
+
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
103
104
|
readonly type: "function";
|
|
104
105
|
readonly function: {
|
|
105
106
|
readonly name: string;
|
|
@@ -111,57 +112,57 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
111
112
|
readonly include_usage: boolean;
|
|
112
113
|
} | undefined;
|
|
113
114
|
readonly prompt_cache_key?: string | undefined;
|
|
114
|
-
readonly reasoning_effort?:
|
|
115
|
+
readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
|
|
115
116
|
readonly frequency_penalty?: number | undefined;
|
|
116
117
|
readonly presence_penalty?: number | undefined;
|
|
117
118
|
}, import("../route/transport/http.js").HttpPrepared<string>>[];
|
|
118
119
|
export declare const configure: (input: GenericModelOptions) => {
|
|
119
120
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
120
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
121
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
121
122
|
configure: (input: GenericModelOptions) => /*elided*/ any;
|
|
122
123
|
};
|
|
123
124
|
export declare const provider: {
|
|
124
125
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
125
126
|
configure: (input: GenericModelOptions) => {
|
|
126
127
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
127
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
128
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
128
129
|
configure: /*elided*/ any;
|
|
129
130
|
};
|
|
130
131
|
};
|
|
131
132
|
export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
132
133
|
export declare const baseten: {
|
|
133
134
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
134
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
135
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
135
136
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
136
137
|
};
|
|
137
138
|
export declare const cerebras: {
|
|
138
139
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
139
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
140
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
140
141
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
141
142
|
};
|
|
142
143
|
export declare const deepinfra: {
|
|
143
144
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
144
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
145
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
145
146
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
146
147
|
};
|
|
147
148
|
export declare const deepseek: {
|
|
148
149
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
149
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
150
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
150
151
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
151
152
|
};
|
|
152
153
|
export declare const fireworks: {
|
|
153
154
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
154
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
155
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
155
156
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
156
157
|
};
|
|
157
158
|
export declare const groq: {
|
|
158
159
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
159
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
160
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
160
161
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
161
162
|
};
|
|
162
163
|
export declare const togetherai: {
|
|
163
164
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
164
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
165
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
165
166
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
166
167
|
};
|
|
167
168
|
export {};
|
|
@@ -43,8 +43,8 @@ export const model = (modelID, settings) => configure({
|
|
|
43
43
|
baseURL: settings.baseURL,
|
|
44
44
|
headers: settings.headers === undefined ? undefined : { ...settings.headers },
|
|
45
45
|
http: settings.body === undefined ? undefined : { body: { ...settings.body } },
|
|
46
|
-
limits: settings.limits,
|
|
47
46
|
provider: settings.provider,
|
|
47
|
+
providerOptions: settings.providerOptions,
|
|
48
48
|
}).model(modelID);
|
|
49
49
|
export const baseten = define(profiles.baseten);
|
|
50
50
|
export const cerebras = define(profiles.cerebras);
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ProviderOptions } from "../schema/index.js";
|
|
2
2
|
import type { OpenResponsesOptionsInput } from "./open-responses-options.js";
|
|
3
3
|
export type { OpenAIResponseIncludable, OpenAIServiceTier } from "../protocols/utils/openai-options.js";
|
|
4
4
|
export type OpenAIOptionsInput = OpenResponsesOptionsInput;
|
|
5
|
-
export type OpenAIProviderOptionsInput =
|
|
6
|
-
readonly openai?: OpenAIOptionsInput;
|
|
7
|
-
};
|
|
5
|
+
export type OpenAIProviderOptionsInput = OpenAIOptionsInput;
|
|
8
6
|
export declare const gpt5DefaultOptions: (modelID: string, options?: {
|
|
9
7
|
readonly textVerbosity?: boolean;
|
|
10
8
|
}) => ProviderOptions | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mergeProviderOptions } from "../schema/index.js";
|
|
2
2
|
const definedEntries = (input) => Object.entries(input).filter((entry) => entry[1] !== undefined);
|
|
3
3
|
const openAIProviderOptions = (options) => {
|
|
4
|
-
const
|
|
4
|
+
const result = Object.fromEntries(definedEntries({
|
|
5
5
|
store: options?.store,
|
|
6
6
|
reasoningEffort: options?.reasoningEffort,
|
|
7
7
|
reasoningSummary: options?.reasoningSummary,
|
|
@@ -9,9 +9,9 @@ const openAIProviderOptions = (options) => {
|
|
|
9
9
|
textVerbosity: options?.textVerbosity,
|
|
10
10
|
serviceTier: options?.serviceTier,
|
|
11
11
|
}));
|
|
12
|
-
if (Object.keys(
|
|
12
|
+
if (Object.keys(result).length === 0)
|
|
13
13
|
return undefined;
|
|
14
|
-
return
|
|
14
|
+
return result;
|
|
15
15
|
};
|
|
16
16
|
export const gpt5DefaultOptions = (modelID, options = {}) => {
|
|
17
17
|
const id = modelID.toLowerCase();
|
|
@@ -69,7 +69,6 @@ export declare const routes: (Route<{
|
|
|
69
69
|
} | undefined;
|
|
70
70
|
})[];
|
|
71
71
|
readonly stream: true;
|
|
72
|
-
readonly stop?: readonly string[] | undefined;
|
|
73
72
|
readonly max_completion_tokens?: number | undefined;
|
|
74
73
|
readonly max_tokens?: number | undefined;
|
|
75
74
|
readonly tools?: readonly {
|
|
@@ -86,9 +85,10 @@ export declare const routes: (Route<{
|
|
|
86
85
|
readonly ttl?: string | undefined;
|
|
87
86
|
} | undefined;
|
|
88
87
|
}[] | undefined;
|
|
88
|
+
readonly stop?: readonly string[] | undefined;
|
|
89
89
|
readonly temperature?: number | undefined;
|
|
90
90
|
readonly seed?: number | undefined;
|
|
91
|
-
readonly tool_choice?: "required" | "
|
|
91
|
+
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
92
92
|
readonly type: "function";
|
|
93
93
|
readonly function: {
|
|
94
94
|
readonly name: string;
|
|
@@ -100,7 +100,7 @@ export declare const routes: (Route<{
|
|
|
100
100
|
readonly include_usage: boolean;
|
|
101
101
|
} | undefined;
|
|
102
102
|
readonly prompt_cache_key?: string | undefined;
|
|
103
|
-
readonly reasoning_effort?:
|
|
103
|
+
readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
|
|
104
104
|
readonly frequency_penalty?: number | undefined;
|
|
105
105
|
readonly presence_penalty?: number | undefined;
|
|
106
106
|
}, import("../route/transport/http.js").HttpPrepared<string>> | Route<{
|
|
@@ -118,6 +118,9 @@ export declare const routes: (Route<{
|
|
|
118
118
|
} | {
|
|
119
119
|
readonly role: "system";
|
|
120
120
|
readonly content: string;
|
|
121
|
+
} | {
|
|
122
|
+
readonly role: "developer";
|
|
123
|
+
readonly content: string;
|
|
121
124
|
} | {
|
|
122
125
|
readonly role: "user";
|
|
123
126
|
readonly content: readonly ({
|
|
@@ -133,17 +136,20 @@ export declare const routes: (Route<{
|
|
|
133
136
|
readonly text: string;
|
|
134
137
|
})[];
|
|
135
138
|
} | {
|
|
139
|
+
readonly type: "message";
|
|
136
140
|
readonly content: readonly {
|
|
137
141
|
readonly type: "output_text";
|
|
138
142
|
readonly text: string;
|
|
139
143
|
}[];
|
|
140
144
|
readonly role: "assistant";
|
|
145
|
+
readonly id?: string | undefined;
|
|
141
146
|
readonly phase?: "commentary" | "final_answer" | undefined;
|
|
142
147
|
} | {
|
|
143
148
|
readonly type: "function_call";
|
|
144
|
-
readonly call_id: string;
|
|
145
149
|
readonly name: string;
|
|
146
150
|
readonly arguments: string;
|
|
151
|
+
readonly call_id: string;
|
|
152
|
+
readonly id?: string | undefined;
|
|
147
153
|
} | {
|
|
148
154
|
readonly type: "function_call_output";
|
|
149
155
|
readonly call_id: string;
|
|
@@ -160,19 +166,24 @@ export declare const routes: (Route<{
|
|
|
160
166
|
readonly text: string;
|
|
161
167
|
})[];
|
|
162
168
|
} | {
|
|
169
|
+
readonly type: "message";
|
|
163
170
|
readonly content: readonly {
|
|
164
171
|
readonly type: "output_text";
|
|
165
172
|
readonly text: string;
|
|
166
173
|
}[];
|
|
167
174
|
readonly role: "assistant";
|
|
175
|
+
readonly id?: string | undefined;
|
|
168
176
|
readonly phase?: "commentary" | "final_answer" | null | undefined;
|
|
169
177
|
})[];
|
|
170
178
|
readonly model: string;
|
|
171
179
|
readonly stream: true;
|
|
180
|
+
readonly metadata?: {
|
|
181
|
+
readonly [x: string]: string;
|
|
182
|
+
} | undefined;
|
|
172
183
|
readonly instructions?: string | undefined;
|
|
173
184
|
readonly reasoning?: {
|
|
174
185
|
readonly summary?: "auto" | "concise" | "detailed" | undefined;
|
|
175
|
-
readonly effort?:
|
|
186
|
+
readonly effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
|
|
176
187
|
} | undefined;
|
|
177
188
|
readonly tools?: readonly ({
|
|
178
189
|
readonly type: "function";
|
|
@@ -187,28 +198,45 @@ export declare const routes: (Route<{
|
|
|
187
198
|
readonly size?: string | undefined;
|
|
188
199
|
readonly action?: "generate" | "auto" | "edit" | undefined;
|
|
189
200
|
readonly output_format?: "png" | "jpeg" | "webp" | undefined;
|
|
190
|
-
readonly quality?: "
|
|
201
|
+
readonly quality?: "auto" | "low" | "medium" | "high" | undefined;
|
|
191
202
|
readonly background?: "auto" | "opaque" | "transparent" | undefined;
|
|
192
203
|
readonly output_compression?: number | undefined;
|
|
193
204
|
readonly input_fidelity?: "low" | "high" | undefined;
|
|
194
205
|
readonly partial_images?: number | undefined;
|
|
195
206
|
})[] | undefined;
|
|
196
207
|
readonly text?: {
|
|
197
|
-
readonly verbosity?: "
|
|
208
|
+
readonly verbosity?: import("../protocols/utils/open-responses-options.js").TextVerbosity | undefined;
|
|
198
209
|
} | undefined;
|
|
199
210
|
readonly temperature?: number | undefined;
|
|
200
|
-
readonly tool_choice?: "required" | "
|
|
211
|
+
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
201
212
|
readonly type: "function";
|
|
202
213
|
readonly name: string;
|
|
214
|
+
} | {
|
|
215
|
+
readonly type: "allowed_tools";
|
|
216
|
+
readonly mode: "required" | "auto" | "none";
|
|
217
|
+
readonly tools: readonly {
|
|
218
|
+
readonly type: "function";
|
|
219
|
+
readonly name: string;
|
|
220
|
+
}[];
|
|
203
221
|
} | {
|
|
204
222
|
readonly type: "image_generation";
|
|
205
223
|
} | undefined;
|
|
206
224
|
readonly top_p?: number | undefined;
|
|
207
|
-
readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
|
|
208
225
|
readonly store?: boolean | undefined;
|
|
226
|
+
readonly include?: readonly import("../protocols/utils/open-responses-options.js").ResponseIncludable[] | undefined;
|
|
227
|
+
readonly truncation?: "auto" | "disabled" | undefined;
|
|
228
|
+
readonly stream_options?: {
|
|
229
|
+
readonly include_obfuscation?: boolean | undefined;
|
|
230
|
+
} | undefined;
|
|
209
231
|
readonly prompt_cache_key?: string | undefined;
|
|
232
|
+
readonly frequency_penalty?: number | undefined;
|
|
233
|
+
readonly presence_penalty?: number | undefined;
|
|
234
|
+
readonly safety_identifier?: string | undefined;
|
|
235
|
+
readonly top_logprobs?: number | undefined;
|
|
210
236
|
readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
211
237
|
readonly max_output_tokens?: number | undefined;
|
|
238
|
+
readonly max_tool_calls?: number | undefined;
|
|
239
|
+
readonly parallel_tool_calls?: boolean | undefined;
|
|
212
240
|
}, import("../protocols/open-responses-channel.js").Prepared>)[];
|
|
213
241
|
export type Config = RouteDefaultsInput & ProviderAuthOption<"optional"> & {
|
|
214
242
|
readonly baseURL?: string;
|
|
@@ -236,29 +264,29 @@ export interface Settings extends ProviderPackage.Settings {
|
|
|
236
264
|
}
|
|
237
265
|
export declare const configure: (input?: Config) => {
|
|
238
266
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
239
|
-
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
240
|
-
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
241
|
-
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
267
|
+
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
268
|
+
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
269
|
+
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
242
270
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
243
271
|
configure: (input?: Config) => /*elided*/ any;
|
|
244
272
|
};
|
|
245
273
|
export declare const provider: {
|
|
246
274
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
247
|
-
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
248
|
-
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
249
|
-
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
275
|
+
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
276
|
+
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
277
|
+
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
250
278
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
251
279
|
configure: (input?: Config) => {
|
|
252
280
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
253
|
-
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
254
|
-
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
255
|
-
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
281
|
+
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
282
|
+
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
283
|
+
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
256
284
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
257
285
|
configure: /*elided*/ any;
|
|
258
286
|
};
|
|
259
287
|
};
|
|
260
288
|
export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
261
289
|
export declare const chatModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
262
|
-
export declare const responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
263
|
-
export declare const chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
290
|
+
export declare const responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
291
|
+
export declare const chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
264
292
|
export declare const image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
package/dist/providers/openai.js
CHANGED
|
@@ -69,7 +69,6 @@ const config = (settings) => {
|
|
|
69
69
|
baseURL: settings.baseURL,
|
|
70
70
|
headers: Object.keys(headers).length === 0 ? undefined : headers,
|
|
71
71
|
http: settings.body === undefined ? undefined : { body: { ...settings.body } },
|
|
72
|
-
limits: settings.limits,
|
|
73
72
|
providerOptions: settings.providerOptions,
|
|
74
73
|
queryParams: settings.queryParams === undefined ? undefined : { ...settings.queryParams },
|
|
75
74
|
};
|
|
@@ -2,7 +2,7 @@ import { Schema } from "effect";
|
|
|
2
2
|
import { Route, type RouteDefaultsInput } from "../route/client.js";
|
|
3
3
|
import { Protocol } from "../route/protocol.js";
|
|
4
4
|
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
5
|
-
import { type ModelID
|
|
5
|
+
import { type ModelID } from "../schema/index.js";
|
|
6
6
|
import type { ProviderPackage } from "../provider-package.js";
|
|
7
7
|
import * as OpenAIChat from "../protocols/openai-chat.js";
|
|
8
8
|
export declare const profile: {
|
|
@@ -76,9 +76,7 @@ export interface OpenRouterOptions {
|
|
|
76
76
|
engine?: OpenRouterString<"native" | "exa">;
|
|
77
77
|
}>;
|
|
78
78
|
}
|
|
79
|
-
export type OpenRouterProviderOptionsInput =
|
|
80
|
-
readonly openrouter?: OpenRouterOptions;
|
|
81
|
-
};
|
|
79
|
+
export type OpenRouterProviderOptionsInput = OpenRouterOptions;
|
|
82
80
|
export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
83
81
|
readonly baseURL?: string;
|
|
84
82
|
readonly providerOptions?: OpenRouterProviderOptionsInput;
|
|
@@ -172,7 +170,7 @@ declare const OpenRouterBody: Schema.StructWithRest<Schema.Struct<{
|
|
|
172
170
|
}>>;
|
|
173
171
|
store: Schema.optional<Schema.Boolean>;
|
|
174
172
|
prompt_cache_key: Schema.optional<Schema.String>;
|
|
175
|
-
reasoning_effort: Schema.optional<Schema.
|
|
173
|
+
reasoning_effort: Schema.optional<Schema.declare<import("../protocols/utils/open-responses-options.js").ReasoningEffort, import("../protocols/utils/open-responses-options.js").ReasoningEffort>>;
|
|
176
174
|
max_completion_tokens: Schema.optional<Schema.Number>;
|
|
177
175
|
max_tokens: Schema.optional<Schema.Number>;
|
|
178
176
|
temperature: Schema.optional<Schema.Number>;
|
|
@@ -246,7 +244,6 @@ export declare const protocol: Protocol<{
|
|
|
246
244
|
} | undefined;
|
|
247
245
|
})[];
|
|
248
246
|
readonly stream: true;
|
|
249
|
-
readonly stop?: readonly string[] | undefined;
|
|
250
247
|
readonly max_completion_tokens?: number | undefined;
|
|
251
248
|
readonly max_tokens?: number | undefined;
|
|
252
249
|
readonly tools?: readonly {
|
|
@@ -263,9 +260,10 @@ export declare const protocol: Protocol<{
|
|
|
263
260
|
readonly ttl?: string | undefined;
|
|
264
261
|
} | undefined;
|
|
265
262
|
}[] | undefined;
|
|
263
|
+
readonly stop?: readonly string[] | undefined;
|
|
266
264
|
readonly temperature?: number | undefined;
|
|
267
265
|
readonly seed?: number | undefined;
|
|
268
|
-
readonly tool_choice?: "required" | "
|
|
266
|
+
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
269
267
|
readonly type: "function";
|
|
270
268
|
readonly function: {
|
|
271
269
|
readonly name: string;
|
|
@@ -277,7 +275,7 @@ export declare const protocol: Protocol<{
|
|
|
277
275
|
readonly include_usage: boolean;
|
|
278
276
|
} | undefined;
|
|
279
277
|
readonly prompt_cache_key?: string | undefined;
|
|
280
|
-
readonly reasoning_effort?:
|
|
278
|
+
readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
|
|
281
279
|
readonly frequency_penalty?: number | undefined;
|
|
282
280
|
readonly presence_penalty?: number | undefined;
|
|
283
281
|
}, string, {
|
|
@@ -309,6 +307,7 @@ export declare const protocol: Protocol<{
|
|
|
309
307
|
readonly reasoning_content?: string | null | undefined;
|
|
310
308
|
readonly reasoning_text?: string | null | undefined;
|
|
311
309
|
readonly content?: string | null | undefined;
|
|
310
|
+
readonly refusal?: string | null | undefined;
|
|
312
311
|
readonly tool_calls?: readonly {
|
|
313
312
|
readonly function?: {
|
|
314
313
|
readonly name?: string | null | undefined;
|
|
@@ -386,7 +385,6 @@ export declare const route: Route<{
|
|
|
386
385
|
} | undefined;
|
|
387
386
|
})[];
|
|
388
387
|
readonly stream: true;
|
|
389
|
-
readonly stop?: readonly string[] | undefined;
|
|
390
388
|
readonly max_completion_tokens?: number | undefined;
|
|
391
389
|
readonly max_tokens?: number | undefined;
|
|
392
390
|
readonly tools?: readonly {
|
|
@@ -403,9 +401,10 @@ export declare const route: Route<{
|
|
|
403
401
|
readonly ttl?: string | undefined;
|
|
404
402
|
} | undefined;
|
|
405
403
|
}[] | undefined;
|
|
404
|
+
readonly stop?: readonly string[] | undefined;
|
|
406
405
|
readonly temperature?: number | undefined;
|
|
407
406
|
readonly seed?: number | undefined;
|
|
408
|
-
readonly tool_choice?: "required" | "
|
|
407
|
+
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
409
408
|
readonly type: "function";
|
|
410
409
|
readonly function: {
|
|
411
410
|
readonly name: string;
|
|
@@ -417,7 +416,7 @@ export declare const route: Route<{
|
|
|
417
416
|
readonly include_usage: boolean;
|
|
418
417
|
} | undefined;
|
|
419
418
|
readonly prompt_cache_key?: string | undefined;
|
|
420
|
-
readonly reasoning_effort?:
|
|
419
|
+
readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
|
|
421
420
|
readonly frequency_penalty?: number | undefined;
|
|
422
421
|
readonly presence_penalty?: number | undefined;
|
|
423
422
|
}, import("../route/transport/http.js").HttpPrepared<string>>;
|
|
@@ -484,7 +483,6 @@ export declare const routes: Route<{
|
|
|
484
483
|
} | undefined;
|
|
485
484
|
})[];
|
|
486
485
|
readonly stream: true;
|
|
487
|
-
readonly stop?: readonly string[] | undefined;
|
|
488
486
|
readonly max_completion_tokens?: number | undefined;
|
|
489
487
|
readonly max_tokens?: number | undefined;
|
|
490
488
|
readonly tools?: readonly {
|
|
@@ -501,9 +499,10 @@ export declare const routes: Route<{
|
|
|
501
499
|
readonly ttl?: string | undefined;
|
|
502
500
|
} | undefined;
|
|
503
501
|
}[] | undefined;
|
|
502
|
+
readonly stop?: readonly string[] | undefined;
|
|
504
503
|
readonly temperature?: number | undefined;
|
|
505
504
|
readonly seed?: number | undefined;
|
|
506
|
-
readonly tool_choice?: "required" | "
|
|
505
|
+
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
507
506
|
readonly type: "function";
|
|
508
507
|
readonly function: {
|
|
509
508
|
readonly name: string;
|
|
@@ -515,21 +514,21 @@ export declare const routes: Route<{
|
|
|
515
514
|
readonly include_usage: boolean;
|
|
516
515
|
} | undefined;
|
|
517
516
|
readonly prompt_cache_key?: string | undefined;
|
|
518
|
-
readonly reasoning_effort?:
|
|
517
|
+
readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
|
|
519
518
|
readonly frequency_penalty?: number | undefined;
|
|
520
519
|
readonly presence_penalty?: number | undefined;
|
|
521
520
|
}, import("../route/transport/http.js").HttpPrepared<string>>[];
|
|
522
521
|
export declare const configure: (input?: LanguageModelOptions) => {
|
|
523
522
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
524
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
523
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenRouterOptions>;
|
|
525
524
|
configure: (input?: LanguageModelOptions) => /*elided*/ any;
|
|
526
525
|
};
|
|
527
526
|
export declare const provider: {
|
|
528
527
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
529
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
528
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenRouterOptions>;
|
|
530
529
|
configure: (input?: LanguageModelOptions) => {
|
|
531
530
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
532
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
531
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenRouterOptions>;
|
|
533
532
|
configure: /*elided*/ any;
|
|
534
533
|
};
|
|
535
534
|
};
|
|
@@ -42,7 +42,7 @@ export const protocol = Protocol.make({
|
|
|
42
42
|
return {
|
|
43
43
|
...body,
|
|
44
44
|
messages,
|
|
45
|
-
...bodyOptions(request.providerOptions
|
|
45
|
+
...bodyOptions(request.providerOptions),
|
|
46
46
|
...(request.promptCacheKey ? { prompt_cache_key: request.promptCacheKey } : {}),
|
|
47
47
|
};
|
|
48
48
|
})),
|
|
@@ -112,6 +112,5 @@ export const model = (modelID, settings) => configure({
|
|
|
112
112
|
baseURL: settings.baseURL,
|
|
113
113
|
headers: settings.headers,
|
|
114
114
|
http: settings.body === undefined ? undefined : { body: { ...settings.body } },
|
|
115
|
-
limits: settings.limits,
|
|
116
115
|
providerOptions: settings.providerOptions,
|
|
117
116
|
}).model(modelID);
|