@ai.ntellect/core 0.1.96 ā 0.1.97
Sign up to get free protection for your applications and to get access to all the features.
- package/llm/evaluator/index.ts +0 -1
- package/package.json +1 -1
- package/types.ts +5 -0
- package/utils/inject-actions.ts +13 -1
package/llm/evaluator/index.ts
CHANGED
package/package.json
CHANGED
package/types.ts
CHANGED
@@ -63,6 +63,11 @@ export interface ActionSchema {
|
|
63
63
|
[key: string]: z.ZodType;
|
64
64
|
}>;
|
65
65
|
execute: (args: any) => Promise<any>;
|
66
|
+
examples?: {
|
67
|
+
role: string;
|
68
|
+
content: string;
|
69
|
+
parameters: Record<string, any>;
|
70
|
+
}[];
|
66
71
|
confirmation?: {
|
67
72
|
requireConfirmation: boolean;
|
68
73
|
message: string;
|
package/utils/inject-actions.ts
CHANGED
@@ -5,7 +5,19 @@ export const injectActions = (actions: ActionSchema[]) => {
|
|
5
5
|
return actions.map((action) => {
|
6
6
|
const parameters = action.parameters as z.ZodObject<any>;
|
7
7
|
const schemaShape = Object.keys(parameters._def.shape()).join(", ");
|
8
|
-
const actionString = `Name: ${action.name}, Description: ${
|
8
|
+
const actionString = `Name: ${action.name}, Description: ${
|
9
|
+
action.description
|
10
|
+
}, Arguments (STRICTLY REQUIRED): { ${schemaShape} } ${
|
11
|
+
action.examples
|
12
|
+
? `Examples: ${action.examples
|
13
|
+
.map((e: any) => {
|
14
|
+
return `Role: ${e.role}, Content: ${
|
15
|
+
e.content
|
16
|
+
}, Parameters: { ${Object.keys(e.parameters).join(", ")} }`;
|
17
|
+
})
|
18
|
+
.join("\n")}`
|
19
|
+
: ""
|
20
|
+
}`;
|
9
21
|
return actionString;
|
10
22
|
});
|
11
23
|
};
|