From 56e47d6c392d8d2311ad36e09263fce80922d134 Mon Sep 17 00:00:00 2001 From: ItzCrazyKns <95534749+ItzCrazyKns@users.noreply.github.com> Date: Sat, 13 Dec 2025 22:19:38 +0530 Subject: [PATCH] feat(ollama-llm): use hash to generate id --- src/lib/models/providers/ollama/ollamaLLM.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/models/providers/ollama/ollamaLLM.ts b/src/lib/models/providers/ollama/ollamaLLM.ts index 7e53786..0b88393 100644 --- a/src/lib/models/providers/ollama/ollamaLLM.ts +++ b/src/lib/models/providers/ollama/ollamaLLM.ts @@ -161,8 +161,13 @@ class OllamaLLM extends BaseLLM { yield { contentChunk: chunk.message.content, toolCallChunk: - chunk.message.tool_calls?.map((tc) => ({ - id: crypto.randomUUID(), + chunk.message.tool_calls?.map((tc, i) => ({ + id: crypto + .createHash('sha256') + .update( + `${i}-${tc.function.name}`, + ) /* Ollama currently doesn't return a tool call ID so we're creating one based on the index and tool call name */ + .digest('hex'), name: tc.function.name, arguments: tc.function.arguments, })) || [],