open-agents-ai 0.178.0 → 0.180.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/index.js +12 -22
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39161,30 +39161,26 @@ async function checkToolSupport(modelName, backendUrl = "http://localhost:11434"
|
|
|
39161
39161
|
if (_toolSupportCache.has(modelName))
|
|
39162
39162
|
return _toolSupportCache.get(modelName);
|
|
39163
39163
|
try {
|
|
39164
|
-
const resp = await fetch(`${backendUrl.replace(/\/+$/, "")}/api/
|
|
39164
|
+
const resp = await fetch(`${backendUrl.replace(/\/+$/, "")}/api/chat`, {
|
|
39165
39165
|
method: "POST",
|
|
39166
39166
|
headers: { "Content-Type": "application/json" },
|
|
39167
|
-
body: JSON.stringify({
|
|
39168
|
-
|
|
39167
|
+
body: JSON.stringify({
|
|
39168
|
+
model: modelName,
|
|
39169
|
+
messages: [{ role: "user", content: "test" }],
|
|
39170
|
+
tools: [{ type: "function", function: { name: "test", description: "test", parameters: { type: "object", properties: {} } } }],
|
|
39171
|
+
stream: false,
|
|
39172
|
+
options: { num_predict: 1 }
|
|
39173
|
+
}),
|
|
39174
|
+
signal: AbortSignal.timeout(1e4)
|
|
39169
39175
|
});
|
|
39170
|
-
|
|
39171
|
-
_toolSupportCache.set(modelName, false);
|
|
39172
|
-
return false;
|
|
39173
|
-
}
|
|
39174
|
-
const data = await resp.json();
|
|
39175
|
-
const template = data.template ?? "";
|
|
39176
|
-
const hasTools = template.includes("{{.Tools}}") || template.includes("{{ .Tools }}");
|
|
39176
|
+
const hasTools = resp.ok;
|
|
39177
39177
|
_toolSupportCache.set(modelName, hasTools);
|
|
39178
39178
|
return hasTools;
|
|
39179
39179
|
} catch {
|
|
39180
|
-
_toolSupportCache.set(modelName,
|
|
39181
|
-
return
|
|
39180
|
+
_toolSupportCache.set(modelName, true);
|
|
39181
|
+
return true;
|
|
39182
39182
|
}
|
|
39183
39183
|
}
|
|
39184
|
-
async function needsTextToolMode(modelName, backendUrl) {
|
|
39185
|
-
const hasTools = await checkToolSupport(modelName, backendUrl);
|
|
39186
|
-
return !hasTools;
|
|
39187
|
-
}
|
|
39188
39184
|
function detectSystemSpecs() {
|
|
39189
39185
|
let totalRamGB = 0;
|
|
39190
39186
|
let availableRamGB = 0;
|
|
@@ -60120,12 +60116,6 @@ ${lines.join("\n")}
|
|
|
60120
60116
|
});
|
|
60121
60117
|
runner.setWorkingDirectory(repoRoot);
|
|
60122
60118
|
_activeRunnerRef = runner;
|
|
60123
|
-
needsTextToolMode(config.model, config.backendUrl).then((needsText) => {
|
|
60124
|
-
if (needsText) {
|
|
60125
|
-
runner.options.textToolMode = true;
|
|
60126
|
-
}
|
|
60127
|
-
}).catch(() => {
|
|
60128
|
-
});
|
|
60129
60119
|
const tools = buildTools(repoRoot, config, contextWindowSize);
|
|
60130
60120
|
if (contextWindowSize && contextWindowSize > 0) {
|
|
60131
60121
|
for (const tool of tools) {
|
package/package.json
CHANGED