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

File metadata

File hashes

Hashes for loongsuite_instrumentation_litellm-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5534141ea697a490deaa61a4b0e5ca82793d329c68081346afa9de7203c86737
MD5 daa132457dd36eb53b6bb57f7016b04b
BLAKE2b-256 46861c57025071ec5dda13ff4cbcc9cb56c725912178a77ef6fb1fcf202e6e98

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