@ax-llm/ax 11.0.60 → 11.0.61

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
@@ -8704,9 +8704,21 @@ function processChildAgentFunction(childFunction, parentValues, parentInputKeys,
8704
8704
  );
8705
8705
  const originalFunc = processedFunction.func;
8706
8706
  processedFunction.func = async (childArgs, funcOptions) => {
8707
+ let valuesToInject = {};
8708
+ if (Array.isArray(parentValues)) {
8709
+ const lastUserMessage = parentValues.filter((msg) => msg.role === "user").pop();
8710
+ if (lastUserMessage) {
8711
+ valuesToInject = pick(
8712
+ lastUserMessage.values,
8713
+ injectionKeys
8714
+ );
8715
+ }
8716
+ } else {
8717
+ valuesToInject = pick(parentValues, injectionKeys);
8718
+ }
8707
8719
  const updatedChildArgs = {
8708
8720
  ...childArgs,
8709
- ...pick(parentValues, injectionKeys)
8721
+ ...valuesToInject
8710
8722
  };
8711
8723
  if (options.debug && injectionKeys.length > 0) {
8712
8724
  const ai = funcOptions?.ai;
@@ -13695,7 +13707,17 @@ var AxRAG = class extends AxChainOfThought {
13695
13707
  this.queryFn = queryFn;
13696
13708
  this.register(this.genQuery);
13697
13709
  }
13698
- async forward(ai, { question }, options) {
13710
+ async forward(ai, values, options) {
13711
+ let question;
13712
+ if (Array.isArray(values)) {
13713
+ const lastUserMessage = values.filter((msg) => msg.role === "user").pop();
13714
+ if (!lastUserMessage) {
13715
+ throw new Error("No user message found in values array");
13716
+ }
13717
+ question = lastUserMessage.values.question;
13718
+ } else {
13719
+ question = values.question;
13720
+ }
13699
13721
  let hop = 0;
13700
13722
  let context3 = [];
13701
13723
  while (hop < this.maxHops) {