@agent-smith/cli 0.0.84 → 0.0.85
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.
|
@@ -35,14 +35,7 @@ async function executeTask(name, payload, options, quiet) {
|
|
|
35
35
|
let hasThink = false;
|
|
36
36
|
let tpl = null;
|
|
37
37
|
if (useTemplates) {
|
|
38
|
-
|
|
39
|
-
const gt = tfm.guess(task.def.model.name);
|
|
40
|
-
if (gt == "none") {
|
|
41
|
-
throw new Error(`Unable to guess the template for ${task.def.model}: please provide a template in the taskDef definition`);
|
|
42
|
-
}
|
|
43
|
-
task.def.model.template = gt;
|
|
44
|
-
}
|
|
45
|
-
tpl = new PromptTemplate(task.def.model.template);
|
|
38
|
+
tpl = new PromptTemplate(model.template ?? "none");
|
|
46
39
|
hasThink = tpl.tags?.think ? true : false;
|
|
47
40
|
}
|
|
48
41
|
const printToken = (t) => {
|
|
@@ -143,6 +136,9 @@ async function executeTask(name, payload, options, quiet) {
|
|
|
143
136
|
conf.inferParams = {};
|
|
144
137
|
}
|
|
145
138
|
conf.inferParams.stream = true;
|
|
139
|
+
if (conf?.model) {
|
|
140
|
+
delete conf.model;
|
|
141
|
+
}
|
|
146
142
|
const tconf = {
|
|
147
143
|
model: model,
|
|
148
144
|
onToolCall: onToolCall,
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { useTemplateForModel } from "@agent-smith/tfm";
|
|
2
2
|
const tfm = useTemplateForModel();
|
|
3
|
+
function guessTemplate(modelname) {
|
|
4
|
+
const gt = tfm.guess(modelname);
|
|
5
|
+
if (gt == "none") {
|
|
6
|
+
throw new Error(`Unable to guess the template for ${modelname}: please provide a template name: --tpl templatename`);
|
|
7
|
+
}
|
|
8
|
+
return gt;
|
|
9
|
+
}
|
|
3
10
|
function configureTaskModel(itConf, taskSpec) {
|
|
4
11
|
let ip = itConf.inferParams;
|
|
5
12
|
let isModelFromTaskFile = false;
|
|
@@ -10,10 +17,22 @@ function configureTaskModel(itConf, taskSpec) {
|
|
|
10
17
|
model.template = itConf.templateName;
|
|
11
18
|
foundTemplate = true;
|
|
12
19
|
}
|
|
20
|
+
if (itConf?.model?.name) {
|
|
21
|
+
if (itConf?.model?.name != taskSpec.model.name) {
|
|
22
|
+
const gt = guessTemplate(itConf.model.name);
|
|
23
|
+
model.template = gt;
|
|
24
|
+
foundTemplate = true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
13
27
|
else if (taskSpec?.model?.template) {
|
|
14
28
|
model.template = taskSpec.model.template;
|
|
15
29
|
foundTemplate = true;
|
|
16
30
|
}
|
|
31
|
+
else {
|
|
32
|
+
const gt = guessTemplate(taskSpec.model.name);
|
|
33
|
+
model.template = gt;
|
|
34
|
+
foundTemplate = true;
|
|
35
|
+
}
|
|
17
36
|
if (itConf?.model?.name) {
|
|
18
37
|
if (taskSpec?.models && Object.keys(taskSpec.models).includes(itConf.model.name)) {
|
|
19
38
|
for (const [k, v] of Object.entries(taskSpec.models)) {
|
|
@@ -37,6 +56,10 @@ function configureTaskModel(itConf, taskSpec) {
|
|
|
37
56
|
}
|
|
38
57
|
}
|
|
39
58
|
}
|
|
59
|
+
else {
|
|
60
|
+
model.name = itConf.model.name;
|
|
61
|
+
foundModel = true;
|
|
62
|
+
}
|
|
40
63
|
}
|
|
41
64
|
else {
|
|
42
65
|
model = taskSpec.model;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@agent-smith/cli",
|
|
3
3
|
"description": "Agent Smith: terminal client for language model agents",
|
|
4
4
|
"repository": "https://github.com/synw/agent-smith",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.85",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"buildrl": "rm -rf dist/* && rollup -c",
|
|
8
8
|
"build": "rm -rf dist/* && tsc",
|