lmnr 0.4.36__tar.gz → 0.4.37__tar.gz
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-0.4.36 → lmnr-0.4.37}/PKG-INFO +2 -2
- {lmnr-0.4.36 → lmnr-0.4.37}/README.md +1 -1
- {lmnr-0.4.36 → lmnr-0.4.37}/pyproject.toml +2 -2
- {lmnr-0.4.36 → lmnr-0.4.37}/src/lmnr/__init__.py +2 -2
- {lmnr-0.4.36/src/lmnr/traceloop_sdk → lmnr-0.4.37/src/lmnr/openllmetry_sdk}/__init__.py +3 -3
- {lmnr-0.4.36/src/lmnr/traceloop_sdk → lmnr-0.4.37/src/lmnr/openllmetry_sdk}/decorators/base.py +4 -4
- lmnr-0.4.37/src/lmnr/openllmetry_sdk/tracing/__init__.py +1 -0
- {lmnr-0.4.36/src/lmnr/traceloop_sdk → lmnr-0.4.37/src/lmnr/openllmetry_sdk}/tracing/context_manager.py +1 -1
- {lmnr-0.4.36/src/lmnr/traceloop_sdk → lmnr-0.4.37/src/lmnr/openllmetry_sdk}/tracing/tracing.py +61 -47
- {lmnr-0.4.36 → lmnr-0.4.37}/src/lmnr/sdk/decorators.py +3 -3
- {lmnr-0.4.36 → lmnr-0.4.37}/src/lmnr/sdk/evaluations.py +2 -2
- {lmnr-0.4.36 → lmnr-0.4.37}/src/lmnr/sdk/laminar.py +7 -7
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tests/__init__.py +0 -1
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tests/cassettes/test_association_properties/test_langchain_and_external_association_properties.yaml +0 -101
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tests/cassettes/test_association_properties/test_langchain_association_properties.yaml +0 -99
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tests/cassettes/test_manual/test_manual_report.yaml +0 -98
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tests/cassettes/test_manual/test_resource_attributes.yaml +0 -98
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tests/cassettes/test_privacy_no_prompts/test_simple_workflow.yaml +0 -199
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tests/cassettes/test_prompt_management/test_prompt_management.yaml +0 -202
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tests/cassettes/test_sdk_initialization/test_resource_attributes.yaml +0 -199
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tests/cassettes/test_tasks/test_task_io_serialization_with_langchain.yaml +0 -96
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tests/cassettes/test_workflows/test_simple_aworkflow.yaml +0 -98
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tests/cassettes/test_workflows/test_simple_workflow.yaml +0 -199
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tests/cassettes/test_workflows/test_streaming_workflow.yaml +0 -167
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tests/conftest.py +0 -111
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tests/test_association_properties.py +0 -229
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tests/test_manual.py +0 -48
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tests/test_nested_tasks.py +0 -47
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tests/test_privacy_no_prompts.py +0 -50
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tests/test_sdk_initialization.py +0 -57
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tests/test_tasks.py +0 -32
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tests/test_workflows.py +0 -262
- lmnr-0.4.36/src/lmnr/traceloop_sdk/tracing/__init__.py +0 -1
- {lmnr-0.4.36 → lmnr-0.4.37}/LICENSE +0 -0
- {lmnr-0.4.36 → lmnr-0.4.37}/src/lmnr/cli.py +0 -0
- {lmnr-0.4.36/src/lmnr/traceloop_sdk → lmnr-0.4.37/src/lmnr/openllmetry_sdk}/.flake8 +0 -0
- {lmnr-0.4.36/src/lmnr/traceloop_sdk → lmnr-0.4.37/src/lmnr/openllmetry_sdk}/.python-version +0 -0
- {lmnr-0.4.36/src/lmnr/traceloop_sdk → lmnr-0.4.37/src/lmnr/openllmetry_sdk}/config/__init__.py +0 -0
- {lmnr-0.4.36/src/lmnr/sdk → lmnr-0.4.37/src/lmnr/openllmetry_sdk/decorators}/__init__.py +0 -0
- {lmnr-0.4.36/src/lmnr/traceloop_sdk → lmnr-0.4.37/src/lmnr/openllmetry_sdk}/instruments.py +0 -0
- {lmnr-0.4.36/src/lmnr/traceloop_sdk → lmnr-0.4.37/src/lmnr/openllmetry_sdk}/tracing/attributes.py +0 -0
- {lmnr-0.4.36/src/lmnr/traceloop_sdk → lmnr-0.4.37/src/lmnr/openllmetry_sdk}/tracing/content_allow_list.py +0 -0
- {lmnr-0.4.36/src/lmnr/traceloop_sdk → lmnr-0.4.37/src/lmnr/openllmetry_sdk}/utils/__init__.py +0 -0
- {lmnr-0.4.36/src/lmnr/traceloop_sdk → lmnr-0.4.37/src/lmnr/openllmetry_sdk}/utils/in_memory_span_exporter.py +0 -0
- {lmnr-0.4.36/src/lmnr/traceloop_sdk → lmnr-0.4.37/src/lmnr/openllmetry_sdk}/utils/json_encoder.py +0 -0
- {lmnr-0.4.36/src/lmnr/traceloop_sdk → lmnr-0.4.37/src/lmnr/openllmetry_sdk}/utils/package_check.py +0 -0
- {lmnr-0.4.36/src/lmnr/traceloop_sdk → lmnr-0.4.37/src/lmnr/openllmetry_sdk}/version.py +0 -0
- {lmnr-0.4.36/src/lmnr/traceloop_sdk/decorators → lmnr-0.4.37/src/lmnr/sdk}/__init__.py +0 -0
- {lmnr-0.4.36 → lmnr-0.4.37}/src/lmnr/sdk/datasets.py +0 -0
- {lmnr-0.4.36 → lmnr-0.4.37}/src/lmnr/sdk/log.py +0 -0
- {lmnr-0.4.36 → lmnr-0.4.37}/src/lmnr/sdk/types.py +0 -0
- {lmnr-0.4.36 → lmnr-0.4.37}/src/lmnr/sdk/utils.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: lmnr
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.37
|
4
4
|
Summary: Python SDK for Laminar AI
|
5
5
|
License: Apache-2.0
|
6
6
|
Author: lmnr.ai
|
@@ -156,7 +156,7 @@ def handle_user_request(topic: str):
|
|
156
156
|
Laminar allows you to automatically instrument majority of the most popular LLM, Vector DB, database, requests, and other libraries.
|
157
157
|
|
158
158
|
If you want to automatically instrument a default set of libraries, then simply do NOT pass `instruments` argument to `.initialize()`.
|
159
|
-
See the full list of available instrumentations in the [enum](/src/lmnr/
|
159
|
+
See the full list of available instrumentations in the [enum](https://github.com/lmnr-ai/lmnr-python/blob/main/src/lmnr/openllmetry_sdk/instruments.py).
|
160
160
|
|
161
161
|
If you want to automatically instrument only specific LLM, Vector DB, or other
|
162
162
|
calls with OpenTelemetry-compatible instrumentation, then pass the appropriate instruments to `.initialize()`.
|
@@ -97,7 +97,7 @@ def handle_user_request(topic: str):
|
|
97
97
|
Laminar allows you to automatically instrument majority of the most popular LLM, Vector DB, database, requests, and other libraries.
|
98
98
|
|
99
99
|
If you want to automatically instrument a default set of libraries, then simply do NOT pass `instruments` argument to `.initialize()`.
|
100
|
-
See the full list of available instrumentations in the [enum](/src/lmnr/
|
100
|
+
See the full list of available instrumentations in the [enum](https://github.com/lmnr-ai/lmnr-python/blob/main/src/lmnr/openllmetry_sdk/instruments.py).
|
101
101
|
|
102
102
|
If you want to automatically instrument only specific LLM, Vector DB, or other
|
103
103
|
calls with OpenTelemetry-compatible instrumentation, then pass the appropriate instruments to `.initialize()`.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "lmnr"
|
3
|
-
version = "0.4.
|
3
|
+
version = "0.4.37"
|
4
4
|
description = "Python SDK for Laminar AI"
|
5
5
|
authors = [
|
6
6
|
{ name = "lmnr.ai", email = "founders@lmnr.ai" }
|
@@ -11,7 +11,7 @@ license = "Apache-2.0"
|
|
11
11
|
|
12
12
|
[tool.poetry]
|
13
13
|
name = "lmnr"
|
14
|
-
version = "0.4.
|
14
|
+
version = "0.4.37"
|
15
15
|
description = "Python SDK for Laminar AI"
|
16
16
|
authors = ["lmnr.ai"]
|
17
17
|
readme = "README.md"
|
@@ -9,6 +9,6 @@ from .sdk.types import (
|
|
9
9
|
PipelineRunResponse,
|
10
10
|
)
|
11
11
|
from .sdk.decorators import observe
|
12
|
-
from .
|
13
|
-
from .
|
12
|
+
from .openllmetry_sdk import Instruments
|
13
|
+
from .openllmetry_sdk.tracing.attributes import Attributes
|
14
14
|
from opentelemetry.trace import use_span
|
@@ -9,12 +9,12 @@ from opentelemetry.sdk.resources import SERVICE_NAME
|
|
9
9
|
from opentelemetry.propagators.textmap import TextMapPropagator
|
10
10
|
from opentelemetry.util.re import parse_env_headers
|
11
11
|
|
12
|
-
from lmnr.
|
13
|
-
from lmnr.
|
12
|
+
from lmnr.openllmetry_sdk.instruments import Instruments
|
13
|
+
from lmnr.openllmetry_sdk.config import (
|
14
14
|
is_content_tracing_enabled,
|
15
15
|
is_tracing_enabled,
|
16
16
|
)
|
17
|
-
from lmnr.
|
17
|
+
from lmnr.openllmetry_sdk.tracing.tracing import TracerWrapper
|
18
18
|
from typing import Dict
|
19
19
|
|
20
20
|
|
{lmnr-0.4.36/src/lmnr/traceloop_sdk → lmnr-0.4.37/src/lmnr/openllmetry_sdk}/decorators/base.py
RENAMED
@@ -10,10 +10,10 @@ from opentelemetry import trace
|
|
10
10
|
from opentelemetry import context as context_api
|
11
11
|
|
12
12
|
from lmnr.sdk.utils import get_input_from_func_args, is_method
|
13
|
-
from lmnr.
|
14
|
-
from lmnr.
|
15
|
-
from lmnr.
|
16
|
-
from lmnr.
|
13
|
+
from lmnr.openllmetry_sdk.tracing import get_tracer
|
14
|
+
from lmnr.openllmetry_sdk.tracing.attributes import SPAN_INPUT, SPAN_OUTPUT, SPAN_PATH
|
15
|
+
from lmnr.openllmetry_sdk.tracing.tracing import TracerWrapper, get_span_path
|
16
|
+
from lmnr.openllmetry_sdk.utils.json_encoder import JSONEncoder
|
17
17
|
|
18
18
|
|
19
19
|
class CustomJSONEncoder(JSONEncoder):
|
@@ -0,0 +1 @@
|
|
1
|
+
from lmnr.openllmetry_sdk.tracing.context_manager import get_tracer
|
{lmnr-0.4.36/src/lmnr/traceloop_sdk → lmnr-0.4.37/src/lmnr/openllmetry_sdk}/tracing/tracing.py
RENAMED
@@ -4,15 +4,16 @@ import logging
|
|
4
4
|
|
5
5
|
|
6
6
|
from contextvars import Context
|
7
|
-
from lmnr.
|
8
|
-
from lmnr.
|
7
|
+
from lmnr.sdk.log import VerboseColorfulFormatter
|
8
|
+
from lmnr.openllmetry_sdk.instruments import Instruments
|
9
|
+
from lmnr.openllmetry_sdk.tracing.attributes import (
|
9
10
|
ASSOCIATION_PROPERTIES,
|
10
11
|
SPAN_INSTRUMENTATION_SOURCE,
|
11
12
|
SPAN_PATH,
|
12
13
|
)
|
13
|
-
from lmnr.
|
14
|
-
from lmnr.
|
15
|
-
from lmnr.
|
14
|
+
from lmnr.openllmetry_sdk.tracing.content_allow_list import ContentAllowList
|
15
|
+
from lmnr.openllmetry_sdk.utils import is_notebook
|
16
|
+
from lmnr.openllmetry_sdk.utils.package_check import is_package_installed
|
16
17
|
from opentelemetry import trace
|
17
18
|
from opentelemetry.exporter.otlp.proto.http.trace_exporter import (
|
18
19
|
OTLPSpanExporter as HTTPExporter,
|
@@ -35,6 +36,11 @@ from opentelemetry.trace import get_tracer_provider, ProxyTracerProvider
|
|
35
36
|
|
36
37
|
from typing import Dict, Optional, Set
|
37
38
|
|
39
|
+
module_logger = logging.getLogger(__name__)
|
40
|
+
console_log_handler = logging.StreamHandler()
|
41
|
+
console_log_handler.setFormatter(VerboseColorfulFormatter())
|
42
|
+
module_logger.addHandler(console_log_handler)
|
43
|
+
|
38
44
|
|
39
45
|
TRACER_NAME = "lmnr.tracer"
|
40
46
|
EXCLUDED_URLS = """
|
@@ -62,6 +68,7 @@ class TracerWrapper(object):
|
|
62
68
|
endpoint: str = None
|
63
69
|
headers: Dict[str, str] = {}
|
64
70
|
__tracer_provider: TracerProvider = None
|
71
|
+
__logger: logging.Logger = None
|
65
72
|
|
66
73
|
def __new__(
|
67
74
|
cls,
|
@@ -72,6 +79,7 @@ class TracerWrapper(object):
|
|
72
79
|
should_enrich_metrics: bool = False,
|
73
80
|
instruments: Optional[Set[Instruments]] = None,
|
74
81
|
) -> "TracerWrapper":
|
82
|
+
cls._initialize_logger(cls)
|
75
83
|
if not hasattr(cls, "instance"):
|
76
84
|
obj = cls.instance = super(TracerWrapper, cls).__new__(cls)
|
77
85
|
if not TracerWrapper.endpoint:
|
@@ -115,8 +123,8 @@ class TracerWrapper(object):
|
|
115
123
|
)
|
116
124
|
|
117
125
|
if not instrument_set:
|
118
|
-
|
119
|
-
"
|
126
|
+
cls.__logger.warning(
|
127
|
+
"No valid instruments set. Remove 'instrument' "
|
120
128
|
"argument to use all instruments, or set a valid instrument."
|
121
129
|
)
|
122
130
|
|
@@ -130,6 +138,12 @@ class TracerWrapper(object):
|
|
130
138
|
def exit_handler(self):
|
131
139
|
self.flush()
|
132
140
|
|
141
|
+
def _initialize_logger(self):
|
142
|
+
self.__logger = logging.getLogger(__name__)
|
143
|
+
console_log_handler = logging.StreamHandler()
|
144
|
+
console_log_handler.setFormatter(VerboseColorfulFormatter())
|
145
|
+
self.__logger.addHandler(console_log_handler)
|
146
|
+
|
133
147
|
def _span_processor_on_start(self, span, parent_context):
|
134
148
|
span_path = get_value("span_path")
|
135
149
|
if span_path is not None:
|
@@ -172,7 +186,7 @@ class TracerWrapper(object):
|
|
172
186
|
if hasattr(cls, "instance"):
|
173
187
|
return True
|
174
188
|
|
175
|
-
|
189
|
+
cls.__logger.warning("Laminar not initialized, make sure to initialize")
|
176
190
|
return False
|
177
191
|
|
178
192
|
def flush(self):
|
@@ -253,7 +267,7 @@ def init_tracer_provider(resource: Resource) -> TracerProvider:
|
|
253
267
|
provider = TracerProvider(resource=resource)
|
254
268
|
trace.set_tracer_provider(provider)
|
255
269
|
elif not hasattr(default_provider, "add_span_processor"):
|
256
|
-
|
270
|
+
module_logger.error(
|
257
271
|
"Cannot add span processor to the default provider since it doesn't support it"
|
258
272
|
)
|
259
273
|
return
|
@@ -280,7 +294,11 @@ def init_instrumentations(
|
|
280
294
|
]
|
281
295
|
)
|
282
296
|
|
283
|
-
instruments =
|
297
|
+
instruments = (
|
298
|
+
instruments
|
299
|
+
if instruments is not None
|
300
|
+
else (set(Instruments) - default_off_instruments)
|
301
|
+
)
|
284
302
|
|
285
303
|
# Remove any instruments that were explicitly blocked
|
286
304
|
instruments = instruments - block_instruments
|
@@ -375,19 +393,15 @@ def init_instrumentations(
|
|
375
393
|
if init_weaviate_instrumentor():
|
376
394
|
instrument_set = True
|
377
395
|
else:
|
378
|
-
|
379
|
-
|
396
|
+
module_logger.warning(
|
397
|
+
f"Warning: {instrument} instrumentation does not exist."
|
398
|
+
)
|
399
|
+
module_logger.warning(
|
380
400
|
"Usage:\n"
|
381
401
|
"from lmnr import Laminar, Instruments\n"
|
382
402
|
"Laminar.init(instruments=set([Instruments.OPENAI]))"
|
383
403
|
)
|
384
404
|
|
385
|
-
if not instrument_set:
|
386
|
-
logging.warning(
|
387
|
-
"Warning: No valid instruments set. "
|
388
|
-
+ "Specify instruments or remove 'instruments' argument to use all instruments."
|
389
|
-
)
|
390
|
-
|
391
405
|
return instrument_set
|
392
406
|
|
393
407
|
|
@@ -405,7 +419,7 @@ def init_openai_instrumentor(should_enrich_metrics: bool):
|
|
405
419
|
return True
|
406
420
|
|
407
421
|
except Exception as e:
|
408
|
-
|
422
|
+
module_logger.error(f"Error initializing OpenAI instrumentor: {e}")
|
409
423
|
return False
|
410
424
|
|
411
425
|
|
@@ -422,7 +436,7 @@ def init_anthropic_instrumentor(should_enrich_metrics: bool):
|
|
422
436
|
instrumentor.instrument()
|
423
437
|
return True
|
424
438
|
except Exception as e:
|
425
|
-
|
439
|
+
module_logger.error(f"Error initializing Anthropic instrumentor: {e}")
|
426
440
|
return False
|
427
441
|
|
428
442
|
|
@@ -436,7 +450,7 @@ def init_cohere_instrumentor():
|
|
436
450
|
instrumentor.instrument()
|
437
451
|
return True
|
438
452
|
except Exception as e:
|
439
|
-
|
453
|
+
module_logger.error(f"Error initializing Cohere instrumentor: {e}")
|
440
454
|
return False
|
441
455
|
|
442
456
|
|
@@ -450,7 +464,7 @@ def init_pinecone_instrumentor():
|
|
450
464
|
instrumentor.instrument()
|
451
465
|
return True
|
452
466
|
except Exception as e:
|
453
|
-
|
467
|
+
module_logger.error(f"Error initializing Pinecone instrumentor: {e}")
|
454
468
|
return False
|
455
469
|
|
456
470
|
|
@@ -463,7 +477,7 @@ def init_qdrant_instrumentor():
|
|
463
477
|
if not instrumentor.is_instrumented_by_opentelemetry:
|
464
478
|
instrumentor.instrument()
|
465
479
|
except Exception as e:
|
466
|
-
|
480
|
+
module_logger.error(f"Error initializing Qdrant instrumentor: {e}")
|
467
481
|
return False
|
468
482
|
|
469
483
|
|
@@ -477,7 +491,7 @@ def init_chroma_instrumentor():
|
|
477
491
|
instrumentor.instrument()
|
478
492
|
return True
|
479
493
|
except Exception as e:
|
480
|
-
|
494
|
+
module_logger.error(f"Error initializing Chroma instrumentor: {e}")
|
481
495
|
return False
|
482
496
|
|
483
497
|
|
@@ -493,7 +507,7 @@ def init_google_generativeai_instrumentor():
|
|
493
507
|
instrumentor.instrument()
|
494
508
|
return True
|
495
509
|
except Exception as e:
|
496
|
-
|
510
|
+
module_logger.error(f"Error initializing Gemini instrumentor: {e}")
|
497
511
|
return False
|
498
512
|
|
499
513
|
|
@@ -507,7 +521,7 @@ def init_haystack_instrumentor():
|
|
507
521
|
instrumentor.instrument()
|
508
522
|
return True
|
509
523
|
except Exception as e:
|
510
|
-
|
524
|
+
module_logger.error(f"Error initializing Haystack instrumentor: {e}")
|
511
525
|
return False
|
512
526
|
|
513
527
|
|
@@ -523,7 +537,7 @@ def init_langchain_instrumentor():
|
|
523
537
|
except Exception as e:
|
524
538
|
# FIXME: silencing this error temporarily, it appears to not be critical
|
525
539
|
if str(e) != "No module named 'langchain_community'":
|
526
|
-
|
540
|
+
module_logger.error(f"Error initializing LangChain instrumentor: {e}")
|
527
541
|
return False
|
528
542
|
|
529
543
|
|
@@ -537,7 +551,7 @@ def init_mistralai_instrumentor():
|
|
537
551
|
instrumentor.instrument()
|
538
552
|
return True
|
539
553
|
except Exception as e:
|
540
|
-
|
554
|
+
module_logger.error(f"Error initializing MistralAI instrumentor: {e}")
|
541
555
|
return False
|
542
556
|
|
543
557
|
|
@@ -551,7 +565,7 @@ def init_ollama_instrumentor():
|
|
551
565
|
instrumentor.instrument()
|
552
566
|
return True
|
553
567
|
except Exception as e:
|
554
|
-
|
568
|
+
module_logger.error(f"Error initializing Ollama instrumentor: {e}")
|
555
569
|
return False
|
556
570
|
|
557
571
|
|
@@ -567,7 +581,7 @@ def init_transformers_instrumentor():
|
|
567
581
|
instrumentor.instrument()
|
568
582
|
return True
|
569
583
|
except Exception as e:
|
570
|
-
|
584
|
+
module_logger.error(f"Error initializing Transformers instrumentor: {e}")
|
571
585
|
return False
|
572
586
|
|
573
587
|
|
@@ -581,7 +595,7 @@ def init_together_instrumentor():
|
|
581
595
|
instrumentor.instrument()
|
582
596
|
return True
|
583
597
|
except Exception as e:
|
584
|
-
|
598
|
+
module_logger.error(f"Error initializing TogetherAI instrumentor: {e}")
|
585
599
|
return False
|
586
600
|
|
587
601
|
|
@@ -595,7 +609,7 @@ def init_llama_index_instrumentor():
|
|
595
609
|
instrumentor.instrument()
|
596
610
|
return True
|
597
611
|
except Exception as e:
|
598
|
-
|
612
|
+
module_logger.error(f"Error initializing LlamaIndex instrumentor: {e}")
|
599
613
|
return False
|
600
614
|
|
601
615
|
|
@@ -609,7 +623,7 @@ def init_milvus_instrumentor():
|
|
609
623
|
instrumentor.instrument()
|
610
624
|
return True
|
611
625
|
except Exception as e:
|
612
|
-
|
626
|
+
module_logger.error(f"Error initializing Milvus instrumentor: {e}")
|
613
627
|
return False
|
614
628
|
|
615
629
|
|
@@ -623,7 +637,7 @@ def init_requests_instrumentor():
|
|
623
637
|
instrumentor.instrument(excluded_urls=EXCLUDED_URLS)
|
624
638
|
return True
|
625
639
|
except Exception as e:
|
626
|
-
|
640
|
+
module_logger.error(f"Error initializing Requests instrumentor: {e}")
|
627
641
|
return False
|
628
642
|
|
629
643
|
|
@@ -637,7 +651,7 @@ def init_urllib3_instrumentor():
|
|
637
651
|
instrumentor.instrument(excluded_urls=EXCLUDED_URLS)
|
638
652
|
return True
|
639
653
|
except Exception as e:
|
640
|
-
|
654
|
+
module_logger.error(f"Error initializing urllib3 instrumentor: {e}")
|
641
655
|
return False
|
642
656
|
|
643
657
|
|
@@ -651,7 +665,7 @@ def init_pymysql_instrumentor():
|
|
651
665
|
instrumentor.instrument()
|
652
666
|
return True
|
653
667
|
except Exception as e:
|
654
|
-
|
668
|
+
module_logger.error(f"Error initializing SQLAlchemy instrumentor: {e}")
|
655
669
|
return False
|
656
670
|
|
657
671
|
|
@@ -667,7 +681,7 @@ def init_bedrock_instrumentor(should_enrich_metrics: bool):
|
|
667
681
|
instrumentor.instrument()
|
668
682
|
return True
|
669
683
|
except Exception as e:
|
670
|
-
|
684
|
+
module_logger.error(f"Error initializing Bedrock instrumentor: {e}")
|
671
685
|
return False
|
672
686
|
|
673
687
|
|
@@ -681,7 +695,7 @@ def init_replicate_instrumentor():
|
|
681
695
|
instrumentor.instrument()
|
682
696
|
return True
|
683
697
|
except Exception as e:
|
684
|
-
|
698
|
+
module_logger.error(f"Error initializing Replicate instrumentor: {e}")
|
685
699
|
return False
|
686
700
|
|
687
701
|
|
@@ -695,7 +709,7 @@ def init_vertexai_instrumentor():
|
|
695
709
|
instrumentor.instrument()
|
696
710
|
return True
|
697
711
|
except Exception as e:
|
698
|
-
|
712
|
+
module_logger.warning(f"Error initializing Vertex AI instrumentor: {e}")
|
699
713
|
return False
|
700
714
|
|
701
715
|
|
@@ -711,7 +725,7 @@ def init_watsonx_instrumentor():
|
|
711
725
|
instrumentor.instrument()
|
712
726
|
return True
|
713
727
|
except Exception as e:
|
714
|
-
|
728
|
+
module_logger.warning(f"Error initializing Watsonx instrumentor: {e}")
|
715
729
|
return False
|
716
730
|
|
717
731
|
|
@@ -725,7 +739,7 @@ def init_weaviate_instrumentor():
|
|
725
739
|
instrumentor.instrument()
|
726
740
|
return True
|
727
741
|
except Exception as e:
|
728
|
-
|
742
|
+
module_logger.warning(f"Error initializing Weaviate instrumentor: {e}")
|
729
743
|
return False
|
730
744
|
|
731
745
|
|
@@ -739,7 +753,7 @@ def init_alephalpha_instrumentor():
|
|
739
753
|
instrumentor.instrument()
|
740
754
|
return True
|
741
755
|
except Exception as e:
|
742
|
-
|
756
|
+
module_logger.error(f"Error initializing Aleph Alpha instrumentor: {e}")
|
743
757
|
return False
|
744
758
|
|
745
759
|
|
@@ -753,7 +767,7 @@ def init_marqo_instrumentor():
|
|
753
767
|
instrumentor.instrument()
|
754
768
|
return True
|
755
769
|
except Exception as e:
|
756
|
-
|
770
|
+
module_logger.error(f"Error initializing marqo instrumentor: {e}")
|
757
771
|
return False
|
758
772
|
|
759
773
|
|
@@ -767,7 +781,7 @@ def init_lancedb_instrumentor():
|
|
767
781
|
instrumentor.instrument()
|
768
782
|
return True
|
769
783
|
except Exception as e:
|
770
|
-
|
784
|
+
module_logger.error(f"Error initializing LanceDB instrumentor: {e}")
|
771
785
|
|
772
786
|
|
773
787
|
def init_redis_instrumentor():
|
@@ -780,7 +794,7 @@ def init_redis_instrumentor():
|
|
780
794
|
instrumentor.instrument(excluded_urls=EXCLUDED_URLS)
|
781
795
|
return True
|
782
796
|
except Exception as e:
|
783
|
-
|
797
|
+
module_logger.error(f"Error initializing redis instrumentor: {e}")
|
784
798
|
return False
|
785
799
|
|
786
800
|
|
@@ -794,7 +808,7 @@ def init_groq_instrumentor():
|
|
794
808
|
instrumentor.instrument()
|
795
809
|
return True
|
796
810
|
except Exception as e:
|
797
|
-
|
811
|
+
module_logger.error(f"Error initializing Groq instrumentor: {e}")
|
798
812
|
return False
|
799
813
|
|
800
814
|
|
@@ -810,5 +824,5 @@ def init_sagemaker_instrumentor(should_enrich_metrics: bool):
|
|
810
824
|
instrumentor.instrument()
|
811
825
|
return True
|
812
826
|
except Exception as e:
|
813
|
-
|
827
|
+
module_logger.error(f"Error initializing SageMaker instrumentor: {e}")
|
814
828
|
return False
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from lmnr.
|
1
|
+
from lmnr.openllmetry_sdk.decorators.base import (
|
2
2
|
entity_method,
|
3
3
|
aentity_method,
|
4
4
|
)
|
@@ -7,8 +7,8 @@ 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.
|
11
|
-
from lmnr.
|
10
|
+
from lmnr.openllmetry_sdk.tracing.attributes import SESSION_ID, USER_ID
|
11
|
+
from lmnr.openllmetry_sdk.tracing.tracing import update_association_properties
|
12
12
|
|
13
13
|
from .utils import is_async
|
14
14
|
|
@@ -7,8 +7,8 @@ from contextlib import contextmanager
|
|
7
7
|
from tqdm import tqdm
|
8
8
|
from typing import Any, Awaitable, Optional, Set, Union
|
9
9
|
|
10
|
-
from ..
|
11
|
-
from ..
|
10
|
+
from ..openllmetry_sdk.instruments import Instruments
|
11
|
+
from ..openllmetry_sdk.tracing.attributes import SPAN_TYPE
|
12
12
|
|
13
13
|
from .datasets import EvaluationDataset
|
14
14
|
from .laminar import Laminar as L
|
@@ -1,15 +1,15 @@
|
|
1
1
|
from contextlib import contextmanager
|
2
2
|
from contextvars import Context
|
3
|
-
from lmnr.
|
4
|
-
from lmnr.
|
5
|
-
from lmnr.
|
6
|
-
from lmnr.
|
3
|
+
from lmnr.openllmetry_sdk import Traceloop
|
4
|
+
from lmnr.openllmetry_sdk.instruments import Instruments
|
5
|
+
from lmnr.openllmetry_sdk.tracing import get_tracer
|
6
|
+
from lmnr.openllmetry_sdk.tracing.attributes import (
|
7
7
|
ASSOCIATION_PROPERTIES,
|
8
8
|
Attributes,
|
9
9
|
SPAN_TYPE,
|
10
10
|
OVERRIDE_PARENT_SPAN,
|
11
11
|
)
|
12
|
-
from lmnr.
|
12
|
+
from lmnr.openllmetry_sdk.decorators.base import json_dumps
|
13
13
|
from opentelemetry import context, trace
|
14
14
|
from opentelemetry.context import attach, detach, set_value
|
15
15
|
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
|
@@ -30,7 +30,7 @@ import requests
|
|
30
30
|
import urllib.parse
|
31
31
|
import uuid
|
32
32
|
|
33
|
-
from lmnr.
|
33
|
+
from lmnr.openllmetry_sdk.tracing.attributes import (
|
34
34
|
SESSION_ID,
|
35
35
|
SPAN_INPUT,
|
36
36
|
SPAN_OUTPUT,
|
@@ -38,7 +38,7 @@ from lmnr.traceloop_sdk.tracing.attributes import (
|
|
38
38
|
TRACE_TYPE,
|
39
39
|
USER_ID,
|
40
40
|
)
|
41
|
-
from lmnr.
|
41
|
+
from lmnr.openllmetry_sdk.tracing.tracing import (
|
42
42
|
get_span_path,
|
43
43
|
remove_association_properties,
|
44
44
|
set_association_properties,
|
@@ -1 +0,0 @@
|
|
1
|
-
# """unit tests."""
|
@@ -1,101 +0,0 @@
|
|
1
|
-
interactions:
|
2
|
-
- request:
|
3
|
-
body: '{"messages": [{"content": "You are helpful assistant", "role": "system"},
|
4
|
-
{"content": "tell me a short joke", "role": "user"}], "model": "gpt-3.5-turbo",
|
5
|
-
"logprobs": false, "n": 1, "stream": false, "temperature": 0.7}'
|
6
|
-
headers:
|
7
|
-
accept:
|
8
|
-
- application/json
|
9
|
-
accept-encoding:
|
10
|
-
- gzip, deflate
|
11
|
-
connection:
|
12
|
-
- keep-alive
|
13
|
-
content-length:
|
14
|
-
- '217'
|
15
|
-
content-type:
|
16
|
-
- application/json
|
17
|
-
host:
|
18
|
-
- api.openai.com
|
19
|
-
user-agent:
|
20
|
-
- OpenAI/Python 1.35.15
|
21
|
-
x-stainless-arch:
|
22
|
-
- arm64
|
23
|
-
x-stainless-async:
|
24
|
-
- 'false'
|
25
|
-
x-stainless-lang:
|
26
|
-
- python
|
27
|
-
x-stainless-os:
|
28
|
-
- MacOS
|
29
|
-
x-stainless-package-version:
|
30
|
-
- 1.35.15
|
31
|
-
x-stainless-runtime:
|
32
|
-
- CPython
|
33
|
-
x-stainless-runtime-version:
|
34
|
-
- 3.9.5
|
35
|
-
method: POST
|
36
|
-
uri: https://api.openai.com/v1/chat/completions
|
37
|
-
response:
|
38
|
-
body:
|
39
|
-
string: !!binary |
|
40
|
-
H4sIAAAAAAAAA1SRS0/DMBCE7/kVW1+4tKgJCo9eEHABhHooLyGEKtfdJgbHa7wbaFX1v6OEtIWL
|
41
|
-
D/PtrGbW6wRA2bkagTKlFlMFN7jIbiaP44fF59Pt5Pj65epu6Zbf44un69MxLVW/cdDsHY1sXYeG
|
42
|
-
quBQLPlfbCJqwWZrepLlaTo8S7MWVDRH19iKIIOjw3wgdZzRYJhmeecsyRpkNYLXBABg3b5NRj/H
|
43
|
-
pRrBsL9VKmTWBarRbghARXKNojSzZdFeVH8PDXlB38a+ryP24LlcwZz8gQAbi14sC4PEmgW0UMXn
|
44
|
-
cIlG14wgJa6g0h8IdQD8wriS0vqi93d9xEXNuqnna+c6fbPL66gIkWbc8Z2+sN5yOY2omXyTjYWC
|
45
|
-
aukmAXhr71L/q6pCpCrIVOgDfbMw686i9j+xh2neQSHRbq8f5UmXT/GKBavpwvoCY4i2PVLbYpP8
|
46
|
-
AAAA//8DAFwYnEsjAgAA
|
47
|
-
headers:
|
48
|
-
CF-Cache-Status:
|
49
|
-
- DYNAMIC
|
50
|
-
CF-RAY:
|
51
|
-
- 8bbd5d409b62b0bd-ATL
|
52
|
-
Connection:
|
53
|
-
- keep-alive
|
54
|
-
Content-Encoding:
|
55
|
-
- gzip
|
56
|
-
Content-Type:
|
57
|
-
- application/json
|
58
|
-
Date:
|
59
|
-
- Sat, 31 Aug 2024 13:28:32 GMT
|
60
|
-
Server:
|
61
|
-
- cloudflare
|
62
|
-
Set-Cookie:
|
63
|
-
- __cf_bm=3B.f5aMPKiXVHyNDAIAPma3ZGvDnGViQrDAMvyT4n_8-1725110912-1.0.1.1-.elzfgXAenLSaVeAmcRwzq2OROEZMEvOpxSRlQ7PPZ8n6nkbc2NfZXBU1bijPQNxQ28MLNRJFyh4B4Mq4G3PPA;
|
64
|
-
path=/; expires=Sat, 31-Aug-24 13:58:32 GMT; domain=.api.openai.com; HttpOnly;
|
65
|
-
Secure; SameSite=None
|
66
|
-
- _cfuvid=LakflcrbwsF6x0qpc03TIL8jU8c3IjMCt5dua3l4dVA-1725110912530-0.0.1.1-604800000;
|
67
|
-
path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None
|
68
|
-
Transfer-Encoding:
|
69
|
-
- chunked
|
70
|
-
X-Content-Type-Options:
|
71
|
-
- nosniff
|
72
|
-
access-control-expose-headers:
|
73
|
-
- X-Request-ID
|
74
|
-
alt-svc:
|
75
|
-
- h3=":443"; ma=86400
|
76
|
-
openai-organization:
|
77
|
-
- traceloop
|
78
|
-
openai-processing-ms:
|
79
|
-
- '233'
|
80
|
-
openai-version:
|
81
|
-
- '2020-10-01'
|
82
|
-
strict-transport-security:
|
83
|
-
- max-age=15552000; includeSubDomains; preload
|
84
|
-
x-ratelimit-limit-requests:
|
85
|
-
- '5000'
|
86
|
-
x-ratelimit-limit-tokens:
|
87
|
-
- '4000000'
|
88
|
-
x-ratelimit-remaining-requests:
|
89
|
-
- '4999'
|
90
|
-
x-ratelimit-remaining-tokens:
|
91
|
-
- '3999970'
|
92
|
-
x-ratelimit-reset-requests:
|
93
|
-
- 12ms
|
94
|
-
x-ratelimit-reset-tokens:
|
95
|
-
- 0s
|
96
|
-
x-request-id:
|
97
|
-
- req_459694e3c39fd24575ad9deb5b65a831
|
98
|
-
status:
|
99
|
-
code: 200
|
100
|
-
message: OK
|
101
|
-
version: 1
|