@ax-llm/ax 11.0.60 → 11.0.63

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 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
- thinkingConfig.includeThoughts = config.showThoughts;
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
- if (config.showThoughts) {
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 {
@@ -6483,7 +6546,7 @@ var toFieldType = (type) => {
6483
6546
  case "json":
6484
6547
  return "JSON object";
6485
6548
  case "class":
6486
- return `classification class (allowed classes: ${type.classes?.join(", ")})`;
6549
+ return `list of classes (match case): ${type.classes?.join(", ")})`;
6487
6550
  case "code":
6488
6551
  return "code";
6489
6552
  default:
@@ -8704,9 +8767,21 @@ function processChildAgentFunction(childFunction, parentValues, parentInputKeys,
8704
8767
  );
8705
8768
  const originalFunc = processedFunction.func;
8706
8769
  processedFunction.func = async (childArgs, funcOptions) => {
8770
+ let valuesToInject = {};
8771
+ if (Array.isArray(parentValues)) {
8772
+ const lastUserMessage = parentValues.filter((msg) => msg.role === "user").pop();
8773
+ if (lastUserMessage) {
8774
+ valuesToInject = pick(
8775
+ lastUserMessage.values,
8776
+ injectionKeys
8777
+ );
8778
+ }
8779
+ } else {
8780
+ valuesToInject = pick(parentValues, injectionKeys);
8781
+ }
8707
8782
  const updatedChildArgs = {
8708
8783
  ...childArgs,
8709
- ...pick(parentValues, injectionKeys)
8784
+ ...valuesToInject
8710
8785
  };
8711
8786
  if (options.debug && injectionKeys.length > 0) {
8712
8787
  const ai = funcOptions?.ai;
@@ -13695,7 +13770,17 @@ var AxRAG = class extends AxChainOfThought {
13695
13770
  this.queryFn = queryFn;
13696
13771
  this.register(this.genQuery);
13697
13772
  }
13698
- async forward(ai, { question }, options) {
13773
+ async forward(ai, values, options) {
13774
+ let question;
13775
+ if (Array.isArray(values)) {
13776
+ const lastUserMessage = values.filter((msg) => msg.role === "user").pop();
13777
+ if (!lastUserMessage) {
13778
+ throw new Error("No user message found in values array");
13779
+ }
13780
+ question = lastUserMessage.values.question;
13781
+ } else {
13782
+ question = values.question;
13783
+ }
13699
13784
  let hop = 0;
13700
13785
  let context3 = [];
13701
13786
  while (hop < this.maxHops) {
@@ -13744,6 +13829,7 @@ var AxRAG = class extends AxChainOfThought {
13744
13829
  AxAIOpenAIResponses,
13745
13830
  AxAIOpenAIResponsesBase,
13746
13831
  AxAIOpenAIResponsesImpl,
13832
+ AxAIOpenAIResponsesModel,
13747
13833
  AxAIReka,
13748
13834
  AxAIRekaModel,
13749
13835
  AxAIServiceAbortedError,