lmnr 0.4.37__py3-none-any.whl → 0.4.45__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.
- lmnr/__init__.py +1 -0
- lmnr/cli.py +25 -11
- lmnr/openllmetry_sdk/decorators/base.py +28 -2
- lmnr/openllmetry_sdk/tracing/attributes.py +1 -0
- lmnr/openllmetry_sdk/tracing/tracing.py +84 -33
- lmnr/openllmetry_sdk/utils/package_check.py +1 -0
- lmnr/sdk/datasets.py +2 -4
- lmnr/sdk/decorators.py +1 -9
- lmnr/sdk/eval_control.py +4 -0
- lmnr/sdk/evaluations.py +11 -28
- lmnr/sdk/laminar.py +172 -75
- lmnr/sdk/types.py +39 -4
- {lmnr-0.4.37.dist-info → lmnr-0.4.45.dist-info}/METADATA +93 -62
- {lmnr-0.4.37.dist-info → lmnr-0.4.45.dist-info}/RECORD +17 -16
- {lmnr-0.4.37.dist-info → lmnr-0.4.45.dist-info}/LICENSE +0 -0
- {lmnr-0.4.37.dist-info → lmnr-0.4.45.dist-info}/WHEEL +0 -0
- {lmnr-0.4.37.dist-info → lmnr-0.4.45.dist-info}/entry_points.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: lmnr
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.45
|
4
4
|
Summary: Python SDK for Laminar AI
|
5
5
|
License: Apache-2.0
|
6
6
|
Author: lmnr.ai
|
@@ -12,49 +12,73 @@ Classifier: Programming Language :: Python :: 3.10
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
14
14
|
Classifier: Programming Language :: Python :: 3.13
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
Provides-Extra: alephalpha
|
16
|
+
Provides-Extra: all
|
17
|
+
Provides-Extra: anthropic
|
18
|
+
Provides-Extra: bedrock
|
19
|
+
Provides-Extra: chromadb
|
20
|
+
Provides-Extra: cohere
|
21
|
+
Provides-Extra: google-generativeai
|
22
|
+
Provides-Extra: groq
|
23
|
+
Provides-Extra: haystack
|
24
|
+
Provides-Extra: lancedb
|
25
|
+
Provides-Extra: langchain
|
26
|
+
Provides-Extra: llamaindex
|
27
|
+
Provides-Extra: marqo
|
28
|
+
Provides-Extra: milvus
|
29
|
+
Provides-Extra: mistralai
|
30
|
+
Provides-Extra: ollama
|
31
|
+
Provides-Extra: openai
|
32
|
+
Provides-Extra: pinecone
|
33
|
+
Provides-Extra: qdrant
|
34
|
+
Provides-Extra: replicate
|
35
|
+
Provides-Extra: sagemaker
|
36
|
+
Provides-Extra: together
|
37
|
+
Provides-Extra: transformers
|
38
|
+
Provides-Extra: vertexai
|
39
|
+
Provides-Extra: watsonx
|
40
|
+
Provides-Extra: weaviate
|
41
|
+
Requires-Dist: aiohttp (>=3.0)
|
42
|
+
Requires-Dist: argparse (>=1.0)
|
43
|
+
Requires-Dist: deprecated (>=1.0)
|
19
44
|
Requires-Dist: opentelemetry-api (>=1.28.0)
|
20
45
|
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc (>=1.28.0)
|
21
46
|
Requires-Dist: opentelemetry-exporter-otlp-proto-http (>=1.28.0)
|
22
|
-
Requires-Dist: opentelemetry-instrumentation-alephalpha (>=0.33.
|
23
|
-
Requires-Dist: opentelemetry-instrumentation-anthropic (>=0.33.
|
24
|
-
Requires-Dist: opentelemetry-instrumentation-bedrock (>=0.33.
|
25
|
-
Requires-Dist: opentelemetry-instrumentation-chromadb (>=0.33.
|
26
|
-
Requires-Dist: opentelemetry-instrumentation-cohere (>=0.33.
|
27
|
-
Requires-Dist: opentelemetry-instrumentation-google-generativeai (>=0.33.
|
28
|
-
Requires-Dist: opentelemetry-instrumentation-groq (>=0.33.
|
29
|
-
Requires-Dist: opentelemetry-instrumentation-haystack (>=0.33.
|
30
|
-
Requires-Dist: opentelemetry-instrumentation-lancedb (>=0.33.
|
31
|
-
Requires-Dist: opentelemetry-instrumentation-langchain (>=0.33.
|
32
|
-
Requires-Dist: opentelemetry-instrumentation-llamaindex (>=0.33.
|
33
|
-
Requires-Dist: opentelemetry-instrumentation-marqo (>=0.33.
|
34
|
-
Requires-Dist: opentelemetry-instrumentation-milvus (>=0.33.
|
35
|
-
Requires-Dist: opentelemetry-instrumentation-mistralai (>=0.33.
|
36
|
-
Requires-Dist: opentelemetry-instrumentation-ollama (>=0.33.
|
37
|
-
Requires-Dist: opentelemetry-instrumentation-openai (>=0.33.
|
38
|
-
Requires-Dist: opentelemetry-instrumentation-pinecone (>=0.33.
|
39
|
-
Requires-Dist: opentelemetry-instrumentation-qdrant (>=0.33.
|
40
|
-
Requires-Dist: opentelemetry-instrumentation-replicate (>=0.33.
|
47
|
+
Requires-Dist: opentelemetry-instrumentation-alephalpha (>=0.33.12) ; extra == "all" or extra == "alephalpha"
|
48
|
+
Requires-Dist: opentelemetry-instrumentation-anthropic (>=0.33.12) ; extra == "all" or extra == "anthropic"
|
49
|
+
Requires-Dist: opentelemetry-instrumentation-bedrock (>=0.33.12) ; extra == "all" or extra == "bedrock"
|
50
|
+
Requires-Dist: opentelemetry-instrumentation-chromadb (>=0.33.12) ; extra == "all" or extra == "chromadb"
|
51
|
+
Requires-Dist: opentelemetry-instrumentation-cohere (>=0.33.12) ; extra == "all" or extra == "cohere"
|
52
|
+
Requires-Dist: opentelemetry-instrumentation-google-generativeai (>=0.33.12) ; extra == "all" or extra == "google-generativeai"
|
53
|
+
Requires-Dist: opentelemetry-instrumentation-groq (>=0.33.12) ; extra == "all" or extra == "groq"
|
54
|
+
Requires-Dist: opentelemetry-instrumentation-haystack (>=0.33.12) ; extra == "all" or extra == "haystack"
|
55
|
+
Requires-Dist: opentelemetry-instrumentation-lancedb (>=0.33.12) ; extra == "all" or extra == "lancedb"
|
56
|
+
Requires-Dist: opentelemetry-instrumentation-langchain (>=0.33.12) ; extra == "all" or extra == "langchain"
|
57
|
+
Requires-Dist: opentelemetry-instrumentation-llamaindex (>=0.33.12) ; extra == "all" or extra == "llamaindex"
|
58
|
+
Requires-Dist: opentelemetry-instrumentation-marqo (>=0.33.12) ; extra == "all" or extra == "marqo"
|
59
|
+
Requires-Dist: opentelemetry-instrumentation-milvus (>=0.33.12) ; extra == "all" or extra == "milvus"
|
60
|
+
Requires-Dist: opentelemetry-instrumentation-mistralai (>=0.33.12) ; extra == "all" or extra == "mistralai"
|
61
|
+
Requires-Dist: opentelemetry-instrumentation-ollama (>=0.33.12) ; extra == "all" or extra == "ollama"
|
62
|
+
Requires-Dist: opentelemetry-instrumentation-openai (>=0.33.12) ; extra == "all" or extra == "openai"
|
63
|
+
Requires-Dist: opentelemetry-instrumentation-pinecone (>=0.33.12) ; extra == "all" or extra == "pinecone"
|
64
|
+
Requires-Dist: opentelemetry-instrumentation-qdrant (>=0.33.12) ; extra == "all" or extra == "qdrant"
|
65
|
+
Requires-Dist: opentelemetry-instrumentation-replicate (>=0.33.12) ; extra == "all" or extra == "replicate"
|
41
66
|
Requires-Dist: opentelemetry-instrumentation-requests (>=0.49b0,<0.50)
|
42
|
-
Requires-Dist: opentelemetry-instrumentation-sagemaker (>=0.33.
|
67
|
+
Requires-Dist: opentelemetry-instrumentation-sagemaker (>=0.33.12) ; extra == "all" or extra == "sagemaker"
|
43
68
|
Requires-Dist: opentelemetry-instrumentation-sqlalchemy (>=0.49b0,<0.50)
|
44
69
|
Requires-Dist: opentelemetry-instrumentation-threading (>=0.49b0,<0.50)
|
45
|
-
Requires-Dist: opentelemetry-instrumentation-together (>=0.33.
|
46
|
-
Requires-Dist: opentelemetry-instrumentation-transformers (>=0.33.
|
70
|
+
Requires-Dist: opentelemetry-instrumentation-together (>=0.33.12) ; extra == "all" or extra == "together"
|
71
|
+
Requires-Dist: opentelemetry-instrumentation-transformers (>=0.33.12) ; extra == "all" or extra == "transformers"
|
47
72
|
Requires-Dist: opentelemetry-instrumentation-urllib3 (>=0.49b0,<0.50)
|
48
|
-
Requires-Dist: opentelemetry-instrumentation-vertexai (>=0.33.
|
49
|
-
Requires-Dist: opentelemetry-instrumentation-watsonx (>=0.33.
|
50
|
-
Requires-Dist: opentelemetry-instrumentation-weaviate (>=0.33.
|
73
|
+
Requires-Dist: opentelemetry-instrumentation-vertexai (>=0.33.12) ; extra == "all" or extra == "vertexai"
|
74
|
+
Requires-Dist: opentelemetry-instrumentation-watsonx (>=0.33.12) ; extra == "all" or extra == "watsonx"
|
75
|
+
Requires-Dist: opentelemetry-instrumentation-weaviate (>=0.33.12) ; extra == "all" or extra == "weaviate"
|
51
76
|
Requires-Dist: opentelemetry-sdk (>=1.28.0)
|
52
77
|
Requires-Dist: opentelemetry-semantic-conventions-ai (==0.4.2)
|
53
|
-
Requires-Dist: pydantic (>=2.7
|
54
|
-
Requires-Dist: python-dotenv (>=1.0
|
55
|
-
Requires-Dist: requests (>=2.0
|
56
|
-
Requires-Dist:
|
57
|
-
Requires-Dist: tqdm (>=4.0,<5.0)
|
78
|
+
Requires-Dist: pydantic (>=2.7)
|
79
|
+
Requires-Dist: python-dotenv (>=1.0)
|
80
|
+
Requires-Dist: requests (>=2.0)
|
81
|
+
Requires-Dist: tqdm (>=4.0)
|
58
82
|
Description-Content-Type: text/markdown
|
59
83
|
|
60
84
|
# Laminar Python
|
@@ -72,23 +96,28 @@ Check our [open-source repo](https://github.com/lmnr-ai/lmnr) and don't forget t
|
|
72
96
|
|
73
97
|
## Quickstart
|
74
98
|
|
75
|
-
First, install the package
|
99
|
+
First, install the package, specifying the instrumentations you want to use.
|
100
|
+
|
101
|
+
For example, to install the package with OpenAI and Anthropic instrumentations:
|
76
102
|
|
77
103
|
```sh
|
78
|
-
pip install lmnr
|
104
|
+
pip install 'lmnr[anthropic,openai]'
|
105
|
+
```
|
106
|
+
|
107
|
+
To install all possible instrumentations, use the following command:
|
108
|
+
|
109
|
+
```sh
|
110
|
+
pip install 'lmnr[all]'
|
79
111
|
```
|
80
112
|
|
81
|
-
|
113
|
+
Initialize Laminar in your code:
|
82
114
|
|
83
115
|
```python
|
84
|
-
from lmnr import Laminar
|
116
|
+
from lmnr import Laminar
|
85
117
|
|
86
|
-
|
118
|
+
Laminar.initialize(project_api_key="<PROJECT_API_KEY>")
|
87
119
|
```
|
88
120
|
|
89
|
-
This will automatically instrument most of the LLM, Vector DB, and related
|
90
|
-
calls with OpenTelemetry-compatible instrumentation.
|
91
|
-
|
92
121
|
Note that you need to only initialize Laminar once in your application.
|
93
122
|
|
94
123
|
## Instrumentation
|
@@ -101,9 +130,9 @@ This can be useful if you want to trace a request handler or a function which co
|
|
101
130
|
```python
|
102
131
|
import os
|
103
132
|
from openai import OpenAI
|
104
|
-
from lmnr import Laminar
|
133
|
+
from lmnr import Laminar
|
105
134
|
|
106
|
-
|
135
|
+
Laminar.initialize(project_api_key=os.environ["LMNR_PROJECT_API_KEY"])
|
107
136
|
|
108
137
|
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
|
109
138
|
|
@@ -126,9 +155,7 @@ def poem_writer(topic: str):
|
|
126
155
|
@observe()
|
127
156
|
def generate_poems():
|
128
157
|
poem1 = poem_writer(topic="laminar flow")
|
129
|
-
L.event("is_poem_generated", True)
|
130
158
|
poem2 = poem_writer(topic="turbulence")
|
131
|
-
L.event("is_poem_generated", True)
|
132
159
|
poems = f"{poem1}\n\n---\n\n{poem2}"
|
133
160
|
return poems
|
134
161
|
```
|
@@ -137,18 +164,10 @@ Also, you can use `Laminar.start_as_current_span` if you want to record a chunk
|
|
137
164
|
|
138
165
|
```python
|
139
166
|
def handle_user_request(topic: str):
|
140
|
-
with
|
141
|
-
...
|
142
|
-
|
167
|
+
with Laminar.start_as_current_span(name="poem_writer", input=topic):
|
143
168
|
poem = poem_writer(topic=topic)
|
144
|
-
|
145
|
-
...
|
146
|
-
|
147
|
-
# while within the span, you can attach laminar events to it
|
148
|
-
L.event("is_poem_generated", True)
|
149
|
-
|
150
169
|
# Use set_span_output to record the output of the span
|
151
|
-
|
170
|
+
Laminar.set_span_output(poem)
|
152
171
|
```
|
153
172
|
|
154
173
|
### Automatic instrumentation
|
@@ -163,9 +182,9 @@ calls with OpenTelemetry-compatible instrumentation, then pass the appropriate i
|
|
163
182
|
For example, if you want to only instrument OpenAI and Anthropic, then do the following:
|
164
183
|
|
165
184
|
```python
|
166
|
-
from lmnr import Laminar
|
185
|
+
from lmnr import Laminar, Instruments
|
167
186
|
|
168
|
-
|
187
|
+
Laminar.initialize(project_api_key=os.environ["LMNR_PROJECT_API_KEY"], instruments={Instruments.OPENAI, Instruments.ANTHROPIC})
|
169
188
|
```
|
170
189
|
|
171
190
|
If you want to fully disable any kind of autoinstrumentation, pass an empty set as `instruments=set()` to `.initialize()`.
|
@@ -246,11 +265,11 @@ Once your pipeline target is set, you can call it from Python in just a few line
|
|
246
265
|
Example use:
|
247
266
|
|
248
267
|
```python
|
249
|
-
from lmnr import Laminar
|
268
|
+
from lmnr import Laminar
|
250
269
|
|
251
|
-
|
270
|
+
Laminar.initialize('<YOUR_PROJECT_API_KEY>', instruments=set())
|
252
271
|
|
253
|
-
result =
|
272
|
+
result = Laminar.run(
|
254
273
|
pipeline = 'my_pipeline_name',
|
255
274
|
inputs = {'input_node_name': 'some_value'},
|
256
275
|
# all environment variables
|
@@ -269,3 +288,15 @@ PipelineRunResponse(
|
|
269
288
|
)
|
270
289
|
```
|
271
290
|
|
291
|
+
## Semantic search
|
292
|
+
|
293
|
+
You can perform a semantic search on a dataset in Laminar by calling `Laminar.semantic_search`.
|
294
|
+
|
295
|
+
```python
|
296
|
+
response = Laminar.semantic_search(
|
297
|
+
query="Greatest Chinese architectural wonders",
|
298
|
+
dataset_id=uuid.UUID("413f8404-724c-4aa4-af16-714d84fd7958"),
|
299
|
+
)
|
300
|
+
```
|
301
|
+
|
302
|
+
[Read more](https://docs.lmnr.ai/datasets/indexing) about indexing and semantic search.
|
@@ -1,32 +1,33 @@
|
|
1
|
-
lmnr/__init__.py,sha256=
|
2
|
-
lmnr/cli.py,sha256=
|
1
|
+
lmnr/__init__.py,sha256=Bqxs-8Mh4h69pOHURgBCgo9EW1GwChebxP6wUX2-bsU,452
|
2
|
+
lmnr/cli.py,sha256=W5zn5DBJiFaVARFy2D-8tJI8ZlGNzjJqk3qiXAG2woo,1456
|
3
3
|
lmnr/openllmetry_sdk/.flake8,sha256=bCxuDlGx3YQ55QHKPiGJkncHanh9qGjQJUujcFa3lAU,150
|
4
4
|
lmnr/openllmetry_sdk/.python-version,sha256=9OLQBQVbD4zE4cJsPePhnAfV_snrPSoqEQw-PXgPMOs,6
|
5
5
|
lmnr/openllmetry_sdk/__init__.py,sha256=vVSGTAwUnJvdulHtslkGAd8QCBuv78WUK3bgfBpH6Do,2390
|
6
6
|
lmnr/openllmetry_sdk/config/__init__.py,sha256=DliMGp2NjYAqRFLKpWQPUKjGMHRO8QsVfazBA1qENQ8,248
|
7
7
|
lmnr/openllmetry_sdk/decorators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
-
lmnr/openllmetry_sdk/decorators/base.py,sha256=
|
8
|
+
lmnr/openllmetry_sdk/decorators/base.py,sha256=xwLsUFd5husf3p-ZllVTYEe9gkwl9T3Bf1WpW1-Ua5I,6413
|
9
9
|
lmnr/openllmetry_sdk/instruments.py,sha256=CGGUEELldrXkQwAzAkDeAtDq07_pjhz7i14a92P7C_E,1036
|
10
10
|
lmnr/openllmetry_sdk/tracing/__init__.py,sha256=xT73L1t2si2CM6QmMiTZ7zn-dKKYBLNrpBBWq6WfVBw,68
|
11
|
-
lmnr/openllmetry_sdk/tracing/attributes.py,sha256=
|
11
|
+
lmnr/openllmetry_sdk/tracing/attributes.py,sha256=B_4KVYWAUu-6DQmsm2eCJQcTxm8pG1EByCBK3uOPkuI,1293
|
12
12
|
lmnr/openllmetry_sdk/tracing/content_allow_list.py,sha256=3feztm6PBWNelc8pAZUcQyEGyeSpNiVKjOaDk65l2ps,846
|
13
13
|
lmnr/openllmetry_sdk/tracing/context_manager.py,sha256=rdSus-p-TaevQ8hIAhfbnZr5dTqRvACDkzXGDpflncY,306
|
14
|
-
lmnr/openllmetry_sdk/tracing/tracing.py,sha256=
|
14
|
+
lmnr/openllmetry_sdk/tracing/tracing.py,sha256=pa8ZPhH4NSwP1QnvD5qNaOZ775H5Q4KVa9OwSki9KUE,32138
|
15
15
|
lmnr/openllmetry_sdk/utils/__init__.py,sha256=pNhf0G3vTd5ccoc03i1MXDbricSaiqCbi1DLWhSekK8,604
|
16
16
|
lmnr/openllmetry_sdk/utils/in_memory_span_exporter.py,sha256=H_4TRaThMO1H6vUQ0OpQvzJk_fZH0OOsRAM1iZQXsR8,2112
|
17
17
|
lmnr/openllmetry_sdk/utils/json_encoder.py,sha256=dK6b_axr70IYL7Vv-bu4wntvDDuyntoqsHaddqX7P58,463
|
18
|
-
lmnr/openllmetry_sdk/utils/package_check.py,sha256=
|
18
|
+
lmnr/openllmetry_sdk/utils/package_check.py,sha256=Da4WoTX6J9naODs99DnY9BA-2MxH2pWLmbbVkbQ7VUQ,236
|
19
19
|
lmnr/openllmetry_sdk/version.py,sha256=OlatFEFA4ttqSSIiV8jdE-sq3KG5zu2hnC4B4mzWF3s,23
|
20
20
|
lmnr/sdk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
|
-
lmnr/sdk/datasets.py,sha256=
|
22
|
-
lmnr/sdk/decorators.py,sha256=
|
23
|
-
lmnr/sdk/
|
24
|
-
lmnr/sdk/
|
21
|
+
lmnr/sdk/datasets.py,sha256=KNMp_v3z1ocIltIw7kTgj8o-l9R8N8Tgj0sw1ajQ9C8,1582
|
22
|
+
lmnr/sdk/decorators.py,sha256=ja2EUWUWvFOp28ER0k78PRuxNahwCVyH0TdM3U-xY7U,1856
|
23
|
+
lmnr/sdk/eval_control.py,sha256=G6Fg3Xx_KWv72iBaWlNMdyRTF2bZFQnwJ68sJNSpIcY,177
|
24
|
+
lmnr/sdk/evaluations.py,sha256=gLImD_uB9uXgw07QiJ_OYRTFDGxiPtFCO1c8HyOq2s0,15935
|
25
|
+
lmnr/sdk/laminar.py,sha256=4Saelm9m6pB9GWquCdHWY-1VhAB8Q2tWlq6hnmorzHU,31250
|
25
26
|
lmnr/sdk/log.py,sha256=cZBeUoSK39LMEV-X4-eEhTWOciULRfHaKfRK8YqIM8I,1532
|
26
|
-
lmnr/sdk/types.py,sha256=
|
27
|
+
lmnr/sdk/types.py,sha256=FCNoFoa0ingOvpXGfbiETVsakYyq9Zpoc56MXJ1YDzQ,6390
|
27
28
|
lmnr/sdk/utils.py,sha256=Uk8y15x-sd5tP2ERONahElLDJVEy_3dA_1_5g9A6auY,3358
|
28
|
-
lmnr-0.4.
|
29
|
-
lmnr-0.4.
|
30
|
-
lmnr-0.4.
|
31
|
-
lmnr-0.4.
|
32
|
-
lmnr-0.4.
|
29
|
+
lmnr-0.4.45.dist-info/LICENSE,sha256=67b_wJHVV1CBaWkrKFWU1wyqTPSdzH77Ls-59631COg,10411
|
30
|
+
lmnr-0.4.45.dist-info/METADATA,sha256=mA47njgTnxaXCPAvEBOeNIRzsuvicfdIVMVLXe1UUWg,12212
|
31
|
+
lmnr-0.4.45.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
32
|
+
lmnr-0.4.45.dist-info/entry_points.txt,sha256=K1jE20ww4jzHNZLnsfWBvU3YKDGBgbOiYG5Y7ivQcq4,37
|
33
|
+
lmnr-0.4.45.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|