@ax-llm/ax 11.0.11 → 11.0.12

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
@@ -1680,6 +1680,7 @@ declare class AxAgent<IN extends AxGenIn, OUT extends AxGenOut = AxGenOut> imple
1680
1680
  * @throws Error if description is too short
1681
1681
  */
1682
1682
  setDescription(description: string): void;
1683
+ setDefinition(definition: string): void;
1683
1684
  }
1684
1685
 
1685
1686
  interface AxApacheTikaArgs {
package/index.d.ts CHANGED
@@ -1680,6 +1680,7 @@ declare class AxAgent<IN extends AxGenIn, OUT extends AxGenOut = AxGenOut> imple
1680
1680
  * @throws Error if description is too short
1681
1681
  */
1682
1682
  setDescription(description: string): void;
1683
+ setDefinition(definition: string): void;
1683
1684
  }
1684
1685
 
1685
1686
  interface AxApacheTikaArgs {
package/index.js CHANGED
@@ -6053,6 +6053,12 @@ function processChildAgentFunction(childFunction, parentValues, parentInputKeys,
6053
6053
  }
6054
6054
  return processedFunction;
6055
6055
  }
6056
+ var descriptionError = new Error(
6057
+ "Agent description must be at least 20 characters (explain in detail what the agent does)"
6058
+ );
6059
+ var definitionError = new Error(
6060
+ "Agent definition is the prompt you give to the LLM for the agent. It must be detailed and at least 100 characters"
6061
+ );
6056
6062
  var AxAgent = class {
6057
6063
  ai;
6058
6064
  program;
@@ -6080,22 +6086,18 @@ var AxAgent = class {
6080
6086
  this.excludeFieldsFromPassthrough = excludeFieldsFromPassthrough ?? [];
6081
6087
  if (!name || name.length < 5) {
6082
6088
  throw new Error(
6083
- `Agent name must be at least 10 characters (more descriptive): ${name}`
6089
+ `Agent name must be at least 10 characters (more descriptive)`
6084
6090
  );
6085
6091
  }
6086
6092
  if (!description || description.length < 20) {
6087
- throw new Error(
6088
- `Agent description must be at least 20 characters (explain in detail what the agent does): ${description}`
6089
- );
6093
+ throw descriptionError;
6090
6094
  }
6091
6095
  if (definition && definition.length < 100) {
6092
- throw new Error(
6093
- `Agent definition is the prompt you give to the LLM for the agent. It must be detailed and at least 100 characters`
6094
- );
6096
+ throw definitionError;
6095
6097
  }
6096
6098
  this.program = new AxGen(signature, {
6097
6099
  ...options,
6098
- description: definition
6100
+ description: definition ?? description
6099
6101
  });
6100
6102
  for (const agent of agents ?? []) {
6101
6103
  this.program.register(agent);
@@ -6217,13 +6219,17 @@ var AxAgent = class {
6217
6219
  */
6218
6220
  setDescription(description) {
6219
6221
  if (!description || description.length < 20) {
6220
- throw new Error(
6221
- "Agent description must be at least 20 characters (explain in detail what the agent does)"
6222
- );
6222
+ throw descriptionError;
6223
6223
  }
6224
6224
  this.program.getSignature().setDescription(description);
6225
6225
  this.func.description = description;
6226
6226
  }
6227
+ setDefinition(definition) {
6228
+ if (!definition || definition.length < 100) {
6229
+ throw definitionError;
6230
+ }
6231
+ this.program.getSignature().setDescription(definition);
6232
+ }
6227
6233
  };
6228
6234
  function toCamelCase(inputString) {
6229
6235
  const words = inputString.split(/[^a-zA-Z0-9]/);