@cognipeer/agent-sdk 0.12.0 → 0.13.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/dist/index.cjs +1202 -133
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -504
- package/dist/index.d.ts +45 -504
- package/dist/index.mjs +1186 -134
- package/dist/index.mjs.map +1 -1
- package/dist/model-rules-Bg9nSqyN.d.cts +658 -0
- package/dist/model-rules-Bg9nSqyN.d.ts +658 -0
- package/dist/model-rules.cjs +763 -0
- package/dist/model-rules.cjs.map +1 -0
- package/dist/model-rules.d.cts +1 -0
- package/dist/model-rules.d.ts +1 -0
- package/dist/model-rules.json +622 -0
- package/dist/model-rules.mjs +756 -0
- package/dist/model-rules.mjs.map +1 -0
- package/package.json +8 -2
|
@@ -0,0 +1,763 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/models/model-rules.json
|
|
4
|
+
var model_rules_default = {
|
|
5
|
+
version: 1,
|
|
6
|
+
effortLadder: [
|
|
7
|
+
"none",
|
|
8
|
+
"minimal",
|
|
9
|
+
"low",
|
|
10
|
+
"medium",
|
|
11
|
+
"high",
|
|
12
|
+
"xhigh",
|
|
13
|
+
"max"
|
|
14
|
+
],
|
|
15
|
+
budgets: {
|
|
16
|
+
minimal: 1024,
|
|
17
|
+
low: 2048,
|
|
18
|
+
medium: 8192,
|
|
19
|
+
high: 16384,
|
|
20
|
+
xhigh: 24576,
|
|
21
|
+
max: 32768
|
|
22
|
+
},
|
|
23
|
+
geminiBudgets: {
|
|
24
|
+
minimal: 512,
|
|
25
|
+
low: 1024,
|
|
26
|
+
medium: 4096,
|
|
27
|
+
high: 12e3,
|
|
28
|
+
xhigh: 24576,
|
|
29
|
+
max: 24576
|
|
30
|
+
},
|
|
31
|
+
rules: [
|
|
32
|
+
{
|
|
33
|
+
id: "openai-chat-models",
|
|
34
|
+
family: "openai",
|
|
35
|
+
match: "^(?:chatgpt|gpt-[\\d.]+[a-z0-9.-]*?-chat)",
|
|
36
|
+
reasoning: {
|
|
37
|
+
style: "none",
|
|
38
|
+
efforts: [],
|
|
39
|
+
off: null
|
|
40
|
+
},
|
|
41
|
+
sampling: {
|
|
42
|
+
temperature: "any",
|
|
43
|
+
topP: true,
|
|
44
|
+
topK: true,
|
|
45
|
+
penalties: true,
|
|
46
|
+
logprobs: true
|
|
47
|
+
},
|
|
48
|
+
maxTokensParam: "max_completion_tokens",
|
|
49
|
+
chatTools: {
|
|
50
|
+
reasoning: "any"
|
|
51
|
+
},
|
|
52
|
+
source: "docs",
|
|
53
|
+
note: "Chat-tuned *-chat variants are not reasoning models: ordinary sampling, no reasoning field."
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: "openai-gpt-6-plus",
|
|
57
|
+
family: "openai",
|
|
58
|
+
match: "^gpt-?(?:[6-9]|(?!35(?!\\d))[1-9]\\d+)(?:[.-]|$)",
|
|
59
|
+
reasoning: {
|
|
60
|
+
style: "effort",
|
|
61
|
+
efforts: [
|
|
62
|
+
"none",
|
|
63
|
+
"low",
|
|
64
|
+
"medium",
|
|
65
|
+
"high",
|
|
66
|
+
"xhigh"
|
|
67
|
+
],
|
|
68
|
+
off: "none",
|
|
69
|
+
responsesEfforts: [
|
|
70
|
+
"none",
|
|
71
|
+
"low",
|
|
72
|
+
"medium",
|
|
73
|
+
"high",
|
|
74
|
+
"xhigh",
|
|
75
|
+
"max"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
sampling: {
|
|
79
|
+
temperature: "default-only",
|
|
80
|
+
topP: false,
|
|
81
|
+
topK: false,
|
|
82
|
+
penalties: false,
|
|
83
|
+
logprobs: false
|
|
84
|
+
},
|
|
85
|
+
maxTokensParam: "max_completion_tokens",
|
|
86
|
+
chatTools: {
|
|
87
|
+
reasoning: "force-none"
|
|
88
|
+
},
|
|
89
|
+
source: "verified-2026-10-14",
|
|
90
|
+
note: "gpt-N, N>=6. Chat Completions takes none/low/medium/high/xhigh (minimal and max are 400s); Responses also takes max. Function tools with an effort other than none are a 400 on Chat Completions and the default effort is not none, so none is sent explicitly. Rejects max_tokens, temperature != 1, top_p, penalties, logprobs."
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: "openai-gpt-5x",
|
|
94
|
+
family: "openai",
|
|
95
|
+
match: "^gpt-?5\\.[1-9]",
|
|
96
|
+
reasoning: {
|
|
97
|
+
style: "effort",
|
|
98
|
+
efforts: [
|
|
99
|
+
"none",
|
|
100
|
+
"low",
|
|
101
|
+
"medium",
|
|
102
|
+
"high",
|
|
103
|
+
"xhigh"
|
|
104
|
+
],
|
|
105
|
+
off: "none",
|
|
106
|
+
responsesEfforts: [
|
|
107
|
+
"none",
|
|
108
|
+
"low",
|
|
109
|
+
"medium",
|
|
110
|
+
"high",
|
|
111
|
+
"xhigh",
|
|
112
|
+
"max"
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
sampling: {
|
|
116
|
+
temperature: "default-only",
|
|
117
|
+
topP: false,
|
|
118
|
+
topK: false,
|
|
119
|
+
penalties: false,
|
|
120
|
+
logprobs: false
|
|
121
|
+
},
|
|
122
|
+
maxTokensParam: "max_completion_tokens",
|
|
123
|
+
chatTools: {
|
|
124
|
+
reasoning: "force-none"
|
|
125
|
+
},
|
|
126
|
+
source: "verified-2026-10-14",
|
|
127
|
+
note: "gpt-5.1 and newer 5.x. Same wire rules as gpt-6: no minimal/max on Chat Completions (Responses takes max), function tools need reasoning_effort none on Chat Completions."
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
id: "openai-gpt-5-base",
|
|
131
|
+
family: "openai",
|
|
132
|
+
match: "^gpt-?5(?![.\\d])",
|
|
133
|
+
reasoning: {
|
|
134
|
+
style: "effort",
|
|
135
|
+
efforts: [
|
|
136
|
+
"minimal",
|
|
137
|
+
"low",
|
|
138
|
+
"medium",
|
|
139
|
+
"high"
|
|
140
|
+
],
|
|
141
|
+
off: null
|
|
142
|
+
},
|
|
143
|
+
sampling: {
|
|
144
|
+
temperature: "default-only",
|
|
145
|
+
topP: false,
|
|
146
|
+
topK: false,
|
|
147
|
+
penalties: false,
|
|
148
|
+
logprobs: false
|
|
149
|
+
},
|
|
150
|
+
maxTokensParam: "max_completion_tokens",
|
|
151
|
+
chatTools: {
|
|
152
|
+
reasoning: "any"
|
|
153
|
+
},
|
|
154
|
+
source: "docs",
|
|
155
|
+
note: "gpt-5, -mini, -nano, -codex: minimal/low/medium/high, reasoning cannot be turned off (none maps to minimal)."
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
id: "openai-o-series",
|
|
159
|
+
family: "openai",
|
|
160
|
+
match: "^o[1-9]\\d?(?![a-z0-9])",
|
|
161
|
+
reasoning: {
|
|
162
|
+
style: "effort",
|
|
163
|
+
efforts: [
|
|
164
|
+
"low",
|
|
165
|
+
"medium",
|
|
166
|
+
"high"
|
|
167
|
+
],
|
|
168
|
+
off: null
|
|
169
|
+
},
|
|
170
|
+
sampling: {
|
|
171
|
+
temperature: "default-only",
|
|
172
|
+
topP: false,
|
|
173
|
+
topK: false,
|
|
174
|
+
penalties: false,
|
|
175
|
+
logprobs: false
|
|
176
|
+
},
|
|
177
|
+
maxTokensParam: "max_completion_tokens",
|
|
178
|
+
chatTools: {
|
|
179
|
+
reasoning: "any"
|
|
180
|
+
},
|
|
181
|
+
source: "docs",
|
|
182
|
+
note: "o1/o3/o4 family: low/medium/high, no sampling overrides."
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
id: "openai-gpt-oss",
|
|
186
|
+
family: "openai",
|
|
187
|
+
match: "^gpt-?oss",
|
|
188
|
+
reasoning: {
|
|
189
|
+
style: "effort",
|
|
190
|
+
efforts: [
|
|
191
|
+
"low",
|
|
192
|
+
"medium",
|
|
193
|
+
"high"
|
|
194
|
+
],
|
|
195
|
+
off: null
|
|
196
|
+
},
|
|
197
|
+
sampling: {
|
|
198
|
+
temperature: "any",
|
|
199
|
+
topP: true,
|
|
200
|
+
topK: true,
|
|
201
|
+
penalties: true,
|
|
202
|
+
logprobs: true
|
|
203
|
+
},
|
|
204
|
+
maxTokensParam: "max_tokens",
|
|
205
|
+
chatTools: {
|
|
206
|
+
reasoning: "any"
|
|
207
|
+
},
|
|
208
|
+
source: "docs",
|
|
209
|
+
note: "Open-weight gpt-oss: low/medium/high; sampling and max_tokens behave like an ordinary chat model."
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
id: "openai-legacy-gpt",
|
|
213
|
+
family: "openai",
|
|
214
|
+
match: "^(?:gpt-?(?:[0-4]|35)(?![0-9])|text-|davinci|babbage)",
|
|
215
|
+
reasoning: {
|
|
216
|
+
style: "none",
|
|
217
|
+
efforts: [],
|
|
218
|
+
off: null
|
|
219
|
+
},
|
|
220
|
+
sampling: {
|
|
221
|
+
temperature: "any",
|
|
222
|
+
topP: true,
|
|
223
|
+
topK: true,
|
|
224
|
+
penalties: true,
|
|
225
|
+
logprobs: true
|
|
226
|
+
},
|
|
227
|
+
maxTokensParam: "max_tokens",
|
|
228
|
+
chatTools: {
|
|
229
|
+
reasoning: "any"
|
|
230
|
+
},
|
|
231
|
+
source: "docs",
|
|
232
|
+
note: "gpt-4o, gpt-4.1, gpt-3.5 and older: no reasoning, ordinary sampling."
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
id: "openai-compatible-toggle",
|
|
236
|
+
family: "openai",
|
|
237
|
+
match: "^(?:deepseek-(?:r\\d|reasoner)|qwq|qwen-?3)",
|
|
238
|
+
reasoning: {
|
|
239
|
+
style: "toggle",
|
|
240
|
+
efforts: [
|
|
241
|
+
"none",
|
|
242
|
+
"minimal",
|
|
243
|
+
"low",
|
|
244
|
+
"medium",
|
|
245
|
+
"high",
|
|
246
|
+
"xhigh",
|
|
247
|
+
"max"
|
|
248
|
+
],
|
|
249
|
+
off: "none"
|
|
250
|
+
},
|
|
251
|
+
sampling: {
|
|
252
|
+
temperature: "any",
|
|
253
|
+
topP: true,
|
|
254
|
+
topK: true,
|
|
255
|
+
penalties: true,
|
|
256
|
+
logprobs: true
|
|
257
|
+
},
|
|
258
|
+
maxTokensParam: "max_tokens",
|
|
259
|
+
chatTools: {
|
|
260
|
+
reasoning: "any"
|
|
261
|
+
},
|
|
262
|
+
source: "docs",
|
|
263
|
+
note: "DeepSeek R/reasoner, QwQ, Qwen3: on/off style hosts. The effort is forwarded as-is (including none, which switches thinking off on thinking-by-default models)."
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
id: "openai-default",
|
|
267
|
+
family: "openai",
|
|
268
|
+
match: ".*",
|
|
269
|
+
reasoning: {
|
|
270
|
+
style: "effort",
|
|
271
|
+
efforts: [
|
|
272
|
+
"none",
|
|
273
|
+
"minimal",
|
|
274
|
+
"low",
|
|
275
|
+
"medium",
|
|
276
|
+
"high",
|
|
277
|
+
"xhigh",
|
|
278
|
+
"max"
|
|
279
|
+
],
|
|
280
|
+
off: "none"
|
|
281
|
+
},
|
|
282
|
+
sampling: {
|
|
283
|
+
temperature: "any",
|
|
284
|
+
topP: true,
|
|
285
|
+
topK: true,
|
|
286
|
+
penalties: true,
|
|
287
|
+
logprobs: true
|
|
288
|
+
},
|
|
289
|
+
maxTokensParam: "max_tokens",
|
|
290
|
+
chatTools: {
|
|
291
|
+
reasoning: "any"
|
|
292
|
+
},
|
|
293
|
+
source: "docs",
|
|
294
|
+
note: "Permissive default for unknown OpenAI-wire models: pass what the caller asked; the provider learns from 400s."
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
id: "claude-haiku-5",
|
|
298
|
+
family: "anthropic",
|
|
299
|
+
match: "^claude-(?:haiku-5|5(?:-\\d+)?-haiku)(?!\\d)",
|
|
300
|
+
reasoning: {
|
|
301
|
+
style: "adaptive",
|
|
302
|
+
efforts: [
|
|
303
|
+
"low",
|
|
304
|
+
"medium",
|
|
305
|
+
"high",
|
|
306
|
+
"xhigh",
|
|
307
|
+
"max"
|
|
308
|
+
],
|
|
309
|
+
off: "disabled"
|
|
310
|
+
},
|
|
311
|
+
sampling: {
|
|
312
|
+
temperature: "unsupported",
|
|
313
|
+
topP: false,
|
|
314
|
+
topK: false,
|
|
315
|
+
penalties: false,
|
|
316
|
+
logprobs: false
|
|
317
|
+
},
|
|
318
|
+
maxTokensParam: "max_tokens",
|
|
319
|
+
chatTools: {
|
|
320
|
+
reasoning: "any"
|
|
321
|
+
},
|
|
322
|
+
source: "verified-2026-10-14",
|
|
323
|
+
note: "Claude Haiku 5.x: thinking:{type:adaptive} + output_config.effort; thinking:{type:enabled,budget_tokens} is rejected. Off = thinking:{type:disabled}. Sampling params are rejected."
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
id: "claude-sonnet-5",
|
|
327
|
+
family: "anthropic",
|
|
328
|
+
match: "^claude-(?:sonnet-5|5(?:-\\d+)?-sonnet)(?!\\d)",
|
|
329
|
+
reasoning: {
|
|
330
|
+
style: "adaptive",
|
|
331
|
+
efforts: [
|
|
332
|
+
"low",
|
|
333
|
+
"medium",
|
|
334
|
+
"high",
|
|
335
|
+
"xhigh",
|
|
336
|
+
"max"
|
|
337
|
+
],
|
|
338
|
+
off: "between_tools"
|
|
339
|
+
},
|
|
340
|
+
sampling: {
|
|
341
|
+
temperature: "unsupported",
|
|
342
|
+
topP: false,
|
|
343
|
+
topK: false,
|
|
344
|
+
penalties: false,
|
|
345
|
+
logprobs: false
|
|
346
|
+
},
|
|
347
|
+
maxTokensParam: "max_tokens",
|
|
348
|
+
chatTools: {
|
|
349
|
+
reasoning: "any"
|
|
350
|
+
},
|
|
351
|
+
source: "verified-2026-10-14",
|
|
352
|
+
note: "Claude Sonnet 5.x: adaptive + output_config.effort. thinking:{type:disabled} is rejected; off = thinking:{type:between_tools}. Sampling params are rejected."
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
id: "claude-opus-5",
|
|
356
|
+
family: "anthropic",
|
|
357
|
+
match: "^claude-(?:opus-5|5(?:-\\d+)?-opus)(?!\\d)",
|
|
358
|
+
reasoning: {
|
|
359
|
+
style: "adaptive",
|
|
360
|
+
efforts: [
|
|
361
|
+
"low",
|
|
362
|
+
"medium",
|
|
363
|
+
"high",
|
|
364
|
+
"xhigh",
|
|
365
|
+
"max"
|
|
366
|
+
],
|
|
367
|
+
off: null
|
|
368
|
+
},
|
|
369
|
+
sampling: {
|
|
370
|
+
temperature: "unsupported",
|
|
371
|
+
topP: false,
|
|
372
|
+
topK: false,
|
|
373
|
+
penalties: false,
|
|
374
|
+
logprobs: false
|
|
375
|
+
},
|
|
376
|
+
maxTokensParam: "max_tokens",
|
|
377
|
+
chatTools: {
|
|
378
|
+
reasoning: "any"
|
|
379
|
+
},
|
|
380
|
+
source: "verified-2026-10-14",
|
|
381
|
+
note: "Claude Opus 5.x: adaptive + output_config.effort; thinking cannot be turned off (none maps to the lowest effort). Sampling params are rejected."
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
id: "claude-fable",
|
|
385
|
+
family: "anthropic",
|
|
386
|
+
match: "^claude-fable",
|
|
387
|
+
reasoning: {
|
|
388
|
+
style: "adaptive",
|
|
389
|
+
efforts: [
|
|
390
|
+
"low",
|
|
391
|
+
"medium",
|
|
392
|
+
"high",
|
|
393
|
+
"xhigh",
|
|
394
|
+
"max"
|
|
395
|
+
],
|
|
396
|
+
off: null
|
|
397
|
+
},
|
|
398
|
+
sampling: {
|
|
399
|
+
temperature: "unsupported",
|
|
400
|
+
topP: false,
|
|
401
|
+
topK: false,
|
|
402
|
+
penalties: false,
|
|
403
|
+
logprobs: false
|
|
404
|
+
},
|
|
405
|
+
maxTokensParam: "max_tokens",
|
|
406
|
+
chatTools: {
|
|
407
|
+
reasoning: "any"
|
|
408
|
+
},
|
|
409
|
+
source: "docs",
|
|
410
|
+
note: "Claude Fable line: treated like the 5.x adaptive models."
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
id: "claude-4-7",
|
|
414
|
+
family: "anthropic",
|
|
415
|
+
match: "^claude-(?:(?:opus|sonnet|haiku)-4[-.]7|4[-.]7-(?:opus|sonnet|haiku))(?!\\d)",
|
|
416
|
+
reasoning: {
|
|
417
|
+
style: "adaptive",
|
|
418
|
+
efforts: [
|
|
419
|
+
"low",
|
|
420
|
+
"medium",
|
|
421
|
+
"high",
|
|
422
|
+
"xhigh",
|
|
423
|
+
"max"
|
|
424
|
+
],
|
|
425
|
+
off: "disabled"
|
|
426
|
+
},
|
|
427
|
+
sampling: {
|
|
428
|
+
temperature: "thinking-requires-1",
|
|
429
|
+
topP: true,
|
|
430
|
+
topK: true,
|
|
431
|
+
penalties: true,
|
|
432
|
+
logprobs: true
|
|
433
|
+
},
|
|
434
|
+
maxTokensParam: "max_tokens",
|
|
435
|
+
chatTools: {
|
|
436
|
+
reasoning: "any"
|
|
437
|
+
},
|
|
438
|
+
source: "docs",
|
|
439
|
+
note: "Claude 4.7: adaptive thinking, low/medium/high/xhigh/max."
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
id: "claude-4-6",
|
|
443
|
+
family: "anthropic",
|
|
444
|
+
match: "^claude-(?:(?:opus|sonnet|haiku)-4[-.]6|4[-.]6-(?:opus|sonnet|haiku))(?!\\d)",
|
|
445
|
+
reasoning: {
|
|
446
|
+
style: "adaptive",
|
|
447
|
+
efforts: [
|
|
448
|
+
"low",
|
|
449
|
+
"medium",
|
|
450
|
+
"high",
|
|
451
|
+
"max"
|
|
452
|
+
],
|
|
453
|
+
off: "disabled"
|
|
454
|
+
},
|
|
455
|
+
sampling: {
|
|
456
|
+
temperature: "thinking-requires-1",
|
|
457
|
+
topP: true,
|
|
458
|
+
topK: true,
|
|
459
|
+
penalties: true,
|
|
460
|
+
logprobs: true
|
|
461
|
+
},
|
|
462
|
+
maxTokensParam: "max_tokens",
|
|
463
|
+
chatTools: {
|
|
464
|
+
reasoning: "any"
|
|
465
|
+
},
|
|
466
|
+
source: "docs",
|
|
467
|
+
note: "Claude 4.6: adaptive thinking, low/medium/high/max (no xhigh)."
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
id: "claude-legacy-budget",
|
|
471
|
+
family: "anthropic",
|
|
472
|
+
match: "^claude-(?:3|4-|(?:opus|sonnet|haiku)-4)",
|
|
473
|
+
reasoning: {
|
|
474
|
+
style: "budget",
|
|
475
|
+
efforts: [
|
|
476
|
+
"none",
|
|
477
|
+
"minimal",
|
|
478
|
+
"low",
|
|
479
|
+
"medium",
|
|
480
|
+
"high",
|
|
481
|
+
"xhigh",
|
|
482
|
+
"max"
|
|
483
|
+
],
|
|
484
|
+
off: null
|
|
485
|
+
},
|
|
486
|
+
sampling: {
|
|
487
|
+
temperature: "thinking-requires-1",
|
|
488
|
+
topP: true,
|
|
489
|
+
topK: true,
|
|
490
|
+
penalties: true,
|
|
491
|
+
logprobs: true
|
|
492
|
+
},
|
|
493
|
+
maxTokensParam: "max_tokens",
|
|
494
|
+
chatTools: {
|
|
495
|
+
reasoning: "any"
|
|
496
|
+
},
|
|
497
|
+
source: "docs",
|
|
498
|
+
note: "Claude 3.7 and 4.0-4.5: thinking:{type:enabled,budget_tokens}; every effort maps to a budget; sampling overrides are not allowed while thinking."
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
id: "anthropic-default",
|
|
502
|
+
family: "anthropic",
|
|
503
|
+
match: ".*",
|
|
504
|
+
reasoning: {
|
|
505
|
+
style: "budget",
|
|
506
|
+
efforts: [
|
|
507
|
+
"none",
|
|
508
|
+
"minimal",
|
|
509
|
+
"low",
|
|
510
|
+
"medium",
|
|
511
|
+
"high",
|
|
512
|
+
"xhigh",
|
|
513
|
+
"max"
|
|
514
|
+
],
|
|
515
|
+
off: null
|
|
516
|
+
},
|
|
517
|
+
sampling: {
|
|
518
|
+
temperature: "thinking-requires-1",
|
|
519
|
+
topP: true,
|
|
520
|
+
topK: true,
|
|
521
|
+
penalties: true,
|
|
522
|
+
logprobs: true
|
|
523
|
+
},
|
|
524
|
+
maxTokensParam: "max_tokens",
|
|
525
|
+
chatTools: {
|
|
526
|
+
reasoning: "any"
|
|
527
|
+
},
|
|
528
|
+
source: "docs",
|
|
529
|
+
note: "Permissive default for unknown Anthropic-wire models: budget style (the long-standing form); the provider flips the thinking form when the API says so."
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
id: "gemini-budget",
|
|
533
|
+
family: "gemini",
|
|
534
|
+
match: "^gemini",
|
|
535
|
+
reasoning: {
|
|
536
|
+
style: "budget",
|
|
537
|
+
efforts: [
|
|
538
|
+
"none",
|
|
539
|
+
"minimal",
|
|
540
|
+
"low",
|
|
541
|
+
"medium",
|
|
542
|
+
"high",
|
|
543
|
+
"xhigh",
|
|
544
|
+
"max"
|
|
545
|
+
],
|
|
546
|
+
off: "none"
|
|
547
|
+
},
|
|
548
|
+
sampling: {
|
|
549
|
+
temperature: "any",
|
|
550
|
+
topP: true,
|
|
551
|
+
topK: true,
|
|
552
|
+
penalties: true,
|
|
553
|
+
logprobs: true
|
|
554
|
+
},
|
|
555
|
+
maxTokensParam: "max_tokens",
|
|
556
|
+
chatTools: {
|
|
557
|
+
reasoning: "any"
|
|
558
|
+
},
|
|
559
|
+
source: "docs",
|
|
560
|
+
note: "Gemini 2.5-style thinkingBudget; effort maps to a token budget, none = budget 0."
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
id: "gemini-default",
|
|
564
|
+
family: "gemini",
|
|
565
|
+
match: ".*",
|
|
566
|
+
reasoning: {
|
|
567
|
+
style: "budget",
|
|
568
|
+
efforts: [
|
|
569
|
+
"none",
|
|
570
|
+
"minimal",
|
|
571
|
+
"low",
|
|
572
|
+
"medium",
|
|
573
|
+
"high",
|
|
574
|
+
"xhigh",
|
|
575
|
+
"max"
|
|
576
|
+
],
|
|
577
|
+
off: "none"
|
|
578
|
+
},
|
|
579
|
+
sampling: {
|
|
580
|
+
temperature: "any",
|
|
581
|
+
topP: true,
|
|
582
|
+
topK: true,
|
|
583
|
+
penalties: true,
|
|
584
|
+
logprobs: true
|
|
585
|
+
},
|
|
586
|
+
maxTokensParam: "max_tokens",
|
|
587
|
+
chatTools: {
|
|
588
|
+
reasoning: "any"
|
|
589
|
+
},
|
|
590
|
+
source: "docs",
|
|
591
|
+
note: "Permissive default for unknown Gemini-wire models."
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
id: "other-default",
|
|
595
|
+
family: "other",
|
|
596
|
+
match: ".*",
|
|
597
|
+
reasoning: {
|
|
598
|
+
style: "effort",
|
|
599
|
+
efforts: [
|
|
600
|
+
"none",
|
|
601
|
+
"minimal",
|
|
602
|
+
"low",
|
|
603
|
+
"medium",
|
|
604
|
+
"high",
|
|
605
|
+
"xhigh",
|
|
606
|
+
"max"
|
|
607
|
+
],
|
|
608
|
+
off: "none"
|
|
609
|
+
},
|
|
610
|
+
sampling: {
|
|
611
|
+
temperature: "any",
|
|
612
|
+
topP: true,
|
|
613
|
+
topK: true,
|
|
614
|
+
penalties: true,
|
|
615
|
+
logprobs: true
|
|
616
|
+
},
|
|
617
|
+
maxTokensParam: "max_tokens",
|
|
618
|
+
chatTools: {
|
|
619
|
+
reasoning: "any"
|
|
620
|
+
},
|
|
621
|
+
source: "docs",
|
|
622
|
+
note: "Permissive default for model families the SDK has no rules for."
|
|
623
|
+
}
|
|
624
|
+
]
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
// src/models/rules.ts
|
|
628
|
+
var MODEL_RULES = model_rules_default;
|
|
629
|
+
var LADDER = MODEL_RULES.effortLadder;
|
|
630
|
+
var compiled = /* @__PURE__ */ new Map();
|
|
631
|
+
function regexFor(rule) {
|
|
632
|
+
let re = compiled.get(rule.id);
|
|
633
|
+
if (!re) {
|
|
634
|
+
re = new RegExp(rule.match, "i");
|
|
635
|
+
compiled.set(rule.id, re);
|
|
636
|
+
}
|
|
637
|
+
return re;
|
|
638
|
+
}
|
|
639
|
+
var GATEWAY_PREFIX = /^(?:(?:global|us|eu|apac|jp|au|ca|us-gov)\.)?(?:(?:openai|anthropic|google|meta|amazon|deepseek|qwen|mistral|cohere|ai21)\.)?/;
|
|
640
|
+
function modelIdCandidates(model) {
|
|
641
|
+
if (!model) return [];
|
|
642
|
+
const lower = String(model).trim().toLowerCase();
|
|
643
|
+
const last = lower.split("/").pop() ?? lower;
|
|
644
|
+
const out = [];
|
|
645
|
+
for (const id of [lower, last]) {
|
|
646
|
+
for (const c of [id, id.replace(GATEWAY_PREFIX, "")]) {
|
|
647
|
+
if (c && !out.includes(c)) out.push(c);
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
return out;
|
|
651
|
+
}
|
|
652
|
+
var OPENAI_WIRE = /* @__PURE__ */ new Set(["openai", "azure", "openai-compatible", "together", "openrouter", "groq", "fireworks", "ollama", "vllm", "litellm", "mistral", "deepseek", "xai", "jev"]);
|
|
653
|
+
function familiesFor(provider) {
|
|
654
|
+
const p = (provider ?? "").toLowerCase();
|
|
655
|
+
if (OPENAI_WIRE.has(p)) return ["openai"];
|
|
656
|
+
if (p === "anthropic") return ["anthropic"];
|
|
657
|
+
if (p === "bedrock") return ["anthropic", "openai", "other"];
|
|
658
|
+
if (p === "vertex" || p === "gemini" || p === "google") return ["gemini", "anthropic"];
|
|
659
|
+
return ["openai", "anthropic", "gemini", "other"];
|
|
660
|
+
}
|
|
661
|
+
function matchRule(family, ids, allowDefault) {
|
|
662
|
+
for (const rule of MODEL_RULES.rules) {
|
|
663
|
+
if (rule.family !== family) continue;
|
|
664
|
+
if (rule.match === ".*") {
|
|
665
|
+
if (allowDefault) return rule;
|
|
666
|
+
continue;
|
|
667
|
+
}
|
|
668
|
+
const re = regexFor(rule);
|
|
669
|
+
if (ids.some((id) => re.test(id))) return rule;
|
|
670
|
+
}
|
|
671
|
+
return void 0;
|
|
672
|
+
}
|
|
673
|
+
function mergeRulePatch(base, patch) {
|
|
674
|
+
if (!patch) return base;
|
|
675
|
+
const out = { ...base };
|
|
676
|
+
if (patch.reasoning) out.reasoning = { ...base.reasoning ?? {}, ...patch.reasoning };
|
|
677
|
+
if (patch.sampling) out.sampling = { ...base.sampling ?? {}, ...patch.sampling };
|
|
678
|
+
if (patch.chatTools) out.chatTools = { ...base.chatTools ?? {}, ...patch.chatTools };
|
|
679
|
+
if (patch.maxTokensParam) out.maxTokensParam = patch.maxTokensParam;
|
|
680
|
+
if (patch.dropParams) out.dropParams = [.../* @__PURE__ */ new Set([...base.dropParams ?? [], ...patch.dropParams])];
|
|
681
|
+
return out;
|
|
682
|
+
}
|
|
683
|
+
var learned = /* @__PURE__ */ new Map();
|
|
684
|
+
function learnedKey(provider, model, scope) {
|
|
685
|
+
return `${(provider ?? "").toLowerCase()}@${scope ?? ""}::${(model ?? "").trim().toLowerCase()}`;
|
|
686
|
+
}
|
|
687
|
+
function resolveModelRule(opts) {
|
|
688
|
+
const families = familiesFor(opts.provider);
|
|
689
|
+
const ids = modelIdCandidates(opts.model);
|
|
690
|
+
let rule;
|
|
691
|
+
for (const family of families) {
|
|
692
|
+
rule = matchRule(family, ids, false);
|
|
693
|
+
if (rule) break;
|
|
694
|
+
}
|
|
695
|
+
let isDefault = false;
|
|
696
|
+
if (!rule) {
|
|
697
|
+
isDefault = true;
|
|
698
|
+
rule = matchRule(families[0], ids, true) ?? MODEL_RULES.rules[MODEL_RULES.rules.length - 1];
|
|
699
|
+
}
|
|
700
|
+
let effective = rule;
|
|
701
|
+
const known = opts.model ? learned.get(learnedKey(opts.provider, opts.model, opts.scope))?.patch : void 0;
|
|
702
|
+
if (known) effective = mergeRulePatch(effective, known);
|
|
703
|
+
if (opts.patch) effective = mergeRulePatch(effective, opts.patch);
|
|
704
|
+
return { ...effective, matchedRuleId: rule.id, isDefault, learned: !!known };
|
|
705
|
+
}
|
|
706
|
+
function mapReasoningEffort(rule, effort, endpoint = "chat") {
|
|
707
|
+
const efforts = endpoint === "responses" && rule.reasoning.responsesEfforts || rule.reasoning.efforts;
|
|
708
|
+
if (rule.reasoning.style === "none" || efforts.length === 0) return { mapped: true };
|
|
709
|
+
const supported = LADDER.filter((e) => efforts.includes(e));
|
|
710
|
+
if (supported.includes(effort)) return { effort, mapped: false };
|
|
711
|
+
if (effort === "none") {
|
|
712
|
+
const off = rule.reasoning.off;
|
|
713
|
+
if (off && off !== "none") return { off, mapped: true };
|
|
714
|
+
const lowest = supported.find((e) => e !== "none");
|
|
715
|
+
return lowest ? { effort: lowest, mapped: true } : { mapped: true };
|
|
716
|
+
}
|
|
717
|
+
const at = LADDER.indexOf(effort);
|
|
718
|
+
if (at < 0) return { mapped: true };
|
|
719
|
+
for (let i = at - 1; i >= 1; i--) if (supported.includes(LADDER[i])) return { effort: LADDER[i], mapped: true };
|
|
720
|
+
for (let i = at + 1; i < LADDER.length; i++) if (supported.includes(LADDER[i])) return { effort: LADDER[i], mapped: true };
|
|
721
|
+
return supported.includes("none") ? { effort: "none", mapped: true } : { mapped: true };
|
|
722
|
+
}
|
|
723
|
+
function allowsSampling(rule, field, value, thinkingOn = false) {
|
|
724
|
+
const s = rule.sampling;
|
|
725
|
+
switch (field) {
|
|
726
|
+
case "temperature":
|
|
727
|
+
switch (s.temperature) {
|
|
728
|
+
case "any":
|
|
729
|
+
return true;
|
|
730
|
+
case "unsupported":
|
|
731
|
+
return false;
|
|
732
|
+
// The default is what the server applies anyway, so it is never sent.
|
|
733
|
+
case "default-only":
|
|
734
|
+
return false;
|
|
735
|
+
case "thinking-requires-1":
|
|
736
|
+
return !thinkingOn || value === 1;
|
|
737
|
+
}
|
|
738
|
+
return true;
|
|
739
|
+
// Anthropic's thinking restriction covers top_p / top_k as well as temperature.
|
|
740
|
+
case "topP":
|
|
741
|
+
return s.topP && !(thinkingOn && s.temperature === "thinking-requires-1");
|
|
742
|
+
case "topK":
|
|
743
|
+
return s.topK && !(thinkingOn && s.temperature === "thinking-requires-1");
|
|
744
|
+
case "presencePenalty":
|
|
745
|
+
case "frequencyPenalty":
|
|
746
|
+
return s.penalties;
|
|
747
|
+
case "logprobs":
|
|
748
|
+
return s.logprobs;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
function effortBudget(effort, table = "anthropic") {
|
|
752
|
+
if (effort === "none") return 0;
|
|
753
|
+
return (table === "gemini" ? MODEL_RULES.geminiBudgets : MODEL_RULES.budgets)[effort] ?? 0;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
exports.MODEL_RULES = MODEL_RULES;
|
|
757
|
+
exports.allowsSampling = allowsSampling;
|
|
758
|
+
exports.effortBudget = effortBudget;
|
|
759
|
+
exports.mapReasoningEffort = mapReasoningEffort;
|
|
760
|
+
exports.modelIdCandidates = modelIdCandidates;
|
|
761
|
+
exports.resolveModelRule = resolveModelRule;
|
|
762
|
+
//# sourceMappingURL=model-rules.cjs.map
|
|
763
|
+
//# sourceMappingURL=model-rules.cjs.map
|