@agent-smith/task 0.0.5 → 0.1.0
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/task.js +6 -7
- package/dist/templates.js +5 -1
- package/package.json +6 -6
package/dist/task.js
CHANGED
|
@@ -15,7 +15,7 @@ class Task {
|
|
|
15
15
|
return new Task(agent, data);
|
|
16
16
|
}
|
|
17
17
|
async run(params, conf) {
|
|
18
|
-
//console.log("
|
|
18
|
+
//console.log("TASK CONF", conf);
|
|
19
19
|
//console.log("TOOLS", this.agent.tools);
|
|
20
20
|
if (!params?.prompt) {
|
|
21
21
|
throw new Error("Please provide a prompt parameter");
|
|
@@ -46,11 +46,11 @@ class Task {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
if (!found) {
|
|
49
|
-
if (["ollama", "llamacpp"].includes(this.agent.lm.providerType)) {
|
|
49
|
+
if (["ollama", "llamacpp", "openai"].includes(this.agent.lm.providerType)) {
|
|
50
50
|
model = { name: conf.modelname };
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
|
-
throw new Error(`
|
|
53
|
+
throw new Error(`Provider type ${this.agent.lm.providerType}: no model found for ${conf.modelname}. Available models:\n${params?.models}`);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -88,16 +88,13 @@ class Task {
|
|
|
88
88
|
if (agentToolsList.length > 0) {
|
|
89
89
|
options.tools = agentToolsList;
|
|
90
90
|
}
|
|
91
|
-
if (conf?.debug) {
|
|
92
|
-
options.debug = true;
|
|
93
|
-
}
|
|
94
91
|
if (conf?.debug) {
|
|
95
92
|
console.log("-----------", model.name, "- Template:", tpl.name, "- Ctx:", ctx, "-----------");
|
|
96
93
|
console.log(finalPrompt);
|
|
97
94
|
console.log("----------------------------------------------");
|
|
98
95
|
console.log("Infer params:", this.def.inferParams);
|
|
99
96
|
console.log("----------------------------------------------");
|
|
100
|
-
|
|
97
|
+
options.debug = true;
|
|
101
98
|
}
|
|
102
99
|
if (this.agent.lm.providerType == "ollama") {
|
|
103
100
|
if (!this.def.inferParams?.extra) {
|
|
@@ -114,6 +111,8 @@ class Task {
|
|
|
114
111
|
if (this.def?.shots) {
|
|
115
112
|
options.history = this.def.shots;
|
|
116
113
|
}
|
|
114
|
+
//console.log("RUN AGENT (TASK) params:", this.def.inferParams);
|
|
115
|
+
//console.log("RUN AGENT (TASK) options:", options);
|
|
117
116
|
answer = await this.agent.run(finalPrompt, this.def.inferParams, options);
|
|
118
117
|
}
|
|
119
118
|
else {
|
package/dist/templates.js
CHANGED
|
@@ -10,7 +10,7 @@ function formatTaskTemplate(taskDef, templateName) {
|
|
|
10
10
|
if ((!taskDef.model?.template)) {
|
|
11
11
|
const gt = tfm.guess(taskDef.model.name);
|
|
12
12
|
if (gt == "none") {
|
|
13
|
-
throw new Error(`Unable to guess the template for ${taskDef.model}: please provide a template in the
|
|
13
|
+
throw new Error(`Unable to guess the template for ${taskDef.model}: please provide a template name in the task definition`);
|
|
14
14
|
}
|
|
15
15
|
taskDef.model.template = gt;
|
|
16
16
|
}
|
|
@@ -25,6 +25,10 @@ function formatTaskTemplate(taskDef, templateName) {
|
|
|
25
25
|
if (taskDef.template?.assistant) {
|
|
26
26
|
tpl.afterAssistant(" " + taskDef.template.assistant);
|
|
27
27
|
}
|
|
28
|
+
if (taskDef.template?.stop) {
|
|
29
|
+
const tps = tpl?.stop ?? [];
|
|
30
|
+
tpl.stop = [...tps, ...taskDef.template.stop];
|
|
31
|
+
}
|
|
28
32
|
}
|
|
29
33
|
// model overrides
|
|
30
34
|
if (taskDef.model?.system) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-smith/task",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "A toolkit to create human friendly agents: the language model tasks module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"docs": "typedoc --entryPointStrategy expand"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@agent-smith/agent": "^0.0
|
|
17
|
+
"@agent-smith/agent": "^0.1.0",
|
|
18
18
|
"@agent-smith/tfm": "^0.1.2",
|
|
19
|
-
"@locallm/api": "^0.
|
|
20
|
-
"modprompt": "^0.12.
|
|
19
|
+
"@locallm/api": "^0.6.1",
|
|
20
|
+
"modprompt": "^0.12.3",
|
|
21
21
|
"yaml": "^2.8.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
26
26
|
"@rollup/plugin-terser": "^0.4.4",
|
|
27
27
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
28
|
-
"@types/node": "^24.
|
|
28
|
+
"@types/node": "^24.10.0",
|
|
29
29
|
"markdown-it-replace-link": "^1.2.2",
|
|
30
30
|
"restmix": "^0.5.0",
|
|
31
|
-
"rollup": "^4.
|
|
31
|
+
"rollup": "^4.53.2",
|
|
32
32
|
"tslib": "^2.8.1",
|
|
33
33
|
"typedoc": "^0.28.14",
|
|
34
34
|
"typedoc-plugin-markdown": "^4.9.0",
|