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.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for loongsuite_instrumentation_litellm-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 63d8b204a37367c260a4be6ef8988235cd2096755016c01480d1eccb25b8a196
MD5 3e57f2980be955cc72814a0958f4b69a
BLAKE2b-256 75a92baa9e4efdbc0c733c5b48f879e50316ecc02c46f6c3ec0e3dff42db83a6

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