llm-strings 1.1.2 → 1.3.0
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 +115 -45
- package/dist/ai-sdk.cjs +1177 -0
- package/dist/ai-sdk.cjs.map +1 -0
- package/dist/ai-sdk.d.cts +28 -0
- package/dist/ai-sdk.d.ts +28 -0
- package/dist/ai-sdk.js +544 -0
- package/dist/ai-sdk.js.map +1 -0
- package/dist/{chunk-UYMVUTLV.js → chunk-7HE4RH6X.js} +5 -9
- package/dist/chunk-7HE4RH6X.js.map +1 -0
- package/dist/{chunk-MPIHGH6L.js → chunk-NZR5DUX5.js} +5 -4
- package/dist/chunk-NZR5DUX5.js.map +1 -0
- package/dist/chunk-OCJX4QFJ.js +1044 -0
- package/dist/chunk-OCJX4QFJ.js.map +1 -0
- package/dist/{chunk-FCEV23OT.js → chunk-TQJ2ABCT.js} +9 -3
- package/dist/chunk-TQJ2ABCT.js.map +1 -0
- package/dist/index.cjs +760 -87
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +9 -4
- package/dist/normalize.cjs +176 -5
- package/dist/normalize.cjs.map +1 -1
- package/dist/normalize.d.cts +1 -1
- package/dist/normalize.d.ts +2 -2
- package/dist/normalize.js +2 -2
- package/dist/parse.cjs +100 -2
- package/dist/parse.cjs.map +1 -1
- package/dist/parse.d.cts +5 -1
- package/dist/parse.d.ts +5 -1
- package/dist/parse.js +2 -1
- package/dist/{provider-core-DinpG40u.d.cts → provider-core-B934MuhJ.d.cts} +21 -2
- package/dist/{provider-core-DinpG40u.d.ts → provider-core-B934MuhJ.d.ts} +21 -2
- package/dist/providers.cjs +1396 -114
- package/dist/providers.cjs.map +1 -1
- package/dist/providers.d.cts +2 -2
- package/dist/providers.d.ts +2 -2
- package/dist/providers.js +672 -61
- package/dist/providers.js.map +1 -1
- package/dist/validate.cjs +750 -82
- package/dist/validate.cjs.map +1 -1
- package/dist/validate.js +4 -4
- package/package.json +13 -3
- package/dist/chunk-FCEV23OT.js.map +0 -1
- package/dist/chunk-MPIHGH6L.js.map +0 -1
- package/dist/chunk-UYMVUTLV.js.map +0 -1
- package/dist/chunk-XID353H7.js +0 -370
- package/dist/chunk-XID353H7.js.map +0 -1
package/dist/ai-sdk.js
ADDED
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
import {
|
|
2
|
+
normalize
|
|
3
|
+
} from "./chunk-NZR5DUX5.js";
|
|
4
|
+
import {
|
|
5
|
+
parse
|
|
6
|
+
} from "./chunk-TQJ2ABCT.js";
|
|
7
|
+
import "./chunk-OCJX4QFJ.js";
|
|
8
|
+
|
|
9
|
+
// src/ai-sdk.ts
|
|
10
|
+
var PROVIDER_OPTION_KEYS = {
|
|
11
|
+
openai: "openai",
|
|
12
|
+
azure: "azure",
|
|
13
|
+
anthropic: "anthropic",
|
|
14
|
+
google: "google",
|
|
15
|
+
"google-vertex": "vertex",
|
|
16
|
+
mistral: "mistral",
|
|
17
|
+
cohere: "cohere",
|
|
18
|
+
bedrock: "bedrock",
|
|
19
|
+
openrouter: "openrouter",
|
|
20
|
+
vercel: "gateway",
|
|
21
|
+
xai: "xai",
|
|
22
|
+
groq: "groq",
|
|
23
|
+
fal: "fal",
|
|
24
|
+
deepinfra: "deepinfra",
|
|
25
|
+
"black-forest-labs": "blackForestLabs",
|
|
26
|
+
together: "together",
|
|
27
|
+
fireworks: "fireworks",
|
|
28
|
+
deepseek: "deepseek",
|
|
29
|
+
moonshotai: "moonshotai",
|
|
30
|
+
perplexity: "perplexity",
|
|
31
|
+
alibaba: "alibaba",
|
|
32
|
+
cerebras: "cerebras",
|
|
33
|
+
replicate: "replicate",
|
|
34
|
+
prodia: "prodia",
|
|
35
|
+
luma: "luma",
|
|
36
|
+
bytedance: "bytedance",
|
|
37
|
+
kling: "kling",
|
|
38
|
+
elevenlabs: "elevenlabs",
|
|
39
|
+
assemblyai: "assemblyai",
|
|
40
|
+
deepgram: "deepgram",
|
|
41
|
+
gladia: "gladia",
|
|
42
|
+
lmnt: "lmnt",
|
|
43
|
+
hume: "hume",
|
|
44
|
+
revai: "revai",
|
|
45
|
+
baseten: "baseten",
|
|
46
|
+
huggingface: "huggingface"
|
|
47
|
+
};
|
|
48
|
+
var TRUE_VALUES = /* @__PURE__ */ new Set(["true", "1", "yes", "on"]);
|
|
49
|
+
var FALSE_VALUES = /* @__PURE__ */ new Set(["false", "0", "no", "off"]);
|
|
50
|
+
function providerOptionsKey(provider) {
|
|
51
|
+
return PROVIDER_OPTION_KEYS[provider];
|
|
52
|
+
}
|
|
53
|
+
function setProviderOption(options, provider, key, value) {
|
|
54
|
+
options[provider] ?? (options[provider] = {});
|
|
55
|
+
options[provider][key] = value;
|
|
56
|
+
}
|
|
57
|
+
function parseBoolean(value) {
|
|
58
|
+
const normalized = value.trim().toLowerCase();
|
|
59
|
+
if (TRUE_VALUES.has(normalized)) return true;
|
|
60
|
+
if (FALSE_VALUES.has(normalized)) return false;
|
|
61
|
+
return void 0;
|
|
62
|
+
}
|
|
63
|
+
function parseNumber(value) {
|
|
64
|
+
if (!value.trim()) return void 0;
|
|
65
|
+
const parsed = Number(value);
|
|
66
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
67
|
+
}
|
|
68
|
+
function parseJson(value) {
|
|
69
|
+
try {
|
|
70
|
+
return JSON.parse(value);
|
|
71
|
+
} catch {
|
|
72
|
+
return void 0;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function parseStringList(value) {
|
|
76
|
+
const json = parseJson(value);
|
|
77
|
+
if (Array.isArray(json)) {
|
|
78
|
+
return json.filter((item) => typeof item === "string");
|
|
79
|
+
}
|
|
80
|
+
return value.split(",").map((item) => item.trim()).filter(Boolean);
|
|
81
|
+
}
|
|
82
|
+
function typedValue(value) {
|
|
83
|
+
const booleanValue = parseBoolean(value);
|
|
84
|
+
if (booleanValue !== void 0) return booleanValue;
|
|
85
|
+
const numberValue = parseNumber(value);
|
|
86
|
+
if (numberValue !== void 0) return numberValue;
|
|
87
|
+
const jsonValue = parseJson(value);
|
|
88
|
+
if (jsonValue !== void 0) return jsonValue;
|
|
89
|
+
return value;
|
|
90
|
+
}
|
|
91
|
+
function mergeObjectOption(options, provider, key, value) {
|
|
92
|
+
const parsed = parseJson(value);
|
|
93
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
94
|
+
setProviderOption(options, provider, key, parsed);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function addOpenAiOption(options, key, value, target = "openai") {
|
|
98
|
+
const mappings = {
|
|
99
|
+
reasoning_effort: "reasoningEffort",
|
|
100
|
+
max_completion_tokens: "maxCompletionTokens",
|
|
101
|
+
parallel_tool_calls: "parallelToolCalls",
|
|
102
|
+
service_tier: "serviceTier",
|
|
103
|
+
strict_json_schema: "strictJsonSchema",
|
|
104
|
+
text_verbosity: "textVerbosity",
|
|
105
|
+
prompt_cache_key: "promptCacheKey",
|
|
106
|
+
prompt_cache_retention: "promptCacheRetention",
|
|
107
|
+
safety_identifier: "safetyIdentifier",
|
|
108
|
+
system_message_mode: "systemMessageMode",
|
|
109
|
+
force_reasoning: "forceReasoning",
|
|
110
|
+
reasoning_summary: "reasoningSummary",
|
|
111
|
+
previous_response_id: "previousResponseId",
|
|
112
|
+
max_tool_calls: "maxToolCalls",
|
|
113
|
+
allowed_tools: "allowedTools"
|
|
114
|
+
};
|
|
115
|
+
const directKeys = /* @__PURE__ */ new Set([
|
|
116
|
+
"conversation",
|
|
117
|
+
"instructions",
|
|
118
|
+
"logprobs",
|
|
119
|
+
"metadata",
|
|
120
|
+
"prediction",
|
|
121
|
+
"store",
|
|
122
|
+
"truncation",
|
|
123
|
+
"user"
|
|
124
|
+
]);
|
|
125
|
+
if (!mappings[key] && !directKeys.has(key) && key !== "include") return;
|
|
126
|
+
const optionKey = mappings[key] ?? key;
|
|
127
|
+
if (key === "include") {
|
|
128
|
+
setProviderOption(options, target, optionKey, parseStringList(value));
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (key === "metadata" || key === "prediction" || key === "allowed_tools") {
|
|
132
|
+
mergeObjectOption(options, target, optionKey, value);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
setProviderOption(options, target, optionKey, typedValue(value));
|
|
136
|
+
}
|
|
137
|
+
function addAnthropicOption(options, key, value) {
|
|
138
|
+
const target = "anthropic";
|
|
139
|
+
if (key === "cache_control" || key === "cacheControl") {
|
|
140
|
+
const ttl = options[target]?.cacheControl;
|
|
141
|
+
const ttlValue = ttl && typeof ttl === "object" && "ttl" in ttl ? ttl.ttl : void 0;
|
|
142
|
+
setProviderOption(options, target, "cacheControl", {
|
|
143
|
+
type: value === "ephemeral" ? "ephemeral" : value,
|
|
144
|
+
...ttlValue ? { ttl: ttlValue } : {}
|
|
145
|
+
});
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (key === "cache_ttl") {
|
|
149
|
+
const current = options[target]?.cacheControl;
|
|
150
|
+
setProviderOption(options, target, "cacheControl", {
|
|
151
|
+
...current && typeof current === "object" ? current : {},
|
|
152
|
+
type: "ephemeral",
|
|
153
|
+
ttl: value
|
|
154
|
+
});
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (key === "thinking") {
|
|
158
|
+
mergeObjectOption(options, target, "thinking", value);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (key === "thinking_budget" || key === "budget_tokens") {
|
|
162
|
+
const budgetTokens = parseNumber(value);
|
|
163
|
+
if (budgetTokens !== void 0) {
|
|
164
|
+
setProviderOption(options, target, "thinking", {
|
|
165
|
+
type: "enabled",
|
|
166
|
+
budgetTokens
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const mappings = {
|
|
172
|
+
send_reasoning: "sendReasoning",
|
|
173
|
+
structured_output_mode: "structuredOutputMode",
|
|
174
|
+
disable_parallel_tool_use: "disableParallelToolUse",
|
|
175
|
+
tool_streaming: "toolStreaming",
|
|
176
|
+
inference_geo: "inferenceGeo",
|
|
177
|
+
anthropic_beta: "anthropicBeta",
|
|
178
|
+
mcp_servers: "mcpServers",
|
|
179
|
+
task_budget: "taskBudget",
|
|
180
|
+
context_management: "contextManagement"
|
|
181
|
+
};
|
|
182
|
+
const directKeys = /* @__PURE__ */ new Set([
|
|
183
|
+
"effort",
|
|
184
|
+
"speed",
|
|
185
|
+
"sendReasoning",
|
|
186
|
+
"structuredOutputMode",
|
|
187
|
+
"disableParallelToolUse",
|
|
188
|
+
"toolStreaming",
|
|
189
|
+
"inferenceGeo",
|
|
190
|
+
"anthropicBeta",
|
|
191
|
+
"metadata",
|
|
192
|
+
"mcpServers",
|
|
193
|
+
"container",
|
|
194
|
+
"taskBudget",
|
|
195
|
+
"contextManagement"
|
|
196
|
+
]);
|
|
197
|
+
if (!mappings[key] && !directKeys.has(key)) return;
|
|
198
|
+
const optionKey = mappings[key] ?? key;
|
|
199
|
+
if (key === "anthropic_beta") {
|
|
200
|
+
setProviderOption(options, target, optionKey, parseStringList(value));
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (key === "metadata" || key === "mcp_servers" || key === "container" || key === "task_budget" || key === "context_management") {
|
|
204
|
+
mergeObjectOption(options, target, optionKey, value);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
setProviderOption(options, target, optionKey, typedValue(value));
|
|
208
|
+
}
|
|
209
|
+
function addGoogleOption(options, key, value, target = "google") {
|
|
210
|
+
if (key === "thinking_budget" || key === "thinking_level" || key === "include_thoughts") {
|
|
211
|
+
const current = options[target]?.thinkingConfig;
|
|
212
|
+
const thinkingConfig = current && typeof current === "object" && !Array.isArray(current) ? { ...current } : {};
|
|
213
|
+
if (key === "thinking_budget") {
|
|
214
|
+
const parsed = parseNumber(value);
|
|
215
|
+
if (parsed !== void 0) thinkingConfig.thinkingBudget = parsed;
|
|
216
|
+
}
|
|
217
|
+
if (key === "thinking_level") thinkingConfig.thinkingLevel = value;
|
|
218
|
+
if (key === "include_thoughts") {
|
|
219
|
+
const parsed = parseBoolean(value);
|
|
220
|
+
if (parsed !== void 0) thinkingConfig.includeThoughts = parsed;
|
|
221
|
+
}
|
|
222
|
+
setProviderOption(options, target, "thinkingConfig", thinkingConfig);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
const mappings = {
|
|
226
|
+
cached_content: "cachedContent",
|
|
227
|
+
structured_outputs: "structuredOutputs",
|
|
228
|
+
safety_settings: "safetySettings",
|
|
229
|
+
response_modalities: "responseModalities",
|
|
230
|
+
audio_timestamp: "audioTimestamp",
|
|
231
|
+
media_resolution: "mediaResolution",
|
|
232
|
+
image_config: "imageConfig",
|
|
233
|
+
retrieval_config: "retrievalConfig",
|
|
234
|
+
stream_function_call_arguments: "streamFunctionCallArguments",
|
|
235
|
+
service_tier: "serviceTier"
|
|
236
|
+
};
|
|
237
|
+
const directKeys = /* @__PURE__ */ new Set([
|
|
238
|
+
"cachedContent",
|
|
239
|
+
"structuredOutputs",
|
|
240
|
+
"safetySettings",
|
|
241
|
+
"threshold",
|
|
242
|
+
"audioTimestamp",
|
|
243
|
+
"labels",
|
|
244
|
+
"mediaResolution",
|
|
245
|
+
"imageConfig",
|
|
246
|
+
"retrievalConfig",
|
|
247
|
+
"responseModalities",
|
|
248
|
+
"streamFunctionCallArguments",
|
|
249
|
+
"serviceTier"
|
|
250
|
+
]);
|
|
251
|
+
if (!mappings[key] && !directKeys.has(key)) return;
|
|
252
|
+
const optionKey = mappings[key] ?? key;
|
|
253
|
+
if (key === "response_modalities") {
|
|
254
|
+
setProviderOption(options, target, optionKey, parseStringList(value));
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
if (key === "safety_settings" || key === "labels" || key === "image_config" || key === "retrieval_config") {
|
|
258
|
+
mergeObjectOption(options, target, optionKey, value);
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
setProviderOption(options, target, optionKey, typedValue(value));
|
|
262
|
+
}
|
|
263
|
+
function addMistralOption(options, key, value) {
|
|
264
|
+
const target = "mistral";
|
|
265
|
+
const mappings = {
|
|
266
|
+
safe_prompt: "safePrompt",
|
|
267
|
+
document_image_limit: "documentImageLimit",
|
|
268
|
+
document_page_limit: "documentPageLimit",
|
|
269
|
+
structured_outputs: "structuredOutputs",
|
|
270
|
+
strict_json_schema: "strictJsonSchema",
|
|
271
|
+
parallel_tool_calls: "parallelToolCalls",
|
|
272
|
+
reasoning_effort: "reasoningEffort"
|
|
273
|
+
};
|
|
274
|
+
const directKeys = /* @__PURE__ */ new Set([
|
|
275
|
+
"safePrompt",
|
|
276
|
+
"documentImageLimit",
|
|
277
|
+
"documentPageLimit",
|
|
278
|
+
"structuredOutputs",
|
|
279
|
+
"strictJsonSchema",
|
|
280
|
+
"parallelToolCalls",
|
|
281
|
+
"reasoningEffort"
|
|
282
|
+
]);
|
|
283
|
+
if (!mappings[key] && !directKeys.has(key)) return;
|
|
284
|
+
const optionKey = mappings[key] ?? key;
|
|
285
|
+
setProviderOption(options, target, optionKey, typedValue(value));
|
|
286
|
+
}
|
|
287
|
+
function addCohereOption(options, key, value) {
|
|
288
|
+
const target = "cohere";
|
|
289
|
+
if (key === "thinking") {
|
|
290
|
+
mergeObjectOption(options, target, "thinking", value);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
if (key === "thinking_token_budget" || key === "token_budget") {
|
|
294
|
+
const tokenBudget = parseNumber(value);
|
|
295
|
+
if (tokenBudget !== void 0) {
|
|
296
|
+
setProviderOption(options, target, "thinking", {
|
|
297
|
+
type: "enabled",
|
|
298
|
+
tokenBudget
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
if (key === "thinking_type") {
|
|
304
|
+
const current = options[target]?.thinking;
|
|
305
|
+
setProviderOption(options, target, "thinking", {
|
|
306
|
+
...current && typeof current === "object" ? current : {},
|
|
307
|
+
type: value
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
function addBedrockOption(options, key, value) {
|
|
312
|
+
const target = "bedrock";
|
|
313
|
+
if (key === "cache_control") {
|
|
314
|
+
setProviderOption(options, target, "cachePoint", {
|
|
315
|
+
type: value === "ephemeral" ? "default" : value
|
|
316
|
+
});
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
if (key === "cache_ttl") {
|
|
320
|
+
const current = options[target]?.cachePoint;
|
|
321
|
+
setProviderOption(options, target, "cachePoint", {
|
|
322
|
+
...current && typeof current === "object" ? current : {},
|
|
323
|
+
type: "default",
|
|
324
|
+
ttl: value
|
|
325
|
+
});
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
if (key === "reasoning_config") {
|
|
329
|
+
mergeObjectOption(options, target, "reasoningConfig", value);
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
if (key === "budget_tokens" || key === "reasoning_effort") {
|
|
333
|
+
const current = options[target]?.reasoningConfig;
|
|
334
|
+
const reasoningConfig = current && typeof current === "object" && !Array.isArray(current) ? { ...current } : {};
|
|
335
|
+
reasoningConfig.type = "enabled";
|
|
336
|
+
if (key === "budget_tokens") {
|
|
337
|
+
const budgetTokens = parseNumber(value);
|
|
338
|
+
if (budgetTokens !== void 0)
|
|
339
|
+
reasoningConfig.budgetTokens = budgetTokens;
|
|
340
|
+
}
|
|
341
|
+
if (key === "reasoning_effort") reasoningConfig.maxReasoningEffort = value;
|
|
342
|
+
setProviderOption(options, target, "reasoningConfig", reasoningConfig);
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
const mappings = {
|
|
346
|
+
additional_model_request_fields: "additionalModelRequestFields",
|
|
347
|
+
anthropic_beta: "anthropicBeta",
|
|
348
|
+
service_tier: "serviceTier"
|
|
349
|
+
};
|
|
350
|
+
const directKeys = /* @__PURE__ */ new Set([
|
|
351
|
+
"additionalModelRequestFields",
|
|
352
|
+
"anthropicBeta",
|
|
353
|
+
"serviceTier"
|
|
354
|
+
]);
|
|
355
|
+
if (!mappings[key] && !directKeys.has(key)) return;
|
|
356
|
+
const optionKey = mappings[key] ?? key;
|
|
357
|
+
if (key === "additional_model_request_fields") {
|
|
358
|
+
mergeObjectOption(options, target, optionKey, value);
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
if (key === "anthropic_beta") {
|
|
362
|
+
setProviderOption(options, target, optionKey, parseStringList(value));
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
setProviderOption(options, target, optionKey, typedValue(value));
|
|
366
|
+
}
|
|
367
|
+
function addGatewayOption(options, key, value) {
|
|
368
|
+
const target = "gateway";
|
|
369
|
+
const listKeys = /* @__PURE__ */ new Set(["only", "order", "tags", "models"]);
|
|
370
|
+
const objectKeys = /* @__PURE__ */ new Set(["byok", "provider_timeouts"]);
|
|
371
|
+
const mappings = {
|
|
372
|
+
zero_data_retention: "zeroDataRetention",
|
|
373
|
+
disallow_prompt_training: "disallowPromptTraining",
|
|
374
|
+
hipaa_compliant: "hipaaCompliant",
|
|
375
|
+
quota_entity_id: "quotaEntityId",
|
|
376
|
+
provider_timeouts: "providerTimeouts"
|
|
377
|
+
};
|
|
378
|
+
const directKeys = /* @__PURE__ */ new Set([
|
|
379
|
+
"sort",
|
|
380
|
+
"user",
|
|
381
|
+
"zeroDataRetention",
|
|
382
|
+
"disallowPromptTraining",
|
|
383
|
+
"hipaaCompliant",
|
|
384
|
+
"quotaEntityId",
|
|
385
|
+
"providerTimeouts"
|
|
386
|
+
]);
|
|
387
|
+
if (!mappings[key] && !directKeys.has(key) && !listKeys.has(key) && !objectKeys.has(key)) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
const optionKey = mappings[key] ?? key;
|
|
391
|
+
if (listKeys.has(key)) {
|
|
392
|
+
setProviderOption(options, target, optionKey, parseStringList(value));
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
if (objectKeys.has(key)) {
|
|
396
|
+
mergeObjectOption(options, target, optionKey, value);
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
setProviderOption(options, target, optionKey, typedValue(value));
|
|
400
|
+
}
|
|
401
|
+
function addOpenRouterOption(options, key, value) {
|
|
402
|
+
const target = "openrouter";
|
|
403
|
+
if (key === "models") {
|
|
404
|
+
setProviderOption(options, target, "models", parseStringList(value));
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
if (key === "reasoning") {
|
|
408
|
+
mergeObjectOption(options, target, "reasoning", value);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
if (key === "reasoning_effort") {
|
|
412
|
+
const current = options[target]?.reasoning;
|
|
413
|
+
setProviderOption(options, target, "reasoning", {
|
|
414
|
+
...current && typeof current === "object" ? current : {},
|
|
415
|
+
effort: value
|
|
416
|
+
});
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
if (key === "reasoning_max_tokens" || key === "max_reasoning_tokens") {
|
|
420
|
+
const current = options[target]?.reasoning;
|
|
421
|
+
const maxTokens = parseNumber(value);
|
|
422
|
+
if (maxTokens !== void 0) {
|
|
423
|
+
setProviderOption(options, target, "reasoning", {
|
|
424
|
+
...current && typeof current === "object" ? current : {},
|
|
425
|
+
max_tokens: maxTokens
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
if (key === "reasoning_enabled" || key === "reasoning_exclude") {
|
|
431
|
+
const current = options[target]?.reasoning;
|
|
432
|
+
const parsed = parseBoolean(value);
|
|
433
|
+
if (parsed !== void 0) {
|
|
434
|
+
setProviderOption(options, target, "reasoning", {
|
|
435
|
+
...current && typeof current === "object" ? current : {},
|
|
436
|
+
[key === "reasoning_enabled" ? "enabled" : "exclude"]: parsed
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
if (key === "user") {
|
|
442
|
+
setProviderOption(options, target, "user", value);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
function addFlexibleProviderOption(options, target, key, value) {
|
|
446
|
+
setProviderOption(options, target, key, typedValue(value));
|
|
447
|
+
}
|
|
448
|
+
function addProviderSpecificOption(options, provider, key, value, includeGatewayOptions) {
|
|
449
|
+
if (provider === "vercel") {
|
|
450
|
+
if (includeGatewayOptions) addGatewayOption(options, key, value);
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
if (provider === "openai") addOpenAiOption(options, key, value);
|
|
454
|
+
if (provider === "azure") addOpenAiOption(options, key, value, "azure");
|
|
455
|
+
if (provider === "anthropic") addAnthropicOption(options, key, value);
|
|
456
|
+
if (provider === "google") addGoogleOption(options, key, value);
|
|
457
|
+
if (provider === "google-vertex")
|
|
458
|
+
addGoogleOption(options, key, value, "vertex");
|
|
459
|
+
if (provider === "mistral") addMistralOption(options, key, value);
|
|
460
|
+
if (provider === "cohere") addCohereOption(options, key, value);
|
|
461
|
+
if (provider === "bedrock") addBedrockOption(options, key, value);
|
|
462
|
+
if (provider === "openrouter") addOpenRouterOption(options, key, value);
|
|
463
|
+
if (provider === "xai") addOpenAiOption(options, key, value, "xai");
|
|
464
|
+
if (provider === "groq") addOpenAiOption(options, key, value, "groq");
|
|
465
|
+
if (provider === "fal") addFlexibleProviderOption(options, "fal", key, value);
|
|
466
|
+
if (provider === "deepinfra")
|
|
467
|
+
addOpenAiOption(options, key, value, "deepinfra");
|
|
468
|
+
if (provider === "black-forest-labs")
|
|
469
|
+
addFlexibleProviderOption(options, "blackForestLabs", key, value);
|
|
470
|
+
if (provider === "together") addOpenAiOption(options, key, value, "together");
|
|
471
|
+
if (provider === "fireworks")
|
|
472
|
+
addOpenAiOption(options, key, value, "fireworks");
|
|
473
|
+
if (provider === "deepseek") addOpenAiOption(options, key, value, "deepseek");
|
|
474
|
+
if (provider === "moonshotai")
|
|
475
|
+
addOpenAiOption(options, key, value, "moonshotai");
|
|
476
|
+
if (provider === "perplexity")
|
|
477
|
+
addOpenAiOption(options, key, value, "perplexity");
|
|
478
|
+
if (provider === "alibaba") addOpenAiOption(options, key, value, "alibaba");
|
|
479
|
+
if (provider === "cerebras") addOpenAiOption(options, key, value, "cerebras");
|
|
480
|
+
if (provider === "replicate")
|
|
481
|
+
addFlexibleProviderOption(options, "replicate", key, value);
|
|
482
|
+
if (provider === "prodia")
|
|
483
|
+
addFlexibleProviderOption(options, "prodia", key, value);
|
|
484
|
+
if (provider === "luma")
|
|
485
|
+
addFlexibleProviderOption(options, "luma", key, value);
|
|
486
|
+
if (provider === "bytedance")
|
|
487
|
+
addFlexibleProviderOption(options, "bytedance", key, value);
|
|
488
|
+
if (provider === "kling")
|
|
489
|
+
addFlexibleProviderOption(options, "kling", key, value);
|
|
490
|
+
if (provider === "elevenlabs")
|
|
491
|
+
addFlexibleProviderOption(options, "elevenlabs", key, value);
|
|
492
|
+
if (provider === "assemblyai")
|
|
493
|
+
addFlexibleProviderOption(options, "assemblyai", key, value);
|
|
494
|
+
if (provider === "deepgram")
|
|
495
|
+
addFlexibleProviderOption(options, "deepgram", key, value);
|
|
496
|
+
if (provider === "gladia")
|
|
497
|
+
addFlexibleProviderOption(options, "gladia", key, value);
|
|
498
|
+
if (provider === "lmnt")
|
|
499
|
+
addFlexibleProviderOption(options, "lmnt", key, value);
|
|
500
|
+
if (provider === "hume")
|
|
501
|
+
addFlexibleProviderOption(options, "hume", key, value);
|
|
502
|
+
if (provider === "revai")
|
|
503
|
+
addFlexibleProviderOption(options, "revai", key, value);
|
|
504
|
+
if (provider === "baseten") addOpenAiOption(options, key, value, "baseten");
|
|
505
|
+
if (provider === "huggingface")
|
|
506
|
+
addOpenAiOption(options, key, value, "huggingface");
|
|
507
|
+
}
|
|
508
|
+
function createAiSdkProviderOptions(configOrResult, options = {}) {
|
|
509
|
+
const normalized = typeof configOrResult === "string" ? normalize(parse(configOrResult), options) : "changes" in configOrResult && "subProvider" in configOrResult ? configOrResult : normalize(configOrResult, options);
|
|
510
|
+
const providerOptions = {};
|
|
511
|
+
if (!normalized.provider) {
|
|
512
|
+
return {
|
|
513
|
+
provider: normalized.provider,
|
|
514
|
+
subProvider: normalized.subProvider,
|
|
515
|
+
providerOptions
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
const includeGatewayOptions = options.includeGatewayOptions ?? normalized.provider === "vercel";
|
|
519
|
+
for (const [key, value] of Object.entries(normalized.config.params)) {
|
|
520
|
+
addProviderSpecificOption(
|
|
521
|
+
providerOptions,
|
|
522
|
+
normalized.provider,
|
|
523
|
+
key,
|
|
524
|
+
value,
|
|
525
|
+
includeGatewayOptions
|
|
526
|
+
);
|
|
527
|
+
}
|
|
528
|
+
if (normalized.provider !== "vercel" && !providerOptions[providerOptionsKey(normalized.provider)]) {
|
|
529
|
+
return {
|
|
530
|
+
provider: normalized.provider,
|
|
531
|
+
subProvider: normalized.subProvider,
|
|
532
|
+
providerOptions: {}
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
return {
|
|
536
|
+
provider: normalized.provider,
|
|
537
|
+
subProvider: normalized.subProvider,
|
|
538
|
+
providerOptions
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
export {
|
|
542
|
+
createAiSdkProviderOptions
|
|
543
|
+
};
|
|
544
|
+
//# sourceMappingURL=ai-sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ai-sdk.ts"],"sourcesContent":["import { normalize } from \"./normalize.js\";\nimport type { NormalizeOptions, NormalizeResult } from \"./normalize.js\";\nimport { parse } from \"./parse.js\";\nimport type { LlmConnectionConfig } from \"./parse.js\";\nimport type { Provider } from \"./provider-core.js\";\n\nexport type AiSdkProviderOptions = Record<string, Record<string, unknown>>;\n\nexport interface AiSdkProviderOptionsResult {\n provider: Provider | undefined;\n subProvider: Provider | undefined;\n providerOptions: AiSdkProviderOptions;\n}\n\nexport interface AiSdkProviderOptionsOptions extends NormalizeOptions {\n /**\n * Include Vercel AI Gateway routing options under `providerOptions.gateway`.\n * Defaults to true for `vercel` hosts.\n */\n includeGatewayOptions?: boolean;\n}\n\nexport type AiSdkProviderOptionsInput =\n | string\n | LlmConnectionConfig\n | NormalizeResult;\n\ntype ProviderOptionsKey = Provider | \"gateway\" | \"vertex\" | \"blackForestLabs\";\n\nconst PROVIDER_OPTION_KEYS: Record<Provider, ProviderOptionsKey> = {\n openai: \"openai\",\n azure: \"azure\",\n anthropic: \"anthropic\",\n google: \"google\",\n \"google-vertex\": \"vertex\",\n mistral: \"mistral\",\n cohere: \"cohere\",\n bedrock: \"bedrock\",\n openrouter: \"openrouter\",\n vercel: \"gateway\",\n xai: \"xai\",\n groq: \"groq\",\n fal: \"fal\",\n deepinfra: \"deepinfra\",\n \"black-forest-labs\": \"blackForestLabs\",\n together: \"together\",\n fireworks: \"fireworks\",\n deepseek: \"deepseek\",\n moonshotai: \"moonshotai\",\n perplexity: \"perplexity\",\n alibaba: \"alibaba\",\n cerebras: \"cerebras\",\n replicate: \"replicate\",\n prodia: \"prodia\",\n luma: \"luma\",\n bytedance: \"bytedance\",\n kling: \"kling\",\n elevenlabs: \"elevenlabs\",\n assemblyai: \"assemblyai\",\n deepgram: \"deepgram\",\n gladia: \"gladia\",\n lmnt: \"lmnt\",\n hume: \"hume\",\n revai: \"revai\",\n baseten: \"baseten\",\n huggingface: \"huggingface\",\n};\n\nconst TRUE_VALUES = new Set([\"true\", \"1\", \"yes\", \"on\"]);\nconst FALSE_VALUES = new Set([\"false\", \"0\", \"no\", \"off\"]);\n\nfunction providerOptionsKey(provider: Provider): ProviderOptionsKey {\n return PROVIDER_OPTION_KEYS[provider];\n}\n\nfunction setProviderOption(\n options: AiSdkProviderOptions,\n provider: ProviderOptionsKey,\n key: string,\n value: unknown,\n): void {\n options[provider] ??= {};\n options[provider][key] = value;\n}\n\nfunction parseBoolean(value: string): boolean | undefined {\n const normalized = value.trim().toLowerCase();\n if (TRUE_VALUES.has(normalized)) return true;\n if (FALSE_VALUES.has(normalized)) return false;\n return undefined;\n}\n\nfunction parseNumber(value: string): number | undefined {\n if (!value.trim()) return undefined;\n const parsed = Number(value);\n return Number.isFinite(parsed) ? parsed : undefined;\n}\n\nfunction parseJson(value: string): unknown {\n try {\n return JSON.parse(value) as unknown;\n } catch {\n return undefined;\n }\n}\n\nfunction parseStringList(value: string): string[] {\n const json = parseJson(value);\n if (Array.isArray(json)) {\n return json.filter((item): item is string => typeof item === \"string\");\n }\n return value\n .split(\",\")\n .map((item) => item.trim())\n .filter(Boolean);\n}\n\nfunction typedValue(value: string): unknown {\n const booleanValue = parseBoolean(value);\n if (booleanValue !== undefined) return booleanValue;\n\n const numberValue = parseNumber(value);\n if (numberValue !== undefined) return numberValue;\n\n const jsonValue = parseJson(value);\n if (jsonValue !== undefined) return jsonValue;\n\n return value;\n}\n\nfunction mergeObjectOption(\n options: AiSdkProviderOptions,\n provider: ProviderOptionsKey,\n key: string,\n value: string,\n): void {\n const parsed = parseJson(value);\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n setProviderOption(options, provider, key, parsed);\n }\n}\n\nfunction addOpenAiOption(\n options: AiSdkProviderOptions,\n key: string,\n value: string,\n target: ProviderOptionsKey = \"openai\",\n): void {\n const mappings: Record<string, string> = {\n reasoning_effort: \"reasoningEffort\",\n max_completion_tokens: \"maxCompletionTokens\",\n parallel_tool_calls: \"parallelToolCalls\",\n service_tier: \"serviceTier\",\n strict_json_schema: \"strictJsonSchema\",\n text_verbosity: \"textVerbosity\",\n prompt_cache_key: \"promptCacheKey\",\n prompt_cache_retention: \"promptCacheRetention\",\n safety_identifier: \"safetyIdentifier\",\n system_message_mode: \"systemMessageMode\",\n force_reasoning: \"forceReasoning\",\n reasoning_summary: \"reasoningSummary\",\n previous_response_id: \"previousResponseId\",\n max_tool_calls: \"maxToolCalls\",\n allowed_tools: \"allowedTools\",\n };\n const directKeys = new Set([\n \"conversation\",\n \"instructions\",\n \"logprobs\",\n \"metadata\",\n \"prediction\",\n \"store\",\n \"truncation\",\n \"user\",\n ]);\n if (!mappings[key] && !directKeys.has(key) && key !== \"include\") return;\n const optionKey = mappings[key] ?? key;\n\n if (key === \"include\") {\n setProviderOption(options, target, optionKey, parseStringList(value));\n return;\n }\n\n if (key === \"metadata\" || key === \"prediction\" || key === \"allowed_tools\") {\n mergeObjectOption(options, target, optionKey, value);\n return;\n }\n\n setProviderOption(options, target, optionKey, typedValue(value));\n}\n\nfunction addAnthropicOption(\n options: AiSdkProviderOptions,\n key: string,\n value: string,\n): void {\n const target: ProviderOptionsKey = \"anthropic\";\n\n if (key === \"cache_control\" || key === \"cacheControl\") {\n const ttl = options[target]?.cacheControl;\n const ttlValue =\n ttl && typeof ttl === \"object\" && \"ttl\" in ttl ? ttl.ttl : undefined;\n setProviderOption(options, target, \"cacheControl\", {\n type: value === \"ephemeral\" ? \"ephemeral\" : value,\n ...(ttlValue ? { ttl: ttlValue } : {}),\n });\n return;\n }\n\n if (key === \"cache_ttl\") {\n const current = options[target]?.cacheControl;\n setProviderOption(options, target, \"cacheControl\", {\n ...(current && typeof current === \"object\" ? current : {}),\n type: \"ephemeral\",\n ttl: value,\n });\n return;\n }\n\n if (key === \"thinking\") {\n mergeObjectOption(options, target, \"thinking\", value);\n return;\n }\n\n if (key === \"thinking_budget\" || key === \"budget_tokens\") {\n const budgetTokens = parseNumber(value);\n if (budgetTokens !== undefined) {\n setProviderOption(options, target, \"thinking\", {\n type: \"enabled\",\n budgetTokens,\n });\n }\n return;\n }\n\n const mappings: Record<string, string> = {\n send_reasoning: \"sendReasoning\",\n structured_output_mode: \"structuredOutputMode\",\n disable_parallel_tool_use: \"disableParallelToolUse\",\n tool_streaming: \"toolStreaming\",\n inference_geo: \"inferenceGeo\",\n anthropic_beta: \"anthropicBeta\",\n mcp_servers: \"mcpServers\",\n task_budget: \"taskBudget\",\n context_management: \"contextManagement\",\n };\n const directKeys = new Set([\n \"effort\",\n \"speed\",\n \"sendReasoning\",\n \"structuredOutputMode\",\n \"disableParallelToolUse\",\n \"toolStreaming\",\n \"inferenceGeo\",\n \"anthropicBeta\",\n \"metadata\",\n \"mcpServers\",\n \"container\",\n \"taskBudget\",\n \"contextManagement\",\n ]);\n if (!mappings[key] && !directKeys.has(key)) return;\n const optionKey = mappings[key] ?? key;\n\n if (key === \"anthropic_beta\") {\n setProviderOption(options, target, optionKey, parseStringList(value));\n return;\n }\n\n if (\n key === \"metadata\" ||\n key === \"mcp_servers\" ||\n key === \"container\" ||\n key === \"task_budget\" ||\n key === \"context_management\"\n ) {\n mergeObjectOption(options, target, optionKey, value);\n return;\n }\n\n setProviderOption(options, target, optionKey, typedValue(value));\n}\n\nfunction addGoogleOption(\n options: AiSdkProviderOptions,\n key: string,\n value: string,\n target: ProviderOptionsKey = \"google\",\n): void {\n if (\n key === \"thinking_budget\" ||\n key === \"thinking_level\" ||\n key === \"include_thoughts\"\n ) {\n const current = options[target]?.thinkingConfig;\n const thinkingConfig: Record<string, unknown> =\n current && typeof current === \"object\" && !Array.isArray(current)\n ? { ...current }\n : {};\n if (key === \"thinking_budget\") {\n const parsed = parseNumber(value);\n if (parsed !== undefined) thinkingConfig.thinkingBudget = parsed;\n }\n if (key === \"thinking_level\") thinkingConfig.thinkingLevel = value;\n if (key === \"include_thoughts\") {\n const parsed = parseBoolean(value);\n if (parsed !== undefined) thinkingConfig.includeThoughts = parsed;\n }\n setProviderOption(options, target, \"thinkingConfig\", thinkingConfig);\n return;\n }\n\n const mappings: Record<string, string> = {\n cached_content: \"cachedContent\",\n structured_outputs: \"structuredOutputs\",\n safety_settings: \"safetySettings\",\n response_modalities: \"responseModalities\",\n audio_timestamp: \"audioTimestamp\",\n media_resolution: \"mediaResolution\",\n image_config: \"imageConfig\",\n retrieval_config: \"retrievalConfig\",\n stream_function_call_arguments: \"streamFunctionCallArguments\",\n service_tier: \"serviceTier\",\n };\n const directKeys = new Set([\n \"cachedContent\",\n \"structuredOutputs\",\n \"safetySettings\",\n \"threshold\",\n \"audioTimestamp\",\n \"labels\",\n \"mediaResolution\",\n \"imageConfig\",\n \"retrievalConfig\",\n \"responseModalities\",\n \"streamFunctionCallArguments\",\n \"serviceTier\",\n ]);\n if (!mappings[key] && !directKeys.has(key)) return;\n const optionKey = mappings[key] ?? key;\n\n if (key === \"response_modalities\") {\n setProviderOption(options, target, optionKey, parseStringList(value));\n return;\n }\n\n if (\n key === \"safety_settings\" ||\n key === \"labels\" ||\n key === \"image_config\" ||\n key === \"retrieval_config\"\n ) {\n mergeObjectOption(options, target, optionKey, value);\n return;\n }\n\n setProviderOption(options, target, optionKey, typedValue(value));\n}\n\nfunction addMistralOption(\n options: AiSdkProviderOptions,\n key: string,\n value: string,\n): void {\n const target: ProviderOptionsKey = \"mistral\";\n const mappings: Record<string, string> = {\n safe_prompt: \"safePrompt\",\n document_image_limit: \"documentImageLimit\",\n document_page_limit: \"documentPageLimit\",\n structured_outputs: \"structuredOutputs\",\n strict_json_schema: \"strictJsonSchema\",\n parallel_tool_calls: \"parallelToolCalls\",\n reasoning_effort: \"reasoningEffort\",\n };\n const directKeys = new Set([\n \"safePrompt\",\n \"documentImageLimit\",\n \"documentPageLimit\",\n \"structuredOutputs\",\n \"strictJsonSchema\",\n \"parallelToolCalls\",\n \"reasoningEffort\",\n ]);\n if (!mappings[key] && !directKeys.has(key)) return;\n const optionKey = mappings[key] ?? key;\n setProviderOption(options, target, optionKey, typedValue(value));\n}\n\nfunction addCohereOption(\n options: AiSdkProviderOptions,\n key: string,\n value: string,\n): void {\n const target: ProviderOptionsKey = \"cohere\";\n\n if (key === \"thinking\") {\n mergeObjectOption(options, target, \"thinking\", value);\n return;\n }\n\n if (key === \"thinking_token_budget\" || key === \"token_budget\") {\n const tokenBudget = parseNumber(value);\n if (tokenBudget !== undefined) {\n setProviderOption(options, target, \"thinking\", {\n type: \"enabled\",\n tokenBudget,\n });\n }\n return;\n }\n\n if (key === \"thinking_type\") {\n const current = options[target]?.thinking;\n setProviderOption(options, target, \"thinking\", {\n ...(current && typeof current === \"object\" ? current : {}),\n type: value,\n });\n }\n}\n\nfunction addBedrockOption(\n options: AiSdkProviderOptions,\n key: string,\n value: string,\n): void {\n const target: ProviderOptionsKey = \"bedrock\";\n\n if (key === \"cache_control\") {\n setProviderOption(options, target, \"cachePoint\", {\n type: value === \"ephemeral\" ? \"default\" : value,\n });\n return;\n }\n\n if (key === \"cache_ttl\") {\n const current = options[target]?.cachePoint;\n setProviderOption(options, target, \"cachePoint\", {\n ...(current && typeof current === \"object\" ? current : {}),\n type: \"default\",\n ttl: value,\n });\n return;\n }\n\n if (key === \"reasoning_config\") {\n mergeObjectOption(options, target, \"reasoningConfig\", value);\n return;\n }\n\n if (key === \"budget_tokens\" || key === \"reasoning_effort\") {\n const current = options[target]?.reasoningConfig;\n const reasoningConfig: Record<string, unknown> =\n current && typeof current === \"object\" && !Array.isArray(current)\n ? { ...current }\n : {};\n reasoningConfig.type = \"enabled\";\n if (key === \"budget_tokens\") {\n const budgetTokens = parseNumber(value);\n if (budgetTokens !== undefined)\n reasoningConfig.budgetTokens = budgetTokens;\n }\n if (key === \"reasoning_effort\") reasoningConfig.maxReasoningEffort = value;\n setProviderOption(options, target, \"reasoningConfig\", reasoningConfig);\n return;\n }\n\n const mappings: Record<string, string> = {\n additional_model_request_fields: \"additionalModelRequestFields\",\n anthropic_beta: \"anthropicBeta\",\n service_tier: \"serviceTier\",\n };\n const directKeys = new Set([\n \"additionalModelRequestFields\",\n \"anthropicBeta\",\n \"serviceTier\",\n ]);\n if (!mappings[key] && !directKeys.has(key)) return;\n const optionKey = mappings[key] ?? key;\n\n if (key === \"additional_model_request_fields\") {\n mergeObjectOption(options, target, optionKey, value);\n return;\n }\n\n if (key === \"anthropic_beta\") {\n setProviderOption(options, target, optionKey, parseStringList(value));\n return;\n }\n\n setProviderOption(options, target, optionKey, typedValue(value));\n}\n\nfunction addGatewayOption(\n options: AiSdkProviderOptions,\n key: string,\n value: string,\n): void {\n const target: ProviderOptionsKey = \"gateway\";\n const listKeys = new Set([\"only\", \"order\", \"tags\", \"models\"]);\n const objectKeys = new Set([\"byok\", \"provider_timeouts\"]);\n const mappings: Record<string, string> = {\n zero_data_retention: \"zeroDataRetention\",\n disallow_prompt_training: \"disallowPromptTraining\",\n hipaa_compliant: \"hipaaCompliant\",\n quota_entity_id: \"quotaEntityId\",\n provider_timeouts: \"providerTimeouts\",\n };\n const directKeys = new Set([\n \"sort\",\n \"user\",\n \"zeroDataRetention\",\n \"disallowPromptTraining\",\n \"hipaaCompliant\",\n \"quotaEntityId\",\n \"providerTimeouts\",\n ]);\n if (\n !mappings[key] &&\n !directKeys.has(key) &&\n !listKeys.has(key) &&\n !objectKeys.has(key)\n ) {\n return;\n }\n const optionKey = mappings[key] ?? key;\n\n if (listKeys.has(key)) {\n setProviderOption(options, target, optionKey, parseStringList(value));\n return;\n }\n\n if (objectKeys.has(key)) {\n mergeObjectOption(options, target, optionKey, value);\n return;\n }\n\n setProviderOption(options, target, optionKey, typedValue(value));\n}\n\nfunction addOpenRouterOption(\n options: AiSdkProviderOptions,\n key: string,\n value: string,\n): void {\n const target: ProviderOptionsKey = \"openrouter\";\n\n if (key === \"models\") {\n setProviderOption(options, target, \"models\", parseStringList(value));\n return;\n }\n\n if (key === \"reasoning\") {\n mergeObjectOption(options, target, \"reasoning\", value);\n return;\n }\n\n if (key === \"reasoning_effort\") {\n const current = options[target]?.reasoning;\n setProviderOption(options, target, \"reasoning\", {\n ...(current && typeof current === \"object\" ? current : {}),\n effort: value,\n });\n return;\n }\n\n if (key === \"reasoning_max_tokens\" || key === \"max_reasoning_tokens\") {\n const current = options[target]?.reasoning;\n const maxTokens = parseNumber(value);\n if (maxTokens !== undefined) {\n setProviderOption(options, target, \"reasoning\", {\n ...(current && typeof current === \"object\" ? current : {}),\n max_tokens: maxTokens,\n });\n }\n return;\n }\n\n if (key === \"reasoning_enabled\" || key === \"reasoning_exclude\") {\n const current = options[target]?.reasoning;\n const parsed = parseBoolean(value);\n if (parsed !== undefined) {\n setProviderOption(options, target, \"reasoning\", {\n ...(current && typeof current === \"object\" ? current : {}),\n [key === \"reasoning_enabled\" ? \"enabled\" : \"exclude\"]: parsed,\n });\n }\n return;\n }\n\n if (key === \"user\") {\n setProviderOption(options, target, \"user\", value);\n }\n}\n\nfunction addFlexibleProviderOption(\n options: AiSdkProviderOptions,\n target: ProviderOptionsKey,\n key: string,\n value: string,\n): void {\n setProviderOption(options, target, key, typedValue(value));\n}\n\nfunction addProviderSpecificOption(\n options: AiSdkProviderOptions,\n provider: Provider,\n key: string,\n value: string,\n includeGatewayOptions: boolean,\n): void {\n if (provider === \"vercel\") {\n if (includeGatewayOptions) addGatewayOption(options, key, value);\n return;\n }\n\n if (provider === \"openai\") addOpenAiOption(options, key, value);\n if (provider === \"azure\") addOpenAiOption(options, key, value, \"azure\");\n if (provider === \"anthropic\") addAnthropicOption(options, key, value);\n if (provider === \"google\") addGoogleOption(options, key, value);\n if (provider === \"google-vertex\")\n addGoogleOption(options, key, value, \"vertex\");\n if (provider === \"mistral\") addMistralOption(options, key, value);\n if (provider === \"cohere\") addCohereOption(options, key, value);\n if (provider === \"bedrock\") addBedrockOption(options, key, value);\n if (provider === \"openrouter\") addOpenRouterOption(options, key, value);\n if (provider === \"xai\") addOpenAiOption(options, key, value, \"xai\");\n if (provider === \"groq\") addOpenAiOption(options, key, value, \"groq\");\n if (provider === \"fal\") addFlexibleProviderOption(options, \"fal\", key, value);\n if (provider === \"deepinfra\")\n addOpenAiOption(options, key, value, \"deepinfra\");\n if (provider === \"black-forest-labs\")\n addFlexibleProviderOption(options, \"blackForestLabs\", key, value);\n if (provider === \"together\") addOpenAiOption(options, key, value, \"together\");\n if (provider === \"fireworks\")\n addOpenAiOption(options, key, value, \"fireworks\");\n if (provider === \"deepseek\") addOpenAiOption(options, key, value, \"deepseek\");\n if (provider === \"moonshotai\")\n addOpenAiOption(options, key, value, \"moonshotai\");\n if (provider === \"perplexity\")\n addOpenAiOption(options, key, value, \"perplexity\");\n if (provider === \"alibaba\") addOpenAiOption(options, key, value, \"alibaba\");\n if (provider === \"cerebras\") addOpenAiOption(options, key, value, \"cerebras\");\n if (provider === \"replicate\")\n addFlexibleProviderOption(options, \"replicate\", key, value);\n if (provider === \"prodia\")\n addFlexibleProviderOption(options, \"prodia\", key, value);\n if (provider === \"luma\")\n addFlexibleProviderOption(options, \"luma\", key, value);\n if (provider === \"bytedance\")\n addFlexibleProviderOption(options, \"bytedance\", key, value);\n if (provider === \"kling\")\n addFlexibleProviderOption(options, \"kling\", key, value);\n if (provider === \"elevenlabs\")\n addFlexibleProviderOption(options, \"elevenlabs\", key, value);\n if (provider === \"assemblyai\")\n addFlexibleProviderOption(options, \"assemblyai\", key, value);\n if (provider === \"deepgram\")\n addFlexibleProviderOption(options, \"deepgram\", key, value);\n if (provider === \"gladia\")\n addFlexibleProviderOption(options, \"gladia\", key, value);\n if (provider === \"lmnt\")\n addFlexibleProviderOption(options, \"lmnt\", key, value);\n if (provider === \"hume\")\n addFlexibleProviderOption(options, \"hume\", key, value);\n if (provider === \"revai\")\n addFlexibleProviderOption(options, \"revai\", key, value);\n if (provider === \"baseten\") addOpenAiOption(options, key, value, \"baseten\");\n if (provider === \"huggingface\")\n addOpenAiOption(options, key, value, \"huggingface\");\n}\n\n/**\n * Build AI SDK `providerOptions` from an LLM connection config.\n *\n * Common model call settings such as `temperature`, `topP`, and\n * `maxOutputTokens` are intentionally not emitted here. This helper only emits\n * provider-specific AI SDK options under the correct provider key.\n */\nexport function createAiSdkProviderOptions(\n configOrResult: AiSdkProviderOptionsInput,\n options: AiSdkProviderOptionsOptions = {},\n): AiSdkProviderOptionsResult {\n const normalized =\n typeof configOrResult === \"string\"\n ? normalize(parse(configOrResult), options)\n : \"changes\" in configOrResult && \"subProvider\" in configOrResult\n ? configOrResult\n : normalize(configOrResult, options);\n const providerOptions: AiSdkProviderOptions = {};\n\n if (!normalized.provider) {\n return {\n provider: normalized.provider,\n subProvider: normalized.subProvider,\n providerOptions,\n };\n }\n\n const includeGatewayOptions =\n options.includeGatewayOptions ?? normalized.provider === \"vercel\";\n\n for (const [key, value] of Object.entries(normalized.config.params)) {\n addProviderSpecificOption(\n providerOptions,\n normalized.provider,\n key,\n value,\n includeGatewayOptions,\n );\n }\n\n if (\n normalized.provider !== \"vercel\" &&\n !providerOptions[providerOptionsKey(normalized.provider)]\n ) {\n return {\n provider: normalized.provider,\n subProvider: normalized.subProvider,\n providerOptions: {},\n };\n }\n\n return {\n provider: normalized.provider,\n subProvider: normalized.subProvider,\n providerOptions,\n };\n}\n"],"mappings":";;;;;;;;;AA6BA,IAAM,uBAA6D;AAAA,EACjE,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,iBAAiB;AAAA,EACjB,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AAAA,EACL,WAAW;AAAA,EACX,qBAAqB;AAAA,EACrB,UAAU;AAAA,EACV,WAAW;AAAA,EACX,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,UAAU;AAAA,EACV,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,WAAW;AAAA,EACX,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,aAAa;AACf;AAEA,IAAM,cAAc,oBAAI,IAAI,CAAC,QAAQ,KAAK,OAAO,IAAI,CAAC;AACtD,IAAM,eAAe,oBAAI,IAAI,CAAC,SAAS,KAAK,MAAM,KAAK,CAAC;AAExD,SAAS,mBAAmB,UAAwC;AAClE,SAAO,qBAAqB,QAAQ;AACtC;AAEA,SAAS,kBACP,SACA,UACA,KACA,OACM;AACN,4CAAsB,CA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CAAC,GACxD;AACA,WAAO;AAAA,MACL,UAAU,WAAW;AAAA,MACrB,aAAa,WAAW;AAAA,MACxB,iBAAiB,CAAC;AAAA,IACpB;AAAA,EACF;AAEA,SAAO;AAAA,IACL,UAAU,WAAW;AAAA,IACrB,aAAa,WAAW;AAAA,IACxB;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalize
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NZR5DUX5.js";
|
|
4
4
|
import {
|
|
5
5
|
parse
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TQJ2ABCT.js";
|
|
7
7
|
import {
|
|
8
8
|
PARAM_SPECS,
|
|
9
9
|
PROVIDER_PARAMS,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
canHostOpenAIModels,
|
|
13
13
|
detectBedrockModelFamily,
|
|
14
14
|
isReasoningModel
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-OCJX4QFJ.js";
|
|
16
16
|
|
|
17
17
|
// src/validate.ts
|
|
18
18
|
function buildReverseParamMap(provider) {
|
|
@@ -103,11 +103,7 @@ function validate(connectionString, options = {}) {
|
|
|
103
103
|
}
|
|
104
104
|
let spec = specs[key];
|
|
105
105
|
if (subProvider && gatewayReverseMap && !spec) {
|
|
106
|
-
const result = lookupSubProviderSpec(
|
|
107
|
-
key,
|
|
108
|
-
gatewayReverseMap,
|
|
109
|
-
subProvider
|
|
110
|
-
);
|
|
106
|
+
const result = lookupSubProviderSpec(key, gatewayReverseMap, subProvider);
|
|
111
107
|
spec = result.spec;
|
|
112
108
|
}
|
|
113
109
|
if (!spec) continue;
|
|
@@ -177,4 +173,4 @@ function validate(connectionString, options = {}) {
|
|
|
177
173
|
export {
|
|
178
174
|
validate
|
|
179
175
|
};
|
|
180
|
-
//# sourceMappingURL=chunk-
|
|
176
|
+
//# sourceMappingURL=chunk-7HE4RH6X.js.map
|