aieo 0.2.2 → 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 +21 -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,7 +43745,7 @@ var PROVIDERS = [
|
|
|
43745
43745
|
];
|
|
43746
43746
|
var MODELS = {
|
|
43747
43747
|
anthropic: {
|
|
43748
|
-
sonnet: "claude-sonnet-5",
|
|
43748
|
+
sonnet: "claude-sonnet-5-5",
|
|
43749
43749
|
opus: "claude-opus-5-5",
|
|
43750
43750
|
haiku: "claude-haiku-4-5"
|
|
43751
43751
|
},
|
|
@@ -43816,6 +43816,7 @@ 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":
|
|
43820
43821
|
case "claude-opus-5-5":
|
|
43821
43822
|
case "claude-opus-5":
|
|
@@ -44140,6 +44141,7 @@ function getModel(provider, opts) {
|
|
|
44140
44141
|
}
|
|
44141
44142
|
var MODEL_CONTEXT_LIMITS = {
|
|
44142
44143
|
// Anthropic — 1M is the default and the max on the 5-series; Haiku 4.5 is 200k.
|
|
44144
|
+
"claude-sonnet-5-5": 1e6,
|
|
44143
44145
|
"claude-sonnet-5": 1e6,
|
|
44144
44146
|
"claude-opus-5-5": 1e6,
|
|
44145
44147
|
"claude-opus-5": 1e6,
|
|
@@ -44159,7 +44161,9 @@ var MODEL_CONTEXT_LIMITS = {
|
|
|
44159
44161
|
// OpenRouter — values from the OpenRouter model catalog
|
|
44160
44162
|
// (https://openrouter.ai/api/v1/models, context_length).
|
|
44161
44163
|
"stealth/ox-alpha": 1048576,
|
|
44164
|
+
"anthropic/claude-opus-5.5": 1e6,
|
|
44162
44165
|
"anthropic/claude-opus-5": 1e6,
|
|
44166
|
+
"anthropic/claude-sonnet-5.5": 1e6,
|
|
44163
44167
|
"anthropic/claude-sonnet-5": 1e6,
|
|
44164
44168
|
"openai/gpt-5": 4e5,
|
|
44165
44169
|
"openai/gpt-5.5": 105e4,
|
|
@@ -44273,13 +44277,23 @@ function getModelPricing(modelId) {
|
|
|
44273
44277
|
function anthropicSupportsAdaptiveThinking(modelName) {
|
|
44274
44278
|
if (!modelName) return false;
|
|
44275
44279
|
const m = modelName.toLowerCase();
|
|
44276
|
-
if (m.includes("haiku")) return false;
|
|
44277
|
-
|
|
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;
|
|
44278
44288
|
}
|
|
44279
44289
|
function anthropicRejectsDisabledThinking(modelName) {
|
|
44280
44290
|
if (!modelName) return false;
|
|
44281
44291
|
const m = modelName.toLowerCase();
|
|
44282
|
-
return m.includes("opus-5-5") || m.includes("fable");
|
|
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;
|
|
44283
44297
|
}
|
|
44284
44298
|
function getProviderOptions(provider, thinkingSpeed, modelName) {
|
|
44285
44299
|
const fast = thinkingSpeed === "fast";
|
|
@@ -44287,6 +44301,7 @@ function getProviderOptions(provider, thinkingSpeed, modelName) {
|
|
|
44287
44301
|
const googleBudget = fast ? 0 : 24e3;
|
|
44288
44302
|
switch (provider) {
|
|
44289
44303
|
case "anthropic":
|
|
44304
|
+
modelName = anthropicModelId(modelName);
|
|
44290
44305
|
let thinking;
|
|
44291
44306
|
if (fast && anthropicRejectsDisabledThinking(modelName)) {
|
|
44292
44307
|
return {
|
|
@@ -44577,7 +44592,7 @@ async function callModel(opts) {
|
|
|
44577
44592
|
}
|
|
44578
44593
|
async function callGenerateObject(args) {
|
|
44579
44594
|
const model = await getModel(args.provider, args.apiKey);
|
|
44580
|
-
const providerOptions = getProviderOptions(args.provider, "fast");
|
|
44595
|
+
const providerOptions = getProviderOptions(args.provider, "fast", model?.modelId);
|
|
44581
44596
|
const { output: object, usage } = await generateText({
|
|
44582
44597
|
model,
|
|
44583
44598
|
output: Output.object({ schema: args.schema }),
|
|
@@ -44597,7 +44612,7 @@ async function callGenerateText(args) {
|
|
|
44597
44612
|
}
|
|
44598
44613
|
];
|
|
44599
44614
|
const model = await getModel(args.provider, args.apiKey);
|
|
44600
|
-
const providerOptions = getProviderOptions(args.provider, args.thinkingSpeed);
|
|
44615
|
+
const providerOptions = getProviderOptions(args.provider, args.thinkingSpeed, model?.modelId);
|
|
44601
44616
|
const { text, usage } = await generateText({
|
|
44602
44617
|
model,
|
|
44603
44618
|
messages,
|