[GH-ISSUE #13106] AsyncClient().chat is not determinable #55190

Open
opened 2026-04-29 08:28:52 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @balabas on GitHub (Nov 16, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/13106

What is the issue?

I am trying to set temp=0 and seed =0 to get deterministic result:

import asyncio
from ollama import AsyncClient
args,kvargs = ('qwen3:8b',), {'messages': [{'role': 'user', 'content': 'generte three random numbers by four digits'}], 'think': None, 'format': None, 'stream': True, 'options': {'temperature': 0.0, 'num_predict': 8196, 'seed': 0, 'num_ctx': 16392}, 'tools': None}


async def chat():
  msg = ""
  async for part in await AsyncClient().chat(*args,**kvargs):
    msg = msg + part['message']['content']
  print(msg)

asyncio.run(asyncio.gather(*[chat() for _ in range(5)]))

but get different numbers in results:

Relevant log output

Here are three random four-digit numbers:  
1. **4567**  
2. **8901**  
3. **2345**  

Let me know if you need them in a specific range or format! 😊
Here are three random four-digit numbers:  
1. **7329**  
2. **4158**  
3. **6093**  

Let me know if you need them in a specific format or range! 😊
Here are three random four-digit numbers:  
1. **4321**  
2. **7654**  
3. **8765**  

Let me know if you need them in a different format! 😊
Here are three random four-digit numbers:  
1. **1234**  
2. **5678**  
3. **9012**  

Let me know if you need them to be unique or follow a specific pattern! 😊
Here are three random four-digit numbers:  
1. **3847**  
2. **1925**  
3. **6073**  

Let me know if you need them in a different format! 😊

OS

Linux

GPU

NVIDIA GeForce RTX 3090

CPU

No response

Ollama version

0.12.11

Originally created by @balabas on GitHub (Nov 16, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/13106 ### What is the issue? I am trying to set temp=0 and seed =0 to get deterministic result: ``` import asyncio from ollama import AsyncClient args,kvargs = ('qwen3:8b',), {'messages': [{'role': 'user', 'content': 'generte three random numbers by four digits'}], 'think': None, 'format': None, 'stream': True, 'options': {'temperature': 0.0, 'num_predict': 8196, 'seed': 0, 'num_ctx': 16392}, 'tools': None} async def chat(): msg = "" async for part in await AsyncClient().chat(*args,**kvargs): msg = msg + part['message']['content'] print(msg) asyncio.run(asyncio.gather(*[chat() for _ in range(5)])) ``` but get different numbers in results: ### Relevant log output ```shell Here are three random four-digit numbers: 1. **4567** 2. **8901** 3. **2345** Let me know if you need them in a specific range or format! 😊 Here are three random four-digit numbers: 1. **7329** 2. **4158** 3. **6093** Let me know if you need them in a specific format or range! 😊 Here are three random four-digit numbers: 1. **4321** 2. **7654** 3. **8765** Let me know if you need them in a different format! 😊 Here are three random four-digit numbers: 1. **1234** 2. **5678** 3. **9012** Let me know if you need them to be unique or follow a specific pattern! 😊 Here are three random four-digit numbers: 1. **3847** 2. **1925** 3. **6073** Let me know if you need them in a different format! 😊 ``` ### OS Linux ### GPU NVIDIA GeForce RTX 3090 ### CPU _No response_ ### Ollama version 0.12.11
GiteaMirror added the bug label 2026-04-29 08:28:52 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#55190