evOo-local/scripts/test-llama-stream-tools.ts
cynarAI 6c7eed7580 Initial clean evOo-local from f00577b
Fresh history cut from cynarAI/evoo antigravity-handoff/project-timeline
(Voice First + project timeline). Brand docs/titles as evOo; keep @rakazo/*
packages as tech debt. Excludes node_modules, caches, secrets, voice blobs.
2026-09-20 17:15:16 +02:00

47 lines
1.1 KiB
TypeScript

async function test() {
const req = {
model: "gemma-4-26b-a4b",
stream: true,
messages: [
{ role: "system", content: "You have tools. You MUST use the shell tool to list files." },
{ role: "user", content: "List the files." },
],
tools: [
{
type: "function",
function: {
name: "shell",
description: "Execute a shell command",
parameters: {
type: "object",
properties: {
command: { type: "string" },
},
required: ["command"],
},
},
},
],
};
const res = await fetch("http://100.114.51.16:1240/v1/chat/completions", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(req),
});
const reader = res.body?.getReader();
const decoder = new TextDecoder();
let done = false;
while (!done) {
const chunk = await reader?.read();
if (!chunk) break;
done = chunk.done;
if (chunk.value) {
console.log("CHUNK:", decoder.decode(chunk.value));
}
}
}
test().catch(console.error);