Respan instrumentation plugin for LiteLLM
Project description
Respan LiteLLM Instrumentation
Respan instrumentation plugin for LiteLLM. It
registers a LiteLLM CustomLogger callback and emits canonical Respan chat
spans into respan-tracing.
Installation
pip install respan-ai respan-instrumentation-litellm litellm
Usage
import os
import litellm
from respan import Respan, workflow
from respan_instrumentation_litellm import LiteLLMInstrumentor
respan = Respan(
api_key=os.environ["RESPAN_API_KEY"],
app_name="litellm-example",
instrumentations=[LiteLLMInstrumentor()],
)
@workflow(name="litellm_quickstart.workflow")
def run_completion() -> str:
response = litellm.completion(
api_key=os.environ["RESPAN_API_KEY"],
api_base=os.getenv("RESPAN_GATEWAY_BASE_URL", "https://api.respan.ai/api"),
model=os.getenv("RESPAN_MODEL", "gpt-4o-mini"),
messages=[{"role": "user", "content": "Say hello in one sentence."}],
)
return response.choices[0].message.content
print(run_completion())
respan.flush()
Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
include_content |
bool |
True |
Capture request messages and assistant response content on chat spans. |
Use Respan(..., customer_identifier=..., thread_identifier=..., metadata=...)
or respan.propagate_attributes(...) to attach Respan attributes to LiteLLM
spans.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file respan_instrumentation_litellm-0.1.0.tar.gz.
File metadata
- Download URL: respan_instrumentation_litellm-0.1.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.4 CPython/3.12.12 Darwin/25.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cf4f4e2173c1c8cea5ad5bb397c04c504549133127a73c6f599b742e332306b
|
|
| MD5 |
2078990cdda6fba8303b34ce388e0cc1
|
|
| BLAKE2b-256 |
810b02d1f052638ebd8259a842777f30dafdcc0b175fce2271936b3ba64760fd
|
File details
Details for the file respan_instrumentation_litellm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: respan_instrumentation_litellm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.4 CPython/3.12.12 Darwin/25.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69193b89230df7ab2ad19f7d09537a064814bf33e6269a69a00307853ef41b9e
|
|
| MD5 |
698357fba43fa20e2c0a86387ba1e144
|
|
| BLAKE2b-256 |
a2ab79c64c5ef87270605f2334e57d696a8ab51bb5ff6772d03cf8aff1eb9c06
|