@ax-llm/ax 11.0.7 → 11.0.8

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
@@ -2657,7 +2657,7 @@ var safetySettings = [
2657
2657
  }
2658
2658
  ];
2659
2659
  var axAIGoogleGeminiDefaultConfig = () => structuredClone({
2660
- model: "gemini-1.5-pro" /* Gemini15Pro */,
2660
+ model: "gemini-2.0-flash" /* Gemini20Flash */,
2661
2661
  embedModel: "text-embedding-004" /* TextEmbedding004 */,
2662
2662
  safetySettings,
2663
2663
  ...axBaseAIDefaultConfig()
@@ -4596,6 +4596,9 @@ var LRUCache = class {
4596
4596
  };
4597
4597
  var globalPrefixCache = new LRUCache(500);
4598
4598
  function matchesContent(content, prefix, startIndex = 0, prefixCache = globalPrefixCache) {
4599
+ if (/^\s*$/.test(content)) {
4600
+ return -3;
4601
+ }
4599
4602
  const exactMatchIndex = content.indexOf(prefix, startIndex);
4600
4603
  if (exactMatchIndex !== -1) {
4601
4604
  return exactMatchIndex;
@@ -5320,6 +5323,9 @@ var streamingExtractValues = (sig, values, xstate, content, streamingValidation
5320
5323
  // Field is not found, continue to the next field
5321
5324
  case -2:
5322
5325
  return true;
5326
+ // Partial match at end, skip and gather more content
5327
+ case -3:
5328
+ return true;
5323
5329
  }
5324
5330
  let prefixLen = prefix.length;
5325
5331
  if (xstate.currField) {
@@ -6103,14 +6109,20 @@ function processChildAgentFunction(childFunction, parentValues, parentInputKeys,
6103
6109
  injectionKeys
6104
6110
  );
6105
6111
  const originalFunc = processedFunction.func;
6106
- processedFunction.func = (childArgs, funcOptions) => originalFunc(
6107
- {
6112
+ processedFunction.func = (childArgs, funcOptions) => {
6113
+ const updatedChildArgs = {
6108
6114
  ...childArgs,
6109
6115
  ...pick(parentValues, injectionKeys)
6110
- },
6111
- funcOptions
6112
- );
6116
+ };
6117
+ if (options.debug && injectionKeys.length > 0) {
6118
+ process.stdout.write(
6119
+ `Function Params: ${JSON.stringify(updatedChildArgs, null, 2)}`
6120
+ );
6121
+ }
6122
+ return originalFunc(updatedChildArgs, funcOptions);
6123
+ };
6113
6124
  }
6125
+ return processedFunction;
6114
6126
  }
6115
6127
  if (modelList && !options.disableSmartModelRouting && options.canConfigureSmartModelRouting) {
6116
6128
  processedFunction.parameters = addModelParameter(
@@ -6223,11 +6235,12 @@ var AxAgent = class {
6223
6235
  init(parentAi, values, options) {
6224
6236
  const ai = this.ai ?? parentAi;
6225
6237
  const mm = ai?.getModelList();
6226
- const parentSchema = this.signature.toJSONSchema();
6227
- const parentKeys = parentSchema.properties ? Object.keys(parentSchema.properties) : [];
6238
+ const parentSchema = this.signature.getInputFields();
6239
+ const parentKeys = parentSchema.map((p) => p.name);
6228
6240
  const agentFuncs = this.agents?.map((agent) => {
6229
6241
  const f = agent.getFeatures();
6230
6242
  const processOptions = {
6243
+ debug: ai?.getOptions()?.debug ?? false,
6231
6244
  disableSmartModelRouting: !!this.disableSmartModelRouting,
6232
6245
  excludeFieldsFromPassthrough: f.excludeFieldsFromPassthrough,
6233
6246
  canConfigureSmartModelRouting: f.canConfigureSmartModelRouting
@@ -6298,7 +6311,7 @@ function addModelParameter(parameters, models) {
6298
6311
  const modelProperty = {
6299
6312
  type: "string",
6300
6313
  enum: models.map((m) => m.key),
6301
- description: `The AI model to use for this function call. Available options: ${models.map((m) => `${m.key}: ${m.description}`).join(" | ")}`
6314
+ description: `The AI model to use for this function call. Available options: ${models.map((m) => `\`${m.key}\` ${m.description}`).join(", ")}`
6302
6315
  };
6303
6316
  const newProperties = {
6304
6317
  ...baseSchema.properties ?? {},