@agent-smith/task 0.0.4 → 0.0.6
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/inferparams.js +5 -0
- package/dist/task.js +10 -1
- package/dist/templates.js +5 -1
- package/dist/variables.js +1 -0
- package/package.json +11 -11
package/dist/inferparams.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
function formatInferParams(ip, conf, tpl) {
|
|
2
|
+
//console.log("TIP", ip);
|
|
3
|
+
//console.log("TC", conf);
|
|
2
4
|
if (!ip?.stop) {
|
|
3
5
|
ip.stop = [];
|
|
4
6
|
}
|
|
@@ -12,6 +14,9 @@ function formatInferParams(ip, conf, tpl) {
|
|
|
12
14
|
_ip[k] = v;
|
|
13
15
|
}
|
|
14
16
|
}
|
|
17
|
+
if (conf?.model) {
|
|
18
|
+
_ip.model = conf.model;
|
|
19
|
+
}
|
|
15
20
|
return _ip;
|
|
16
21
|
}
|
|
17
22
|
export { formatInferParams, };
|
package/dist/task.js
CHANGED
|
@@ -46,7 +46,7 @@ class Task {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
if (!found) {
|
|
49
|
-
if (this.agent.lm.providerType
|
|
49
|
+
if (["ollama", "llamacpp"].includes(this.agent.lm.providerType)) {
|
|
50
50
|
model = { name: conf.modelname };
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
@@ -55,6 +55,7 @@ class Task {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
+
//console.log("CONF", conf)
|
|
58
59
|
if (this.agent.lm.providerType == "ollama") {
|
|
59
60
|
await this.agent.lm.loadModel(model.name, ctx);
|
|
60
61
|
}
|
|
@@ -80,15 +81,23 @@ class Task {
|
|
|
80
81
|
this.def.inferParams = formatInferParams(this.def.inferParams ?? {}, conf ?? {});
|
|
81
82
|
finalPrompt = this.def.prompt.replace("{prompt}", params.prompt);
|
|
82
83
|
}
|
|
84
|
+
// model
|
|
85
|
+
if (model) {
|
|
86
|
+
this.def.inferParams.model = model;
|
|
87
|
+
}
|
|
83
88
|
if (agentToolsList.length > 0) {
|
|
84
89
|
options.tools = agentToolsList;
|
|
85
90
|
}
|
|
91
|
+
if (conf?.debug) {
|
|
92
|
+
options.debug = true;
|
|
93
|
+
}
|
|
86
94
|
if (conf?.debug) {
|
|
87
95
|
console.log("-----------", model.name, "- Template:", tpl.name, "- Ctx:", ctx, "-----------");
|
|
88
96
|
console.log(finalPrompt);
|
|
89
97
|
console.log("----------------------------------------------");
|
|
90
98
|
console.log("Infer params:", this.def.inferParams);
|
|
91
99
|
console.log("----------------------------------------------");
|
|
100
|
+
//options.debug = true
|
|
92
101
|
}
|
|
93
102
|
if (this.agent.lm.providerType == "ollama") {
|
|
94
103
|
if (!this.def.inferParams?.extra) {
|
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/dist/variables.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-smith/task",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "A toolkit to create human friendly agents: the language model tasks module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,26 +14,26 @@
|
|
|
14
14
|
"docs": "typedoc --entryPointStrategy expand"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@agent-smith/agent": "^0.0.
|
|
17
|
+
"@agent-smith/agent": "^0.0.7",
|
|
18
18
|
"@agent-smith/tfm": "^0.1.2",
|
|
19
|
-
"@locallm/api": "0.
|
|
20
|
-
"modprompt": "^0.12.
|
|
19
|
+
"@locallm/api": "^0.5.1",
|
|
20
|
+
"modprompt": "^0.12.2",
|
|
21
21
|
"yaml": "^2.8.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@locallm/types": "^0.4.2",
|
|
25
|
-
"@rollup/plugin-node-resolve": "^16.0.
|
|
25
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
26
26
|
"@rollup/plugin-terser": "^0.4.4",
|
|
27
|
-
"@rollup/plugin-typescript": "^12.
|
|
28
|
-
"@types/node": "^24.
|
|
27
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
28
|
+
"@types/node": "^24.9.2",
|
|
29
29
|
"markdown-it-replace-link": "^1.2.2",
|
|
30
30
|
"restmix": "^0.5.0",
|
|
31
|
-
"rollup": "^4.
|
|
31
|
+
"rollup": "^4.52.5",
|
|
32
32
|
"tslib": "^2.8.1",
|
|
33
|
-
"typedoc": "^0.28.
|
|
34
|
-
"typedoc-plugin-markdown": "^4.
|
|
33
|
+
"typedoc": "^0.28.14",
|
|
34
|
+
"typedoc-plugin-markdown": "^4.9.0",
|
|
35
35
|
"typedoc-plugin-rename-defaults": "^0.7.3",
|
|
36
|
-
"typescript": "^5.9.
|
|
36
|
+
"typescript": "^5.9.3"
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
39
39
|
"dist"
|