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.
- openlit/instrumentation/cohere/cohere.py +4 -3
- {openlit-1.8.0.dist-info → openlit-1.9.0.dist-info}/METADATA +72 -56
- {openlit-1.8.0.dist-info → openlit-1.9.0.dist-info}/RECORD +5 -5
- {openlit-1.8.0.dist-info → openlit-1.9.0.dist-info}/LICENSE +0 -0
- {openlit-1.8.0.dist-info → openlit-1.9.0.dist-info}/WHEEL +0 -0
@@ -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.
|
206
|
+
response.generation_id)
|
207
207
|
span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_FINISH_REASON,
|
208
|
-
response.
|
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.
|
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
|
[](https://join.slack.com/t/openlit/shared_invite/zt-2etnfttwg-TjP_7BZXfYg84oAukY8QRQ)
|
39
39
|
[](https://twitter.com/openlit_io)
|
40
40
|
|
41
|
+

|
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
|
-
##
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
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
|
-
|
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:
|
102
|
-
Integrating the OpenLIT into LLM applications is straightforward. Start monitoring for your LLM Application with just **
|
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
|
-
|
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
|
-
|
112
|
+
---
|
117
113
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
)
|
123
|
-
```
|
114
|
+
<details>
|
115
|
+
<summary>Initialize using Function Arguments</summary>
|
116
|
+
|
117
|
+
---
|
124
118
|
|
125
|
-
|
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
|
-
|
128
|
-
openlit.init()
|
129
|
-
```
|
130
|
+
</details>
|
130
131
|
|
131
|
-
|
132
|
-
|
133
|
-
|
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
|
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 application’s performance, behavior, and identify areas of improvement.
|
138
160
|
|
139
|
-
|
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
|
-
|
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
|
-
|
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
|
+

|
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.
|
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=
|
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.
|
47
|
-
openlit-1.
|
48
|
-
openlit-1.
|
49
|
-
openlit-1.
|
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,,
|
File without changes
|
File without changes
|