feat(ollama-llm): use hash to generate id

This commit is contained in:
ItzCrazyKns
2025-12-13 22:19:38 +05:30
parent fd745577d6
commit 56e47d6c39

View File

@@ -161,8 +161,13 @@ class OllamaLLM extends BaseLLM<OllamaConfig> {
yield { yield {
contentChunk: chunk.message.content, contentChunk: chunk.message.content,
toolCallChunk: toolCallChunk:
chunk.message.tool_calls?.map((tc) => ({ chunk.message.tool_calls?.map((tc, i) => ({
id: crypto.randomUUID(), 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, name: tc.function.name,
arguments: tc.function.arguments, arguments: tc.function.arguments,
})) || [], })) || [],