@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.js CHANGED
@@ -754,15 +754,16 @@ var logResponse = (resp) => {
754
754
  if (r.functionCalls) {
755
755
  for (const [i, f] of r.functionCalls.entries()) {
756
756
  if (f.function.name) {
757
+ if (i > 0) {
758
+ process.stdout.write("\n\n");
759
+ }
757
760
  process.stdout.write(
758
- `
759
- Function ${i + 1} -> ${colorLog.greenBright(f.function.name)} `
761
+ `Function ${i + 1} -> ${colorLog.greenBright(f.function.name)} `
760
762
  );
761
763
  }
762
764
  if (f.function.params) {
763
- process.stdout.write(
764
- colorLog.greenBright(f.function.params)
765
- );
765
+ const params = typeof f.function.params === "string" ? f.function.params : JSON.stringify(f.function.params, null, 2);
766
+ process.stdout.write(`${colorLog.greenBright(params)}`);
766
767
  }
767
768
  }
768
769
  }
@@ -3274,7 +3275,9 @@ var assertStreamingAssertions = (asserts, values, xstate, content, final) => {
3274
3275
  };
3275
3276
  var assertRequiredFields = (sig, values) => {
3276
3277
  const fields = sig.getOutputFields();
3277
- const missingFields = fields.filter((f) => !(f.name in values));
3278
+ const missingFields = fields.filter(
3279
+ (f) => !f.isOptional && !(f.name in values)
3280
+ );
3278
3281
  if (missingFields.length > 0) {
3279
3282
  throw new AxAssertionError({
3280
3283
  message: `Output must include: ${missingFields.map((f) => `\`${f.title}:\``).join(", ")}`,
@@ -4031,7 +4034,9 @@ var AxPromptTemplate = class {
4031
4034
  const funcs = functions?.map(
4032
4035
  (f) => "toFunction" in f ? f.toFunction() : f
4033
4036
  );
4034
- const funcList = funcs?.map((fn) => `\`${fn.name}\`: ${capitalizeFirstLetter(fn.description)}`).join("\n");
4037
+ const funcList = funcs?.map(
4038
+ (fn) => `- \`${fn.name}\`: ${capitalizeFirstLetter(fn.description)}`
4039
+ ).join("\n");
4035
4040
  if (funcList && funcList.length > 0) {
4036
4041
  task.push(`## Available Functions
4037
4042
  ${funcList}`);