opik 1.9.5__py3-none-any.whl → 1.9.39__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 (248) hide show
  1. opik/__init__.py +10 -3
  2. opik/anonymizer/__init__.py +5 -0
  3. opik/anonymizer/anonymizer.py +12 -0
  4. opik/anonymizer/factory.py +80 -0
  5. opik/anonymizer/recursive_anonymizer.py +64 -0
  6. opik/anonymizer/rules.py +56 -0
  7. opik/anonymizer/rules_anonymizer.py +35 -0
  8. opik/api_objects/dataset/rest_operations.py +5 -0
  9. opik/api_objects/experiment/experiment.py +46 -49
  10. opik/api_objects/experiment/helpers.py +34 -10
  11. opik/api_objects/local_recording.py +8 -3
  12. opik/api_objects/opik_client.py +230 -48
  13. opik/api_objects/opik_query_language.py +9 -0
  14. opik/api_objects/prompt/__init__.py +11 -3
  15. opik/api_objects/prompt/base_prompt.py +69 -0
  16. opik/api_objects/prompt/base_prompt_template.py +29 -0
  17. opik/api_objects/prompt/chat/__init__.py +1 -0
  18. opik/api_objects/prompt/chat/chat_prompt.py +193 -0
  19. opik/api_objects/prompt/chat/chat_prompt_template.py +350 -0
  20. opik/api_objects/prompt/{chat_content_renderer_registry.py → chat/content_renderer_registry.py} +37 -35
  21. opik/api_objects/prompt/client.py +101 -30
  22. opik/api_objects/prompt/text/__init__.py +1 -0
  23. opik/api_objects/prompt/text/prompt.py +174 -0
  24. opik/api_objects/prompt/{prompt_template.py → text/prompt_template.py} +10 -6
  25. opik/api_objects/prompt/types.py +1 -1
  26. opik/cli/export.py +6 -2
  27. opik/cli/usage_report/charts.py +39 -10
  28. opik/cli/usage_report/cli.py +164 -45
  29. opik/cli/usage_report/pdf.py +14 -1
  30. opik/config.py +0 -5
  31. opik/decorator/base_track_decorator.py +37 -40
  32. opik/decorator/context_manager/span_context_manager.py +9 -0
  33. opik/decorator/context_manager/trace_context_manager.py +5 -0
  34. opik/dict_utils.py +3 -3
  35. opik/evaluation/__init__.py +13 -2
  36. opik/evaluation/engine/engine.py +195 -223
  37. opik/evaluation/engine/helpers.py +8 -7
  38. opik/evaluation/engine/metrics_evaluator.py +237 -0
  39. opik/evaluation/evaluation_result.py +35 -1
  40. opik/evaluation/evaluator.py +318 -30
  41. opik/evaluation/models/litellm/util.py +78 -6
  42. opik/evaluation/models/model_capabilities.py +33 -0
  43. opik/evaluation/report.py +14 -2
  44. opik/evaluation/rest_operations.py +36 -33
  45. opik/evaluation/test_case.py +2 -2
  46. opik/evaluation/types.py +9 -1
  47. opik/exceptions.py +17 -0
  48. opik/hooks/__init__.py +17 -1
  49. opik/hooks/anonymizer_hook.py +36 -0
  50. opik/id_helpers.py +18 -0
  51. opik/integrations/adk/helpers.py +16 -7
  52. opik/integrations/adk/legacy_opik_tracer.py +7 -4
  53. opik/integrations/adk/opik_tracer.py +3 -1
  54. opik/integrations/adk/patchers/adk_otel_tracer/opik_adk_otel_tracer.py +7 -3
  55. opik/integrations/adk/recursive_callback_injector.py +1 -6
  56. opik/integrations/dspy/callback.py +1 -4
  57. opik/integrations/haystack/opik_connector.py +2 -2
  58. opik/integrations/haystack/opik_tracer.py +2 -4
  59. opik/integrations/langchain/opik_tracer.py +273 -82
  60. opik/integrations/llama_index/callback.py +110 -108
  61. opik/integrations/openai/agents/opik_tracing_processor.py +1 -2
  62. opik/integrations/openai/opik_tracker.py +1 -1
  63. opik/message_processing/batching/batchers.py +11 -7
  64. opik/message_processing/encoder_helpers.py +79 -0
  65. opik/message_processing/messages.py +25 -1
  66. opik/message_processing/online_message_processor.py +23 -8
  67. opik/opik_context.py +7 -7
  68. opik/rest_api/__init__.py +188 -12
  69. opik/rest_api/client.py +3 -0
  70. opik/rest_api/dashboards/__init__.py +4 -0
  71. opik/rest_api/dashboards/client.py +462 -0
  72. opik/rest_api/dashboards/raw_client.py +648 -0
  73. opik/rest_api/datasets/client.py +893 -89
  74. opik/rest_api/datasets/raw_client.py +1328 -87
  75. opik/rest_api/experiments/client.py +30 -2
  76. opik/rest_api/experiments/raw_client.py +26 -0
  77. opik/rest_api/feedback_definitions/types/find_feedback_definitions_request_type.py +1 -1
  78. opik/rest_api/optimizations/client.py +302 -0
  79. opik/rest_api/optimizations/raw_client.py +463 -0
  80. opik/rest_api/optimizations/types/optimization_update_status.py +3 -1
  81. opik/rest_api/prompts/__init__.py +2 -2
  82. opik/rest_api/prompts/client.py +34 -4
  83. opik/rest_api/prompts/raw_client.py +32 -2
  84. opik/rest_api/prompts/types/__init__.py +3 -1
  85. opik/rest_api/prompts/types/create_prompt_version_detail_template_structure.py +5 -0
  86. opik/rest_api/prompts/types/prompt_write_template_structure.py +5 -0
  87. opik/rest_api/spans/__init__.py +0 -2
  88. opik/rest_api/spans/client.py +148 -64
  89. opik/rest_api/spans/raw_client.py +210 -83
  90. opik/rest_api/spans/types/__init__.py +0 -2
  91. opik/rest_api/traces/client.py +241 -73
  92. opik/rest_api/traces/raw_client.py +344 -90
  93. opik/rest_api/types/__init__.py +200 -15
  94. opik/rest_api/types/aggregation_data.py +1 -0
  95. opik/rest_api/types/alert_trigger_config_public_type.py +6 -1
  96. opik/rest_api/types/alert_trigger_config_type.py +6 -1
  97. opik/rest_api/types/alert_trigger_config_write_type.py +6 -1
  98. opik/rest_api/types/automation_rule_evaluator.py +23 -1
  99. opik/rest_api/types/automation_rule_evaluator_llm_as_judge.py +2 -0
  100. opik/rest_api/types/automation_rule_evaluator_llm_as_judge_public.py +2 -0
  101. opik/rest_api/types/automation_rule_evaluator_llm_as_judge_write.py +2 -0
  102. opik/rest_api/types/{automation_rule_evaluator_object_public.py → automation_rule_evaluator_object_object_public.py} +32 -10
  103. opik/rest_api/types/automation_rule_evaluator_page_public.py +2 -2
  104. opik/rest_api/types/automation_rule_evaluator_public.py +23 -1
  105. opik/rest_api/types/automation_rule_evaluator_span_llm_as_judge.py +22 -0
  106. opik/rest_api/types/automation_rule_evaluator_span_llm_as_judge_public.py +22 -0
  107. opik/rest_api/types/automation_rule_evaluator_span_llm_as_judge_write.py +22 -0
  108. opik/rest_api/types/automation_rule_evaluator_trace_thread_llm_as_judge.py +2 -0
  109. opik/rest_api/types/automation_rule_evaluator_trace_thread_llm_as_judge_public.py +2 -0
  110. opik/rest_api/types/automation_rule_evaluator_trace_thread_llm_as_judge_write.py +2 -0
  111. opik/rest_api/types/automation_rule_evaluator_trace_thread_user_defined_metric_python.py +2 -0
  112. opik/rest_api/types/automation_rule_evaluator_trace_thread_user_defined_metric_python_public.py +2 -0
  113. opik/rest_api/types/automation_rule_evaluator_trace_thread_user_defined_metric_python_write.py +2 -0
  114. opik/rest_api/types/automation_rule_evaluator_update.py +23 -1
  115. opik/rest_api/types/automation_rule_evaluator_update_llm_as_judge.py +2 -0
  116. opik/rest_api/types/automation_rule_evaluator_update_span_llm_as_judge.py +22 -0
  117. opik/rest_api/types/automation_rule_evaluator_update_trace_thread_llm_as_judge.py +2 -0
  118. opik/rest_api/types/automation_rule_evaluator_update_trace_thread_user_defined_metric_python.py +2 -0
  119. opik/rest_api/types/automation_rule_evaluator_update_user_defined_metric_python.py +2 -0
  120. opik/rest_api/types/automation_rule_evaluator_user_defined_metric_python.py +2 -0
  121. opik/rest_api/types/automation_rule_evaluator_user_defined_metric_python_public.py +2 -0
  122. opik/rest_api/types/automation_rule_evaluator_user_defined_metric_python_write.py +2 -0
  123. opik/rest_api/types/automation_rule_evaluator_write.py +23 -1
  124. opik/rest_api/types/boolean_feedback_definition.py +25 -0
  125. opik/rest_api/types/boolean_feedback_definition_create.py +20 -0
  126. opik/rest_api/types/boolean_feedback_definition_public.py +25 -0
  127. opik/rest_api/types/boolean_feedback_definition_update.py +20 -0
  128. opik/rest_api/types/boolean_feedback_detail.py +29 -0
  129. opik/rest_api/types/boolean_feedback_detail_create.py +29 -0
  130. opik/rest_api/types/boolean_feedback_detail_public.py +29 -0
  131. opik/rest_api/types/boolean_feedback_detail_update.py +29 -0
  132. opik/rest_api/types/dashboard_page_public.py +24 -0
  133. opik/rest_api/types/dashboard_public.py +30 -0
  134. opik/rest_api/types/dataset.py +2 -0
  135. opik/rest_api/types/dataset_item.py +2 -0
  136. opik/rest_api/types/dataset_item_compare.py +2 -0
  137. opik/rest_api/types/dataset_item_filter.py +23 -0
  138. opik/rest_api/types/dataset_item_filter_operator.py +21 -0
  139. opik/rest_api/types/dataset_item_page_compare.py +1 -0
  140. opik/rest_api/types/dataset_item_page_public.py +1 -0
  141. opik/rest_api/types/dataset_item_public.py +2 -0
  142. opik/rest_api/types/dataset_item_update.py +39 -0
  143. opik/rest_api/types/dataset_item_write.py +1 -0
  144. opik/rest_api/types/dataset_public.py +2 -0
  145. opik/rest_api/types/dataset_public_status.py +5 -0
  146. opik/rest_api/types/dataset_status.py +5 -0
  147. opik/rest_api/types/dataset_version_diff.py +22 -0
  148. opik/rest_api/types/dataset_version_diff_stats.py +24 -0
  149. opik/rest_api/types/dataset_version_page_public.py +23 -0
  150. opik/rest_api/types/dataset_version_public.py +49 -0
  151. opik/rest_api/types/experiment.py +2 -0
  152. opik/rest_api/types/experiment_public.py +2 -0
  153. opik/rest_api/types/experiment_score.py +20 -0
  154. opik/rest_api/types/experiment_score_public.py +20 -0
  155. opik/rest_api/types/experiment_score_write.py +20 -0
  156. opik/rest_api/types/feedback.py +20 -1
  157. opik/rest_api/types/feedback_create.py +16 -1
  158. opik/rest_api/types/feedback_object_public.py +22 -1
  159. opik/rest_api/types/feedback_public.py +20 -1
  160. opik/rest_api/types/feedback_score_public.py +4 -0
  161. opik/rest_api/types/feedback_update.py +16 -1
  162. opik/rest_api/types/image_url.py +20 -0
  163. opik/rest_api/types/image_url_public.py +20 -0
  164. opik/rest_api/types/image_url_write.py +20 -0
  165. opik/rest_api/types/llm_as_judge_message.py +5 -1
  166. opik/rest_api/types/llm_as_judge_message_content.py +24 -0
  167. opik/rest_api/types/llm_as_judge_message_content_public.py +24 -0
  168. opik/rest_api/types/llm_as_judge_message_content_write.py +24 -0
  169. opik/rest_api/types/llm_as_judge_message_public.py +5 -1
  170. opik/rest_api/types/llm_as_judge_message_write.py +5 -1
  171. opik/rest_api/types/llm_as_judge_model_parameters.py +2 -0
  172. opik/rest_api/types/llm_as_judge_model_parameters_public.py +2 -0
  173. opik/rest_api/types/llm_as_judge_model_parameters_write.py +2 -0
  174. opik/rest_api/types/optimization.py +2 -0
  175. opik/rest_api/types/optimization_public.py +2 -0
  176. opik/rest_api/types/optimization_public_status.py +3 -1
  177. opik/rest_api/types/optimization_status.py +3 -1
  178. opik/rest_api/types/optimization_studio_config.py +27 -0
  179. opik/rest_api/types/optimization_studio_config_public.py +27 -0
  180. opik/rest_api/types/optimization_studio_config_write.py +27 -0
  181. opik/rest_api/types/optimization_studio_log.py +22 -0
  182. opik/rest_api/types/optimization_write.py +2 -0
  183. opik/rest_api/types/optimization_write_status.py +3 -1
  184. opik/rest_api/types/prompt.py +6 -0
  185. opik/rest_api/types/prompt_detail.py +6 -0
  186. opik/rest_api/types/prompt_detail_template_structure.py +5 -0
  187. opik/rest_api/types/prompt_public.py +6 -0
  188. opik/rest_api/types/prompt_public_template_structure.py +5 -0
  189. opik/rest_api/types/prompt_template_structure.py +5 -0
  190. opik/rest_api/types/prompt_version.py +2 -0
  191. opik/rest_api/types/prompt_version_detail.py +2 -0
  192. opik/rest_api/types/prompt_version_detail_template_structure.py +5 -0
  193. opik/rest_api/types/prompt_version_public.py +2 -0
  194. opik/rest_api/types/prompt_version_public_template_structure.py +5 -0
  195. opik/rest_api/types/prompt_version_template_structure.py +5 -0
  196. opik/rest_api/types/score_name.py +1 -0
  197. opik/rest_api/types/service_toggles_config.py +6 -0
  198. opik/rest_api/types/span_enrichment_options.py +31 -0
  199. opik/rest_api/types/span_filter.py +23 -0
  200. opik/rest_api/types/span_filter_operator.py +21 -0
  201. opik/rest_api/types/span_filter_write.py +23 -0
  202. opik/rest_api/types/span_filter_write_operator.py +21 -0
  203. opik/rest_api/types/span_llm_as_judge_code.py +27 -0
  204. opik/rest_api/types/span_llm_as_judge_code_public.py +27 -0
  205. opik/rest_api/types/span_llm_as_judge_code_write.py +27 -0
  206. opik/rest_api/types/span_update.py +46 -0
  207. opik/rest_api/types/studio_evaluation.py +20 -0
  208. opik/rest_api/types/studio_evaluation_public.py +20 -0
  209. opik/rest_api/types/studio_evaluation_write.py +20 -0
  210. opik/rest_api/types/studio_llm_model.py +21 -0
  211. opik/rest_api/types/studio_llm_model_public.py +21 -0
  212. opik/rest_api/types/studio_llm_model_write.py +21 -0
  213. opik/rest_api/types/studio_message.py +20 -0
  214. opik/rest_api/types/studio_message_public.py +20 -0
  215. opik/rest_api/types/studio_message_write.py +20 -0
  216. opik/rest_api/types/studio_metric.py +21 -0
  217. opik/rest_api/types/studio_metric_public.py +21 -0
  218. opik/rest_api/types/studio_metric_write.py +21 -0
  219. opik/rest_api/types/studio_optimizer.py +21 -0
  220. opik/rest_api/types/studio_optimizer_public.py +21 -0
  221. opik/rest_api/types/studio_optimizer_write.py +21 -0
  222. opik/rest_api/types/studio_prompt.py +20 -0
  223. opik/rest_api/types/studio_prompt_public.py +20 -0
  224. opik/rest_api/types/studio_prompt_write.py +20 -0
  225. opik/rest_api/types/trace.py +6 -0
  226. opik/rest_api/types/trace_public.py +6 -0
  227. opik/rest_api/types/trace_thread_filter_write.py +23 -0
  228. opik/rest_api/types/trace_thread_filter_write_operator.py +21 -0
  229. opik/rest_api/types/trace_thread_update.py +19 -0
  230. opik/rest_api/types/trace_update.py +39 -0
  231. opik/rest_api/types/value_entry.py +2 -0
  232. opik/rest_api/types/value_entry_compare.py +2 -0
  233. opik/rest_api/types/value_entry_experiment_item_bulk_write_view.py +2 -0
  234. opik/rest_api/types/value_entry_public.py +2 -0
  235. opik/rest_api/types/video_url.py +19 -0
  236. opik/rest_api/types/video_url_public.py +19 -0
  237. opik/rest_api/types/video_url_write.py +19 -0
  238. opik/synchronization.py +5 -6
  239. opik/{decorator/tracing_runtime_config.py → tracing_runtime_config.py} +6 -7
  240. {opik-1.9.5.dist-info → opik-1.9.39.dist-info}/METADATA +5 -4
  241. {opik-1.9.5.dist-info → opik-1.9.39.dist-info}/RECORD +246 -151
  242. opik/api_objects/prompt/chat_prompt_template.py +0 -164
  243. opik/api_objects/prompt/prompt.py +0 -131
  244. /opik/rest_api/{spans/types → types}/span_update_type.py +0 -0
  245. {opik-1.9.5.dist-info → opik-1.9.39.dist-info}/WHEEL +0 -0
  246. {opik-1.9.5.dist-info → opik-1.9.39.dist-info}/entry_points.txt +0 -0
  247. {opik-1.9.5.dist-info → opik-1.9.39.dist-info}/licenses/LICENSE +0 -0
  248. {opik-1.9.5.dist-info → opik-1.9.39.dist-info}/top_level.txt +0 -0
