@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.cjs +17 -11
- package/index.cjs.map +1 -1
- package/index.d.cts +1 -0
- package/index.d.ts +1 -0
- package/index.js +17 -11
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -6155,6 +6155,12 @@ function processChildAgentFunction(childFunction, parentValues, parentInputKeys,
|
|
|
6155
6155
|
}
|
|
6156
6156
|
return processedFunction;
|
|
6157
6157
|
}
|
|
6158
|
+
var descriptionError = new Error(
|
|
6159
|
+
"Agent description must be at least 20 characters (explain in detail what the agent does)"
|
|
6160
|
+
);
|
|
6161
|
+
var definitionError = new Error(
|
|
6162
|
+
"Agent definition is the prompt you give to the LLM for the agent. It must be detailed and at least 100 characters"
|
|
6163
|
+
);
|
|
6158
6164
|
var AxAgent = class {
|
|
6159
6165
|
ai;
|
|
6160
6166
|
program;
|
|
@@ -6182,22 +6188,18 @@ var AxAgent = class {
|
|
|
6182
6188
|
this.excludeFieldsFromPassthrough = excludeFieldsFromPassthrough ?? [];
|
|
6183
6189
|
if (!name || name.length < 5) {
|
|
6184
6190
|
throw new Error(
|
|
6185
|
-
`Agent name must be at least 10 characters (more descriptive)
|
|
6191
|
+
`Agent name must be at least 10 characters (more descriptive)`
|
|
6186
6192
|
);
|
|
6187
6193
|
}
|
|
6188
6194
|
if (!description || description.length < 20) {
|
|
6189
|
-
throw
|
|
6190
|
-
`Agent description must be at least 20 characters (explain in detail what the agent does): ${description}`
|
|
6191
|
-
);
|
|
6195
|
+
throw descriptionError;
|
|
6192
6196
|
}
|
|
6193
6197
|
if (definition && definition.length < 100) {
|
|
6194
|
-
throw
|
|
6195
|
-
`Agent definition is the prompt you give to the LLM for the agent. It must be detailed and at least 100 characters`
|
|
6196
|
-
);
|
|
6198
|
+
throw definitionError;
|
|
6197
6199
|
}
|
|
6198
6200
|
this.program = new AxGen(signature, {
|
|
6199
6201
|
...options,
|
|
6200
|
-
description: definition
|
|
6202
|
+
description: definition ?? description
|
|
6201
6203
|
});
|
|
6202
6204
|
for (const agent of agents ?? []) {
|
|
6203
6205
|
this.program.register(agent);
|
|
@@ -6319,13 +6321,17 @@ var AxAgent = class {
|
|
|
6319
6321
|
*/
|
|
6320
6322
|
setDescription(description) {
|
|
6321
6323
|
if (!description || description.length < 20) {
|
|
6322
|
-
throw
|
|
6323
|
-
"Agent description must be at least 20 characters (explain in detail what the agent does)"
|
|
6324
|
-
);
|
|
6324
|
+
throw descriptionError;
|
|
6325
6325
|
}
|
|
6326
6326
|
this.program.getSignature().setDescription(description);
|
|
6327
6327
|
this.func.description = description;
|
|
6328
6328
|
}
|
|
6329
|
+
setDefinition(definition) {
|
|
6330
|
+
if (!definition || definition.length < 100) {
|
|
6331
|
+
throw definitionError;
|
|
6332
|
+
}
|
|
6333
|
+
this.program.getSignature().setDescription(definition);
|
|
6334
|
+
}
|
|
6329
6335
|
};
|
|
6330
6336
|
function toCamelCase(inputString) {
|
|
6331
6337
|
const words = inputString.split(/[^a-zA-Z0-9]/);
|