@ax-llm/ax 11.0.61 → 11.0.64
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/index.cjs +100 -26
- package/index.cjs.map +1 -1
- package/index.d.cts +27 -11
- package/index.d.ts +27 -11
- package/index.js +99 -26
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -64,6 +64,7 @@ __export(index_exports, {
|
|
|
64
64
|
AxAIOpenAIResponses: () => AxAIOpenAIResponses,
|
|
65
65
|
AxAIOpenAIResponsesBase: () => AxAIOpenAIResponsesBase,
|
|
66
66
|
AxAIOpenAIResponsesImpl: () => AxAIOpenAIResponsesImpl,
|
|
67
|
+
AxAIOpenAIResponsesModel: () => AxAIOpenAIResponsesModel,
|
|
67
68
|
AxAIReka: () => AxAIReka,
|
|
68
69
|
AxAIRekaModel: () => AxAIRekaModel,
|
|
69
70
|
AxAIServiceAbortedError: () => AxAIServiceAbortedError,
|
|
@@ -2173,10 +2174,7 @@ function getModelInfo({
|
|
|
2173
2174
|
// ai/openai/chat_types.ts
|
|
2174
2175
|
var AxAIOpenAIModel = /* @__PURE__ */ ((AxAIOpenAIModel2) => {
|
|
2175
2176
|
AxAIOpenAIModel2["O1"] = "o1";
|
|
2176
|
-
AxAIOpenAIModel2["O3"] = "o3";
|
|
2177
2177
|
AxAIOpenAIModel2["O1Mini"] = "o1-mini";
|
|
2178
|
-
AxAIOpenAIModel2["O3Mini"] = "o3-mini";
|
|
2179
|
-
AxAIOpenAIModel2["O4Mini"] = "o4-mini";
|
|
2180
2178
|
AxAIOpenAIModel2["GPT4"] = "gpt-4";
|
|
2181
2179
|
AxAIOpenAIModel2["GPT41"] = "gpt-4.1";
|
|
2182
2180
|
AxAIOpenAIModel2["GPT41Mini"] = "gpt-4.1-mini";
|
|
@@ -2198,6 +2196,28 @@ var AxAIOpenAIEmbedModel = /* @__PURE__ */ ((AxAIOpenAIEmbedModel2) => {
|
|
|
2198
2196
|
return AxAIOpenAIEmbedModel2;
|
|
2199
2197
|
})(AxAIOpenAIEmbedModel || {});
|
|
2200
2198
|
|
|
2199
|
+
// ai/openai/responses_types.ts
|
|
2200
|
+
var AxAIOpenAIResponsesModel = /* @__PURE__ */ ((AxAIOpenAIResponsesModel2) => {
|
|
2201
|
+
AxAIOpenAIResponsesModel2["O1"] = "o1";
|
|
2202
|
+
AxAIOpenAIResponsesModel2["O1Mini"] = "o1-mini";
|
|
2203
|
+
AxAIOpenAIResponsesModel2["GPT4"] = "gpt-4";
|
|
2204
|
+
AxAIOpenAIResponsesModel2["GPT41"] = "gpt-4.1";
|
|
2205
|
+
AxAIOpenAIResponsesModel2["GPT41Mini"] = "gpt-4.1-mini";
|
|
2206
|
+
AxAIOpenAIResponsesModel2["GPT4O"] = "gpt-4o";
|
|
2207
|
+
AxAIOpenAIResponsesModel2["GPT4OMini"] = "gpt-4o-mini";
|
|
2208
|
+
AxAIOpenAIResponsesModel2["GPT4ChatGPT4O"] = "chatgpt-4o-latest";
|
|
2209
|
+
AxAIOpenAIResponsesModel2["GPT4Turbo"] = "gpt-4-turbo";
|
|
2210
|
+
AxAIOpenAIResponsesModel2["GPT35Turbo"] = "gpt-3.5-turbo";
|
|
2211
|
+
AxAIOpenAIResponsesModel2["GPT35TurboInstruct"] = "gpt-3.5-turbo-instruct";
|
|
2212
|
+
AxAIOpenAIResponsesModel2["GPT35TextDavinci002"] = "text-davinci-002";
|
|
2213
|
+
AxAIOpenAIResponsesModel2["GPT3TextBabbage002"] = "text-babbage-002";
|
|
2214
|
+
AxAIOpenAIResponsesModel2["GPT3TextAda001"] = "text-ada-001";
|
|
2215
|
+
AxAIOpenAIResponsesModel2["O3"] = "o3";
|
|
2216
|
+
AxAIOpenAIResponsesModel2["O3Mini"] = "o3-mini";
|
|
2217
|
+
AxAIOpenAIResponsesModel2["O4Mini"] = "o4-mini";
|
|
2218
|
+
return AxAIOpenAIResponsesModel2;
|
|
2219
|
+
})(AxAIOpenAIResponsesModel || {});
|
|
2220
|
+
|
|
2201
2221
|
// ai/openai/info.ts
|
|
2202
2222
|
var axModelInfoOpenAI = [
|
|
2203
2223
|
{
|
|
@@ -2214,20 +2234,6 @@ var axModelInfoOpenAI = [
|
|
|
2214
2234
|
completionTokenCostPer1M: 14.4,
|
|
2215
2235
|
hasThinkingBudget: true
|
|
2216
2236
|
},
|
|
2217
|
-
{
|
|
2218
|
-
name: "o3-mini" /* O3Mini */,
|
|
2219
|
-
currency: "usd",
|
|
2220
|
-
promptTokenCostPer1M: 1.1,
|
|
2221
|
-
completionTokenCostPer1M: 4.4,
|
|
2222
|
-
hasThinkingBudget: true
|
|
2223
|
-
},
|
|
2224
|
-
{
|
|
2225
|
-
name: "o4-mini" /* O4Mini */,
|
|
2226
|
-
currency: "usd",
|
|
2227
|
-
promptTokenCostPer1M: 1.1,
|
|
2228
|
-
completionTokenCostPer1M: 4.4,
|
|
2229
|
-
hasThinkingBudget: true
|
|
2230
|
-
},
|
|
2231
2237
|
{
|
|
2232
2238
|
name: "gpt-4" /* GPT4 */,
|
|
2233
2239
|
currency: "usd",
|
|
@@ -2276,6 +2282,32 @@ var axModelInfoOpenAI = [
|
|
|
2276
2282
|
promptTokenCostPer1M: 0.5,
|
|
2277
2283
|
completionTokenCostPer1M: 1.5
|
|
2278
2284
|
},
|
|
2285
|
+
// Responses API only models
|
|
2286
|
+
{
|
|
2287
|
+
name: "o3" /* O3 */,
|
|
2288
|
+
currency: "usd",
|
|
2289
|
+
promptTokenCostPer1M: 15,
|
|
2290
|
+
completionTokenCostPer1M: 60,
|
|
2291
|
+
hasThinkingBudget: true,
|
|
2292
|
+
hasShowThoughts: true
|
|
2293
|
+
},
|
|
2294
|
+
{
|
|
2295
|
+
name: "o3-mini" /* O3Mini */,
|
|
2296
|
+
currency: "usd",
|
|
2297
|
+
promptTokenCostPer1M: 1.1,
|
|
2298
|
+
completionTokenCostPer1M: 4.4,
|
|
2299
|
+
hasThinkingBudget: true,
|
|
2300
|
+
hasShowThoughts: true
|
|
2301
|
+
},
|
|
2302
|
+
{
|
|
2303
|
+
name: "o4-mini" /* O4Mini */,
|
|
2304
|
+
currency: "usd",
|
|
2305
|
+
promptTokenCostPer1M: 1.1,
|
|
2306
|
+
completionTokenCostPer1M: 4.4,
|
|
2307
|
+
hasThinkingBudget: true,
|
|
2308
|
+
hasShowThoughts: true
|
|
2309
|
+
},
|
|
2310
|
+
// Embedding models
|
|
2279
2311
|
{
|
|
2280
2312
|
name: "text-embedding-ada-002" /* TextEmbeddingAda002 */,
|
|
2281
2313
|
currency: "usd",
|
|
@@ -3476,6 +3508,7 @@ var AxAIGoogleGeminiImpl = class {
|
|
|
3476
3508
|
switch (config.thinkingTokenBudget) {
|
|
3477
3509
|
case "none":
|
|
3478
3510
|
thinkingConfig.thinkingBudget = 0;
|
|
3511
|
+
thinkingConfig.includeThoughts = false;
|
|
3479
3512
|
break;
|
|
3480
3513
|
case "minimal":
|
|
3481
3514
|
thinkingConfig.thinkingBudget = 200;
|
|
@@ -3495,7 +3528,9 @@ var AxAIGoogleGeminiImpl = class {
|
|
|
3495
3528
|
}
|
|
3496
3529
|
}
|
|
3497
3530
|
if (config.showThoughts !== void 0) {
|
|
3498
|
-
|
|
3531
|
+
if (config.thinkingTokenBudget !== "none") {
|
|
3532
|
+
thinkingConfig.includeThoughts = config.showThoughts;
|
|
3533
|
+
}
|
|
3499
3534
|
}
|
|
3500
3535
|
const generationConfig = {
|
|
3501
3536
|
maxOutputTokens: req.modelConfig?.maxTokens ?? this.config.maxTokens,
|
|
@@ -4309,7 +4344,8 @@ var AxAIOpenAIResponsesImpl = class {
|
|
|
4309
4344
|
})
|
|
4310
4345
|
);
|
|
4311
4346
|
const includeFields = [];
|
|
4312
|
-
|
|
4347
|
+
const shouldShowThoughts = config?.thinkingTokenBudget === "none" ? false : config?.showThoughts;
|
|
4348
|
+
if (shouldShowThoughts) {
|
|
4313
4349
|
includeFields.push("reasoning.encrypted_content");
|
|
4314
4350
|
}
|
|
4315
4351
|
let mutableReq = {
|
|
@@ -4366,6 +4402,33 @@ var AxAIOpenAIResponsesImpl = class {
|
|
|
4366
4402
|
effort: this.config.reasoningEffort
|
|
4367
4403
|
};
|
|
4368
4404
|
}
|
|
4405
|
+
if (config?.thinkingTokenBudget) {
|
|
4406
|
+
switch (config.thinkingTokenBudget) {
|
|
4407
|
+
case "none":
|
|
4408
|
+
currentReasoning = {};
|
|
4409
|
+
break;
|
|
4410
|
+
case "minimal":
|
|
4411
|
+
currentReasoning = {
|
|
4412
|
+
...currentReasoning,
|
|
4413
|
+
effort: "low"
|
|
4414
|
+
};
|
|
4415
|
+
break;
|
|
4416
|
+
case "low":
|
|
4417
|
+
currentReasoning = {
|
|
4418
|
+
...currentReasoning,
|
|
4419
|
+
effort: "medium"
|
|
4420
|
+
};
|
|
4421
|
+
break;
|
|
4422
|
+
case "medium":
|
|
4423
|
+
case "high":
|
|
4424
|
+
case "highest":
|
|
4425
|
+
currentReasoning = {
|
|
4426
|
+
...currentReasoning,
|
|
4427
|
+
effort: "high"
|
|
4428
|
+
};
|
|
4429
|
+
break;
|
|
4430
|
+
}
|
|
4431
|
+
}
|
|
4369
4432
|
if (Object.keys(currentReasoning).length > 0 && currentReasoning.effort) {
|
|
4370
4433
|
mutableReq.reasoning = currentReasoning;
|
|
4371
4434
|
} else {
|
|
@@ -6443,7 +6506,17 @@ var renderOutputFields = (fields) => {
|
|
|
6443
6506
|
const name = field.title;
|
|
6444
6507
|
const type = field.type?.name ? toFieldType(field.type) : "string";
|
|
6445
6508
|
const requiredMsg = field.isOptional ? `Only include this ${type} field if its value is available` : `This ${type} field must be included`;
|
|
6446
|
-
|
|
6509
|
+
let description = "";
|
|
6510
|
+
if (field.description && field.description.length > 0) {
|
|
6511
|
+
const value = field.type?.name === "class" ? field.description : formatDescription(field.description);
|
|
6512
|
+
description = ` ${value}`;
|
|
6513
|
+
}
|
|
6514
|
+
if (field.type?.options && field.type.options.length > 0) {
|
|
6515
|
+
if (description.length > 0) {
|
|
6516
|
+
description += `. `;
|
|
6517
|
+
}
|
|
6518
|
+
description += `Allowed values: ${field.type.options.join(", ")}`;
|
|
6519
|
+
}
|
|
6447
6520
|
return `${name}: (${requiredMsg})${description}`.trim();
|
|
6448
6521
|
});
|
|
6449
6522
|
return rows.join("\n");
|
|
@@ -6483,7 +6556,7 @@ var toFieldType = (type) => {
|
|
|
6483
6556
|
case "json":
|
|
6484
6557
|
return "JSON object";
|
|
6485
6558
|
case "class":
|
|
6486
|
-
return
|
|
6559
|
+
return "classification class";
|
|
6487
6560
|
case "code":
|
|
6488
6561
|
return "code";
|
|
6489
6562
|
default:
|
|
@@ -6770,12 +6843,12 @@ var convertValueToType = (field, val, required = false) => {
|
|
|
6770
6843
|
return parseLLMFriendlyDateTime(field, val, required);
|
|
6771
6844
|
case "class":
|
|
6772
6845
|
const className = val;
|
|
6773
|
-
if (field.type.
|
|
6846
|
+
if (field.type.options && !field.type.options.includes(className)) {
|
|
6774
6847
|
if (field.isOptional) {
|
|
6775
6848
|
return;
|
|
6776
6849
|
}
|
|
6777
6850
|
throw new Error(
|
|
6778
|
-
`Invalid class '${val}', expected one of the following: ${field.type.
|
|
6851
|
+
`Invalid class '${val}', expected one of the following: ${field.type.options.join(", ")}`
|
|
6779
6852
|
);
|
|
6780
6853
|
}
|
|
6781
6854
|
return className;
|
|
@@ -7554,13 +7627,13 @@ ${pointer}`;
|
|
|
7554
7627
|
`Output field "${name}": Expected class names in quotes after "class" type. Example: class "MyClass1, MyClass2"`
|
|
7555
7628
|
);
|
|
7556
7629
|
}
|
|
7557
|
-
const
|
|
7558
|
-
if (
|
|
7630
|
+
const options = classNamesString.split(/[,\s]+/).map((s) => s.trim()).filter((s) => s.length > 0);
|
|
7631
|
+
if (options.length === 0) {
|
|
7559
7632
|
throw new Error(
|
|
7560
7633
|
`Output field "${name}": Empty class list provided. At least one class name is required`
|
|
7561
7634
|
);
|
|
7562
7635
|
}
|
|
7563
|
-
type = { name: "class", isArray,
|
|
7636
|
+
type = { name: "class", isArray, options };
|
|
7564
7637
|
} else {
|
|
7565
7638
|
try {
|
|
7566
7639
|
const typeName = this.parseTypeNotClass();
|
|
@@ -13766,6 +13839,7 @@ var AxRAG = class extends AxChainOfThought {
|
|
|
13766
13839
|
AxAIOpenAIResponses,
|
|
13767
13840
|
AxAIOpenAIResponsesBase,
|
|
13768
13841
|
AxAIOpenAIResponsesImpl,
|
|
13842
|
+
AxAIOpenAIResponsesModel,
|
|
13769
13843
|
AxAIReka,
|
|
13770
13844
|
AxAIRekaModel,
|
|
13771
13845
|
AxAIServiceAbortedError,
|