@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.js CHANGED
@@ -2006,10 +2006,7 @@ function getModelInfo({
2006
2006
  // ai/openai/chat_types.ts
2007
2007
  var AxAIOpenAIModel = /* @__PURE__ */ ((AxAIOpenAIModel2) => {
2008
2008
  AxAIOpenAIModel2["O1"] = "o1";
2009
- AxAIOpenAIModel2["O3"] = "o3";
2010
2009
  AxAIOpenAIModel2["O1Mini"] = "o1-mini";
2011
- AxAIOpenAIModel2["O3Mini"] = "o3-mini";
2012
- AxAIOpenAIModel2["O4Mini"] = "o4-mini";
2013
2010
  AxAIOpenAIModel2["GPT4"] = "gpt-4";
2014
2011
  AxAIOpenAIModel2["GPT41"] = "gpt-4.1";
2015
2012
  AxAIOpenAIModel2["GPT41Mini"] = "gpt-4.1-mini";
@@ -2031,6 +2028,28 @@ var AxAIOpenAIEmbedModel = /* @__PURE__ */ ((AxAIOpenAIEmbedModel2) => {
2031
2028
  return AxAIOpenAIEmbedModel2;
2032
2029
  })(AxAIOpenAIEmbedModel || {});
2033
2030
 
2031
+ // ai/openai/responses_types.ts
2032
+ var AxAIOpenAIResponsesModel = /* @__PURE__ */ ((AxAIOpenAIResponsesModel2) => {
2033
+ AxAIOpenAIResponsesModel2["O1"] = "o1";
2034
+ AxAIOpenAIResponsesModel2["O1Mini"] = "o1-mini";
2035
+ AxAIOpenAIResponsesModel2["GPT4"] = "gpt-4";
2036
+ AxAIOpenAIResponsesModel2["GPT41"] = "gpt-4.1";
2037
+ AxAIOpenAIResponsesModel2["GPT41Mini"] = "gpt-4.1-mini";
2038
+ AxAIOpenAIResponsesModel2["GPT4O"] = "gpt-4o";
2039
+ AxAIOpenAIResponsesModel2["GPT4OMini"] = "gpt-4o-mini";
2040
+ AxAIOpenAIResponsesModel2["GPT4ChatGPT4O"] = "chatgpt-4o-latest";
2041
+ AxAIOpenAIResponsesModel2["GPT4Turbo"] = "gpt-4-turbo";
2042
+ AxAIOpenAIResponsesModel2["GPT35Turbo"] = "gpt-3.5-turbo";
2043
+ AxAIOpenAIResponsesModel2["GPT35TurboInstruct"] = "gpt-3.5-turbo-instruct";
2044
+ AxAIOpenAIResponsesModel2["GPT35TextDavinci002"] = "text-davinci-002";
2045
+ AxAIOpenAIResponsesModel2["GPT3TextBabbage002"] = "text-babbage-002";
2046
+ AxAIOpenAIResponsesModel2["GPT3TextAda001"] = "text-ada-001";
2047
+ AxAIOpenAIResponsesModel2["O3"] = "o3";
2048
+ AxAIOpenAIResponsesModel2["O3Mini"] = "o3-mini";
2049
+ AxAIOpenAIResponsesModel2["O4Mini"] = "o4-mini";
2050
+ return AxAIOpenAIResponsesModel2;
2051
+ })(AxAIOpenAIResponsesModel || {});
2052
+
2034
2053
  // ai/openai/info.ts
2035
2054
  var axModelInfoOpenAI = [
2036
2055
  {
@@ -2047,20 +2066,6 @@ var axModelInfoOpenAI = [
2047
2066
  completionTokenCostPer1M: 14.4,
2048
2067
  hasThinkingBudget: true
2049
2068
  },
2050
- {
2051
- name: "o3-mini" /* O3Mini */,
2052
- currency: "usd",
2053
- promptTokenCostPer1M: 1.1,
2054
- completionTokenCostPer1M: 4.4,
2055
- hasThinkingBudget: true
2056
- },
2057
- {
2058
- name: "o4-mini" /* O4Mini */,
2059
- currency: "usd",
2060
- promptTokenCostPer1M: 1.1,
2061
- completionTokenCostPer1M: 4.4,
2062
- hasThinkingBudget: true
2063
- },
2064
2069
  {
2065
2070
  name: "gpt-4" /* GPT4 */,
2066
2071
  currency: "usd",
@@ -2109,6 +2114,32 @@ var axModelInfoOpenAI = [
2109
2114
  promptTokenCostPer1M: 0.5,
2110
2115
  completionTokenCostPer1M: 1.5
2111
2116
  },
2117
+ // Responses API only models
2118
+ {
2119
+ name: "o3" /* O3 */,
2120
+ currency: "usd",
2121
+ promptTokenCostPer1M: 15,
2122
+ completionTokenCostPer1M: 60,
2123
+ hasThinkingBudget: true,
2124
+ hasShowThoughts: true
2125
+ },
2126
+ {
2127
+ name: "o3-mini" /* O3Mini */,
2128
+ currency: "usd",
2129
+ promptTokenCostPer1M: 1.1,
2130
+ completionTokenCostPer1M: 4.4,
2131
+ hasThinkingBudget: true,
2132
+ hasShowThoughts: true
2133
+ },
2134
+ {
2135
+ name: "o4-mini" /* O4Mini */,
2136
+ currency: "usd",
2137
+ promptTokenCostPer1M: 1.1,
2138
+ completionTokenCostPer1M: 4.4,
2139
+ hasThinkingBudget: true,
2140
+ hasShowThoughts: true
2141
+ },
2142
+ // Embedding models
2112
2143
  {
2113
2144
  name: "text-embedding-ada-002" /* TextEmbeddingAda002 */,
2114
2145
  currency: "usd",
@@ -3309,6 +3340,7 @@ var AxAIGoogleGeminiImpl = class {
3309
3340
  switch (config.thinkingTokenBudget) {
3310
3341
  case "none":
3311
3342
  thinkingConfig.thinkingBudget = 0;
3343
+ thinkingConfig.includeThoughts = false;
3312
3344
  break;
3313
3345
  case "minimal":
3314
3346
  thinkingConfig.thinkingBudget = 200;
@@ -3328,7 +3360,9 @@ var AxAIGoogleGeminiImpl = class {
3328
3360
  }
3329
3361
  }
3330
3362
  if (config.showThoughts !== void 0) {
3331
- thinkingConfig.includeThoughts = config.showThoughts;
3363
+ if (config.thinkingTokenBudget !== "none") {
3364
+ thinkingConfig.includeThoughts = config.showThoughts;
3365
+ }
3332
3366
  }
3333
3367
  const generationConfig = {
3334
3368
  maxOutputTokens: req.modelConfig?.maxTokens ?? this.config.maxTokens,
@@ -4142,7 +4176,8 @@ var AxAIOpenAIResponsesImpl = class {
4142
4176
  })
4143
4177
  );
4144
4178
  const includeFields = [];
4145
- if (config.showThoughts) {
4179
+ const shouldShowThoughts = config?.thinkingTokenBudget === "none" ? false : config?.showThoughts;
4180
+ if (shouldShowThoughts) {
4146
4181
  includeFields.push("reasoning.encrypted_content");
4147
4182
  }
4148
4183
  let mutableReq = {
@@ -4199,6 +4234,33 @@ var AxAIOpenAIResponsesImpl = class {
4199
4234
  effort: this.config.reasoningEffort
4200
4235
  };
4201
4236
  }
4237
+ if (config?.thinkingTokenBudget) {
4238
+ switch (config.thinkingTokenBudget) {
4239
+ case "none":
4240
+ currentReasoning = {};
4241
+ break;
4242
+ case "minimal":
4243
+ currentReasoning = {
4244
+ ...currentReasoning,
4245
+ effort: "low"
4246
+ };
4247
+ break;
4248
+ case "low":
4249
+ currentReasoning = {
4250
+ ...currentReasoning,
4251
+ effort: "medium"
4252
+ };
4253
+ break;
4254
+ case "medium":
4255
+ case "high":
4256
+ case "highest":
4257
+ currentReasoning = {
4258
+ ...currentReasoning,
4259
+ effort: "high"
4260
+ };
4261
+ break;
4262
+ }
4263
+ }
4202
4264
  if (Object.keys(currentReasoning).length > 0 && currentReasoning.effort) {
4203
4265
  mutableReq.reasoning = currentReasoning;
4204
4266
  } else {
@@ -6320,7 +6382,7 @@ var toFieldType = (type) => {
6320
6382
  case "json":
6321
6383
  return "JSON object";
6322
6384
  case "class":
6323
- return `classification class (allowed classes: ${type.classes?.join(", ")})`;
6385
+ return `list of classes (match case): ${type.classes?.join(", ")})`;
6324
6386
  case "code":
6325
6387
  return "code";
6326
6388
  default:
@@ -8541,9 +8603,21 @@ function processChildAgentFunction(childFunction, parentValues, parentInputKeys,
8541
8603
  );
8542
8604
  const originalFunc = processedFunction.func;
8543
8605
  processedFunction.func = async (childArgs, funcOptions) => {
8606
+ let valuesToInject = {};
8607
+ if (Array.isArray(parentValues)) {
8608
+ const lastUserMessage = parentValues.filter((msg) => msg.role === "user").pop();
8609
+ if (lastUserMessage) {
8610
+ valuesToInject = pick(
8611
+ lastUserMessage.values,
8612
+ injectionKeys
8613
+ );
8614
+ }
8615
+ } else {
8616
+ valuesToInject = pick(parentValues, injectionKeys);
8617
+ }
8544
8618
  const updatedChildArgs = {
8545
8619
  ...childArgs,
8546
- ...pick(parentValues, injectionKeys)
8620
+ ...valuesToInject
8547
8621
  };
8548
8622
  if (options.debug && injectionKeys.length > 0) {
8549
8623
  const ai = funcOptions?.ai;
@@ -13532,7 +13606,17 @@ var AxRAG = class extends AxChainOfThought {
13532
13606
  this.queryFn = queryFn;
13533
13607
  this.register(this.genQuery);
13534
13608
  }
13535
- async forward(ai, { question }, options) {
13609
+ async forward(ai, values, options) {
13610
+ let question;
13611
+ if (Array.isArray(values)) {
13612
+ const lastUserMessage = values.filter((msg) => msg.role === "user").pop();
13613
+ if (!lastUserMessage) {
13614
+ throw new Error("No user message found in values array");
13615
+ }
13616
+ question = lastUserMessage.values.question;
13617
+ } else {
13618
+ question = values.question;
13619
+ }
13536
13620
  let hop = 0;
13537
13621
  let context3 = [];
13538
13622
  while (hop < this.maxHops) {
@@ -13580,6 +13664,7 @@ export {
13580
13664
  AxAIOpenAIResponses,
13581
13665
  AxAIOpenAIResponsesBase,
13582
13666
  AxAIOpenAIResponsesImpl,
13667
+ AxAIOpenAIResponsesModel,
13583
13668
  AxAIReka,
13584
13669
  AxAIRekaModel,
13585
13670
  AxAIServiceAbortedError,