lucidicai 1.3.1__tar.gz → 1.3.2__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.
- {lucidicai-1.3.1 → lucidicai-1.3.2}/PKG-INFO +1 -1
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/__init__.py +19 -3
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/client.py +3 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/decorators.py +33 -15
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/event.py +3 -1
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/session.py +1 -1
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai.egg-info/PKG-INFO +1 -1
- {lucidicai-1.3.1 → lucidicai-1.3.2}/setup.py +1 -1
- {lucidicai-1.3.1 → lucidicai-1.3.2}/README.md +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/constants.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/errors.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/image_upload.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/lru.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/model_pricing.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/singleton.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/step.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/streaming.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/telemetry/__init__.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/telemetry/base_provider.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/telemetry/litellm_bridge.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/telemetry/lucidic_exporter.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/telemetry/lucidic_span_processor.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/telemetry/openai_agents_instrumentor.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/telemetry/opentelemetry_converter.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/telemetry/otel_handlers.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/telemetry/otel_init.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/telemetry/otel_provider.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/telemetry/pydantic_ai_handler.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/telemetry/utils/__init__.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/telemetry/utils/image_storage.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/telemetry/utils/text_storage.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/telemetry/utils/universal_image_interceptor.py +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai.egg-info/SOURCES.txt +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai.egg-info/dependency_links.txt +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai.egg-info/requires.txt +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai.egg-info/top_level.txt +0 -0
- {lucidicai-1.3.1 → lucidicai-1.3.2}/setup.cfg +0 -0
|
@@ -117,6 +117,7 @@ def init(
|
|
|
117
117
|
providers: Optional[List[ProviderType]] = [],
|
|
118
118
|
production_monitoring: Optional[bool] = False,
|
|
119
119
|
mass_sim_id: Optional[str] = None,
|
|
120
|
+
experiment_id: Optional[str] = None,
|
|
120
121
|
rubrics: Optional[list] = None,
|
|
121
122
|
tags: Optional[list] = None,
|
|
122
123
|
masking_function = None,
|
|
@@ -133,6 +134,7 @@ def init(
|
|
|
133
134
|
task: Task description.
|
|
134
135
|
providers: List of provider types ("openai", "anthropic", "langchain", "pydantic_ai").
|
|
135
136
|
mass_sim_id: Optional mass simulation ID, if session is to be part of a mass simulation.
|
|
137
|
+
experiment_id: Optional experiment ID, if session is to be part of an experiment.
|
|
136
138
|
rubrics: Optional rubrics for evaluation, list of strings.
|
|
137
139
|
tags: Optional tags for the session, list of strings.
|
|
138
140
|
masking_function: Optional function to mask sensitive data.
|
|
@@ -180,6 +182,7 @@ def init(
|
|
|
180
182
|
tags=tags,
|
|
181
183
|
production_monitoring=production_monitoring,
|
|
182
184
|
session_id=session_id,
|
|
185
|
+
experiment_id=experiment_id,
|
|
183
186
|
)
|
|
184
187
|
if masking_function:
|
|
185
188
|
client.masking_function = masking_function
|
|
@@ -487,7 +490,9 @@ def create_event(
|
|
|
487
490
|
result: Optional[str] = None,
|
|
488
491
|
cost_added: Optional[float] = None,
|
|
489
492
|
model: Optional[str] = None,
|
|
490
|
-
screenshots: Optional[List[str]] = None
|
|
493
|
+
screenshots: Optional[List[str]] = None,
|
|
494
|
+
function_name: Optional[str] = None,
|
|
495
|
+
arguments: Optional[dict] = None,
|
|
491
496
|
) -> str:
|
|
492
497
|
"""
|
|
493
498
|
Create a new event in the current step. Current step must not be finished.
|
|
@@ -498,6 +503,8 @@ def create_event(
|
|
|
498
503
|
cost_added: Cost added by the event.
|
|
499
504
|
model: Model used for the event.
|
|
500
505
|
screenshots: List of screenshots encoded in base64.
|
|
506
|
+
function_name: Name of the function that created the event.
|
|
507
|
+
arguments: Arguments of the function that created the event.
|
|
501
508
|
"""
|
|
502
509
|
|
|
503
510
|
client = Client()
|
|
@@ -512,7 +519,9 @@ def update_event(
|
|
|
512
519
|
result: Optional[str] = None,
|
|
513
520
|
cost_added: Optional[float] = None,
|
|
514
521
|
model: Optional[str] = None,
|
|
515
|
-
screenshots: Optional[List[str]] = None
|
|
522
|
+
screenshots: Optional[List[str]] = None,
|
|
523
|
+
function_name: Optional[str] = None,
|
|
524
|
+
arguments: Optional[dict] = None,
|
|
516
525
|
) -> None:
|
|
517
526
|
"""
|
|
518
527
|
Update the event with the given ID in the current step.
|
|
@@ -524,6 +533,8 @@ def update_event(
|
|
|
524
533
|
cost_added: Cost added by the event.
|
|
525
534
|
model: Model used for the event.
|
|
526
535
|
screenshots: List of screenshots encoded in base64.
|
|
536
|
+
function_name: Name of the function that created the event.
|
|
537
|
+
arguments: Arguments of the function that created the event.
|
|
527
538
|
"""
|
|
528
539
|
client = Client()
|
|
529
540
|
if not client.session:
|
|
@@ -537,7 +548,9 @@ def end_event(
|
|
|
537
548
|
result: Optional[str] = None,
|
|
538
549
|
cost_added: Optional[float] = None,
|
|
539
550
|
model: Optional[str] = None,
|
|
540
|
-
screenshots: Optional[List[str]] = None
|
|
551
|
+
screenshots: Optional[List[str]] = None,
|
|
552
|
+
function_name: Optional[str] = None,
|
|
553
|
+
arguments: Optional[dict] = None,
|
|
541
554
|
) -> None:
|
|
542
555
|
"""
|
|
543
556
|
End the latest event in the current step.
|
|
@@ -548,6 +561,9 @@ def end_event(
|
|
|
548
561
|
result: Result of the event.
|
|
549
562
|
cost_added: Cost added by the event.
|
|
550
563
|
model: Model used for the event.
|
|
564
|
+
screenshots: List of screenshots encoded in base64.
|
|
565
|
+
function_name: Name of the function that created the event.
|
|
566
|
+
arguments: Arguments of the function that created the event.
|
|
551
567
|
"""
|
|
552
568
|
client = Client()
|
|
553
569
|
if not client.session:
|
|
@@ -85,6 +85,7 @@ class Client:
|
|
|
85
85
|
tags: Optional[list] = None,
|
|
86
86
|
production_monitoring: Optional[bool] = False,
|
|
87
87
|
session_id: Optional[str] = None,
|
|
88
|
+
experiment_id: Optional[str] = None,
|
|
88
89
|
) -> None:
|
|
89
90
|
if session_id:
|
|
90
91
|
# Check if it's a known session ID, maybe custom and maybe real
|
|
@@ -107,6 +108,7 @@ class Client:
|
|
|
107
108
|
"session_name": session_name,
|
|
108
109
|
"task": task,
|
|
109
110
|
"mass_sim_id": mass_sim_id,
|
|
111
|
+
"experiment_id": experiment_id,
|
|
110
112
|
"rubrics": rubrics,
|
|
111
113
|
"tags": tags,
|
|
112
114
|
"session_id": session_id
|
|
@@ -124,6 +126,7 @@ class Client:
|
|
|
124
126
|
session_id=real_session_id,
|
|
125
127
|
session_name=session_name,
|
|
126
128
|
mass_sim_id=mass_sim_id,
|
|
129
|
+
experiment_id=experiment_id,
|
|
127
130
|
task=task,
|
|
128
131
|
rubrics=rubrics,
|
|
129
132
|
tags=tags,
|
|
@@ -5,6 +5,7 @@ import inspect
|
|
|
5
5
|
import json
|
|
6
6
|
import logging
|
|
7
7
|
from typing import Any, Callable, Optional, TypeVar, Union
|
|
8
|
+
from collections.abc import Iterable
|
|
8
9
|
|
|
9
10
|
from .client import Client
|
|
10
11
|
from .errors import LucidicNotInitializedError
|
|
@@ -219,27 +220,44 @@ def event(
|
|
|
219
220
|
|
|
220
221
|
# Build event description from inputs if not provided
|
|
221
222
|
event_desc = description
|
|
223
|
+
function_name = func.__name__
|
|
224
|
+
|
|
225
|
+
# Get function signature
|
|
226
|
+
sig = inspect.signature(func)
|
|
227
|
+
bound_args = sig.bind(*args, **kwargs)
|
|
228
|
+
bound_args.apply_defaults()
|
|
229
|
+
|
|
230
|
+
def serialize(value):
|
|
231
|
+
if isinstance(value, str):
|
|
232
|
+
return value
|
|
233
|
+
if isinstance(value, int):
|
|
234
|
+
return value
|
|
235
|
+
if isinstance(value, float):
|
|
236
|
+
return value
|
|
237
|
+
if isinstance(value, bool):
|
|
238
|
+
return value
|
|
239
|
+
if isinstance(value, dict):
|
|
240
|
+
return {k: serialize(v) for k, v in value.items()}
|
|
241
|
+
if isinstance(value, Iterable):
|
|
242
|
+
return [serialize(v) for v in value]
|
|
243
|
+
return str(value)
|
|
244
|
+
|
|
245
|
+
# Construct JSONable object of args
|
|
246
|
+
args_dict = {
|
|
247
|
+
param_name: serialize(param_value) # Recursive - maybe change later
|
|
248
|
+
for param_name, param_value in bound_args.arguments.items()
|
|
249
|
+
}
|
|
250
|
+
|
|
222
251
|
if not event_desc:
|
|
223
|
-
|
|
224
|
-
sig = inspect.signature(func)
|
|
225
|
-
bound_args = sig.bind(*args, **kwargs)
|
|
226
|
-
bound_args.apply_defaults()
|
|
227
|
-
|
|
228
|
-
# Create string representation of inputs
|
|
229
|
-
input_parts = []
|
|
230
|
-
for param_name, param_value in bound_args.arguments.items():
|
|
231
|
-
try:
|
|
232
|
-
input_parts.append(f"{param_name}={repr(param_value)}")
|
|
233
|
-
except Exception:
|
|
234
|
-
input_parts.append(f"{param_name}=<{type(param_value).__name__}>")
|
|
235
|
-
|
|
236
|
-
event_desc = f"{func.__name__}({', '.join(input_parts)})"
|
|
252
|
+
event_desc = f"Function {function_name}({json.dumps(args_dict)})"
|
|
237
253
|
|
|
238
254
|
# Create the event
|
|
239
255
|
event_id = create_event(
|
|
240
256
|
description=event_desc,
|
|
241
257
|
model=model,
|
|
242
|
-
cost_added=cost_added
|
|
258
|
+
cost_added=cost_added,
|
|
259
|
+
function_name=function_name,
|
|
260
|
+
arguments=args_dict,
|
|
243
261
|
)
|
|
244
262
|
tok = _current_event.set(event_id)
|
|
245
263
|
try:
|
|
@@ -48,7 +48,9 @@ class Event:
|
|
|
48
48
|
"cost_added": kwargs.get("cost_added", None),
|
|
49
49
|
"model": kwargs.get("model", None),
|
|
50
50
|
"nscreenshots": len(self.screenshots) + num_new_screenshots,
|
|
51
|
-
"duration": kwargs.get("duration", None)
|
|
51
|
+
"duration": kwargs.get("duration", None),
|
|
52
|
+
"function_name": kwargs.get("function_name", None),
|
|
53
|
+
"arguments": kwargs.get("arguments", None),
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
def _upload_screenshots(self, **kwargs) -> None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lucidicai-1.3.1 → lucidicai-1.3.2}/lucidicai/telemetry/utils/universal_image_interceptor.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|