@agent-smith/agent 0.0.1 → 0.0.2
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/dist/agent.d.ts +1 -0
- package/dist/agent.js +3 -6
- package/package.json +2 -2
package/dist/agent.d.ts
CHANGED
package/dist/agent.js
CHANGED
|
@@ -73,16 +73,10 @@ class Agent {
|
|
|
73
73
|
}
|
|
74
74
|
async runAgentWithTemplate(it, prompt, params, options = {}, tpl) {
|
|
75
75
|
let res = await this.lm.infer(tpl.prompt(prompt), params, options);
|
|
76
|
-
const toolResponseStart = tpl.toolsDef?.response.split("{tools_response}")[0];
|
|
77
|
-
const toolCallStart = tpl.toolsDef?.response.split("{tool}")[0];
|
|
78
|
-
if (!toolCallStart || !toolResponseStart) {
|
|
79
|
-
throw new Error(`Tool definition malformed in template ${tpl.name}`);
|
|
80
|
-
}
|
|
81
76
|
const { isToolCall, toolsCall, error } = tpl.processAnswer(res.text);
|
|
82
77
|
if (error) {
|
|
83
78
|
throw new Error(`error processing tool call answer:\n, ${error}`);
|
|
84
79
|
}
|
|
85
|
-
console.log("\nProcessed answer", isToolCall, toolsCall, error);
|
|
86
80
|
const toolResults = new Array();
|
|
87
81
|
if (isToolCall) {
|
|
88
82
|
for (const toolCall of toolsCall) {
|
|
@@ -139,5 +133,8 @@ class Agent {
|
|
|
139
133
|
return { inferenceResult: res, template: tpl };
|
|
140
134
|
}
|
|
141
135
|
}
|
|
136
|
+
async abort() {
|
|
137
|
+
this.lm.abort();
|
|
138
|
+
}
|
|
142
139
|
}
|
|
143
140
|
export { Agent, };
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@agent-smith/agent",
|
|
3
3
|
"description": "Agent Smith: agent runtime",
|
|
4
4
|
"repository": "https://github.com/synw/agent-smith",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.2",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"buildrl": "rm -rf dist/* && rollup -c",
|
|
8
8
|
"build": "rm -rf dist/* && tsc"
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@locallm/types": "^0.4.2",
|
|
16
16
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
17
17
|
"@rollup/plugin-typescript": "^12.1.4",
|
|
18
|
-
"@types/node": "^24.
|
|
18
|
+
"@types/node": "^24.4.0",
|
|
19
19
|
"rollup": "^4.50.1",
|
|
20
20
|
"ts-node": "^10.9.2",
|
|
21
21
|
"tslib": "2.8.1",
|