@agent-smith/task 0.1.6 → 0.1.8
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/interfaces.d.ts +3 -4
- package/dist/task.js +6 -4
- package/package.json +7 -6
package/dist/interfaces.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InferenceParams, InferenceResult, InferenceOptions, ToolSpec, HistoryTurn, ToolCallSpec } from "@locallm/types";
|
|
2
|
-
import { PromptTemplate } from "modprompt";
|
|
1
|
+
import type { InferenceParams, InferenceResult, InferenceOptions, ToolSpec, HistoryTurn, ToolCallSpec } from "@locallm/types";
|
|
2
|
+
import type { PromptTemplate } from "modprompt";
|
|
3
3
|
interface ModelSpec {
|
|
4
4
|
name: string;
|
|
5
5
|
template?: string;
|
|
@@ -83,7 +83,6 @@ interface TaskDef {
|
|
|
83
83
|
}
|
|
84
84
|
interface TaskOutput {
|
|
85
85
|
answer: InferenceResult;
|
|
86
|
-
|
|
87
|
-
template?: PromptTemplate;
|
|
86
|
+
template: PromptTemplate;
|
|
88
87
|
}
|
|
89
88
|
export { ModelSpec, TaskInput, TaskDef, TemplateSpec, TaskConf, TaskOutput, TaskVariableDef, TaskOptionalVariableDef, TaskVariables, };
|
package/dist/task.js
CHANGED
|
@@ -46,7 +46,7 @@ class Task {
|
|
|
46
46
|
if (useTemplates) {
|
|
47
47
|
tpl = formatTaskTemplate(this.def, model?.template ? model.template : undefined);
|
|
48
48
|
this.def.inferParams = formatInferParams(this.def.inferParams ?? {}, conf ?? {}, tpl);
|
|
49
|
-
tpl.replacePrompt(this.def.prompt);
|
|
49
|
+
//tpl.replacePrompt(this.def.prompt);
|
|
50
50
|
if (agentToolsList.length > 0) {
|
|
51
51
|
if (!tpl?.toolsDef) {
|
|
52
52
|
throw new Error(`The template ${tpl.name} does not have tools and the task ${this.def.name} specifies some`);
|
|
@@ -54,7 +54,7 @@ class Task {
|
|
|
54
54
|
agentToolsList.forEach((t) => tpl.addTool(t));
|
|
55
55
|
}
|
|
56
56
|
;
|
|
57
|
-
finalPrompt =
|
|
57
|
+
finalPrompt = params.prompt;
|
|
58
58
|
}
|
|
59
59
|
else {
|
|
60
60
|
this.def.inferParams = formatInferParams(this.def.inferParams ?? {}, conf ?? {});
|
|
@@ -69,7 +69,7 @@ class Task {
|
|
|
69
69
|
}
|
|
70
70
|
if (conf?.debug) {
|
|
71
71
|
console.log("-----------", model.name, "- Template:", tpl.name, "- Ctx:", ctx, "-----------");
|
|
72
|
-
console.log(finalPrompt);
|
|
72
|
+
console.log(useTemplates ? tpl.prompt(finalPrompt) : finalPrompt);
|
|
73
73
|
console.log("----------------------------------------------");
|
|
74
74
|
console.log("Infer params:", this.def.inferParams);
|
|
75
75
|
console.log("----------------------------------------------");
|
|
@@ -102,10 +102,12 @@ class Task {
|
|
|
102
102
|
//console.log("RUN AGENT (TASK) params:", this.def.inferParams);
|
|
103
103
|
//console.log("RUN AGENT (TASK) options:", options);
|
|
104
104
|
answer = await this.agent.run(finalPrompt, this.def.inferParams, options, tpl);
|
|
105
|
+
tpl.history = this.agent.history;
|
|
105
106
|
//console.log("RAW ANSWER", answer);
|
|
107
|
+
//console.log("\nHISTORY", this.agent.history);
|
|
106
108
|
}
|
|
107
109
|
//console.log("TASK: ANSWER FINAL:", { answer: answer.result, errors: {}, template: answer.template })
|
|
108
|
-
return { answer,
|
|
110
|
+
return { answer, template: tpl };
|
|
109
111
|
}
|
|
110
112
|
addTools(tools) {
|
|
111
113
|
tools.forEach(t => this.agent.tools[t.name] = t);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-smith/task",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "A toolkit to create human friendly agents: the language model tasks module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,21 +14,22 @@
|
|
|
14
14
|
"docs": "typedoc --entryPointStrategy expand"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@agent-smith/agent": "^0.1.
|
|
17
|
+
"@agent-smith/agent": "^0.1.6",
|
|
18
18
|
"@agent-smith/tfm": "^0.2.0",
|
|
19
19
|
"modprompt": "^0.12.6",
|
|
20
20
|
"yaml": "^2.8.2"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
23
|
+
"@locallm/api": "^0.7.3",
|
|
24
|
+
"openai": "6.15.0",
|
|
25
|
+
"@locallm/types": "^0.6.4",
|
|
25
26
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
26
27
|
"@rollup/plugin-terser": "^0.4.4",
|
|
27
28
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
28
|
-
"@types/node": "^
|
|
29
|
+
"@types/node": "^25.0.3",
|
|
29
30
|
"markdown-it-replace-link": "^1.2.2",
|
|
30
31
|
"restmix": "^0.6.1",
|
|
31
|
-
"rollup": "^4.
|
|
32
|
+
"rollup": "^4.54.0",
|
|
32
33
|
"tslib": "^2.8.1",
|
|
33
34
|
"typedoc": "^0.28.15",
|
|
34
35
|
"typedoc-plugin-markdown": "^4.9.0",
|