Skip to main content

LoongSuite LiteLLM instrumentation

Project description

pypi

This library provides automatic instrumentation for the LiteLLM library, which provides a unified interface to 100+ LLM providers.

Installation

git clone https://github.com/alibaba/loongsuite-python-agent.git
cd loongsuite-python-agent
pip install ./instrumentation-loongsuite/loongsuite-instrumentation-litellm

Configuration

The instrumentation can be enabled/disabled using environment variables:

  • ENABLE_LITELLM_INSTRUMENTOR: Enable/disable instrumentation (default: true)

Usage

from opentelemetry.instrumentation.litellm import LiteLLMInstrumentor
import litellm

# Instrument LiteLLM
LiteLLMInstrumentor().instrument()

# Use LiteLLM as normal
response = litellm.completion(
    model="gpt-3.5-turbo",
    messages=[{"role": "user", "content": "Hello!"}]
)

Features

This instrumentation automatically captures:

  • LLM completion calls (sync and async)

  • Streaming completions

  • Embedding calls

  • Retry mechanisms

  • Tool/function calls

  • Request and response metadata

  • Token usage

  • Model information

The instrumentation follows OpenTelemetry semantic conventions for GenAI operations.

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file loongsuite_instrumentation_litellm-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for loongsuite_instrumentation_litellm-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d073af1ee1f9cdafdee1a648402bd5284eccb4f3ac7b8ef7ec3440983445db5
MD5 85137634d2ec77cb84419809a76f66c0
BLAKE2b-256 87a887775ccebc79805108d4c5b32151e4dc165736896f47d9355ff6d4fd6630

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page