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);