Skip to content

Conversation

@dmsuehir
Copy link

@dmsuehir dmsuehir commented Jan 9, 2026

Motivation and Context

Running the python native Ollama examples fail when using the OLLAMA_CHAT_MODEL_ID environment variable mentioned in the documentation:

root ➜ .../samples/getting_started/agents/ollama $ export OLLAMA_HOST="http://localhost:11434"
root ➜ .../samples/getting_started/agents/ollama $ export OLLAMA_CHAT_MODEL_ID=qwen3:8b

root ➜ .../samples/getting_started/agents/ollama $ python3 ollama_agent_basic.py 
=== Basic Ollama Chat Client Agent Example ===
=== Non-streaming Response Example ===
Traceback (most recent call last):
  File "/workspace/agent_framework/agent-framework/python/samples/getting_started/agents/ollama/ollama_agent_basic.py", line 68, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/workspace/agent_framework/agent-framework/python/samples/getting_started/agents/ollama/ollama_agent_basic.py", line 63, in main
    await non_streaming_example()
  File "/workspace/agent_framework/agent-framework/python/samples/getting_started/agents/ollama/ollama_agent_basic.py", line 30, in non_streaming_example
    agent = OllamaChatClient().create_agent(
            ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/agent_framework_ollama/_chat_client.py", line 102, in __init__
    raise ServiceInitializationError(
agent_framework.exceptions.ServiceInitializationError: Ollama chat model ID must be provided via model_id or OLLAMA_MODEL_ID environment variable.

When using OLLAMA_MODEL_ID instead of OLLAMA_CHAT_MODEL_ID, then the examples work:

root ➜ .../samples/getting_started/agents/ollama $ export OLLAMA_MODEL_ID=qwen3:8b
root ➜ .../samples/getting_started/agents/ollama $ python3 ollama_agent_basic.py 
=== Basic Ollama Chat Client Agent Example ===
=== Non-streaming Response Example ===
User: What time is it in Seattle? Use a tool call
Result: The current time in Seattle is 10:58 PM.

=== Streaming Response Example ===
User: What time is it in San Francisco? Use a tool call
Agent: The current time in San Francisco is 10:58 PM.

Description

This PR updates the environment variable name in the documentation and comments in the .py file. No actual code is being changed. I tested using OLLAMA_MODEL_ID with all 4 of the native ollama examples from main.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation python labels Jan 9, 2026
@dmsuehir dmsuehir changed the title Dina/ollama env var Python: Fix Ollama model environment variable in documentation Jan 9, 2026
@github-actions github-actions bot changed the title Python: Fix Ollama model environment variable in documentation Python: Dina/ollama env var Jan 9, 2026
@dmsuehir dmsuehir changed the title Python: Dina/ollama env var Python: Fix Ollama model env var in documentation Jan 9, 2026
@dmsuehir
Copy link
Author

dmsuehir commented Jan 9, 2026

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants