@ai.ntellect/core 0.1.100 → 0.1.102
Sign up to get free protection for your applications and to get access to all the features.
- package/agent/index.ts +11 -10
- package/dist/agent/index.js +7 -7
- package/dist/utils/inject-actions.js +3 -7
- package/package.json +1 -1
- package/utils/inject-actions.ts +5 -9
package/agent/index.ts
CHANGED
@@ -78,16 +78,6 @@ 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
|
-
}
|
91
81
|
return request.actions.length > 0
|
92
82
|
? this.handleActions(
|
93
83
|
{
|
@@ -135,6 +125,17 @@ export class Agent {
|
|
135
125
|
...actionsResult.data,
|
136
126
|
];
|
137
127
|
|
128
|
+
const isOnChainAction = actions.some(
|
129
|
+
(action) => action.type === "on-chain"
|
130
|
+
);
|
131
|
+
|
132
|
+
if (isOnChainAction) {
|
133
|
+
return {
|
134
|
+
data: this.accumulatedResults,
|
135
|
+
initialPrompt,
|
136
|
+
};
|
137
|
+
}
|
138
|
+
|
138
139
|
if (this.evaluatorIteration >= this.maxEvaluatorIteration) {
|
139
140
|
return this.handleActionResults({
|
140
141
|
data: this.accumulatedResults,
|
package/dist/agent/index.js
CHANGED
@@ -24,13 +24,6 @@ class Agent {
|
|
24
24
|
console.log("Requesting orchestrator for actions..");
|
25
25
|
const request = await this.orchestrator.process(prompt, this.accumulatedResults);
|
26
26
|
events.onMessage?.(request);
|
27
|
-
const isOnChainAction = request.actions.some((action) => action.type === "on-chain");
|
28
|
-
if (isOnChainAction) {
|
29
|
-
return {
|
30
|
-
data: this.accumulatedResults,
|
31
|
-
initialPrompt: prompt,
|
32
|
-
};
|
33
|
-
}
|
34
27
|
return request.actions.length > 0
|
35
28
|
? this.handleActions({
|
36
29
|
initialPrompt: prompt,
|
@@ -51,6 +44,13 @@ class Agent {
|
|
51
44
|
...this.accumulatedResults,
|
52
45
|
...actionsResult.data,
|
53
46
|
];
|
47
|
+
const isOnChainAction = actions.some((action) => action.type === "on-chain");
|
48
|
+
if (isOnChainAction) {
|
49
|
+
return {
|
50
|
+
data: this.accumulatedResults,
|
51
|
+
initialPrompt,
|
52
|
+
};
|
53
|
+
}
|
54
54
|
if (this.evaluatorIteration >= this.maxEvaluatorIteration) {
|
55
55
|
return this.handleActionResults({
|
56
56
|
data: this.accumulatedResults,
|
@@ -6,13 +6,9 @@ const injectActions = (actions) => {
|
|
6
6
|
const parameters = action.parameters;
|
7
7
|
const schemaShape = Object.keys(parameters._def.shape()).join(", ");
|
8
8
|
const actionString = `Name: ${action.name}, Description: ${action.description}, Arguments (STRICTLY REQUIRED): { ${schemaShape} } ${action.examples
|
9
|
-
? `
|
10
|
-
.
|
11
|
-
|
12
|
-
? `{ ${Object.keys(e.parameters).join(", ")} }`
|
13
|
-
: ""}`;
|
14
|
-
})
|
15
|
-
.join("\n")}`
|
9
|
+
? `Format examples (MUST RESPECT): ${action.examples.map((example) => {
|
10
|
+
return JSON.stringify(example);
|
11
|
+
})}`
|
16
12
|
: ""}`;
|
17
13
|
return actionString;
|
18
14
|
});
|
package/package.json
CHANGED
package/utils/inject-actions.ts
CHANGED
@@ -9,15 +9,11 @@ export const injectActions = (actions: ActionSchema[]) => {
|
|
9
9
|
action.description
|
10
10
|
}, Arguments (STRICTLY REQUIRED): { ${schemaShape} } ${
|
11
11
|
action.examples
|
12
|
-
? `
|
13
|
-
|
14
|
-
return
|
15
|
-
|
16
|
-
|
17
|
-
: ""
|
18
|
-
}`;
|
19
|
-
})
|
20
|
-
.join("\n")}`
|
12
|
+
? `Format examples (MUST RESPECT): ${action.examples.map(
|
13
|
+
(example: any) => {
|
14
|
+
return JSON.stringify(example);
|
15
|
+
}
|
16
|
+
)}`
|
21
17
|
: ""
|
22
18
|
}`;
|
23
19
|
return actionString;
|