lmnr 0.4.39b0__py3-none-any.whl → 0.4.40__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.
@@ -407,7 +407,9 @@ def init_instrumentations(
407
407
 
408
408
  def init_openai_instrumentor(should_enrich_metrics: bool):
409
409
  try:
410
- if is_package_installed("openai"):
410
+ if is_package_installed("openai") and is_package_installed(
411
+ "opentelemetry-instrumentation-openai"
412
+ ):
411
413
  from opentelemetry.instrumentation.openai import OpenAIInstrumentor
412
414
 
413
415
  instrumentor = OpenAIInstrumentor(
@@ -425,7 +427,9 @@ def init_openai_instrumentor(should_enrich_metrics: bool):
425
427
 
426
428
  def init_anthropic_instrumentor(should_enrich_metrics: bool):
427
429
  try:
428
- if is_package_installed("anthropic"):
430
+ if is_package_installed("anthropic") and is_package_installed(
431
+ "opentelemetry-instrumentation-anthropic"
432
+ ):
429
433
  from opentelemetry.instrumentation.anthropic import AnthropicInstrumentor
430
434
 
431
435
  instrumentor = AnthropicInstrumentor(
@@ -442,7 +446,9 @@ def init_anthropic_instrumentor(should_enrich_metrics: bool):
442
446
 
443
447
  def init_cohere_instrumentor():
444
448
  try:
445
- if is_package_installed("cohere"):
449
+ if is_package_installed("cohere") and is_package_installed(
450
+ "opentelemetry-instrumentation-cohere"
451
+ ):
446
452
  from opentelemetry.instrumentation.cohere import CohereInstrumentor
447
453
 
448
454
  instrumentor = CohereInstrumentor()
@@ -456,7 +462,9 @@ def init_cohere_instrumentor():
456
462
 
457
463
  def init_pinecone_instrumentor():
458
464
  try:
459
- if is_package_installed("pinecone"):
465
+ if is_package_installed("pinecone") and is_package_installed(
466
+ "opentelemetry-instrumentation-pinecone"
467
+ ):
460
468
  from opentelemetry.instrumentation.pinecone import PineconeInstrumentor
461
469
 
462
470
  instrumentor = PineconeInstrumentor()
@@ -470,7 +478,9 @@ def init_pinecone_instrumentor():
470
478
 
471
479
  def init_qdrant_instrumentor():
472
480
  try:
473
- if is_package_installed("qdrant_client"):
481
+ if is_package_installed("qdrant_client") and is_package_installed(
482
+ "opentelemetry-instrumentation-qdrant"
483
+ ):
474
484
  from opentelemetry.instrumentation.qdrant import QdrantInstrumentor
475
485
 
476
486
  instrumentor = QdrantInstrumentor()
@@ -483,7 +493,9 @@ def init_qdrant_instrumentor():
483
493
 
484
494
  def init_chroma_instrumentor():
485
495
  try:
486
- if is_package_installed("chromadb"):
496
+ if is_package_installed("chromadb") and is_package_installed(
497
+ "opentelemetry-instrumentation-chromadb"
498
+ ):
487
499
  from opentelemetry.instrumentation.chromadb import ChromaInstrumentor
488
500
 
489
501
  instrumentor = ChromaInstrumentor()
@@ -497,7 +509,9 @@ def init_chroma_instrumentor():
497
509
 
498
510
  def init_google_generativeai_instrumentor():
499
511
  try:
500
- if is_package_installed("google.generativeai"):
512
+ if is_package_installed("google.generativeai") and is_package_installed(
513
+ "opentelemetry-instrumentation-google-generativeai"
514
+ ):
501
515
  from opentelemetry.instrumentation.google_generativeai import (
502
516
  GoogleGenerativeAiInstrumentor,
503
517
  )
@@ -513,7 +527,9 @@ def init_google_generativeai_instrumentor():
513
527
 
514
528
  def init_haystack_instrumentor():
515
529
  try:
516
- if is_package_installed("haystack"):
530
+ if is_package_installed("haystack") and is_package_installed(
531
+ "opentelemetry-instrumentation-haystack"
532
+ ):
517
533
  from opentelemetry.instrumentation.haystack import HaystackInstrumentor
518
534
 
519
535
  instrumentor = HaystackInstrumentor()
@@ -527,7 +543,9 @@ def init_haystack_instrumentor():
527
543
 
528
544
  def init_langchain_instrumentor():
529
545
  try:
530
- if is_package_installed("langchain"):
546
+ if is_package_installed("langchain") and is_package_installed(
547
+ "opentelemetry-instrumentation-langchain"
548
+ ):
531
549
  from opentelemetry.instrumentation.langchain import LangchainInstrumentor
532
550
 
533
551
  instrumentor = LangchainInstrumentor()
@@ -543,7 +561,9 @@ def init_langchain_instrumentor():
543
561
 
544
562
  def init_mistralai_instrumentor():
545
563
  try:
546
- if is_package_installed("mistralai"):
564
+ if is_package_installed("mistralai") and is_package_installed(
565
+ "opentelemetry-instrumentation-mistralai"
566
+ ):
547
567
  from opentelemetry.instrumentation.mistralai import MistralAiInstrumentor
548
568
 
549
569
  instrumentor = MistralAiInstrumentor()
@@ -557,7 +577,9 @@ def init_mistralai_instrumentor():
557
577
 
558
578
  def init_ollama_instrumentor():
559
579
  try:
560
- if is_package_installed("ollama"):
580
+ if is_package_installed("ollama") and is_package_installed(
581
+ "opentelemetry-instrumentation-ollama"
582
+ ):
561
583
  from opentelemetry.instrumentation.ollama import OllamaInstrumentor
562
584
 
563
585
  instrumentor = OllamaInstrumentor()
@@ -571,7 +593,9 @@ def init_ollama_instrumentor():
571
593
 
572
594
  def init_transformers_instrumentor():
573
595
  try:
574
- if is_package_installed("transformers"):
596
+ if is_package_installed("transformers") and is_package_installed(
597
+ "opentelemetry-instrumentation-transformers"
598
+ ):
575
599
  from opentelemetry.instrumentation.transformers import (
576
600
  TransformersInstrumentor,
577
601
  )
@@ -587,7 +611,9 @@ def init_transformers_instrumentor():
587
611
 
588
612
  def init_together_instrumentor():
589
613
  try:
590
- if is_package_installed("together"):
614
+ if is_package_installed("together") and is_package_installed(
615
+ "opentelemetry-instrumentation-together"
616
+ ):
591
617
  from opentelemetry.instrumentation.together import TogetherAiInstrumentor
592
618
 
593
619
  instrumentor = TogetherAiInstrumentor()
@@ -601,7 +627,9 @@ def init_together_instrumentor():
601
627
 
602
628
  def init_llama_index_instrumentor():
603
629
  try:
604
- if is_package_installed("llama-index") or is_package_installed("llama_index"):
630
+ if (
631
+ is_package_installed("llama-index") or is_package_installed("llama_index")
632
+ ) and is_package_installed("opentelemetry-instrumentation-llamaindex"):
605
633
  from opentelemetry.instrumentation.llamaindex import LlamaIndexInstrumentor
606
634
 
607
635
  instrumentor = LlamaIndexInstrumentor()
@@ -615,7 +643,9 @@ def init_llama_index_instrumentor():
615
643
 
616
644
  def init_milvus_instrumentor():
617
645
  try:
618
- if is_package_installed("pymilvus"):
646
+ if is_package_installed("pymilvus") and is_package_installed(
647
+ "opentelemetry-instrumentation-milvus"
648
+ ):
619
649
  from opentelemetry.instrumentation.milvus import MilvusInstrumentor
620
650
 
621
651
  instrumentor = MilvusInstrumentor()
@@ -671,7 +701,9 @@ def init_pymysql_instrumentor():
671
701
 
672
702
  def init_bedrock_instrumentor(should_enrich_metrics: bool):
673
703
  try:
674
- if is_package_installed("boto3"):
704
+ if is_package_installed("boto3") and is_package_installed(
705
+ "opentelemetry-instrumentation-bedrock"
706
+ ):
675
707
  from opentelemetry.instrumentation.bedrock import BedrockInstrumentor
676
708
 
677
709
  instrumentor = BedrockInstrumentor(
@@ -687,7 +719,9 @@ def init_bedrock_instrumentor(should_enrich_metrics: bool):
687
719
 
688
720
  def init_replicate_instrumentor():
689
721
  try:
690
- if is_package_installed("replicate"):
722
+ if is_package_installed("replicate") and is_package_installed(
723
+ "opentelemetry-instrumentation-replicate"
724
+ ):
691
725
  from opentelemetry.instrumentation.replicate import ReplicateInstrumentor
692
726
 
693
727
  instrumentor = ReplicateInstrumentor()
@@ -701,7 +735,9 @@ def init_replicate_instrumentor():
701
735
 
702
736
  def init_vertexai_instrumentor():
703
737
  try:
704
- if is_package_installed("vertexai"):
738
+ if is_package_installed("vertexai") and is_package_installed(
739
+ "opentelemetry-instrumentation-vertexai"
740
+ ):
705
741
  from opentelemetry.instrumentation.vertexai import VertexAIInstrumentor
706
742
 
707
743
  instrumentor = VertexAIInstrumentor()
@@ -715,9 +751,10 @@ def init_vertexai_instrumentor():
715
751
 
716
752
  def init_watsonx_instrumentor():
717
753
  try:
718
- if is_package_installed("ibm-watsonx-ai") or is_package_installed(
719
- "ibm-watson-machine-learning"
720
- ):
754
+ if (
755
+ is_package_installed("ibm-watsonx-ai")
756
+ or is_package_installed("ibm-watson-machine-learning")
757
+ ) and is_package_installed("opentelemetry-instrumentation-watsonx"):
721
758
  from opentelemetry.instrumentation.watsonx import WatsonxInstrumentor
722
759
 
723
760
  instrumentor = WatsonxInstrumentor()
@@ -731,7 +768,9 @@ def init_watsonx_instrumentor():
731
768
 
732
769
  def init_weaviate_instrumentor():
733
770
  try:
734
- if is_package_installed("weaviate"):
771
+ if is_package_installed("weaviate") and is_package_installed(
772
+ "opentelemetry-instrumentation-weaviate"
773
+ ):
735
774
  from opentelemetry.instrumentation.weaviate import WeaviateInstrumentor
736
775
 
737
776
  instrumentor = WeaviateInstrumentor()
@@ -745,7 +784,9 @@ def init_weaviate_instrumentor():
745
784
 
746
785
  def init_alephalpha_instrumentor():
747
786
  try:
748
- if is_package_installed("aleph_alpha_client"):
787
+ if is_package_installed("aleph_alpha_client") and is_package_installed(
788
+ "opentelemetry-instrumentation-alephalpha"
789
+ ):
749
790
  from opentelemetry.instrumentation.alephalpha import AlephAlphaInstrumentor
750
791
 
751
792
  instrumentor = AlephAlphaInstrumentor()
@@ -759,7 +800,9 @@ def init_alephalpha_instrumentor():
759
800
 
760
801
  def init_marqo_instrumentor():
761
802
  try:
762
- if is_package_installed("marqo"):
803
+ if is_package_installed("marqo") and is_package_installed(
804
+ "opentelemetry-instrumentation-marqo"
805
+ ):
763
806
  from opentelemetry.instrumentation.marqo import MarqoInstrumentor
764
807
 
765
808
  instrumentor = MarqoInstrumentor()
@@ -773,7 +816,9 @@ def init_marqo_instrumentor():
773
816
 
774
817
  def init_lancedb_instrumentor():
775
818
  try:
776
- if is_package_installed("lancedb"):
819
+ if is_package_installed("lancedb") and is_package_installed(
820
+ "opentelemetry-instrumentation-lancedb"
821
+ ):
777
822
  from opentelemetry.instrumentation.lancedb import LanceInstrumentor
778
823
 
779
824
  instrumentor = LanceInstrumentor()
@@ -786,7 +831,9 @@ def init_lancedb_instrumentor():
786
831
 
787
832
  def init_redis_instrumentor():
788
833
  try:
789
- if is_package_installed("redis"):
834
+ if is_package_installed("redis") and is_package_installed(
835
+ "opentelemetry-instrumentation-redis"
836
+ ):
790
837
  from opentelemetry.instrumentation.redis import RedisInstrumentor
791
838
 
792
839
  instrumentor = RedisInstrumentor()
@@ -800,7 +847,9 @@ def init_redis_instrumentor():
800
847
 
801
848
  def init_groq_instrumentor():
802
849
  try:
803
- if is_package_installed("groq"):
850
+ if is_package_installed("groq") and is_package_installed(
851
+ "opentelemetry-instrumentation-groq"
852
+ ):
804
853
  from opentelemetry.instrumentation.groq import GroqInstrumentor
805
854
 
806
855
  instrumentor = GroqInstrumentor()
@@ -814,7 +863,9 @@ def init_groq_instrumentor():
814
863
 
815
864
  def init_sagemaker_instrumentor(should_enrich_metrics: bool):
816
865
  try:
817
- if is_package_installed("boto3"):
866
+ if is_package_installed("boto3") and is_package_installed(
867
+ "opentelemetry-instrumentation-sagemaker"
868
+ ):
818
869
  from opentelemetry.instrumentation.sagemaker import SageMakerInstrumentor
819
870
 
820
871
  instrumentor = SageMakerInstrumentor(
@@ -2,5 +2,6 @@ from importlib.metadata import distributions
2
2
 
3
3
  installed_packages = {dist.metadata["Name"].lower() for dist in distributions()}
4
4
 
5
+
5
6
  def is_package_installed(package_name: str) -> bool:
6
7
  return package_name.lower() in installed_packages
lmnr/sdk/decorators.py CHANGED
@@ -7,7 +7,7 @@ from opentelemetry.trace import INVALID_SPAN, get_current_span
7
7
  from typing import Callable, Optional, TypeVar, cast
8
8
  from typing_extensions import ParamSpec
9
9
 
10
- from lmnr.openllmetry_sdk.tracing.attributes import SESSION_ID, USER_ID
10
+ from lmnr.openllmetry_sdk.tracing.attributes import SESSION_ID
11
11
  from lmnr.openllmetry_sdk.tracing.tracing import update_association_properties
12
12
 
13
13
  from .utils import is_async
@@ -20,7 +20,6 @@ R = TypeVar("R")
20
20
  def observe(
21
21
  *,
22
22
  name: Optional[str] = None,
23
- user_id: Optional[str] = None,
24
23
  session_id: Optional[str] = None,
25
24
  ) -> Callable[[Callable[P, R]], Callable[P, R]]:
26
25
  """The main decorator entrypoint for Laminar. This is used to wrap
@@ -30,9 +29,6 @@ def observe(
30
29
  name (Optional[str], optional): Name of the span. Function
31
30
  name is used if not specified.
32
31
  Defaults to None.
33
- user_id (Optional[str], optional): User ID to associate
34
- with the span and the following context.
35
- Defaults to None.
36
32
  session_id (Optional[str], optional): Session ID to associate with the
37
33
  span and the following context. Defaults to None.
38
34
 
@@ -49,13 +45,9 @@ def observe(
49
45
  if current_span != INVALID_SPAN:
50
46
  if session_id is not None:
51
47
  current_span.set_attribute(SESSION_ID, session_id)
52
- if user_id is not None:
53
- current_span.set_attribute(USER_ID, user_id)
54
48
  association_properties = {}
55
49
  if session_id is not None:
56
50
  association_properties["session_id"] = session_id
57
- if user_id is not None:
58
- association_properties["user_id"] = user_id
59
51
  update_association_properties(association_properties)
60
52
  return (
61
53
  aentity_method(name=name)(func)
lmnr/sdk/laminar.py CHANGED
@@ -36,7 +36,6 @@ from lmnr.openllmetry_sdk.tracing.attributes import (
36
36
  SPAN_OUTPUT,
37
37
  SPAN_PATH,
38
38
  TRACE_TYPE,
39
- USER_ID,
40
39
  )
41
40
  from lmnr.openllmetry_sdk.tracing.tracing import (
42
41
  get_span_path,
@@ -588,7 +587,6 @@ class Laminar:
588
587
  def set_session(
589
588
  cls,
590
589
  session_id: Optional[str] = None,
591
- user_id: Optional[str] = None,
592
590
  ):
593
591
  """Set the session and user id for the current span and the context
594
592
  (i.e. any children spans created from the current span in the current
@@ -599,29 +597,18 @@ class Laminar:
599
597
  Useful to debug and group long-running\
600
598
  sessions/conversations.
601
599
  Defaults to None.
602
- user_id (Optional[str], optional). Deprecated.\
603
- Use `Laminar.set_metadata` instead.\
604
- Custom user id.\
605
- Useful for grouping spans or traces by user.\
606
- Defaults to None.
607
600
  """
608
601
  association_properties = {}
609
602
  if session_id is not None:
610
603
  association_properties[SESSION_ID] = session_id
611
- if user_id is not None:
612
- cls.__logger.warning(
613
- "User ID in set_session is deprecated and will be removed soon. "
614
- "Please use `Laminar.set_metadata` instead."
615
- )
616
- association_properties["metadata." + USER_ID] = user_id
617
604
  update_association_properties(association_properties)
618
605
 
619
606
  @classmethod
620
- def set_metadata(cls, metadata: dict[str, Any]):
607
+ def set_metadata(cls, metadata: dict[str, str]):
621
608
  """Set the metadata for the current trace.
622
609
 
623
610
  Args:
624
- metadata (dict[str, Any]): Metadata to set for the trace. Willl be\
611
+ metadata (dict[str, str]): Metadata to set for the trace. Willl be\
625
612
  sent as attributes, so must be json serializable.
626
613
  """
627
614
  props = {f"metadata.{k}": json_dumps(v) for k, v in metadata.items()}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lmnr
3
- Version: 0.4.39b0
3
+ Version: 0.4.40
4
4
  Summary: Python SDK for Laminar AI
5
5
  License: Apache-2.0
6
6
  Author: lmnr.ai
@@ -12,7 +12,32 @@ 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
- Provides-Extra: full
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
16
41
  Requires-Dist: argparse (>=1.0,<2.0)
17
42
  Requires-Dist: backoff (>=2.0,<3.0)
18
43
  Requires-Dist: deprecated (>=1.0,<2.0)
@@ -20,10 +45,35 @@ Requires-Dist: jinja2 (>=3.0,<4.0)
20
45
  Requires-Dist: opentelemetry-api (>=1.28.0)
21
46
  Requires-Dist: opentelemetry-exporter-otlp-proto-grpc (>=1.28.0)
22
47
  Requires-Dist: opentelemetry-exporter-otlp-proto-http (>=1.28.0)
48
+ Requires-Dist: opentelemetry-instrumentation-alephalpha (>=0.33.12) ; extra == "all" or extra == "alephalpha"
49
+ Requires-Dist: opentelemetry-instrumentation-anthropic (>=0.33.12) ; extra == "all" or extra == "anthropic"
50
+ Requires-Dist: opentelemetry-instrumentation-bedrock (>=0.33.12) ; extra == "all" or extra == "bedrock"
51
+ Requires-Dist: opentelemetry-instrumentation-chromadb (>=0.33.12) ; extra == "all" or extra == "chromadb"
52
+ Requires-Dist: opentelemetry-instrumentation-cohere (>=0.33.12) ; extra == "all" or extra == "cohere"
53
+ Requires-Dist: opentelemetry-instrumentation-google-generativeai (>=0.33.12) ; extra == "all" or extra == "google-generativeai"
54
+ Requires-Dist: opentelemetry-instrumentation-groq (>=0.33.12) ; extra == "all" or extra == "groq"
55
+ Requires-Dist: opentelemetry-instrumentation-haystack (>=0.33.12) ; extra == "all" or extra == "haystack"
56
+ Requires-Dist: opentelemetry-instrumentation-lancedb (>=0.33.12) ; extra == "all" or extra == "lancedb"
57
+ Requires-Dist: opentelemetry-instrumentation-langchain (>=0.33.12) ; extra == "all" or extra == "langchain"
58
+ Requires-Dist: opentelemetry-instrumentation-llamaindex (>=0.33.12) ; extra == "all" or extra == "llamaindex"
59
+ Requires-Dist: opentelemetry-instrumentation-marqo (>=0.33.12) ; extra == "all" or extra == "marqo"
60
+ Requires-Dist: opentelemetry-instrumentation-milvus (>=0.33.12) ; extra == "all" or extra == "milvus"
61
+ Requires-Dist: opentelemetry-instrumentation-mistralai (>=0.33.12) ; extra == "all" or extra == "mistralai"
62
+ Requires-Dist: opentelemetry-instrumentation-ollama (>=0.33.12) ; extra == "all" or extra == "ollama"
63
+ Requires-Dist: opentelemetry-instrumentation-openai (>=0.33.12) ; extra == "all" or extra == "openai"
64
+ Requires-Dist: opentelemetry-instrumentation-pinecone (>=0.33.12) ; extra == "all" or extra == "pinecone"
65
+ Requires-Dist: opentelemetry-instrumentation-qdrant (>=0.33.12) ; extra == "all" or extra == "qdrant"
66
+ Requires-Dist: opentelemetry-instrumentation-replicate (>=0.33.12) ; extra == "all" or extra == "replicate"
23
67
  Requires-Dist: opentelemetry-instrumentation-requests (>=0.49b0,<0.50)
68
+ Requires-Dist: opentelemetry-instrumentation-sagemaker (>=0.33.12) ; extra == "all" or extra == "sagemaker"
24
69
  Requires-Dist: opentelemetry-instrumentation-sqlalchemy (>=0.49b0,<0.50)
25
70
  Requires-Dist: opentelemetry-instrumentation-threading (>=0.49b0,<0.50)
71
+ Requires-Dist: opentelemetry-instrumentation-together (>=0.33.12) ; extra == "all" or extra == "together"
72
+ Requires-Dist: opentelemetry-instrumentation-transformers (>=0.33.12) ; extra == "all" or extra == "transformers"
26
73
  Requires-Dist: opentelemetry-instrumentation-urllib3 (>=0.49b0,<0.50)
74
+ Requires-Dist: opentelemetry-instrumentation-vertexai (>=0.33.12) ; extra == "all" or extra == "vertexai"
75
+ Requires-Dist: opentelemetry-instrumentation-watsonx (>=0.33.12) ; extra == "all" or extra == "watsonx"
76
+ Requires-Dist: opentelemetry-instrumentation-weaviate (>=0.33.12) ; extra == "all" or extra == "weaviate"
27
77
  Requires-Dist: opentelemetry-sdk (>=1.28.0)
28
78
  Requires-Dist: opentelemetry-semantic-conventions-ai (==0.4.2)
29
79
  Requires-Dist: pydantic (>=2.7,<3.0)
@@ -48,23 +98,28 @@ Check our [open-source repo](https://github.com/lmnr-ai/lmnr) and don't forget t
48
98
 
49
99
  ## Quickstart
50
100
 
51
- First, install the package:
101
+ First, install the package, specifying the instrumentations you want to use.
102
+
103
+ For example, to install the package with OpenAI and Anthropic instrumentations:
52
104
 
53
105
  ```sh
54
- pip install lmnr
106
+ pip install 'lmnr[anthropic,openai]'
55
107
  ```
56
108
 
57
- And then in the code
109
+ To install all possible instrumentations, use the following command:
110
+
111
+ ```sh
112
+ pip install 'lmnr[all]'
113
+ ```
114
+
115
+ Initialize Laminar in your code:
58
116
 
59
117
  ```python
60
- from lmnr import Laminar as L
118
+ from lmnr import Laminar
61
119
 
62
- L.initialize(project_api_key="<PROJECT_API_KEY>")
120
+ Laminar.initialize(project_api_key="<PROJECT_API_KEY>")
63
121
  ```
64
122
 
65
- This will automatically instrument most of the LLM, Vector DB, and related
66
- calls with OpenTelemetry-compatible instrumentation.
67
-
68
123
  Note that you need to only initialize Laminar once in your application.
69
124
 
70
125
  ## Instrumentation
@@ -77,9 +132,9 @@ This can be useful if you want to trace a request handler or a function which co
77
132
  ```python
78
133
  import os
79
134
  from openai import OpenAI
80
- from lmnr import Laminar as L, Instruments
135
+ from lmnr import Laminar
81
136
 
82
- L.initialize(project_api_key=os.environ["LMNR_PROJECT_API_KEY"])
137
+ Laminar.initialize(project_api_key=os.environ["LMNR_PROJECT_API_KEY"])
83
138
 
84
139
  client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
85
140
 
@@ -102,9 +157,7 @@ def poem_writer(topic: str):
102
157
  @observe()
103
158
  def generate_poems():
104
159
  poem1 = poem_writer(topic="laminar flow")
105
- L.event("is_poem_generated", True)
106
160
  poem2 = poem_writer(topic="turbulence")
107
- L.event("is_poem_generated", True)
108
161
  poems = f"{poem1}\n\n---\n\n{poem2}"
109
162
  return poems
110
163
  ```
@@ -113,18 +166,10 @@ Also, you can use `Laminar.start_as_current_span` if you want to record a chunk
113
166
 
114
167
  ```python
115
168
  def handle_user_request(topic: str):
116
- with L.start_as_current_span(name="poem_writer", input=topic):
117
- ...
118
-
169
+ with Laminar.start_as_current_span(name="poem_writer", input=topic):
119
170
  poem = poem_writer(topic=topic)
120
-
121
- ...
122
-
123
- # while within the span, you can attach laminar events to it
124
- L.event("is_poem_generated", True)
125
-
126
171
  # Use set_span_output to record the output of the span
127
- L.set_span_output(poem)
172
+ Laminar.set_span_output(poem)
128
173
  ```
129
174
 
130
175
  ### Automatic instrumentation
@@ -139,9 +184,9 @@ calls with OpenTelemetry-compatible instrumentation, then pass the appropriate i
139
184
  For example, if you want to only instrument OpenAI and Anthropic, then do the following:
140
185
 
141
186
  ```python
142
- from lmnr import Laminar as L, Instruments
187
+ from lmnr import Laminar, Instruments
143
188
 
144
- L.initialize(project_api_key=os.environ["LMNR_PROJECT_API_KEY"], instruments={Instruments.OPENAI, Instruments.ANTHROPIC})
189
+ Laminar.initialize(project_api_key=os.environ["LMNR_PROJECT_API_KEY"], instruments={Instruments.OPENAI, Instruments.ANTHROPIC})
145
190
  ```
146
191
 
147
192
  If you want to fully disable any kind of autoinstrumentation, pass an empty set as `instruments=set()` to `.initialize()`.
@@ -222,11 +267,11 @@ Once your pipeline target is set, you can call it from Python in just a few line
222
267
  Example use:
223
268
 
224
269
  ```python
225
- from lmnr import Laminar as L
270
+ from lmnr import Laminar
226
271
 
227
- L.initialize('<YOUR_PROJECT_API_KEY>', instruments=set())
272
+ Laminar.initialize('<YOUR_PROJECT_API_KEY>', instruments=set())
228
273
 
229
- result = l.run(
274
+ result = Laminar.run(
230
275
  pipeline = 'my_pipeline_name',
231
276
  inputs = {'input_node_name': 'some_value'},
232
277
  # all environment variables
@@ -11,22 +11,22 @@ lmnr/openllmetry_sdk/tracing/__init__.py,sha256=xT73L1t2si2CM6QmMiTZ7zn-dKKYBLNr
11
11
  lmnr/openllmetry_sdk/tracing/attributes.py,sha256=h970zmb7yTszzf2oHBfOY3cDYhE6O7LhkiHLqa_7x1k,1261
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=j16opjtsUZ_xjh0kKAi3JswX7HUxou6EnFV63atpFnM,29808
14
+ lmnr/openllmetry_sdk/tracing/tracing.py,sha256=TvVQ0lxKOyIUkK5d35cFfpQdPG2Tmvtu7cNeAF_zonM,32117
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=Ki74WZME-ASF0fx7RXSIMsULGYUzI86sOINi1EGrc_Y,235
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
21
  lmnr/sdk/datasets.py,sha256=w8U9E6fvetAo65Cb2CbYzlfhY8CfXAR-VysrakG6-4I,1591
22
- lmnr/sdk/decorators.py,sha256=kH7wNmxahNYu8DieodQrf3DyNtzEoxt0XB7LErGkn8k,2256
22
+ lmnr/sdk/decorators.py,sha256=ja2EUWUWvFOp28ER0k78PRuxNahwCVyH0TdM3U-xY7U,1856
23
23
  lmnr/sdk/evaluations.py,sha256=rz92RKam5bWTj-w-c2ZTdsK6Bl7KSxW5UarBjG472Mc,16268
24
- lmnr/sdk/laminar.py,sha256=k5vxPdS4IN48M-k-JqGK2VPuAD6kvzhOLjEZcOuW8b8,27443
24
+ lmnr/sdk/laminar.py,sha256=0wZE0gDq8eEx4zOTNuLuD--tY9DNSBGldo8158cfxmY,26810
25
25
  lmnr/sdk/log.py,sha256=cZBeUoSK39LMEV-X4-eEhTWOciULRfHaKfRK8YqIM8I,1532
26
26
  lmnr/sdk/types.py,sha256=qGD1tkGszd-_sZJaZ_Zx9U_CdUYzoDkUeN2g-o48Gls,5588
27
27
  lmnr/sdk/utils.py,sha256=Uk8y15x-sd5tP2ERONahElLDJVEy_3dA_1_5g9A6auY,3358
28
- lmnr-0.4.39b0.dist-info/LICENSE,sha256=67b_wJHVV1CBaWkrKFWU1wyqTPSdzH77Ls-59631COg,10411
29
- lmnr-0.4.39b0.dist-info/METADATA,sha256=maWQfdgVL-Xw3uyEbEJEH7Q_bS5WgBFF8N6H5gfRgxE,8741
30
- lmnr-0.4.39b0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
31
- lmnr-0.4.39b0.dist-info/entry_points.txt,sha256=K1jE20ww4jzHNZLnsfWBvU3YKDGBgbOiYG5Y7ivQcq4,37
32
- lmnr-0.4.39b0.dist-info/RECORD,,
28
+ lmnr-0.4.40.dist-info/LICENSE,sha256=67b_wJHVV1CBaWkrKFWU1wyqTPSdzH77Ls-59631COg,10411
29
+ lmnr-0.4.40.dist-info/METADATA,sha256=PH9XYlxd--FIEL4sG_j6TtUjrxiWDz1XXCWQuE5MV7g,11938
30
+ lmnr-0.4.40.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
31
+ lmnr-0.4.40.dist-info/entry_points.txt,sha256=K1jE20ww4jzHNZLnsfWBvU3YKDGBgbOiYG5Y7ivQcq4,37
32
+ lmnr-0.4.40.dist-info/RECORD,,
File without changes