@@ -20,6 +20,8 @@ from ..types.trace_public import TracePublic
20
20
  from ..types.trace_thread import TraceThread
21
21
  from ..types.trace_thread_filter import TraceThreadFilter
22
22
  from ..types.trace_thread_page import TraceThreadPage
23
+ from ..types.trace_thread_update import TraceThreadUpdate
24
+ from ..types.trace_update import TraceUpdate
23
25
  from ..types.trace_write import TraceWrite
24
26
  from ..types.value_entry import ValueEntry
25
27
  from .raw_client import AsyncRawTracesClient, RawTracesClient
@@ -227,6 +229,114 @@ class TracesClient:
227
229
  )
228
230
  return _response.data
229
231
 
232
+ def create_traces(
233
+ self, *, traces: typing.Sequence[TraceWrite], request_options: typing.Optional[RequestOptions] = None
234
+ ) -> None:
235
+ """
236
+ Create traces
237
+
238
+ Parameters
239
+ ----------
240
+ traces : typing.Sequence[TraceWrite]
241
+
242
+ request_options : typing.Optional[RequestOptions]
243
+ Request-specific configuration.
244
+
245
+ Returns
246
+ -------
247
+ None
248
+
249
+ Examples
250
+ --------
251
+ from Opik import OpikApi
252
+ from Opik import TraceWrite
253
+ import datetime
254
+ client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
255
+ client.traces.create_traces(traces=[TraceWrite(start_time=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00", ), )], )
256
+ """
257
+ _response = self._raw_client.create_traces(traces=traces, request_options=request_options)
258
+ return _response.data
259
+
260
+ def batch_update_traces(
261
+ self,
262
+ *,
263
+ ids: typing.Sequence[str],
264
+ update: TraceUpdate,
265
+ merge_tags: typing.Optional[bool] = OMIT,
266
+ request_options: typing.Optional[RequestOptions] = None,
267
+ ) -> None:
268
+ """
269
+ Update multiple traces
270
+
271
+ Parameters
272
+ ----------
273
+ ids : typing.Sequence[str]
274
+ List of trace IDs to update (max 1000)
275
+
276
+ update : TraceUpdate
277
+
278
+ merge_tags : typing.Optional[bool]
279
+ If true, merge tags with existing tags instead of replacing them. Default: false
280
+
281
+ request_options : typing.Optional[RequestOptions]
282
+ Request-specific configuration.
283
+
284
+ Returns
285
+ -------
286
+ None
287
+
288
+ Examples
289
+ --------
290
+ from Opik import OpikApi
291
+ from Opik import TraceUpdate
292
+ client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
293
+ client.traces.batch_update_traces(ids=['ids'], update=TraceUpdate(), )
294
+ """
295
+ _response = self._raw_client.batch_update_traces(
296
+ ids=ids, update=update, merge_tags=merge_tags, request_options=request_options
297
+ )
298
+ return _response.data
299
+
300
+ def batch_update_threads(
301
+ self,
302
+ *,
303
+ ids: typing.Sequence[str],
304
+ update: TraceThreadUpdate,
305
+ merge_tags: typing.Optional[bool] = OMIT,
306
+ request_options: typing.Optional[RequestOptions] = None,
307
+ ) -> None:
308
+ """
309
+ Update multiple threads
310
+
311
+ Parameters
312
+ ----------
313
+ ids : typing.Sequence[str]
314
+ List of thread model IDs to update (max 1000)
315
+
316
+ update : TraceThreadUpdate
317
+
318
+ merge_tags : typing.Optional[bool]
319
+ If true, merge tags with existing tags instead of replacing them. Default: false
320
+
321
+ request_options : typing.Optional[RequestOptions]
322
+ Request-specific configuration.
323
+
324
+ Returns
325
+ -------
326
+ None
327
+
328
+ Examples
329
+ --------
330
+ from Opik import OpikApi
331
+ from Opik import TraceThreadUpdate
332
+ client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
333
+ client.traces.batch_update_threads(ids=['ids'], update=TraceThreadUpdate(), )
334
+ """
335
+ _response = self._raw_client.batch_update_threads(
336
+ ids=ids, update=update, merge_tags=merge_tags, request_options=request_options
337
+ )
338
+ return _response.data
339
+
230
340
  def close_trace_thread(
231
341
  self,
232
342
  *,
@@ -422,34 +532,6 @@ class TracesClient:
422
532
  )
