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.
Metadata
Release files for respan-instrumentation-litellm 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 | |
|---|---|---|---|
| respan_instrumentation_litellm-0.1.1.tar.gz | 9.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| respan_instrumentation_litellm-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.6 kB
Release files / respan_instrumentation_litellm-0.1.1.tar.gz
| Download URL | respan_instrumentation_litellm-0.1.1.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e980faf6d05957bea43c7f0d1e98df3d016893be7f65b7099369aeea89978e80
|
|
BLAKE2b-256 checksum How to use checksums |
5e3ac60a5b220f402de52232e8a3b652ecd5ee6d9d14b95c844ca8655030e2d3
|
| 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_litellm-0.1.1-py3-none-any.whl
| Download URL | respan_instrumentation_litellm-0.1.1-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c613f0177cf501afce55583e1141f2a7db87d7901224bd9ad22616d8f50761f
|
|
BLAKE2b-256 checksum How to use checksums |
4274dec5b54d259baded736301dbbfa76c7bd6bf65dc2f9a316ada197057fe21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|