OpenTelemetry-native Auto instrumentation library for monitoring LLM Applications and GPUs, facilitating the integration of observability into your GenAI-driven projects
Project description
OpenTelemetry-native
AI Observability, Evaluation and Guardrails Framework
Documentation | Quickstart | Roadmap | Feature Request | Report a Bug
OpenLIT SDK is a monitoring framework built on top of OpenTelemetry that gives your complete Observability for your AI stack, from LLMs to vector databases and GPUs, with just one line of code with tracing and metrics. It also allows you to send the generated traces and metrics to your existing monitoring tools like Grafana, New Relic, and more.
This project proudly follows and maintains the Semantic Conventions with the OpenTelemetry community, consistently updating to align with the latest standards in Observability.
โก Features
- ๐ Auto Instrumentation: Works with 40+ LLM providers, Agents, Vector databases, and GPUs with just one line of code.
- ๐ญ OpenTelemetry-Native Observability SDKs: Vendor-neutral SDKs that can send traces and metrics to your existing observability tool like Prometheus and Jaeger.
- ๐ฒ Cost Tracking for Custom and Fine-Tuned Models: Pass custom pricing files for accurate budgeting of custom and fine-tuned models.
- ๐ Suppport for OpenLIT Features: Includes suppprt for prompt management and secrets management features available in OpenLIT.
Auto Instrumentation Capabilities
Supported Destinations
- โ OpenTelemetry Collector
- โ Prometheus + Tempo
- โ Prometheus + Jaeger
- โ Grafana Cloud
- โ New Relic
- โ Elastic
- โ Middleware.io
- โ HyperDX
- โ DataDog
- โ SigNoz
- โ OneUptime
- โ Dynatrace
- โ OpenObserve
- โ Highlight.io
๐ฟ Installation
pip install openlit
๐ Getting Started with LLM Observability
Step 1: Install OpenLIT SDK
Open your command line or terminal and run:
pip install openlit
Step 2: Initialize OpenLIT in your Application
Integrate OpenLIT into your AI applications by adding the following lines to your code.
import openlit
openlit.init()
Configure the telemetry data destination as follows:
Purpose | Parameter/Environment Variable | For Sending to OpenLIT |
---|---|---|
Send data to an HTTP OTLP endpoint | otlp_endpoint or OTEL_EXPORTER_OTLP_ENDPOINT |
"http://127.0.0.1:4318" |
Authenticate telemetry backends | otlp_headers or OTEL_EXPORTER_OTLP_HEADERS |
Not required by default |
๐ก Info: If the
otlp_endpoint
orOTEL_EXPORTER_OTLP_ENDPOINT
is not provided, the OpenLIT SDK will output traces directly to your console, which is recommended during the development phase.
Example
Initialize using Function Arguments
Add the following two lines to your application code:
import openlit
openlit.init(
otlp_endpoint="YOUR_OTEL_ENDPOINT",
otlp_headers ="YOUR_OTEL_ENDPOINT_AUTH"
)
Initialize using Environment Variables
Add the following two lines to your application code:
import openlit
openlit.init()
Then, configure the your OTLP endpoint using environment variable:
export OTEL_EXPORTER_OTLP_ENDPOINT = "YOUR_OTEL_ENDPOINT"
export OTEL_EXPORTER_OTLP_HEADERS = "YOUR_OTEL_ENDPOINT_AUTH"
Step 3: Visualize and Optimize!
Now that your LLM observability data is being collected and sent to configured OpenTelemetry destination, the next step is to visualize and analyze this data. This will help you understand your LLM application's performance and behavior and identify where it can be improved.
If you want to use OpenLIT's Observability Dashboard to monitor LLM usageโlike cost, tokens, and user interactionsโplease check out our Quickstart Guide.
If you're sending metrics and traces to other observability tools, take a look at our Connections Guide to start using a pre-built dashboard we have created for these tools.
Configuration
Observability - openlit.init()
Below is a detailed overview of the configuration options available, allowing you to adjust OpenLIT's behavior and functionality to align with your specific observability needs:
Argument | Description | Default Value | Required |
---|---|---|---|
environment |
The deployment environment of the application. | "default" |
Yes |
application_name |
Identifies the name of your application. | "default" |
Yes |
tracer |
An instance of OpenTelemetry Tracer for tracing operations. | None |
No |
meter |
An OpenTelemetry Metrics instance for capturing metrics. | None |
No |
otlp_endpoint |
Specifies the OTLP endpoint for transmitting telemetry data. | None |
No |
otlp_headers |
Defines headers for the OTLP exporter, useful for backends requiring authentication. | None |
No |
disable_batch |
A flag to disable batch span processing, favoring immediate dispatch. | False |
No |
trace_content |
Enables tracing of content for deeper insights. | True |
No |
disabled_instrumentors |
List of instrumentors to disable. | None |
No |
disable_metrics |
If set, disables the collection of metrics. | False |
No |
pricing_json |
URL or file path of the pricing JSON file. | https://github.com/openlit/openlit/blob/main/assets/pricing.json |
No |
collect_gpu_stats |
Flag to enable or disable GPU metrics collection. | False |
No |
OpenLIT Prompt Hub - openlit.get_prompt()
Below are the parameters for use with the SDK for OpenLIT Prompt Hub for prompt management:
Parameter | Description |
---|---|
url |
Sets the OpenLIT URL. Defaults to the OPENLIT_URL environment variable. |
api_key |
Sets the OpenLIT API Key. Can also be provided via the OPENLIT_API_KEY environment variable. |
name |
Sets the name to fetch a unique prompt. Use this or prompt_id . |
prompt_id |
Sets the ID to fetch a unique prompt. Use this or name . Optional |
version |
Set to True to get the prompt with variable substitution.. Optional |
shouldCompile |
Boolean value that compiles the prompt using the provided variables. Optional |
variables |
Sets the variables for prompt compilation. Optional |
meta_properties |
Sets the meta-properties for storing in the prompt's access history metadata. Optional |
OpenLIT Vault - openlit.get_secrets()
Below are the parameters for use with the SDK for OpenLIT Vault for secret management:
Parameter | Description |
---|---|
url |
Sets the Openlit URL. Defaults to the OPENLIT_URL environment variable. |
api_key |
Sets the OpenLIT API Key. Can also be provided via the OPENLIT_API_KEY environment variable. |
key |
Sets the key to fetch a specific secret. Optional |
should_set_env |
Boolean value that sets all the secrets as environment variables for the application. Optional |
tags |
Sets the tags for fetching only the secrets that have the mentioned tags assigned. Optional |
๐ฃ๏ธ Roadmap
We are dedicated to continuously improving OpenLIT SDKs. Here's a look at what's been accomplished and what's on the horizon:
Feature | Status |
---|---|
OpenTelmetry auto-instrumentation for LLM Providers like OpenAI, Anthropic | โ Completed |
OpenTelmetry auto-instrumentation for Vector databases like Pinecone, Chroma | โ Completed |
OpenTelmetry auto-instrumentation for LLM Frameworks like LangChain, LlamaIndex | โ Completed |
OpenTelemetry-native auto-instrumentation for NVIDIA GPU Monitoring | โ Completed |
Real-Time Guardrails Implementation | โ Completed |
Programmatic Evaluation for LLM Response | โ Completed |
OpenTelmetry auto-instrumentation for Agent Frameworks like CrewAI, DsPy | ๐ Coming Soon |
๐ฑ Contributing
Whether it's big or small, we love contributions ๐. Check out our Contribution guide to get started
Unsure where to start? Here are a few ways to get involved:
- Join our Slack or Discord community to discuss ideas, share feedback, and connect with both our team and the wider OpenLIT community.
Your input helps us grow and improve, and we're here to support you every step of the way.
๐ Community & Support
Connect with the OpenLIT community and maintainers for support, discussions, and updates:
- ๐ If you like it, Leave a star on our GitHub
- ๐ Join our Slack or Discord community for live interactions and questions.
- ๐ Report bugs on our GitHub Issues to help us improve OpenLIT.
- ๐ Follow us on X for the latest updates and news.
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
File details
Details for the file openlit-1.32.3.tar.gz
.
File metadata
- Download URL: openlit-1.32.3.tar.gz
- Upload date:
- Size: 115.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 592073b89132c9cdad926a1c17f7b56bd891f1cc896adcd320d7d1a5bfcb687c |
|
MD5 | 8f95fdfb0b565bc1a059ded41928bbdf |
|
BLAKE2b-256 | 017c15bd3781eed5618a7839a38c1c183990b37cd90918381501dbbf2fbd36a0 |
File details
Details for the file openlit-1.32.3-py3-none-any.whl
.
File metadata
- Download URL: openlit-1.32.3-py3-none-any.whl
- Upload date:
- Size: 220.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4dc502f1f668b88f8628f694a4add877b8dc4bb57799ac64ee13507f3be1f87b |
|
MD5 | beda4546587789d9cf3ab167a16b138b |
|
BLAKE2b-256 | dc4c9a8d822c95514f766c57e323d91b2097adba7adb1c456a313262b694e0ed |