@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.js CHANGED
@@ -2555,7 +2555,7 @@ var safetySettings = [
2555
2555
  }
2556
2556
  ];
2557
2557
  var axAIGoogleGeminiDefaultConfig = () => structuredClone({
2558
- model: "gemini-1.5-pro" /* Gemini15Pro */,
2558
+ model: "gemini-2.0-flash" /* Gemini20Flash */,
2559
2559
  embedModel: "text-embedding-004" /* TextEmbedding004 */,
2560
2560
  safetySettings,
2561
2561
  ...axBaseAIDefaultConfig()
@@ -4494,6 +4494,9 @@ var LRUCache = class {
4494
4494
  };
4495
4495
  var globalPrefixCache = new LRUCache(500);
4496
4496
  function matchesContent(content, prefix, startIndex = 0, prefixCache = globalPrefixCache) {
4497
+ if (/^\s*$/.test(content)) {
4498
+ return -3;
4499
+ }
4497
4500
  const exactMatchIndex = content.indexOf(prefix, startIndex);
4498
4501
  if (exactMatchIndex !== -1) {
4499
4502
  return exactMatchIndex;
@@ -5218,6 +5221,9 @@ var streamingExtractValues = (sig, values, xstate, content, streamingValidation
5218
5221
  // Field is not found, continue to the next field
5219
5222
  case -2:
5220
5223
  return true;
5224
+ // Partial match at end, skip and gather more content
5225
+ case -3:
5226
+ return true;
5221
5227
  }
5222
5228
  let prefixLen = prefix.length;
5223
5229
  if (xstate.currField) {
@@ -6001,14 +6007,20 @@ function processChildAgentFunction(childFunction, parentValues, parentInputKeys,
6001
6007
  injectionKeys
6002
6008
  );
6003
6009
  const originalFunc = processedFunction.func;
6004
- processedFunction.func = (childArgs, funcOptions) => originalFunc(
6005
- {
6010
+ processedFunction.func = (childArgs, funcOptions) => {
6011
+ const updatedChildArgs = {
6006
6012
  ...childArgs,
6007
6013
  ...pick(parentValues, injectionKeys)
6008
- },
6009
- funcOptions
6010
- );
6014
+ };
6015
+ if (options.debug && injectionKeys.length > 0) {
6016
+ process.stdout.write(
6017
+ `Function Params: ${JSON.stringify(updatedChildArgs, null, 2)}`
6018
+ );
6019
+ }
6020
+ return originalFunc(updatedChildArgs, funcOptions);
6021
+ };
6011
6022
  }
6023
+ return processedFunction;
6012
6024
  }
6013
6025
  if (modelList && !options.disableSmartModelRouting && options.canConfigureSmartModelRouting) {
6014
6026
  processedFunction.parameters = addModelParameter(
@@ -6121,11 +6133,12 @@ var AxAgent = class {
6121
6133
  init(parentAi, values, options) {
6122
6134
  const ai = this.ai ?? parentAi;
6123
6135
  const mm = ai?.getModelList();
6124
- const parentSchema = this.signature.toJSONSchema();
6125
- const parentKeys = parentSchema.properties ? Object.keys(parentSchema.properties) : [];
6136
+ const parentSchema = this.signature.getInputFields();
6137
+ const parentKeys = parentSchema.map((p) => p.name);
6126
6138
  const agentFuncs = this.agents?.map((agent) => {
6127
6139
  const f = agent.getFeatures();
6128
6140
  const processOptions = {
6141
+ debug: ai?.getOptions()?.debug ?? false,
6129
6142
  disableSmartModelRouting: !!this.disableSmartModelRouting,
6130
6143
  excludeFieldsFromPassthrough: f.excludeFieldsFromPassthrough,
6131
6144
  canConfigureSmartModelRouting: f.canConfigureSmartModelRouting
@@ -6196,7 +6209,7 @@ function addModelParameter(parameters, models) {
6196
6209
  const modelProperty = {
6197
6210
  type: "string",
6198
6211
  enum: models.map((m) => m.key),
6199
- description: `The AI model to use for this function call. Available options: ${models.map((m) => `${m.key}: ${m.description}`).join(" | ")}`
6212
+ description: `The AI model to use for this function call. Available options: ${models.map((m) => `\`${m.key}\` ${m.description}`).join(", ")}`
6200
6213
  };
6201
6214
  const newProperties = {
6202
6215
  ...baseSchema.properties ?? {},