aieo 0.2.1 → 0.2.3
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.d.ts +2 -2
- package/dist/index.js +36 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -92,8 +92,8 @@ declare function getGatewayBaseURL(provider: Provider): string | undefined;
|
|
|
92
92
|
declare function gatewayUrlFor(provider: Provider, baseUrl: string): string;
|
|
93
93
|
/**
|
|
94
94
|
* Like {@link gatewayUrlFor} but takes a model name (shortcut like
|
|
95
|
-
* `"sonnet"`, namespaced like `"anthropic/claude-sonnet-5"`, or a full
|
|
96
|
-
* model id like `"claude-sonnet-5"`) and resolves the provider for you.
|
|
95
|
+
* `"sonnet"`, namespaced like `"anthropic/claude-sonnet-5-5"`, or a full
|
|
96
|
+
* model id like `"claude-sonnet-5-5"`) and resolves the provider for you.
|
|
97
97
|
*
|
|
98
98
|
* Convenient for spawners that have a model name in hand but not a
|
|
99
99
|
* provider — e.g. Hive picking up a user's chosen model and needing to
|
package/dist/index.js
CHANGED
|
@@ -43745,8 +43745,8 @@ var PROVIDERS = [
|
|
|
43745
43745
|
];
|
|
43746
43746
|
var MODELS = {
|
|
43747
43747
|
anthropic: {
|
|
43748
|
-
sonnet: "claude-sonnet-5",
|
|
43749
|
-
opus: "claude-opus-5",
|
|
43748
|
+
sonnet: "claude-sonnet-5-5",
|
|
43749
|
+
opus: "claude-opus-5-5",
|
|
43750
43750
|
haiku: "claude-haiku-4-5"
|
|
43751
43751
|
},
|
|
43752
43752
|
google: {
|
|
@@ -43816,7 +43816,9 @@ function getProviderForModel(modelName) {
|
|
|
43816
43816
|
case "grok":
|
|
43817
43817
|
return "xai";
|
|
43818
43818
|
// Full model IDs
|
|
43819
|
+
case "claude-sonnet-5-5":
|
|
43819
43820
|
case "claude-sonnet-5":
|
|
43821
|
+
case "claude-opus-5-5":
|
|
43820
43822
|
case "claude-opus-5":
|
|
43821
43823
|
case "claude-opus-4-6":
|
|
43822
43824
|
case "claude-haiku-4-5":
|
|
@@ -44139,7 +44141,9 @@ function getModel(provider, opts) {
|
|
|
44139
44141
|
}
|
|
44140
44142
|
var MODEL_CONTEXT_LIMITS = {
|
|
44141
44143
|
// Anthropic — 1M is the default and the max on the 5-series; Haiku 4.5 is 200k.
|
|
44144
|
+
"claude-sonnet-5-5": 1e6,
|
|
44142
44145
|
"claude-sonnet-5": 1e6,
|
|
44146
|
+
"claude-opus-5-5": 1e6,
|
|
44143
44147
|
"claude-opus-5": 1e6,
|
|
44144
44148
|
"claude-opus-4-6": 1e6,
|
|
44145
44149
|
"claude-haiku-4-5": 2e5,
|
|
@@ -44157,7 +44161,9 @@ var MODEL_CONTEXT_LIMITS = {
|
|
|
44157
44161
|
// OpenRouter — values from the OpenRouter model catalog
|
|
44158
44162
|
// (https://openrouter.ai/api/v1/models, context_length).
|
|
44159
44163
|
"stealth/ox-alpha": 1048576,
|
|
44164
|
+
"anthropic/claude-opus-5.5": 1e6,
|
|
44160
44165
|
"anthropic/claude-opus-5": 1e6,
|
|
44166
|
+
"anthropic/claude-sonnet-5.5": 1e6,
|
|
44161
44167
|
"anthropic/claude-sonnet-5": 1e6,
|
|
44162
44168
|
"openai/gpt-5": 4e5,
|
|
44163
44169
|
"openai/gpt-5.5": 105e4,
|
|
@@ -44271,8 +44277,23 @@ function getModelPricing(modelId) {
|
|
|
44271
44277
|
function anthropicSupportsAdaptiveThinking(modelName) {
|
|
44272
44278
|
if (!modelName) return false;
|
|
44273
44279
|
const m = modelName.toLowerCase();
|
|
44274
|
-
if (m.includes("haiku")) return false;
|
|
44275
|
-
|
|
44280
|
+
if (m.includes("haiku") || /claude-3[-.]/.test(m)) return false;
|
|
44281
|
+
if (m.includes("fable") || m.includes("mythos")) return true;
|
|
44282
|
+
if (!(m.includes("sonnet") || m.includes("opus"))) return false;
|
|
44283
|
+
const v = /(?:sonnet|opus)-(\d+)(?:-(\d+))?(?!\d)/.exec(m);
|
|
44284
|
+
if (!v) return true;
|
|
44285
|
+
const major = Number(v[1]);
|
|
44286
|
+
const minor = v[2] == null ? 0 : Number(v[2]);
|
|
44287
|
+
return major >= 5 || major === 4 && minor >= 6;
|
|
44288
|
+
}
|
|
44289
|
+
function anthropicRejectsDisabledThinking(modelName) {
|
|
44290
|
+
if (!modelName) return false;
|
|
44291
|
+
const m = modelName.toLowerCase();
|
|
44292
|
+
return m.includes("opus-5-5") || m.includes("sonnet-5-5") || m.includes("fable");
|
|
44293
|
+
}
|
|
44294
|
+
function anthropicModelId(modelName) {
|
|
44295
|
+
if (!modelName) return DEFAULT_MODELS.anthropic;
|
|
44296
|
+
return MODELS.anthropic[modelName] ?? modelName;
|
|
44276
44297
|
}
|
|
44277
44298
|
function getProviderOptions(provider, thinkingSpeed, modelName) {
|
|
44278
44299
|
const fast = thinkingSpeed === "fast";
|
|
@@ -44280,7 +44301,16 @@ function getProviderOptions(provider, thinkingSpeed, modelName) {
|
|
|
44280
44301
|
const googleBudget = fast ? 0 : 24e3;
|
|
44281
44302
|
switch (provider) {
|
|
44282
44303
|
case "anthropic":
|
|
44304
|
+
modelName = anthropicModelId(modelName);
|
|
44283
44305
|
let thinking;
|
|
44306
|
+
if (fast && anthropicRejectsDisabledThinking(modelName)) {
|
|
44307
|
+
return {
|
|
44308
|
+
anthropic: {
|
|
44309
|
+
effort: "low",
|
|
44310
|
+
cacheControl: { type: "ephemeral" }
|
|
44311
|
+
}
|
|
44312
|
+
};
|
|
44313
|
+
}
|
|
44284
44314
|
if (fast) {
|
|
44285
44315
|
thinking = { type: "disabled" };
|
|
44286
44316
|
return {
|
|
@@ -44562,7 +44592,7 @@ async function callModel(opts) {
|
|
|
44562
44592
|
}
|
|
44563
44593
|
async function callGenerateObject(args) {
|
|
44564
44594
|
const model = await getModel(args.provider, args.apiKey);
|
|
44565
|
-
const providerOptions = getProviderOptions(args.provider, "fast");
|
|
44595
|
+
const providerOptions = getProviderOptions(args.provider, "fast", model?.modelId);
|
|
44566
44596
|
const { output: object, usage } = await generateText({
|
|
44567
44597
|
model,
|
|
44568
44598
|
output: Output.object({ schema: args.schema }),
|
|
@@ -44582,7 +44612,7 @@ async function callGenerateText(args) {
|
|
|
44582
44612
|
}
|
|
44583
44613
|
];
|
|
44584
44614
|
const model = await getModel(args.provider, args.apiKey);
|
|
44585
|
-
const providerOptions = getProviderOptions(args.provider, args.thinkingSpeed);
|
|
44615
|
+
const providerOptions = getProviderOptions(args.provider, args.thinkingSpeed, model?.modelId);
|
|
44586
44616
|
const { text, usage } = await generateText({
|
|
44587
44617
|
model,
|
|
44588
44618
|
messages,
|