@ax-llm/ax 11.0.63 → 11.0.64

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.d.cts CHANGED
@@ -2050,7 +2050,7 @@ interface AxField {
2050
2050
  type?: {
2051
2051
  name: 'string' | 'number' | 'boolean' | 'json' | 'image' | 'audio' | 'date' | 'datetime' | 'class' | 'code';
2052
2052
  isArray: boolean;
2053
- classes?: string[];
2053
+ options?: string[];
2054
2054
  };
2055
2055
  isOptional?: boolean;
2056
2056
  isInternal?: boolean;
package/index.d.ts CHANGED
@@ -2050,7 +2050,7 @@ interface AxField {
2050
2050
  type?: {
2051
2051
  name: 'string' | 'number' | 'boolean' | 'json' | 'image' | 'audio' | 'date' | 'datetime' | 'class' | 'code';
2052
2052
  isArray: boolean;
2053
- classes?: string[];
2053
+ options?: string[];
2054
2054
  };
2055
2055
  isOptional?: boolean;
2056
2056
  isInternal?: boolean;
package/index.js CHANGED
@@ -6342,7 +6342,17 @@ var renderOutputFields = (fields) => {
6342
6342
  const name = field.title;
6343
6343
  const type = field.type?.name ? toFieldType(field.type) : "string";
6344
6344
  const requiredMsg = field.isOptional ? `Only include this ${type} field if its value is available` : `This ${type} field must be included`;
6345
- const description = field.description ? ` ${formatDescription(field.description)}` : "";
6345
+ let description = "";
6346
+ if (field.description && field.description.length > 0) {
6347
+ const value = field.type?.name === "class" ? field.description : formatDescription(field.description);
6348
+ description = ` ${value}`;
6349
+ }
6350
+ if (field.type?.options && field.type.options.length > 0) {
6351
+ if (description.length > 0) {
6352
+ description += `. `;
6353
+ }
6354
+ description += `Allowed values: ${field.type.options.join(", ")}`;
6355
+ }
6346
6356
  return `${name}: (${requiredMsg})${description}`.trim();
6347
6357
  });
6348
6358
  return rows.join("\n");
@@ -6382,7 +6392,7 @@ var toFieldType = (type) => {
6382
6392
  case "json":
6383
6393
  return "JSON object";
6384
6394
  case "class":
6385
- return `list of classes (match case): ${type.classes?.join(", ")})`;
6395
+ return "classification class";
6386
6396
  case "code":
6387
6397
  return "code";
6388
6398
  default:
@@ -6669,12 +6679,12 @@ var convertValueToType = (field, val, required = false) => {
6669
6679
  return parseLLMFriendlyDateTime(field, val, required);
6670
6680
  case "class":
6671
6681
  const className = val;
6672
- if (field.type.classes && !field.type.classes.includes(className)) {
6682
+ if (field.type.options && !field.type.options.includes(className)) {
6673
6683
  if (field.isOptional) {
6674
6684
  return;
6675
6685
  }
6676
6686
  throw new Error(
6677
- `Invalid class '${val}', expected one of the following: ${field.type.classes.join(", ")}`
6687
+ `Invalid class '${val}', expected one of the following: ${field.type.options.join(", ")}`
6678
6688
  );
6679
6689
  }
6680
6690
  return className;
@@ -7453,13 +7463,13 @@ ${pointer}`;
7453
7463
  `Output field "${name}": Expected class names in quotes after "class" type. Example: class "MyClass1, MyClass2"`
7454
7464
  );
7455
7465
  }
7456
- const classes = classNamesString.split(/[,\s]+/).map((s) => s.trim()).filter((s) => s.length > 0);
7457
- if (classes.length === 0) {
7466
+ const options = classNamesString.split(/[,\s]+/).map((s) => s.trim()).filter((s) => s.length > 0);
7467
+ if (options.length === 0) {
7458
7468
  throw new Error(
7459
7469
  `Output field "${name}": Empty class list provided. At least one class name is required`
7460
7470
  );
7461
7471
  }
7462
- type = { name: "class", isArray, classes };
7472
+ type = { name: "class", isArray, options };
7463
7473
  } else {
7464
7474
  try {
7465
7475
  const typeName = this.parseTypeNotClass();