@ax-llm/ax 10.0.30 → 10.0.32

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
@@ -848,15 +848,16 @@ var logResponse = (resp) => {
848
848
  if (r.functionCalls) {
849
849
  for (const [i, f] of r.functionCalls.entries()) {
850
850
  if (f.function.name) {
851
+ if (i > 0) {
852
+ process.stdout.write("\n\n");
853
+ }
851
854
  process.stdout.write(
852
- `
853
- Function ${i + 1} -> ${colorLog.greenBright(f.function.name)} `
855
+ `Function ${i + 1} -> ${colorLog.greenBright(f.function.name)} `
854
856
  );
855
857
  }
856
858
  if (f.function.params) {
857
- process.stdout.write(
858
- colorLog.greenBright(f.function.params)
859
- );
859
+ const params = typeof f.function.params === "string" ? f.function.params : JSON.stringify(f.function.params, null, 2);
860
+ process.stdout.write(`${colorLog.greenBright(params)}`);
860
861
  }
861
862
  }
862
863
  }
@@ -3368,7 +3369,9 @@ var assertStreamingAssertions = (asserts, values, xstate, content, final) => {
3368
3369
  };
3369
3370
  var assertRequiredFields = (sig, values) => {
3370
3371
  const fields = sig.getOutputFields();
3371
- const missingFields = fields.filter((f) => !(f.name in values));
3372
+ const missingFields = fields.filter(
3373
+ (f) => !f.isOptional && !(f.name in values)
3374
+ );
3372
3375
  if (missingFields.length > 0) {
3373
3376
  throw new AxAssertionError({
3374
3377
  message: `Output must include: ${missingFields.map((f) => `\`${f.title}:\``).join(", ")}`,
@@ -4125,7 +4128,9 @@ var AxPromptTemplate = class {
4125
4128
  const funcs = functions?.map(
4126
4129
  (f) => "toFunction" in f ? f.toFunction() : f
4127
4130
  );
4128
- const funcList = funcs?.map((fn) => `\`${fn.name}\`: ${capitalizeFirstLetter(fn.description)}`).join("\n");
4131
+ const funcList = funcs?.map(
4132
+ (fn) => `- \`${fn.name}\`: ${capitalizeFirstLetter(fn.description)}`
4133
+ ).join("\n");
4129
4134
  if (funcList && funcList.length > 0) {
4130
4135
  task.push(`## Available Functions
4131
4136
  ${funcList}`);