@ai.ntellect/core 0.1.95 → 0.1.97

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/agent/index.ts CHANGED
@@ -78,6 +78,16 @@ export class Agent {
78
78
  );
79
79
  events.onMessage?.(request);
80
80
 
81
+ const isOnChainAction = request.actions.some(
82
+ (action) => action.type === "on-chain"
83
+ );
84
+
85
+ if (isOnChainAction) {
86
+ return {
87
+ data: this.accumulatedResults,
88
+ initialPrompt: prompt,
89
+ };
90
+ }
81
91
  return request.actions.length > 0
82
92
  ? this.handleActions(
83
93
  {
@@ -120,22 +130,11 @@ export class Agent {
120
130
  }
121
131
  );
122
132
 
123
- const isOnChainAction = actions.some(
124
- (action) => action.type === "on-chain"
125
- );
126
-
127
133
  this.accumulatedResults = [
128
134
  ...this.accumulatedResults,
129
135
  ...actionsResult.data,
130
136
  ];
131
137
 
132
- if (isOnChainAction) {
133
- return {
134
- data: this.accumulatedResults,
135
- initialPrompt,
136
- };
137
- }
138
-
139
138
  if (this.evaluatorIteration >= this.maxEvaluatorIteration) {
140
139
  return this.handleActionResults({
141
140
  data: this.accumulatedResults,
@@ -44,7 +44,6 @@ export class Evaluator {
44
44
  actions: this.tools,
45
45
  results: results,
46
46
  });
47
-
48
47
  console.log("\nšŸ” Evaluator processing");
49
48
  console.log("Goal:", prompt);
50
49
  console.log("Results to evaluate:", JSON.stringify(results, null, 2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai.ntellect/core",
3
- "version": "0.1.95",
3
+ "version": "0.1.97",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
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;
@@ -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: ${action.description}, Arguments (STRICTLY REQUIRED): { ${schemaShape} }`;
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
  };