lmnr 0.5.1a0__py3-none-any.whl → 0.5.3__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.
Files changed (50) hide show
  1. lmnr/__init__.py +2 -10
  2. lmnr/cli.py +10 -8
  3. lmnr/{openllmetry_sdk → opentelemetry_lib}/__init__.py +8 -36
  4. lmnr/{openllmetry_sdk → opentelemetry_lib}/decorators/base.py +27 -20
  5. lmnr/{openllmetry_sdk → opentelemetry_lib}/instruments.py +2 -0
  6. lmnr/opentelemetry_lib/opentelemetry/instrumentation/google_genai/__init__.py +454 -0
  7. lmnr/opentelemetry_lib/opentelemetry/instrumentation/google_genai/config.py +9 -0
  8. lmnr/opentelemetry_lib/opentelemetry/instrumentation/google_genai/utils.py +216 -0
  9. lmnr/opentelemetry_lib/tracing/__init__.py +1 -0
  10. lmnr/opentelemetry_lib/tracing/context_manager.py +13 -0
  11. lmnr/{openllmetry_sdk → opentelemetry_lib}/tracing/tracing.py +253 -257
  12. lmnr/sdk/browser/browser_use_otel.py +20 -3
  13. lmnr/sdk/browser/patchright_otel.py +177 -0
  14. lmnr/sdk/browser/playwright_otel.py +55 -62
  15. lmnr/sdk/browser/pw_utils.py +122 -116
  16. lmnr/sdk/browser/rrweb/rrweb.umd.min.cjs +98 -0
  17. lmnr/sdk/client/asynchronous/async_client.py +0 -34
  18. lmnr/sdk/client/asynchronous/resources/__init__.py +0 -4
  19. lmnr/sdk/client/asynchronous/resources/agent.py +115 -6
  20. lmnr/sdk/client/synchronous/resources/__init__.py +1 -3
  21. lmnr/sdk/client/synchronous/resources/agent.py +112 -6
  22. lmnr/sdk/client/synchronous/sync_client.py +0 -36
  23. lmnr/sdk/decorators.py +19 -5
  24. lmnr/sdk/eval_control.py +3 -2
  25. lmnr/sdk/evaluations.py +8 -14
  26. lmnr/sdk/laminar.py +10 -10
  27. lmnr/sdk/types.py +86 -170
  28. lmnr/sdk/utils.py +8 -1
  29. lmnr/version.py +1 -1
  30. {lmnr-0.5.1a0.dist-info → lmnr-0.5.3.dist-info}/METADATA +58 -58
  31. lmnr-0.5.3.dist-info/RECORD +55 -0
  32. {lmnr-0.5.1a0.dist-info → lmnr-0.5.3.dist-info}/WHEEL +1 -1
  33. lmnr/openllmetry_sdk/tracing/__init__.py +0 -0
  34. lmnr/sdk/browser/rrweb/rrweb.min.js +0 -18
  35. lmnr/sdk/client/asynchronous/resources/pipeline.py +0 -89
  36. lmnr/sdk/client/asynchronous/resources/semantic_search.py +0 -60
  37. lmnr/sdk/client/synchronous/resources/pipeline.py +0 -89
  38. lmnr/sdk/client/synchronous/resources/semantic_search.py +0 -60
  39. lmnr-0.5.1a0.dist-info/RECORD +0 -54
  40. /lmnr/{openllmetry_sdk → opentelemetry_lib}/.flake8 +0 -0
  41. /lmnr/{openllmetry_sdk → opentelemetry_lib}/config/__init__.py +0 -0
  42. /lmnr/{openllmetry_sdk → opentelemetry_lib}/decorators/__init__.py +0 -0
  43. /lmnr/{openllmetry_sdk → opentelemetry_lib}/tracing/attributes.py +0 -0
  44. /lmnr/{openllmetry_sdk → opentelemetry_lib}/tracing/content_allow_list.py +0 -0
  45. /lmnr/{openllmetry_sdk → opentelemetry_lib}/utils/__init__.py +0 -0
  46. /lmnr/{openllmetry_sdk → opentelemetry_lib}/utils/in_memory_span_exporter.py +0 -0
  47. /lmnr/{openllmetry_sdk → opentelemetry_lib}/utils/json_encoder.py +0 -0
  48. /lmnr/{openllmetry_sdk → opentelemetry_lib}/utils/package_check.py +0 -0
  49. {lmnr-0.5.1a0.dist-info → lmnr-0.5.3.dist-info}/LICENSE +0 -0
  50. {lmnr-0.5.1a0.dist-info → lmnr-0.5.3.dist-info}/entry_points.txt +0 -0
