respan-instrumentation-ollama
Respan instrumentation plugin for Ollama. It instruments the official Ollama Python client and emits chat, completion, and embedding spans into the Respan tracing pipeline.
Chat spans include canonical request tool definitions and only the tool calls emitted by the current response turn. Streamed calls are marked with llm.is_streaming, and provider HTTP failures retain their explicit status code.
Configuration
1. Install
pip install respan-ai respan-instrumentation-ollama ollama
ollama is the official Ollama Python client. A running Ollama server is required for real model calls.
2. Set Environment Variables
| Variable | Required | Description |
|---|---|---|
RESPAN_API_KEY |
Yes | Your Respan API key. |
RESPAN_BASE_URL |
No | Defaults to https://api.respan.ai/api. |
OLLAMA_HOST |
No | Ollama server URL. Defaults to the Ollama client default. |
OLLAMA_MODEL |
No | Model used by your application. |
Quickstart
import os
from dotenv import load_dotenv
from ollama import Client
from respan import Respan, workflow
from respan_instrumentation_ollama import OllamaInstrumentor
load_dotenv()
respan = Respan(
api_key=os.environ["RESPAN_API_KEY"],
base_url=os.getenv("RESPAN_BASE_URL", "https://api.respan.ai/api"),
instrumentations=[OllamaInstrumentor()],
)
client = Client(host=os.getenv("OLLAMA_HOST"))
@workflow(name="ollama_quickstart")
def run() -> str:
response = client.chat(
model=os.getenv("OLLAMA_MODEL", "llama3.2"),
messages=[{"role": "user", "content": "Reply with one concise sentence."}],
)
return response["message"]["content"]
print(run())
respan.flush()
respan.shutdown()
Further Reading
See the Respan example projects for runnable scripts.
Metadata
Release files for respan-instrumentation-ollama 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| respan_instrumentation_ollama-0.1.1.tar.gz | 12.7 kB | Without provenance | Details for respan_instrumentation_ollama-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| respan_instrumentation_ollama-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for respan_instrumentation_ollama-0.1.1-py3-none-any.whl |
Total release size: 27.2 kB
Release files / respan_instrumentation_ollama-0.1.1.tar.gz
| Download URL | respan_instrumentation_ollama-0.1.1.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f94d2e96e46bc4114391a2d0294f5572736127860e27549cbd5f6799eff9cb6e
|
|
BLAKE2b-256 checksum How to use checksums |
6bd9cbaff00733e3517e7284df5ac1787b6c627c7d6a1312d1c69be08b13fe7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / respan_instrumentation_ollama-0.1.1-py3-none-any.whl
| Download URL | respan_instrumentation_ollama-0.1.1-py3-none-any.whl |
|---|---|
| Size | 14.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0e98d75f468df06021cb81489a742f061f590065042e86c349c68874372b285a
|
|
BLAKE2b-256 checksum How to use checksums |
97cf37e7961b09658d666ee940b1e1818bd910bbeb84acd77a1e91913aee7444
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for respan-instrumentation-ollama 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.