I am trying to run the notebook locally using ollama, to test how small model may work with agentic workflows.
I set the model to ollama:local-model and it runs and connects well to ollama, my problem is that because inference is slow, (specially with reasoning models) i reach a timeout error, and the workflow dies.
I tried to pass as a parameter a timeout value, but it does not seem to work. Basically I do something similar to this:
import aisuite as ai
client = ai.Client()
response = client.chat.completions.create(
model="ollama:gpt-oss",
messages=[{"role": "user", "content": prompt}],
temperature=0,
timeout=150,
)
Any ideas how to increase the waiting time so it does not time out?
I paste the Traceback error for other possible searches:
Traceback (most recent call last):
File “/home/david/MOOC/agentic_AI_AndreNg/02_sql/Lab2.py”, line 307, in
feedback, sql_V2 = refine_sql(
~~~~~~~~~~^
question=question,
^^^^^^^^^^^^^^^^^^
…<3 lines>…
model=“ollama:gpt-oss”
^^^^^^^^^^^^^^^^^^^^^^
)
^
File “/home/david/MOOC/agentic_AI_AndreNg/02_sql/Lab2.py”, line 274, in refine_sql
response = client.chat.completions.create(
model=model,
…<2 lines>…
timeout=150,
)
File “/home/david/miniconda3/envs/ooo/lib/python3.13/site-packages/aisuite/client.py”, line 245, in create
response = provider.chat_completions_create(model_name, messages, **kwargs)
File “/home/david/miniconda3/envs/ooo/lib/python3.13/site-packages/aisuite/providers/ollama_provider.py”, line 52, in chat_completions_create
raise LLMError(f"An error occurred: {e}")
aisuite.provider.LLMError: An error occurred: timed out
Somehow I need that the timeout parameter reaches the httpx.post method, as in per the traceback:
Traceback (most recent call last):
File “/home/david/miniconda3/envs/ooo/lib/python3.13/site-packages/aisuite/providers/ollama_provider.py”, line 41, in chat_completions_create
response = httpx.post(
self.url.rstrip(“/”) + self._CHAT_COMPLETION_ENDPOINT,
json=data,
timeout=self.timeout,
)
I just do not know where to include this parameter in the chat_completion_create method.