@@ -1,89 +0,0 @@
1
- """Pipeline resource for running Laminar pipelines."""
2
-
3
- import uuid
4
- from typing import Optional
5
- from opentelemetry import trace
6
-
7
- from lmnr.sdk.client.synchronous.resources.base import BaseResource
8
- from lmnr.sdk.types import (
9
- NodeInput,
10
- PipelineRunError,
11
- PipelineRunRequest,
12
- PipelineRunResponse,
13
- )
14
-
15
-
16
- class Pipeline(BaseResource):
17
- """Resource for interacting with Laminar pipelines."""
18
-
19
- def run(
20
- self,
21
- pipeline: str,
22
- inputs: dict[str, NodeInput],
23
- env: dict[str, str] = {},
24
- metadata: dict[str, str] = {},
25
- parent_span_id: Optional[uuid.UUID] = None,
26
- trace_id: Optional[uuid.UUID] = None,
27
- ) -> PipelineRunResponse:
28
- """Run a pipeline with the given inputs and environment variables.
29
-
30
- Args:
31
- pipeline (str): pipeline name
32
- inputs (dict[str, NodeInput]): input values for the pipeline
33
- env (dict[str, str], optional): environment variables for the pipeline
34
- metadata (dict[str, str], optional): metadata for the pipeline run
35
- parent_span_id (Optional[uuid.UUID], optional): parent span id for the pipeline
36
- trace_id (Optional[uuid.UUID], optional): trace id for the pipeline
37
-
38
- Raises:
39
- ValueError: if the project API key is not set
40
- PipelineRunError: if the pipeline run fails
41
-
42
- Returns:
43
- PipelineRunResponse: response from the pipeline run
44
- """
45
- if self._project_api_key is None:
46
- raise ValueError(
47
- "Please initialize the Laminar object with your project "
48
- "API key or set the LMNR_PROJECT_API_KEY environment variable"
49
- )
50
-
51
- current_span = trace.get_current_span()
52
- if current_span != trace.INVALID_SPAN:
53
- parent_span_id = parent_span_id or uuid.UUID(
54
- int=current_span.get_span_context().span_id
55
- )
56
- trace_id = trace_id or uuid.UUID(
57
- int=current_span.get_span_context().trace_id
58
- )
59
-
60
- request = PipelineRunRequest(
61
- inputs=inputs,
62
- pipeline=pipeline,
63
- env=env or {},
64
- metadata=metadata,
65
- parent_span_id=parent_span_id,
66
- trace_id=trace_id,
67
- )
68
-
69
- response = self._client.post(
70
- self._base_url + "/v1/pipeline/run",
71
- json=request.to_dict(),
72
- headers=self._headers(),
73
- )
74
-
75
- if response.status_code != 200:
76
- raise PipelineRunError(response)
77
-
78
- try:
79
- from pydantic.alias_generators import to_snake
80
-
81
- resp_json = response.json()
82
- keys = list(resp_json.keys())
83
- for key in keys:
84
- value = resp_json[key]
85
- del resp_json[key]
86
- resp_json[to_snake(key)] = value
87
- return PipelineRunResponse(**resp_json)
88
- except Exception:
89
- raise PipelineRunError(response)
@@ -1,60 +0,0 @@
1
- """SemanticSearch resource for interacting with Laminar semantic search API."""
2
-
3
- import uuid
4
- from typing import Optional
5
-
6
- from lmnr.sdk.client.synchronous.resources.base import BaseResource
7
- from lmnr.sdk.types import (
8
- SemanticSearchRequest,
9
- SemanticSearchResponse,
10
- )
11
-
12
-
13
- class SemanticSearch(BaseResource):
14
- """Resource for interacting with Laminar semantic search API."""
15
-
16
- def search(
17
- self,
18
- query: str,
19
- dataset_id: uuid.UUID,
20
- limit: Optional[int] = None,
21
- threshold: Optional[float] = None,
22
- ) -> SemanticSearchResponse:
23
- """Perform a semantic search on the given dataset.
24
-
25
- Args:
26
- query (str): query to search for
27
- dataset_id (uuid.UUID): dataset ID created in the UI
28
- limit (Optional[int], optional): maximum number of results to return
29
- threshold (Optional[float], optional): lowest similarity score to return
30
-
31
- Raises:
32
- ValueError: if an error happens while performing the semantic search
33
-
34
- Returns:
35
- SemanticSearchResponse: response from the semantic search
36
- """
37
- request = SemanticSearchRequest(
38
- query=query,
39
- dataset_id=dataset_id,
40
- limit=limit,
41
- threshold=threshold,
42
- )
43
- response = self._client.post(
44
- self._base_url + "/v1/semantic-search",
45
- json=request.to_dict(),
46
- headers=self._headers(),
47
- )
48
- if response.status_code != 200:
49
- raise ValueError(
50
- f"Error performing semantic search: [{response.status_code}] {response.text}"
51
- )
52
- try:
53
- resp_json = response.json()
54
- for result in resp_json["results"]:
55
- result["dataset_id"] = uuid.UUID(result["datasetId"])
56
- return SemanticSearchResponse(**resp_json)
57
- except Exception as e:
58
- raise ValueError(
59
- f"Error parsing semantic search response: status={response.status_code} error={e}"
60
- )
@@ -1,54 +0,0 @@
1
- lmnr/__init__.py,sha256=q_LvkFcUKZCxrCap4Mr4cewyNg1vh-t2tX-kaOUdWos,1186
2
- lmnr/cli.py,sha256=4J2RZQhHM3jJcjFvBC4PChQTS-ukxykVvI0X6lTkK-o,2918
3
- lmnr/openllmetry_sdk/.flake8,sha256=bCxuDlGx3YQ55QHKPiGJkncHanh9qGjQJUujcFa3lAU,150
4
- lmnr/openllmetry_sdk/__init__.py,sha256=3zDqa-NEDEwdaxYv9Lcg39IpOnl-CWhGvU3fP17GwTk,3325
5
- lmnr/openllmetry_sdk/config/__init__.py,sha256=5aGdIdo1LffBkNwIBUbqzN6OUCMCrURU4b0rf5LBSI0,300
6
- lmnr/openllmetry_sdk/decorators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- lmnr/openllmetry_sdk/decorators/base.py,sha256=Wrr6r7nsPyNl8fE1w7BcTLeaE965kON8LvwOcwMfTRI,7100
8
- lmnr/openllmetry_sdk/instruments.py,sha256=9KoJ19Qar1dBrmO1wikNEkKxRfus8znQTj-g_maRTTM,1098
9
- lmnr/openllmetry_sdk/tracing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- lmnr/openllmetry_sdk/tracing/attributes.py,sha256=BEMMGrX_7kPu4PNCV7Bz1uaclY4DNhlaLT0bWwFQnRE,1366
11
- lmnr/openllmetry_sdk/tracing/content_allow_list.py,sha256=3feztm6PBWNelc8pAZUcQyEGyeSpNiVKjOaDk65l2ps,846
12
- lmnr/openllmetry_sdk/tracing/tracing.py,sha256=eX2Fwmu6iiRxOSjH3KyCjmZNH3rVXhlbYef1vauJijc,38839
13
- lmnr/openllmetry_sdk/utils/__init__.py,sha256=pNhf0G3vTd5ccoc03i1MXDbricSaiqCbi1DLWhSekK8,604
14
- lmnr/openllmetry_sdk/utils/in_memory_span_exporter.py,sha256=H_4TRaThMO1H6vUQ0OpQvzJk_fZH0OOsRAM1iZQXsR8,2112
15
- lmnr/openllmetry_sdk/utils/json_encoder.py,sha256=dK6b_axr70IYL7Vv-bu4wntvDDuyntoqsHaddqX7P58,463
16
- lmnr/openllmetry_sdk/utils/package_check.py,sha256=_-Fu9Zbp9tOyy27_-Rul7tDc8JaXYR2FmqF8SWOXSCc,244
17
- lmnr/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
- lmnr/sdk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
- lmnr/sdk/browser/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
- lmnr/sdk/browser/browser_use_otel.py,sha256=wKFe07XTUUCuPDwFD9gqGrcaaj82BRg-kLLZQM_KshM,3915
21
- lmnr/sdk/browser/playwright_otel.py,sha256=en91IZxuHFgFHbmssbdJZejtBIlma7gJ9NCv3_RLXzk,12636
22
- lmnr/sdk/browser/pw_utils.py,sha256=Lh0pJ3sb_NC8roZnQppBtK8VV-AHXchPUxISEm5SkF4,10490
23
- lmnr/sdk/browser/rrweb/rrweb.min.js,sha256=X5pgaoX1j_OjKTqGQgKB-83xUSuydNLQa-Kkh1AAZYM,140485
24
- lmnr/sdk/browser/utils.py,sha256=xPpMRP2y9aJIsdIDNg2wN4PSa_4w0LSsra-GIMx9VXc,2366
25
- lmnr/sdk/client/asynchronous/async_client.py,sha256=9QqeYIsHPCS23kAUhwTqBmSxGKJ6j_M0AUicOI3KoM8,4953
26
- lmnr/sdk/client/asynchronous/resources/__init__.py,sha256=ul1K_uvLmN5pw1Z_NZojdZ_CDp7om4RYV78pkgx6-2M,507
27
- lmnr/sdk/client/asynchronous/resources/agent.py,sha256=95m72mNL1ScCkaoHg204h7evNbgtm1hkoHf9Pe6f0X4,8940
28
- lmnr/sdk/client/asynchronous/resources/base.py,sha256=aJ43Q1rltg23IQaI4eeaZKckxVTgDUbCJrChhQCUEoE,986
29
- lmnr/sdk/client/asynchronous/resources/browser_events.py,sha256=T-DUbbAfMQ2VqiVfgVplxuTaJZuoNcC1O6RCxdfw7UQ,1163
30
- lmnr/sdk/client/asynchronous/resources/evals.py,sha256=bm3ATwqLozUoW2Ed6psmdjmeJ7joBaQHSv6mBeA_cws,2187
31
- lmnr/sdk/client/asynchronous/resources/pipeline.py,sha256=Tdb-ChxBcjDvOLuPQA6V-Gksf-3dJpHfbrGToa2qVmk,3002
32
- lmnr/sdk/client/asynchronous/resources/semantic_search.py,sha256=YEshW6sIlkAi29yEKkp7b95V9aK0sj5zwaU6sWgeB-M,2074
33
- lmnr/sdk/client/synchronous/resources/__init__.py,sha256=T9gI_QhvdBYbIEzfa_Z8QEtzunqgNGOsSJ9KVvR5cL0,429
34
- lmnr/sdk/client/synchronous/resources/agent.py,sha256=dRXkMO6AMZFh5yz8q0TdszG4oTHmOUg1CYNzfEq8zss,8829
35
- lmnr/sdk/client/synchronous/resources/base.py,sha256=ne1ZZ10UmNkMrECVvClcEJfcFJlSGvaXOC8K6mZTPdY,971
36
- lmnr/sdk/client/synchronous/resources/browser_events.py,sha256=9rFYWZesXQomnFgbZ590tGFMTaNj0OAzT9RcFwD8q_Y,1135
37
- lmnr/sdk/client/synchronous/resources/evals.py,sha256=sMMAai7_IW842z_J0W9OpthDhGQPCkTVJZamIkKq0wk,3496
38
- lmnr/sdk/client/synchronous/resources/pipeline.py,sha256=MJLF7HICjB7kS1-DvtJPAneIO1aMRl8fGG1QZjCsPl4,2974
39
- lmnr/sdk/client/synchronous/resources/semantic_search.py,sha256=oFH5r3bWJEvoZrC_a4jAtZko9tdpuUzCX1M0yvj8MMw,2046
40
- lmnr/sdk/client/synchronous/sync_client.py,sha256=jLX-hZMwm6m9urajg1HrpDuaRdNs9_M11DnJ6-HV3EY,5380
41
- lmnr/sdk/datasets.py,sha256=jl5Wj5nEI9pww4Jwn4XKF8h0gXBU4TOIrhqNjTJsHZQ,1709
42
- lmnr/sdk/decorators.py,sha256=g0VBqUEMCPRbgjgGHauVuKK1wHEd9rkiGzlYUYrcml4,2336
43
- lmnr/sdk/eval_control.py,sha256=G6Fg3Xx_KWv72iBaWlNMdyRTF2bZFQnwJ68sJNSpIcY,177
44
- lmnr/sdk/evaluations.py,sha256=kjzc257BKhq3z_vMeHD96pJ_xBoiWzW8e0lkVaNJ2jY,20555
45
- lmnr/sdk/laminar.py,sha256=0FRgGT7SWw4mwGY525EXUHAf_Qj5swaeg3RewUYPyAA,27976
46
- lmnr/sdk/log.py,sha256=nt_YMmPw1IRbGy0b7q4rTtP4Yo3pQfNxqJPXK3nDSNQ,2213
47
- lmnr/sdk/types.py,sha256=wtSiq7KqdvQ5k7URdDnGoWwX3ucDNMabNfVnbKBXfhs,13940
48
- lmnr/sdk/utils.py,sha256=o9MybEMM0Tp_xxCMFpzEYDsOAn2I7g1t7MrazOQAxAs,3692
49
- lmnr/version.py,sha256=in8hiGDV28kmF2xSVRf1DEvu8z9A1snM4PoxsftIn-I,1323
50
- lmnr-0.5.1a0.dist-info/LICENSE,sha256=67b_wJHVV1CBaWkrKFWU1wyqTPSdzH77Ls-59631COg,10411
51
- lmnr-0.5.1a0.dist-info/METADATA,sha256=2BpQewtLlMeR3u2OxJqzPnGwi4yvoyKs-0GP8TuzKz4,14998
52
- lmnr-0.5.1a0.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
53
- lmnr-0.5.1a0.dist-info/entry_points.txt,sha256=K1jE20ww4jzHNZLnsfWBvU3YKDGBgbOiYG5Y7ivQcq4,37
54
- lmnr-0.5.1a0.dist-info/RECORD,,
File without changes
File without changes