423
533
  return _response.data
424
534
 
425
- def create_traces(
426
- self, *, traces: typing.Sequence[TraceWrite], request_options: typing.Optional[RequestOptions] = None
427
- ) -> None:
428
- """
429
- Create traces
430
-
431
- Parameters
432
- ----------
433
- traces : typing.Sequence[TraceWrite]
434
-
435
- request_options : typing.Optional[RequestOptions]
436
- Request-specific configuration.
437
-
438
- Returns
439
- -------
440
- None
441
-
442
- Examples
443
- --------
444
- from Opik import OpikApi
445
- from Opik import TraceWrite
446
- import datetime
447
- client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
448
- client.traces.create_traces(traces=[TraceWrite(start_time=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00", ), )], )
449
- """
450
- _response = self._raw_client.create_traces(traces=traces, request_options=request_options)
451
- return _response.data
452
-
453
535
  def get_trace_by_id(
454
536
  self,
455
537
  id: str,
@@ -805,14 +887,14 @@ class TracesClient:
805
887
  return _response.data
806
888
 
807
889
  def find_trace_threads_feedback_score_names(
808
- self, *, project_id: str, request_options: typing.Optional[RequestOptions] = None
890
+ self, *, project_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
809
891
  ) -> typing.List[str]:
810
892
  """
811
893
  Find Trace Threads Feedback Score names
812
894
 
813
895
  Parameters
814
896
  ----------
815
- project_id : str
897
+ project_id : typing.Optional[str]
816
898
 
817
899
  request_options : typing.Optional[RequestOptions]
818
900
  Request-specific configuration.
@@ -826,7 +908,7 @@ class TracesClient:
826
908
  --------
827
909
  from Opik import OpikApi
828
910
  client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
829
- client.traces.find_trace_threads_feedback_score_names(project_id='project_id', )
911
+ client.traces.find_trace_threads_feedback_score_names()
830
912
  """
831
913
  _response = self._raw_client.find_trace_threads_feedback_score_names(
832
914
  project_id=project_id, request_options=request_options
@@ -1195,10 +1277,10 @@ class TracesClient:
1195
1277
  If true, returns attachment references like [file.png]; if false, downloads and reinjects stripped attachments
1196
1278
 
1197
1279
  from_time : typing.Optional[dt.datetime]
1198
- Filter trace threads created from this time (ISO-8601 format). Must be provided together with 'to_time'.
1280
+ Filter trace threads created from this time (ISO-8601 format).
1199
1281
 
1200
1282
  to_time : typing.Optional[dt.datetime]
1201
- Filter trace threads created up to this time (ISO-8601 format). Must be provided together with 'from_time' and must be after 'from_time'.
1283
+ Filter trace threads created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.
1202
1284
 
1203
1285
  request_options : typing.Optional[RequestOptions]
1204
1286
  Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
@@ -1259,10 +1341,10 @@ class TracesClient:
1259
1341
  If true, returns attachment references like [file.png]; if false, downloads and reinjects stripped attachments
1260
1342
 
1261
1343
  from_time : typing.Optional[dt.datetime]
1262
- Filter traces created from this time (ISO-8601 format). Must be provided together with 'to_time'.
1344
+ Filter traces created from this time (ISO-8601 format).
1263
1345
 
1264
1346
  to_time : typing.Optional[dt.datetime]
1265
- Filter traces created up to this time (ISO-8601 format). Must be provided together with 'from_time' and must be after 'from_time'.
1347
+ Filter traces created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.
1266
1348
 
1267
1349
  request_options : typing.Optional[RequestOptions]
1268
1350
  Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
@@ -1639,6 +1721,123 @@ class AsyncTracesClient:
1639
1721
  )
1640
1722
  return _response.data
1641
1723
 
1724
+ async def create_traces(
1725
+ self, *, traces: typing.Sequence[TraceWrite], request_options: typing.Optional[RequestOptions] = None
1726
+ ) -> None:
1727
+ """
1728
+ Create traces
1729
+
1730
+ Parameters
1731
+ ----------
1732
+ traces : typing.Sequence[TraceWrite]
1733
+
1734
+ request_options : typing.Optional[RequestOptions]
1735
+ Request-specific configuration.
1736
+
1737
+ Returns
1738
+ -------
1739
+ None
1740
+
1741
+ Examples
1742
+ --------
1743
+ from Opik import AsyncOpikApi
1744
+ from Opik import TraceWrite
1745
+ import datetime
1746
+ import asyncio
1747
+ client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
1748
+ async def main() -> None:
1749
+ await client.traces.create_traces(traces=[TraceWrite(start_time=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00", ), )], )
1750
+ asyncio.run(main())
1751
+ """
1752
+ _response = await self._raw_client.create_traces(traces=traces, request_options=request_options)
1753
+ return _response.data
1754
+
1755
+ async def batch_update_traces(
1756
+ self,
1757
+ *,
1758
+ ids: typing.Sequence[str],
1759
+ update: TraceUpdate,
1760
+ merge_tags: typing.Optional[bool] = OMIT,
1761
+ request_options: typing.Optional[RequestOptions] = None,
1762
+ ) -> None:
1763
+ """
1764
+ Update multiple traces
1765
+
1766
+ Parameters
1767
+ ----------
1768
+ ids : typing.Sequence[str]
1769
+ List of trace IDs to update (max 1000)
1770
+
1771
+ update : TraceUpdate
1772
+
1773
+ merge_tags : typing.Optional[bool]
1774
+ If true, merge tags with existing tags instead of replacing them. Default: false
1775
+
1776
+ request_options : typing.Optional[RequestOptions]
1777
+ Request-specific configuration.
1778
+
1779
+ Returns
1780
+ -------
1781
+ None
1782
+
1783
+ Examples
1784
+ --------
1785
+ from Opik import AsyncOpikApi
1786
+ from Opik import TraceUpdate
1787
+ import asyncio
1788
+ client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
1789
+ async def main() -> None:
1790
+ await client.traces.batch_update_traces(ids=['ids'], update=TraceUpdate(), )
1791
+ asyncio.run(main())
1792
+ """
1793
+ _response = await self._raw_client.batch_update_traces(
1794
+ ids=ids, update=update, merge_tags=merge_tags, request_options=request_options
1795
+ )
1796
+ return _response.data
1797
+
1798
+ async def batch_update_threads(
1799
+ self,
1800
+ *,
1801
+ ids: typing.Sequence[str],
1802
+ update: TraceThreadUpdate,
1803
+ merge_tags: typing.Optional[bool] = OMIT,
1804
+ request_options: typing.Optional[RequestOptions] = None,
1805
+ ) -> None:
1806
+ """
1807
+ Update multiple threads
1808
+
1809
+ Parameters
1810
+ ----------
1811
+ ids : typing.Sequence[str]
1812
+ List of thread model IDs to update (max 1000)
1813
+
1814
+ update : TraceThreadUpdate
1815
+
1816
+ merge_tags : typing.Optional[bool]
1817
+ If true, merge tags with existing tags instead of replacing them. Default: false
1818
+
1819
+ request_options : typing.Optional[RequestOptions]
1820
+ Request-specific configuration.
1821
+
1822
+ Returns
1823
+ -------
1824
+ None
1825
+
1826
+ Examples
1827
+ --------
1828
+ from Opik import AsyncOpikApi
1829
+ from Opik import TraceThreadUpdate
1830
+ import asyncio
1831
+ client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
1832
+ async def main() -> None:
1833
+ await client.traces.batch_update_threads(ids=['ids'], update=TraceThreadUpdate(), )
1834
+ asyncio.run(main())
1835
+ """
1836
+ _response = await self._raw_client.batch_update_threads(
1837
+ ids=ids, update=update, merge_tags=merge_tags, request_options=request_options
1838
+ )
1839
+ return _response.data
1840
+
1642
1841
  async def close_trace_thread(
1643
1842
  self,
1644
1843
  *,
@@ -1843,37 +2042,6 @@ class AsyncTracesClient:
1843
2042
  )
1844
2043
  return _response.data
1845
2044
 
1846
- async def create_traces(
1847
- self, *, traces: typing.Sequence[TraceWrite], request_options: typing.Optional[RequestOptions] = None
1848
- ) -> None:
1849
- """
1850
- Create traces
1851
-
1852
- Parameters
1853
- ----------
1854
- traces : typing.Sequence[TraceWrite]
1855
-
1856
- request_options : typing.Optional[RequestOptions]
1857
- Request-specific configuration.
1858
-
1859
- Returns
1860
- -------
1861
- None
1862
-
1863
- Examples
1864
- --------
1865
- from Opik import AsyncOpikApi
1866
- from Opik import TraceWrite
1867
- import datetime
1868
- import asyncio
1869
- client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
1870
- async def main() -> None:
1871
- await client.traces.create_traces(traces=[TraceWrite(start_time=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00", ), )], )
1872
- asyncio.run(main())
1873
- """
1874
- _response = await self._raw_client.create_traces(traces=traces, request_options=request_options)
1875
- return _response.data
1876
-
1877
2045
  async def get_trace_by_id(
1878
2046
  self,
1879
2047
  id: str,
@@ -2261,14 +2429,14 @@ class AsyncTracesClient:
2261
2429
  return _response.data
2262
2430
 
2263
2431
  async def find_trace_threads_feedback_score_names(
2264
- self, *, project_id: str, request_options: typing.Optional[RequestOptions] = None
2432
+ self, *, project_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
2265
2433
  ) -> typing.List[str]:
2266
2434
  """
2267
2435
  Find Trace Threads Feedback Score names
2268
2436
 
2269
2437
  Parameters
2270
2438
  ----------
2271
- project_id : str
2439
+ project_id : typing.Optional[str]
2272
2440
 
2273
2441
  request_options : typing.Optional[RequestOptions]
2274
2442
  Request-specific configuration.
@@ -2284,7 +2452,7 @@ class AsyncTracesClient:
2284
2452
  import asyncio
2285
2453
  client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
2286
2454
  async def main() -> None:
2287
- await client.traces.find_trace_threads_feedback_score_names(project_id='project_id', )
2455
+ await client.traces.find_trace_threads_feedback_score_names()
2288
2456
  asyncio.run(main())
2289
2457
  """
2290
2458
  _response = await self._raw_client.find_trace_threads_feedback_score_names(
@@ -2678,10 +2846,10 @@ class AsyncTracesClient:
2678
2846
  If true, returns attachment references like [file.png]; if false, downloads and reinjects stripped attachments
2679
2847
 
2680
2848
  from_time : typing.Optional[dt.datetime]
2681
- Filter trace threads created from this time (ISO-8601 format). Must be provided together with 'to_time'.
2849
+ Filter trace threads created from this time (ISO-8601 format).
2682
2850
 
2683
2851
  to_time : typing.Optional[dt.datetime]
2684
- Filter trace threads created up to this time (ISO-8601 format). Must be provided together with 'from_time' and must be after 'from_time'.
2852
+ Filter trace threads created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.
2685
2853
 
2686
2854
  request_options : typing.Optional[RequestOptions]
2687
2855
  Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
@@ -2743,10 +2911,10 @@ class AsyncTracesClient:
2743
2911
  If true, returns attachment references like [file.png]; if false, downloads and reinjects stripped attachments
2744
2912
 
2745
2913
  from_time : typing.Optional[dt.datetime]
2746
- Filter traces created from this time (ISO-8601 format). Must be provided together with 'to_time'.
2914
+ Filter traces created from this time (ISO-8601 format).
2747
2915
 
2748
2916
  to_time : typing.Optional[dt.datetime]
2749
- Filter traces created up to this time (ISO-8601 format). Must be provided together with 'from_time' and must be after 'from_time'.
2917
+ Filter traces created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.
2750
2918
 
2751
2919
  request_options : typing.Optional[RequestOptions]
2752
2920
  Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.