@opencode-ai/ai 0.0.0-beta-17639 → 0.0.0-beta-17728
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 +5 -5
- package/dist/protocols/gemini.d.ts +5 -9
- package/dist/protocols/gemini.js +5 -4
- package/dist/protocols/open-responses.d.ts +176 -38
- package/dist/protocols/open-responses.js +108 -33
- 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 +27 -5
- package/dist/protocols/openai-responses.d.ts +151 -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 +46 -15
- package/dist/protocols/utils/open-responses-options.js +38 -25
- 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 +43 -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 +40 -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 +29 -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 -14
- package/dist/providers/openai-compatible-responses.d.ts +29 -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 +44 -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 +46 -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/package.json +5 -5
|
@@ -49,17 +49,20 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
49
49
|
readonly text: string;
|
|
50
50
|
})[];
|
|
51
51
|
} | {
|
|
52
|
+
readonly type: "message";
|
|
52
53
|
readonly content: readonly {
|
|
53
54
|
readonly type: "output_text";
|
|
54
55
|
readonly text: string;
|
|
55
56
|
}[];
|
|
56
57
|
readonly role: "assistant";
|
|
58
|
+
readonly id?: string | undefined;
|
|
57
59
|
readonly phase?: "commentary" | "final_answer" | undefined;
|
|
58
60
|
} | {
|
|
59
61
|
readonly type: "function_call";
|
|
60
|
-
readonly call_id: string;
|
|
61
62
|
readonly name: string;
|
|
62
63
|
readonly arguments: string;
|
|
64
|
+
readonly call_id: string;
|
|
65
|
+
readonly id?: string | undefined;
|
|
63
66
|
} | {
|
|
64
67
|
readonly type: "function_call_output";
|
|
65
68
|
readonly call_id: string;
|
|
@@ -78,10 +81,13 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
78
81
|
})[];
|
|
79
82
|
readonly model: string;
|
|
80
83
|
readonly stream: true;
|
|
84
|
+
readonly metadata?: {
|
|
85
|
+
readonly [x: string]: string;
|
|
86
|
+
} | undefined;
|
|
81
87
|
readonly instructions?: string | undefined;
|
|
82
88
|
readonly reasoning?: {
|
|
83
89
|
readonly summary?: "auto" | "concise" | "detailed" | undefined;
|
|
84
|
-
readonly effort?:
|
|
90
|
+
readonly effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
|
|
85
91
|
} | undefined;
|
|
86
92
|
readonly tools?: readonly {
|
|
87
93
|
readonly type: "function";
|
|
@@ -93,31 +99,47 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
93
99
|
readonly strict?: boolean | undefined;
|
|
94
100
|
}[] | undefined;
|
|
95
101
|
readonly text?: {
|
|
96
|
-
readonly verbosity?: "
|
|
102
|
+
readonly verbosity?: import("../protocols/utils/open-responses-options.js").TextVerbosity | undefined;
|
|
97
103
|
} | undefined;
|
|
98
104
|
readonly temperature?: number | undefined;
|
|
99
|
-
readonly tool_choice?: "required" | "
|
|
105
|
+
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
100
106
|
readonly type: "function";
|
|
101
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
|
+
}[];
|
|
102
115
|
} | undefined;
|
|
103
116
|
readonly top_p?: number | undefined;
|
|
104
|
-
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;
|
|
105
117
|
readonly store?: boolean | undefined;
|
|
118
|
+
readonly include?: readonly import("../protocols/utils/open-responses-options.js").ResponseIncludable[] | undefined;
|
|
106
119
|
readonly truncation?: "auto" | "disabled" | undefined;
|
|
120
|
+
readonly stream_options?: {
|
|
121
|
+
readonly include_obfuscation?: boolean | undefined;
|
|
122
|
+
} | undefined;
|
|
107
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;
|
|
108
128
|
readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
109
129
|
readonly max_output_tokens?: number | undefined;
|
|
130
|
+
readonly max_tool_calls?: number | undefined;
|
|
131
|
+
readonly parallel_tool_calls?: boolean | undefined;
|
|
110
132
|
}, import("../route/transport/http.js").HttpPrepared<string>>[];
|
|
111
133
|
export declare const configure: (input: Config) => {
|
|
112
134
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
113
|
-
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>;
|
|
114
136
|
configure: (input: Config) => /*elided*/ any;
|
|
115
137
|
};
|
|
116
138
|
export declare const provider: {
|
|
117
139
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
118
140
|
configure: (input: Config) => {
|
|
119
141
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
120
|
-
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>;
|
|
121
143
|
configure: /*elided*/ any;
|
|
122
144
|
};
|
|
123
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<{
|
|
@@ -136,17 +136,20 @@ export declare const routes: (Route<{
|
|
|
136
136
|
readonly text: string;
|
|
137
137
|
})[];
|
|
138
138
|
} | {
|
|
139
|
+
readonly type: "message";
|
|
139
140
|
readonly content: readonly {
|
|
140
141
|
readonly type: "output_text";
|
|
141
142
|
readonly text: string;
|
|
142
143
|
}[];
|
|
143
144
|
readonly role: "assistant";
|
|
145
|
+
readonly id?: string | undefined;
|
|
144
146
|
readonly phase?: "commentary" | "final_answer" | undefined;
|
|
145
147
|
} | {
|
|
146
148
|
readonly type: "function_call";
|
|
147
|
-
readonly call_id: string;
|
|
148
149
|
readonly name: string;
|
|
149
150
|
readonly arguments: string;
|
|
151
|
+
readonly call_id: string;
|
|
152
|
+
readonly id?: string | undefined;
|
|
150
153
|
} | {
|
|
151
154
|
readonly type: "function_call_output";
|
|
152
155
|
readonly call_id: string;
|
|
@@ -163,19 +166,24 @@ export declare const routes: (Route<{
|
|
|
163
166
|
readonly text: string;
|
|
164
167
|
})[];
|
|
165
168
|
} | {
|
|
169
|
+
readonly type: "message";
|
|
166
170
|
readonly content: readonly {
|
|
167
171
|
readonly type: "output_text";
|
|
168
172
|
readonly text: string;
|
|
169
173
|
}[];
|
|
170
174
|
readonly role: "assistant";
|
|
175
|
+
readonly id?: string | undefined;
|
|
171
176
|
readonly phase?: "commentary" | "final_answer" | null | undefined;
|
|
172
177
|
})[];
|
|
173
178
|
readonly model: string;
|
|
174
179
|
readonly stream: true;
|
|
180
|
+
readonly metadata?: {
|
|
181
|
+
readonly [x: string]: string;
|
|
182
|
+
} | undefined;
|
|
175
183
|
readonly instructions?: string | undefined;
|
|
176
184
|
readonly reasoning?: {
|
|
177
185
|
readonly summary?: "auto" | "concise" | "detailed" | undefined;
|
|
178
|
-
readonly effort?:
|
|
186
|
+
readonly effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
|
|
179
187
|
} | undefined;
|
|
180
188
|
readonly tools?: readonly ({
|
|
181
189
|
readonly type: "function";
|
|
@@ -190,29 +198,45 @@ export declare const routes: (Route<{
|
|
|
190
198
|
readonly size?: string | undefined;
|
|
191
199
|
readonly action?: "generate" | "auto" | "edit" | undefined;
|
|
192
200
|
readonly output_format?: "png" | "jpeg" | "webp" | undefined;
|
|
193
|
-
readonly quality?: "
|
|
201
|
+
readonly quality?: "auto" | "low" | "medium" | "high" | undefined;
|
|
194
202
|
readonly background?: "auto" | "opaque" | "transparent" | undefined;
|
|
195
203
|
readonly output_compression?: number | undefined;
|
|
196
204
|
readonly input_fidelity?: "low" | "high" | undefined;
|
|
197
205
|
readonly partial_images?: number | undefined;
|
|
198
206
|
})[] | undefined;
|
|
199
207
|
readonly text?: {
|
|
200
|
-
readonly verbosity?: "
|
|
208
|
+
readonly verbosity?: import("../protocols/utils/open-responses-options.js").TextVerbosity | undefined;
|
|
201
209
|
} | undefined;
|
|
202
210
|
readonly temperature?: number | undefined;
|
|
203
|
-
readonly tool_choice?: "required" | "
|
|
211
|
+
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
204
212
|
readonly type: "function";
|
|
205
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
|
+
}[];
|
|
206
221
|
} | {
|
|
207
222
|
readonly type: "image_generation";
|
|
208
223
|
} | undefined;
|
|
209
224
|
readonly top_p?: number | undefined;
|
|
210
|
-
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;
|
|
211
225
|
readonly store?: boolean | undefined;
|
|
226
|
+
readonly include?: readonly import("../protocols/utils/open-responses-options.js").ResponseIncludable[] | undefined;
|
|
212
227
|
readonly truncation?: "auto" | "disabled" | undefined;
|
|
228
|
+
readonly stream_options?: {
|
|
229
|
+
readonly include_obfuscation?: boolean | undefined;
|
|
230
|
+
} | undefined;
|
|
213
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;
|
|
214
236
|
readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
215
237
|
readonly max_output_tokens?: number | undefined;
|
|
238
|
+
readonly max_tool_calls?: number | undefined;
|
|
239
|
+
readonly parallel_tool_calls?: boolean | undefined;
|
|
216
240
|
}, import("../protocols/open-responses-channel.js").Prepared>)[];
|
|
217
241
|
export type Config = RouteDefaultsInput & ProviderAuthOption<"optional"> & {
|
|
218
242
|
readonly baseURL?: string;
|
|
@@ -240,29 +264,29 @@ export interface Settings extends ProviderPackage.Settings {
|
|
|
240
264
|
}
|
|
241
265
|
export declare const configure: (input?: Config) => {
|
|
242
266
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
243
|
-
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
244
|
-
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
245
|
-
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>;
|
|
246
270
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
247
271
|
configure: (input?: Config) => /*elided*/ any;
|
|
248
272
|
};
|
|
249
273
|
export declare const provider: {
|
|
250
274
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
251
|
-
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
252
|
-
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
253
|
-
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>;
|
|
254
278
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
255
279
|
configure: (input?: Config) => {
|
|
256
280
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
257
|
-
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
258
|
-
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
259
|
-
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>;
|
|
260
284
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
261
285
|
configure: /*elided*/ any;
|
|
262
286
|
};
|
|
263
287
|
};
|
|
264
288
|
export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
265
289
|
export declare const chatModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
266
|
-
export declare const responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
267
|
-
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>;
|
|
268
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);
|