lmnr 0.4.26__py3-none-any.whl → 0.4.28__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/sdk/datasets.py CHANGED
@@ -34,7 +34,7 @@ class LaminarDataset(EvaluationDataset):
34
34
  self._fetched_items = []
35
35
  self._offset = 0
36
36
  self._fetch_size = fetch_size
37
- self._logger = get_default_logger(self.__class__.__name__, level=logging.DEBUG)
37
+ self._logger = get_default_logger(self.__class__.__name__)
38
38
 
39
39
  def _fetch_batch(self):
40
40
  self._logger.debug(
lmnr/sdk/laminar.py CHANGED
@@ -61,6 +61,7 @@ class Laminar:
61
61
  __project_api_key: Optional[str] = None
62
62
  __env: dict[str, str] = {}
63
63
  __initialized: bool = False
64
+ __http_session: Optional[requests.Session] = None
64
65
 
65
66
  @classmethod
66
67
  def initialize(
@@ -125,6 +126,7 @@ class Laminar:
125
126
  cls.__env = env
126
127
  cls.__initialized = True
127
128
  cls._initialize_logger()
129
+ cls.__http_session = requests.Session()
128
130
  Traceloop.init(
129
131
  exporter=OTLPSpanExporter(
130
132
  endpoint=cls.__base_grpc_url,
@@ -213,10 +215,18 @@ class Laminar:
213
215
  except Exception as e:
214
216
  raise ValueError(f"Invalid request: {e}")
215
217
 
216
- response = requests.post(
217
- cls.__base_http_url + "/v1/pipeline/run",
218
- data=json.dumps(request.to_dict()),
219
- headers=cls._headers(),
218
+ response = (
219
+ cls.__http_session.post(
220
+ cls.__base_http_url + "/v1/pipeline/run",
221
+ data=json.dumps(request.to_dict()),
222
+ headers=cls._headers(),
223
+ )
224
+ if cls.__http_session
225
+ else requests.post(
226
+ cls.__base_http_url + "/v1/pipeline/run",
227
+ data=json.dumps(request.to_dict()),
228
+ headers=cls._headers(),
229
+ )
220
230
  )
221
231
  if response.status_code != 200:
222
232
  raise PipelineRunError(response)
@@ -5,6 +5,7 @@ SPAN_INPUT = "lmnr.span.input"
5
5
  SPAN_OUTPUT = "lmnr.span.output"
6
6
  SPAN_TYPE = "lmnr.span.type"
7
7
  SPAN_PATH = "lmnr.span.path"
8
+ SPAN_INSTRUMENTATION_SOURCE = "lmnr.span.instrumentation_source"
8
9
 
9
10
  ASSOCIATION_PROPERTIES = "lmnr.association.properties"
10
11
  SESSION_ID = "session_id"
@@ -25,7 +25,11 @@ from opentelemetry.instrumentation.threading import ThreadingInstrumentor
25
25
 
26
26
  # from lmnr.traceloop_sdk import Telemetry
27
27
  from lmnr.traceloop_sdk.instruments import Instruments
28
- from lmnr.traceloop_sdk.tracing.attributes import ASSOCIATION_PROPERTIES, SPAN_PATH
28
+ from lmnr.traceloop_sdk.tracing.attributes import (
29
+ ASSOCIATION_PROPERTIES,
30
+ SPAN_INSTRUMENTATION_SOURCE,
31
+ SPAN_PATH,
32
+ )
29
33
  from lmnr.traceloop_sdk.tracing.content_allow_list import ContentAllowList
30
34
  from lmnr.traceloop_sdk.utils import is_notebook
31
35
  from lmnr.traceloop_sdk.utils.package_check import is_package_installed
@@ -235,6 +239,8 @@ class TracerWrapper(object):
235
239
  # the final part of the name to the span on the backend.
236
240
  span.set_attribute(SPAN_PATH, span_path)
237
241
 
242
+ span.set_attribute(SPAN_INSTRUMENTATION_SOURCE, "python")
243
+
238
244
  association_properties = get_value("association_properties")
239
245
  if association_properties is not None:
240
246
  _set_association_properties_attributes(span, association_properties)
@@ -266,10 +272,7 @@ class TracerWrapper(object):
266
272
  if hasattr(cls, "instance"):
267
273
  return True
268
274
 
269
- if (os.getenv("TRACELOOP_SUPPRESS_WARNINGS") or "false").lower() == "true":
270
- return False
271
-
272
- print("Warning: Laminar not initialized, make sure to initialize")
275
+ logging.warning("Warning: Laminar not initialized, make sure to initialize")
273
276
  return False
274
277
 
275
278
  def flush(self):
@@ -557,7 +560,9 @@ def init_langchain_instrumentor():
557
560
  instrumentor.instrument()
558
561
  return True
559
562
  except Exception as e:
560
- logging.error(f"Error initializing LangChain instrumentor: {e}")
563
+ # FIXME: silence this error temporarily, it appears to not be critical
564
+ if str(e) != "No module named 'langchain_community'":
565
+ logging.error(f"Error initializing LangChain instrumentor: {e}")
561
566
  # Telemetry().log_exception(e)
562
567
  return False
563
568
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lmnr
3
- Version: 0.4.26
3
+ Version: 0.4.28
4
4
  Summary: Python SDK for Laminar AI
5
5
  License: Apache-2.0
6
6
  Author: lmnr.ai
@@ -16,40 +16,39 @@ Requires-Dist: argparse (>=1.0,<2.0)
16
16
  Requires-Dist: backoff (>=2.0,<3.0)
17
17
  Requires-Dist: deprecated (>=1.0,<2.0)
18
18
  Requires-Dist: jinja2 (>=3.0,<4.0)
19
- Requires-Dist: openai (>=1.52.0,<2.0.0)
20
19
  Requires-Dist: opentelemetry-api (>=1.27.0,<2.0.0)
21
20
  Requires-Dist: opentelemetry-exporter-otlp-proto-grpc (>=1.27.0,<2.0.0)
22
21
  Requires-Dist: opentelemetry-exporter-otlp-proto-http (>=1.27.0,<2.0.0)
23
- Requires-Dist: opentelemetry-instrumentation-alephalpha (>=0.33.1)
24
- Requires-Dist: opentelemetry-instrumentation-anthropic (>=0.33.1)
25
- Requires-Dist: opentelemetry-instrumentation-bedrock (>=0.33.1)
26
- Requires-Dist: opentelemetry-instrumentation-chromadb (>=0.33.1)
27
- Requires-Dist: opentelemetry-instrumentation-cohere (>=0.33.1)
28
- Requires-Dist: opentelemetry-instrumentation-google-generativeai (>=0.33.1)
29
- Requires-Dist: opentelemetry-instrumentation-groq (>=0.33.1)
30
- Requires-Dist: opentelemetry-instrumentation-haystack (>=0.33.1)
31
- Requires-Dist: opentelemetry-instrumentation-lancedb (>=0.33.1)
32
- Requires-Dist: opentelemetry-instrumentation-langchain (>=0.33.1)
33
- Requires-Dist: opentelemetry-instrumentation-llamaindex (>=0.33.1)
34
- Requires-Dist: opentelemetry-instrumentation-marqo (>=0.33.1)
35
- Requires-Dist: opentelemetry-instrumentation-milvus (>=0.33.1)
36
- Requires-Dist: opentelemetry-instrumentation-mistralai (>=0.33.1)
37
- Requires-Dist: opentelemetry-instrumentation-ollama (>=0.33.1)
38
- Requires-Dist: opentelemetry-instrumentation-openai (>=0.33.1)
39
- Requires-Dist: opentelemetry-instrumentation-pinecone (>=0.33.1)
40
- Requires-Dist: opentelemetry-instrumentation-qdrant (>=0.33.1)
41
- Requires-Dist: opentelemetry-instrumentation-replicate (>=0.33.1)
22
+ Requires-Dist: opentelemetry-instrumentation-alephalpha (>=0.33.5)
23
+ Requires-Dist: opentelemetry-instrumentation-anthropic (>=0.33.5)
24
+ Requires-Dist: opentelemetry-instrumentation-bedrock (>=0.33.5)
25
+ Requires-Dist: opentelemetry-instrumentation-chromadb (>=0.33.5)
26
+ Requires-Dist: opentelemetry-instrumentation-cohere (>=0.33.5)
27
+ Requires-Dist: opentelemetry-instrumentation-google-generativeai (>=0.33.5)
28
+ Requires-Dist: opentelemetry-instrumentation-groq (>=0.33.5)
29
+ Requires-Dist: opentelemetry-instrumentation-haystack (>=0.33.5)
30
+ Requires-Dist: opentelemetry-instrumentation-lancedb (>=0.33.5)
31
+ Requires-Dist: opentelemetry-instrumentation-langchain (>=0.33.5)
32
+ Requires-Dist: opentelemetry-instrumentation-llamaindex (>=0.33.5)
33
+ Requires-Dist: opentelemetry-instrumentation-marqo (>=0.33.5)
34
+ Requires-Dist: opentelemetry-instrumentation-milvus (>=0.33.5)
35
+ Requires-Dist: opentelemetry-instrumentation-mistralai (>=0.33.5)
36
+ Requires-Dist: opentelemetry-instrumentation-ollama (>=0.33.5)
37
+ Requires-Dist: opentelemetry-instrumentation-openai (>=0.33.5)
38
+ Requires-Dist: opentelemetry-instrumentation-pinecone (>=0.33.5)
39
+ Requires-Dist: opentelemetry-instrumentation-qdrant (>=0.33.5)
40
+ Requires-Dist: opentelemetry-instrumentation-replicate (>=0.33.5)
42
41
  Requires-Dist: opentelemetry-instrumentation-requests (>=0.48b0,<0.49)
43
42
  Requires-Dist: opentelemetry-instrumentation-sqlalchemy (>=0.48b0,<0.49)
44
43
  Requires-Dist: opentelemetry-instrumentation-threading (>=0.48b0,<0.49)
45
- Requires-Dist: opentelemetry-instrumentation-together (>=0.33.1)
46
- Requires-Dist: opentelemetry-instrumentation-transformers (>=0.33.1)
44
+ Requires-Dist: opentelemetry-instrumentation-together (>=0.33.5)
45
+ Requires-Dist: opentelemetry-instrumentation-transformers (>=0.33.5)
47
46
  Requires-Dist: opentelemetry-instrumentation-urllib3 (>=0.48b0,<0.49)
48
- Requires-Dist: opentelemetry-instrumentation-vertexai (>=0.33.1)
49
- Requires-Dist: opentelemetry-instrumentation-watsonx (>=0.33.1)
50
- Requires-Dist: opentelemetry-instrumentation-weaviate (>=0.33.1)
47
+ Requires-Dist: opentelemetry-instrumentation-vertexai (>=0.33.5)
48
+ Requires-Dist: opentelemetry-instrumentation-watsonx (>=0.33.5)
49
+ Requires-Dist: opentelemetry-instrumentation-weaviate (>=0.33.5)
51
50
  Requires-Dist: opentelemetry-sdk (>=1.27.0,<2.0.0)
52
- Requires-Dist: opentelemetry-semantic-conventions-ai (==0.4.1)
51
+ Requires-Dist: opentelemetry-semantic-conventions-ai (==0.4.2)
53
52
  Requires-Dist: pydantic (>=2.7,<3.0)
54
53
  Requires-Dist: python-dotenv (>=1.0,<2.0)
55
54
  Requires-Dist: requests (>=2.0,<3.0)
@@ -1,10 +1,10 @@
1
1
  lmnr/__init__.py,sha256=87ZHKNA2xmZvqtXrWjhXUNR7YUrdP8-77fYqe-PEtrE,348
2
2
  lmnr/cli.py,sha256=Ptvm5dsNLKUY5lwnN8XkT5GtCYjzpRNi2WvefknB3OQ,1079
3
3
  lmnr/sdk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- lmnr/sdk/datasets.py,sha256=V6q0Zcv7znx5cB1YZd0pBgTEcAKXbb-pEwguScEhBw0,1612
4
+ lmnr/sdk/datasets.py,sha256=w8U9E6fvetAo65Cb2CbYzlfhY8CfXAR-VysrakG6-4I,1591
5
5
  lmnr/sdk/decorators.py,sha256=ZSDaEZyjo-RUzRCltsNbe6x0t9SKl2xRQ2q4uaKvXtk,2250
6
6
  lmnr/sdk/evaluations.py,sha256=vG788rSDppAGEvIpyglKvm8Ac_D5cw07a6btMeMr8AI,15124
7
- lmnr/sdk/laminar.py,sha256=vMp_mhirG1IPKxRjfUgbeHPKDW98GP2oHrDweJ2vu-c,18398
7
+ lmnr/sdk/laminar.py,sha256=H87fXSWb9shcPW4AeoYwvTXJ-jSTjzm2sI1A1U1Vkg8,18780
8
8
  lmnr/sdk/log.py,sha256=cZBeUoSK39LMEV-X4-eEhTWOciULRfHaKfRK8YqIM8I,1532
9
9
  lmnr/sdk/types.py,sha256=6_C2LhcbI9PwlntnSuREE0FRsBUxc3WS_yC_Y_trPBI,5052
10
10
  lmnr/sdk/utils.py,sha256=s81p6uJehgJSaLWy3sR5fTpEDH7vzn3i_UujUHChl6M,3346
@@ -36,17 +36,17 @@ lmnr/traceloop_sdk/tests/test_sdk_initialization.py,sha256=fRaf6lrxFzJIN94P1Tav_
36
36
  lmnr/traceloop_sdk/tests/test_tasks.py,sha256=xlEx8BKp4yG83SCjK5WkPGfyC33JSrx4h8VyjVwGbgw,906
37
37
  lmnr/traceloop_sdk/tests/test_workflows.py,sha256=RVcfY3WAFIDZC15-aSua21aoQyYeWE7KypDyUsm-2EM,9372
38
38
  lmnr/traceloop_sdk/tracing/__init__.py,sha256=Ckq7zCM26VdJVB5tIZv0GTPyMZKyfso_KWD5yPHaqdo,66
39
- lmnr/traceloop_sdk/tracing/attributes.py,sha256=QzfFVhbuYnT-ym4lHocQF_e5zm5Aw8r36FTxV5Qrjlk,1136
39
+ lmnr/traceloop_sdk/tracing/attributes.py,sha256=QeqItpCCwUipkwgXG7J7swJCD0yk9uuI28aepPhemtE,1201
40
40
  lmnr/traceloop_sdk/tracing/content_allow_list.py,sha256=3feztm6PBWNelc8pAZUcQyEGyeSpNiVKjOaDk65l2ps,846
41
41
  lmnr/traceloop_sdk/tracing/context_manager.py,sha256=csVlB6kDmbgSPsROHwnddvGGblx55v6lJMRj0wsSMQM,304
42
- lmnr/traceloop_sdk/tracing/tracing.py,sha256=_HDLuyy4XgobC1ig4qz5jYbB4tWAZSfD6gbgUqwmYJU,35522
42
+ lmnr/traceloop_sdk/tracing/tracing.py,sha256=2Vyc0hUdTqXYlBzoW7YO6DlLaUKWouLv7eEvrVMZYOo,35680
43
43
  lmnr/traceloop_sdk/utils/__init__.py,sha256=pNhf0G3vTd5ccoc03i1MXDbricSaiqCbi1DLWhSekK8,604
44
44
  lmnr/traceloop_sdk/utils/in_memory_span_exporter.py,sha256=H_4TRaThMO1H6vUQ0OpQvzJk_fZH0OOsRAM1iZQXsR8,2112
45
45
  lmnr/traceloop_sdk/utils/json_encoder.py,sha256=dK6b_axr70IYL7Vv-bu4wntvDDuyntoqsHaddqX7P58,463
46
46
  lmnr/traceloop_sdk/utils/package_check.py,sha256=TZSngzJOpFhfUZLXIs38cpMxQiZSmp0D-sCrIyhz7BA,251
47
47
  lmnr/traceloop_sdk/version.py,sha256=OlatFEFA4ttqSSIiV8jdE-sq3KG5zu2hnC4B4mzWF3s,23
48
- lmnr-0.4.26.dist-info/LICENSE,sha256=67b_wJHVV1CBaWkrKFWU1wyqTPSdzH77Ls-59631COg,10411
49
- lmnr-0.4.26.dist-info/METADATA,sha256=AvPOPlTsnPvJkVALFJTdpiR4rZtnEKTwMpBPFyXW6ys,10662
50
- lmnr-0.4.26.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
51
- lmnr-0.4.26.dist-info/entry_points.txt,sha256=K1jE20ww4jzHNZLnsfWBvU3YKDGBgbOiYG5Y7ivQcq4,37
52
- lmnr-0.4.26.dist-info/RECORD,,
48
+ lmnr-0.4.28.dist-info/LICENSE,sha256=67b_wJHVV1CBaWkrKFWU1wyqTPSdzH77Ls-59631COg,10411
49
+ lmnr-0.4.28.dist-info/METADATA,sha256=giQPDHe_FGDtrlT7gPGJIDCdY0aSWTuoq9j9CKE0nO8,10622
50
+ lmnr-0.4.28.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
51
+ lmnr-0.4.28.dist-info/entry_points.txt,sha256=K1jE20ww4jzHNZLnsfWBvU3YKDGBgbOiYG5Y7ivQcq4,37
52
+ lmnr-0.4.28.dist-info/RECORD,,
File without changes
File without changes