openlit 1.8.0__py3-none-any.whl → 1.9.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -203,9 +203,9 @@ def chat(gen_ai_endpoint, version, environment, application_name, tracer,
203
203
  span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IS_STREAM,
204
204
  False)
205
205
  span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_ID,
206
- response.response_id)
206
+ response.generation_id)
207
207
  span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_FINISH_REASON,
208
- response.response_id)
208
+ response.finish_reason)
209
209
  span.set_attribute(SemanticConvetion.GEN_AI_USAGE_PROMPT_TOKENS,
210
210
  response.meta.billed_units.input_tokens)
211
211
  span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COMPLETION_TOKENS,
@@ -306,10 +306,11 @@ def chat_stream(gen_ai_endpoint, version, environment, application_name,
306
306
  # Collect message IDs and aggregated response from events
307
307
  if event.event_type == "stream-end":
308
308
  llmresponse = event.response.text
309
- response_id = event.response.response_id
310
309
  prompt_tokens = event.response.meta.billed_units.input_tokens
311
310
  completion_tokens = event.response.meta.billed_units.output_tokens
312
311
  finish_reason = event.finish_reason
312
+ if event.event_type == "stream-start":
313
+ response_id = event.generation_id
313
314
  yield event
314
315
 
315
316
  # Handling exception ensure observability without disrupting operation
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openlit
3
- Version: 1.8.0
3
+ Version: 1.9.0
4
4
  Summary: OpenTelemetry-native Auto instrumentation library for monitoring LLM Applications, facilitating the integration of observability into your GenAI-driven projects
5
5
  Home-page: https://github.com/openlit/openlit/tree/main/openlit/python
6
6
  Keywords: OpenTelemetry,otel,otlp,llm,tracing,openai,anthropic,claude,cohere,llm monitoring,observability,monitoring,gpt,Generative AI,chatGPT
@@ -38,6 +38,9 @@ OpenTelemetry Auto-Instrumentation for GenAI & LLM Applications</h1>
38
38
  [![Slack](https://img.shields.io/badge/Slack-4A154B?logo=slack&logoColor=white)](https://join.slack.com/t/openlit/shared_invite/zt-2etnfttwg-TjP_7BZXfYg84oAukY8QRQ)
39
39
  [![X](https://img.shields.io/badge/follow-%40OpenLIT-1DA1F2?logo=x&style=social)](https://twitter.com/openlit_io)
40
40
 
41
+ ![OpenLIT Connections Banner](https://github.com/openlit/.github/blob/main/profile/assets/github-readme-connections-banner.png?raw=true)
42
+
43
+
41
44
  </div>
42
45
 
43
46
  OpenLIT Python SDK is an **OpenTelemetry-native** Auto instrumentation library for monitoring LLM Applications, facilitating the integration of observability into your GenAI-driven projects. Designed with simplicity and efficiency, OpenLIT offers the ability to embed observability into your GenAI-driven projects effortlessly using just **a single line of code**.
@@ -46,31 +49,20 @@ Whether you're directly using LLM Libraries like OpenAI, Anthropic or building c
46
49
 
47
50
  This project adheres to the [Semantic Conventions](https://github.com/open-telemetry/semantic-conventions/tree/main/docs/gen-ai) proposed by the OpenTelemetry community. You can check out the current definitions [here](src/openlit/semcov/__init__.py).
48
51
 
49
- ## What can be Auto Instrumented?
50
-
51
- ### LLMs
52
- - [✅ OpenAI](https://docs.openlit.io/latest/integrations/openai)
53
- - [✅ Ollama](https://docs.openlit.io/latest/integrations/ollama)
54
- - [✅ Anthropic](https://docs.openlit.io/latest/integrations/anthropic)
55
- - [✅ Cohere](https://docs.openlit.io/latest/integrations/cohere)
56
- - [✅ Mistral](https://docs.openlit.io/latest/integrations/mistral)
57
- - [✅ Azure OpenAI](https://docs.openlit.io/latest/integrations/azure-openai)
58
- - [✅ HuggingFace Transformers](https://docs.openlit.io/latest/integrations/huggingface)
59
- - [✅ Amazon Bedrock](https://docs.openlit.io/latest/integrations/bedrock)
60
- - [✅ Vertex AI](https://docs.openlit.io/latest/integrations/vertexai)
61
- - [✅ Groq](https://docs.openlit.io/latest/integrations/groq)
62
-
63
- ### Vector DBs
64
- - [✅ ChromaDB](https://docs.openlit.io/latest/integrations/chromadb)
65
- - [✅ Pinecone](https://docs.openlit.io/latest/integrations/pinecone)
66
- - [✅ Qdrant](https://docs.openlit.io/latest/integrations/qdrant)
67
- - [✅ Milvus](https://docs.openlit.io/latest/integrations/milvus)
68
-
69
- ### Frameworks
70
- - [✅ Langchain](https://docs.openlit.io/latest/integrations/langchain)
71
- - [✅ LiteLLM](https://docs.openlit.io/latest/integrations/litellm)
72
- - [✅ LlamaIndex](https://docs.openlit.io/latest/integrations/llama-index)
73
- - [✅ Haystack](https://docs.openlit.io/latest/integrations/haystack)
52
+ ## Auto Instrumentation Capabilities
53
+
54
+ | LLMs | Vector DBs | Frameworks |
55
+ |----------------------------------------------------------|----------------------------------------------|----------------------------------------------|
56
+ | [✅ OpenAI](https://docs.openlit.io/latest/integrations/openai) | [✅ ChromaDB](https://docs.openlit.io/latest/integrations/chromadb) | [✅ Langchain](https://docs.openlit.io/latest/integrations/langchain) |
57
+ | [✅ Ollama](https://docs.openlit.io/latest/integrations/ollama) | [✅ Pinecone](https://docs.openlit.io/latest/integrations/pinecone) | [✅ LiteLLM](https://docs.openlit.io/latest/integrations/litellm) |
58
+ | [✅ Anthropic](https://docs.openlit.io/latest/integrations/anthropic) | [✅ Qdrant](https://docs.openlit.io/latest/integrations/qdrant) | [✅ LlamaIndex](https://docs.openlit.io/latest/integrations/llama-index) |
59
+ | [✅ Cohere](https://docs.openlit.io/latest/integrations/cohere) | [✅ Milvus](https://docs.openlit.io/latest/integrations/milvus) | [✅ Haystack](https://docs.openlit.io/latest/integrations/haystack) |
60
+ | [✅ Mistral](https://docs.openlit.io/latest/integrations/mistral) | |
61
+ | [✅ Azure OpenAI](https://docs.openlit.io/latest/integrations/azure-openai) | |
62
+ | [✅ HuggingFace Transformers](https://docs.openlit.io/latest/integrations/huggingface) | |
63
+ | [✅ Amazon Bedrock](https://docs.openlit.io/latest/integrations/bedrock) | |
64
+ | [✅ Vertex AI](https://docs.openlit.io/latest/integrations/vertexai) | |
65
+ | [✅ Groq](https://docs.openlit.io/latest/integrations/groq) | |
74
66
 
75
67
  ## Supported Destinations
76
68
  - [✅ OpenTelemetry Collector](https://docs.openlit.io/latest/connections/otelcol)
@@ -92,14 +84,16 @@ pip install openlit
92
84
 
93
85
  ## 🚀 Getting Started
94
86
 
95
- ## Step 1: Install OpenLIT SDK
87
+ ### Step 1: Install OpenLIT
88
+
89
+ Open your command line or terminal and run:
96
90
 
97
91
  ```bash
98
92
  pip install openlit
99
93
  ```
100
94
 
101
- ### Step 2: Instrument your Application
102
- Integrating the OpenLIT into LLM applications is straightforward. Start monitoring for your LLM Application with just **one line of code**:
95
+ ### Step 2: Initialize OpenLIT in your Application
96
+ Integrating the OpenLIT into LLM applications is straightforward. Start monitoring for your LLM Application with just **two lines of code**:
103
97
 
104
98
  ```python
105
99
  import openlit
@@ -107,46 +101,68 @@ import openlit
107
101
  openlit.init()
108
102
  ```
109
103
 
110
- By default, OpenLIT directs traces and metrics straight to your console. To forward telemetry data to an HTTP OTLP endpoint, such as the OpenTelemetry Collector, set the `otlp_endpoint` parameter with the desired endpoint. Alternatively, you can configure the endpoint by setting the `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable as recommended in the OpenTelemetry documentation.
104
+ To forward telemetry data to an HTTP OTLP endpoint, such as the OpenTelemetry Collector, set the `otlp_endpoint` parameter with the desired endpoint. Alternatively, you can configure the endpoint by setting the `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable as recommended in the OpenTelemetry documentation.
105
+
106
+ > 💡 Info: If you dont provide `otlp_endpoint` function argument or set the `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable, OpenLIT directs the trace directly to your console, which can be useful during development.
111
107
 
112
108
  To send telemetry to OpenTelemetry backends requiring authentication, set the `otlp_headers` parameter with its desired value. Alternatively, you can configure the endpoint by setting the `OTEL_EXPORTER_OTLP_HEADERS` environment variable as recommended in the OpenTelemetry documentation.
113
109
 
114
110
  #### Example
115
111
 
116
- Here is how you can send telemetry from OpenLIT to Grafana Cloud
112
+ ---
117
113
 
118
- ```python
119
- openlit.init(
120
- otlp_endpoint="https://otlp-gateway-prod-us-east-0.grafana.net/otlp",
121
- otlp_headers="Authorization=Basic%20<base64 encoded Instance ID and API Token>"
122
- )
123
- ```
114
+ <details>
115
+ <summary>Initialize using Function Arguments</summary>
116
+
117
+ ---
124
118
 
125
- Alternatively, You can also choose to set these values using `OTEL_EXPORTER_OTLP_ENDPOINT` and `OTEL_EXPORTER_OTLP_HEADERS` environment variables
119
+ Add the following two lines to your application code:
120
+
121
+ ```python
122
+ import openlit
123
+
124
+ openlit.init(
125
+ otlp_endpoint="YOUR_OTEL_ENDPOINT",
126
+ otlp_headers ="YOUR_OTEL_ENDPOINT_AUTH"
127
+ )
128
+ ```
126
129
 
127
- ```python
128
- openlit.init()
129
- ```
130
+ </details>
130
131
 
131
- ```env
132
- export OTEL_EXPORTER_OTLP_ENDPOINT = "https://otlp-gateway-prod-us-east-0.grafana.net/otlp"
133
- export OTEL_EXPORTER_OTLP_HEADERS = "Authorization=Basic%20<base64 encoded Instance ID and API Token>"
134
- ```
132
+ ---
133
+
134
+ <details>
135
+
136
+ <summary>Initialize using Environment Variables</summary>
137
+
138
+ ---
139
+
140
+ Add the following two lines to your application code:
141
+
142
+ ```python
143
+ import openlit
144
+
145
+ openlit.init()
146
+ ```
147
+
148
+ Then, configure the your OTLP endpoint using environment variable:
149
+
150
+ ```env
151
+ export OTEL_EXPORTER_OTLP_ENDPOINT = "YOUR_OTEL_ENDPOINT"
152
+ export OTEL_EXPORTER_OTLP_HEADERS = "YOUR_OTEL_ENDPOINT_AUTH"
153
+ ```
154
+ </details>
155
+
156
+ ---
135
157
 
136
158
  ### Step 3: Visualize and Optimize!
137
- With the LLM Observability data now being collected and sent to your chosen OpenTelemetry backend, the next step is to visualize and analyze this data to glean insights into your application's performance, behavior, and identify areas of improvement. Here is how you would use the data in Grafana, follow these detailed instructions to explore your LLM application's Telemetry data.
159
+ With the LLM Observability data now being collected and sent to OpenLIT, the next step is to visualize and analyze this data to get insights into your LLM applications performance, behavior, and identify areas of improvement.
138
160
 
139
- - Select the **Explore** option from Grafana's sidebar.
140
- - At the top, ensure the correct Tempo data source is selected from the dropdown menu.
141
- - Use the **Query** field to specify any particular traces you are interested in, or leave it empty to browse through all the available traces.
142
- - You can adjust the time range to focus on specific periods of interest.
143
- - Hit **Run Query** to fetch your trace data. You'll see a visual representation of your traces along with detailed information on particular spans when clicked.
161
+ To begin exploring your LLM Application's performance data within the OpenLIT UI, please see the [Quickstart Guide](https://docs.openlit.io/latest/quickstart).
144
162
 
145
- #### Next Steps
163
+ If you want to integrate and send metrics and traces to your existing observability tools, refer to our [Connections Guide](https://docs.openlit.io/latest/connections/intro) for detailed instructions.
146
164
 
147
- - **Create Dashboards:** Beyond just exploring traces, consider creating dashboards in Grafana to monitor key performance indicators (KPIs) and metrics over time. Dashboards can be customized with various panels to display graphs, logs, and single stats that are most relevant to your application's performance and usage patterns.
148
- - **Set Alerts:** Grafana also allows you to set up alerts based on specific thresholds. This feature can be invaluable in proactively managing your application's health by notifying you of potential issues before they impact users.
149
- - **Iterate and Optimize:** Use the insights gained from your observability data to make informed decisions on optimizing your LLM application. This might involve refining model parameters, adjusting scaling strategies, or identifying and resolving bottlenecks.
165
+ ![](https://github.com/openlit/.github/blob/main/profile/assets/openlit-client-1.png?raw=true)
150
166
 
151
167
 
152
168
  ### Configuration
@@ -163,7 +179,7 @@ Below is a detailed overview of the configuration options available, allowing yo
163
179
  | `otlp_headers` | Defines headers for the OTLP exporter, useful for backends requiring authentication. | `None` | No |
164
180
  | `disable_batch` | A flag to disable batch span processing, favoring immediate dispatch. | `False` | No |
165
181
  | `trace_content` | Enables tracing of content for deeper insights. | `True` | No |
166
- | `disabled_instrumentors`| List of instrumentors to disable. Choices: `["openai", "anthropic", "langchain", "cohere", "mistral", "transformers", "chroma", "pinecone"]`. | `None` | No |
182
+ | `disabled_instrumentors`| List of instrumentors to disable. | `None` | No |
167
183
  | `disable_metrics` | If set, disables the collection of metrics. | `False` | No |
168
184
  | `pricing_json` | URL or file path of the pricing JSON file. | `https://github.com/openlit/openlit/blob/main/assets/pricing.json` | No |
169
185
 
@@ -8,7 +8,7 @@ openlit/instrumentation/bedrock/bedrock.py,sha256=Q5t5283LGEvhyrUCr9ofEQF22JTkc1
8
8
  openlit/instrumentation/chroma/__init__.py,sha256=61lFpHlUEQUobsUJZHXdvOViKwsOH8AOvSfc4VgCmiM,3253
9
9
  openlit/instrumentation/chroma/chroma.py,sha256=r75mAdwSDmjgphixRJPiCmcSoqFIH8ojkohkcAOj7i4,10407
10
10
  openlit/instrumentation/cohere/__init__.py,sha256=PC5T1qIg9pwLNocBP_WjG5B_6p_z019s8quk_fNLAMs,1920
11
- openlit/instrumentation/cohere/cohere.py,sha256=_TXAB64-sujs51-JQVu30HqwBaNengNWHEL0hgAAgJA,20381
11
+ openlit/instrumentation/cohere/cohere.py,sha256=GvxIp55TJIu4YyG0_FwLBDHvAMUlAXyvMNIFhl2CQP4,20437
12
12
  openlit/instrumentation/groq/__init__.py,sha256=uW_0G6HSanQyK2dIXYhzR604pDiyPQfybzc37DsfSew,1911
13
13
  openlit/instrumentation/groq/async_groq.py,sha256=WQwHpC-NJoyEf-jAJlxEcdnpd5jmlfAsDtEBRJ47CxA,19084
14
14
  openlit/instrumentation/groq/groq.py,sha256=4uiEFUjxJ0q-c3GlgPAMc4NijG1YLgQp7o3wcwFrxeg,19048
@@ -43,7 +43,7 @@ openlit/instrumentation/vertexai/vertexai.py,sha256=UvpNKBHPoV9idVMfGigZnmWuEQiy
43
43
  openlit/otel/metrics.py,sha256=O7NoaDz0bY19mqpE4-0PcKwEe-B-iJFRgOCaanAuZAc,4291
44
44
  openlit/otel/tracing.py,sha256=vL1ifMbARPBpqK--yXYsCM6y5dSu5LFIKqkhZXtYmUc,3712
45
45
  openlit/semcov/__init__.py,sha256=wcy_1uP6_YxpaHxlo5he91m2GcuD5sfngZbZGgIwNlY,6328
46
- openlit-1.8.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
47
- openlit-1.8.0.dist-info/METADATA,sha256=148uqS7Fbltn1PI2Ulk1T-9s1AnyJdtuE1tOQjxBYTU,12481
48
- openlit-1.8.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
49
- openlit-1.8.0.dist-info/RECORD,,
46
+ openlit-1.9.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
47
+ openlit-1.9.0.dist-info/METADATA,sha256=ei3GxGSQxQTC3juKLJPvUNcIVcbj_Gd5VnNX3LkEUmM,12840
48
+ openlit-1.9.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
49
+ openlit-1.9.0.dist-info/RECORD,,