openinference-instrumentation-ollama package.
Coverage
The instrumentor traceschat calls made through ollama.chat, ollama.Client.chat, and ollama.AsyncClient.chat, including streaming responses (stream=True) and tool calls. It captures input and output messages, token counts, the model name (also on error spans), and invocation parameters. When plain Python functions are passed as tools, their schemas are captured under llm.tools.N.tool.json_schema.
Other client methods — including generate and embed/embeddings — are not currently traced.
Install
Setup
Make sure a local Ollama server is running and the model you want to use has been pulled, for exampleollama pull llama3.2.
Connect your application to Phoenix and instrument the Ollama client:
from ollama import chat binds the unwrapped method at import time, so calls to that alias will not produce spans. Instrument first, or call ollama.chat(...) via the module attribute.
Run Ollama
AsyncClient.chat), and tool-call examples, see the example scripts in the OpenInference package.
Observe
Now that you have tracing setup, allchat calls made through your Ollama application will be streamed to your running Phoenix for observability and evaluation.

