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
@@ -0,0 +1,648 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.jsonable_encoder import jsonable_encoder
10
+ from ..core.pydantic_utilities import parse_obj_as
11
+ from ..core.request_options import RequestOptions
12
+ from ..errors.conflict_error import ConflictError
13
+ from ..errors.not_found_error import NotFoundError
14
+ from ..types.dashboard_page_public import DashboardPagePublic
15
+ from ..types.dashboard_public import DashboardPublic
16
+ from ..types.json_node_public import JsonNodePublic
17
+ from ..types.json_node_write import JsonNodeWrite
18
+
19
+ # this is used as the default value for optional parameters
20
+ OMIT = typing.cast(typing.Any, ...)
21
+
22
+
23
+ class RawDashboardsClient:
24
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
25
+ self._client_wrapper = client_wrapper
26
+
27
+ def find_dashboards(
28
+ self,
29
+ *,
30
+ page: typing.Optional[int] = None,
31
+ size: typing.Optional[int] = None,
32
+ name: typing.Optional[str] = None,
33
+ sorting: typing.Optional[str] = None,
34
+ request_options: typing.Optional[RequestOptions] = None,
35
+ ) -> HttpResponse[DashboardPagePublic]:
36
+ """
37
+ Find dashboards in a workspace
38
+
39
+ Parameters
40
+ ----------
41
+ page : typing.Optional[int]
42
+
43
+ size : typing.Optional[int]
44
+
45
+ name : typing.Optional[str]
46
+
47
+ sorting : typing.Optional[str]
48
+
49
+ request_options : typing.Optional[RequestOptions]
50
+ Request-specific configuration.
51
+
52
+ Returns
53
+ -------
54
+ HttpResponse[DashboardPagePublic]
55
+ Dashboard page
56
+ """
57
+ _response = self._client_wrapper.httpx_client.request(
58
+ "v1/private/dashboards",
59
+ method="GET",
60
+ params={
61
+ "page": page,
62
+ "size": size,
63
+ "name": name,
64
+ "sorting": sorting,
65
+ },
66
+ request_options=request_options,
67
+ )
68
+ try:
69
+ if 200 <= _response.status_code < 300:
70
+ _data = typing.cast(
71
+ DashboardPagePublic,
72
+ parse_obj_as(
73
+ type_=DashboardPagePublic, # type: ignore
74
+ object_=_response.json(),
75
+ ),
76
+ )
77
+ return HttpResponse(response=_response, data=_data)
78
+ _response_json = _response.json()
79
+ except JSONDecodeError:
80
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
81
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
82
+
83
+ def create_dashboard(
84
+ self,
85
+ *,
86
+ name: str,
87
+ config: JsonNodeWrite,
88
+ description: typing.Optional[str] = OMIT,
89
+ request_options: typing.Optional[RequestOptions] = None,
90
+ ) -> HttpResponse[DashboardPublic]:
91
+ """
92
+ Create a new dashboard in a workspace
93
+
94
+ Parameters
95
+ ----------
96
+ name : str
97
+
98
+ config : JsonNodeWrite
99
+
100
+ description : typing.Optional[str]
101
+
102
+ request_options : typing.Optional[RequestOptions]
103
+ Request-specific configuration.
104
+
105
+ Returns
106
+ -------
107
+ HttpResponse[DashboardPublic]
108
+ Created
109
+ """
110
+ _response = self._client_wrapper.httpx_client.request(
111
+ "v1/private/dashboards",
112
+ method="POST",
113
+ json={
114
+ "name": name,
115
+ "description": description,
116
+ "config": config,
117
+ },
118
+ headers={
119
+ "content-type": "application/json",
120
+ },
121
+ request_options=request_options,
122
+ omit=OMIT,
123
+ )
124
+ try:
125
+ if 200 <= _response.status_code < 300:
126
+ _data = typing.cast(
127
+ DashboardPublic,
128
+ parse_obj_as(
129
+ type_=DashboardPublic, # type: ignore
130
+ object_=_response.json(),
131
+ ),
132
+ )
133
+ return HttpResponse(response=_response, data=_data)
134
+ _response_json = _response.json()
135
+ except JSONDecodeError:
136
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
137
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
138
+
139
+ def get_dashboard_by_id(
140
+ self, dashboard_id: str, *, request_options: typing.Optional[RequestOptions] = None
141
+ ) -> HttpResponse[DashboardPublic]:
142
+ """
143
+ Get dashboard by id
144
+
145
+ Parameters
146
+ ----------
147
+ dashboard_id : str
148
+
149
+ request_options : typing.Optional[RequestOptions]
150
+ Request-specific configuration.
151
+
152
+ Returns
153
+ -------
154
+ HttpResponse[DashboardPublic]
155
+ Dashboard resource
156
+ """
157
+ _response = self._client_wrapper.httpx_client.request(
158
+ f"v1/private/dashboards/{jsonable_encoder(dashboard_id)}",
159
+ method="GET",
160
+ request_options=request_options,
161
+ )
162
+ try:
163
+ if 200 <= _response.status_code < 300:
164
+ _data = typing.cast(
165
+ DashboardPublic,
166
+ parse_obj_as(
167
+ type_=DashboardPublic, # type: ignore
168
+ object_=_response.json(),
169
+ ),
170
+ )
171
+ return HttpResponse(response=_response, data=_data)
172
+ if _response.status_code == 404:
173
+ raise NotFoundError(
174
+ headers=dict(_response.headers),
175
+ body=typing.cast(
176
+ typing.Optional[typing.Any],
177
+ parse_obj_as(
178
+ type_=typing.Optional[typing.Any], # type: ignore
179
+ object_=_response.json(),
180
+ ),
181
+ ),
182
+ )
183
+ _response_json = _response.json()
184
+ except JSONDecodeError:
185
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
186
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
187
+
188
+ def delete_dashboard(
189
+ self, dashboard_id: str, *, request_options: typing.Optional[RequestOptions] = None
190
+ ) -> HttpResponse[None]:
191
+ """
192
+ Delete dashboard by id
193
+
194
+ Parameters
195
+ ----------
196
+ dashboard_id : str
197
+
198
+ request_options : typing.Optional[RequestOptions]
199
+ Request-specific configuration.
200
+
201
+ Returns
202
+ -------
203
+ HttpResponse[None]
204
+ """
205
+ _response = self._client_wrapper.httpx_client.request(
206
+ f"v1/private/dashboards/{jsonable_encoder(dashboard_id)}",
207
+ method="DELETE",
208
+ request_options=request_options,
209
+ )
210
+ try:
211
+ if 200 <= _response.status_code < 300:
212
+ return HttpResponse(response=_response, data=None)
213
+ _response_json = _response.json()
214
+ except JSONDecodeError:
215
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
216
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
217
+
218
+ def update_dashboard(
219
+ self,
220
+ dashboard_id: str,
221
+ *,
222
+ name: typing.Optional[str] = OMIT,
223
+ description: typing.Optional[str] = OMIT,
224
+ config: typing.Optional[JsonNodePublic] = OMIT,
225
+ request_options: typing.Optional[RequestOptions] = None,
226
+ ) -> HttpResponse[DashboardPublic]:
227
+ """
228
+ Update dashboard by id. Partial updates are supported - only provided fields will be updated.
229
+
230
+ Parameters
231
+ ----------
232
+ dashboard_id : str
233
+
234
+ name : typing.Optional[str]
235
+
236
+ description : typing.Optional[str]
237
+
238
+ config : typing.Optional[JsonNodePublic]
239
+
240
+ request_options : typing.Optional[RequestOptions]
241
+ Request-specific configuration.
242
+
243
+ Returns
244
+ -------
245
+ HttpResponse[DashboardPublic]
246
+ Updated dashboard
247
+ """
248
+ _response = self._client_wrapper.httpx_client.request(
249
+ f"v1/private/dashboards/{jsonable_encoder(dashboard_id)}",
250
+ method="PATCH",
251
+ json={
252
+ "name": name,
253
+ "description": description,
254
+ "config": config,
255
+ },
256
+ headers={
257
+ "content-type": "application/json",
258
+ },
259
+ request_options=request_options,
260
+ omit=OMIT,
261
+ )
262
+ try:
263
+ if 200 <= _response.status_code < 300:
264
+ _data = typing.cast(
265
+ DashboardPublic,
266
+ parse_obj_as(
267
+ type_=DashboardPublic, # type: ignore
268
+ object_=_response.json(),
269
+ ),
270
+ )
271
+ return HttpResponse(response=_response, data=_data)
272
+ if _response.status_code == 404:
273
+ raise NotFoundError(
274
+ headers=dict(_response.headers),
275
+ body=typing.cast(
276
+ typing.Optional[typing.Any],
277
+ parse_obj_as(
278
+ type_=typing.Optional[typing.Any], # type: ignore
279
+ object_=_response.json(),
280
+ ),
281
+ ),
282
+ )
283
+ if _response.status_code == 409:
284
+ raise ConflictError(
285
+ headers=dict(_response.headers),
286
+ body=typing.cast(
287
+ typing.Optional[typing.Any],
288
+ parse_obj_as(
289
+ type_=typing.Optional[typing.Any], # type: ignore
290
+ object_=_response.json(),
291
+ ),
292
+ ),
293
+ )
294
+ _response_json = _response.json()
295
+ except JSONDecodeError:
296
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
297
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
298
+
299
+ def delete_dashboards_batch(
300
+ self, *, ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
301
+ ) -> HttpResponse[None]:
302
+ """
303
+ Delete dashboards batch
304
+
305
+ Parameters
306
+ ----------
307
+ ids : typing.Sequence[str]
308
+
309
+ request_options : typing.Optional[RequestOptions]
310
+ Request-specific configuration.
311
+
312
+ Returns
313
+ -------
314
+ HttpResponse[None]
315
+ """
316
+ _response = self._client_wrapper.httpx_client.request(
317
+ "v1/private/dashboards/delete-batch",
318
+ method="POST",
319
+ json={
320
+ "ids": ids,
321
+ },
322
+ headers={
323
+ "content-type": "application/json",
324
+ },
325
+ request_options=request_options,
326
+ omit=OMIT,
327
+ )
328
+ try:
329
+ if 200 <= _response.status_code < 300:
330
+ return HttpResponse(response=_response, data=None)
331
+ _response_json = _response.json()
332
+ except JSONDecodeError:
333
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
334
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
335
+
336
+
337
+ class AsyncRawDashboardsClient:
338
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
339
+ self._client_wrapper = client_wrapper
340
+
341
+ async def find_dashboards(
342
+ self,
343
+ *,
344
+ page: typing.Optional[int] = None,
345
+ size: typing.Optional[int] = None,
346
+ name: typing.Optional[str] = None,
347
+ sorting: typing.Optional[str] = None,
348
+ request_options: typing.Optional[RequestOptions] = None,
349
+ ) -> AsyncHttpResponse[DashboardPagePublic]:
350
+ """
351
+ Find dashboards in a workspace
352
+
353
+ Parameters
354
+ ----------
355
+ page : typing.Optional[int]
356
+
357
+ size : typing.Optional[int]
358
+
359
+ name : typing.Optional[str]
360
+
361
+ sorting : typing.Optional[str]
362
+
363
+ request_options : typing.Optional[RequestOptions]
364
+ Request-specific configuration.
365
+
366
+ Returns
367
+ -------
368
+ AsyncHttpResponse[DashboardPagePublic]
369
+ Dashboard page
370
+ """
371
+ _response = await self._client_wrapper.httpx_client.request(
372
+ "v1/private/dashboards",
373
+ method="GET",
374
+ params={
375
+ "page": page,
376
+ "size": size,
377
+ "name": name,
378
+ "sorting": sorting,
379
+ },
380
+ request_options=request_options,
381
+ )
382
+ try:
383
+ if 200 <= _response.status_code < 300:
384
+ _data = typing.cast(
385
+ DashboardPagePublic,
386
+ parse_obj_as(
387
+ type_=DashboardPagePublic, # type: ignore
388
+ object_=_response.json(),
389
+ ),
390
+ )
391
+ return AsyncHttpResponse(response=_response, data=_data)
392
+ _response_json = _response.json()
393
+ except JSONDecodeError:
394
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
395
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
396
+
397
+ async def create_dashboard(
398
+ self,
399
+ *,
400
+ name: str,
401
+ config: JsonNodeWrite,
402
+ description: typing.Optional[str] = OMIT,
403
+ request_options: typing.Optional[RequestOptions] = None,
404
+ ) -> AsyncHttpResponse[DashboardPublic]:
405
+ """
406
+ Create a new dashboard in a workspace
407
+
408
+ Parameters
409
+ ----------
410
+ name : str
411
+
412
+ config : JsonNodeWrite
413
+
414
+ description : typing.Optional[str]
415
+
416
+ request_options : typing.Optional[RequestOptions]
417
+ Request-specific configuration.
418
+
419
+ Returns
420
+ -------
421
+ AsyncHttpResponse[DashboardPublic]
422
+ Created
423
+ """
424
+ _response = await self._client_wrapper.httpx_client.request(
425
+ "v1/private/dashboards",
426
+ method="POST",
427
+ json={
428
+ "name": name,
429
+ "description": description,
430
+ "config": config,
431
+ },
432
+ headers={
433
+ "content-type": "application/json",
434
+ },
435
+ request_options=request_options,
436
+ omit=OMIT,
437
+ )
438
+ try:
439
+ if 200 <= _response.status_code < 300:
440
+ _data = typing.cast(
441
+ DashboardPublic,
442
+ parse_obj_as(
443
+ type_=DashboardPublic, # type: ignore
444
+ object_=_response.json(),
445
+ ),
446
+ )
447
+ return AsyncHttpResponse(response=_response, data=_data)
448
+ _response_json = _response.json()
449
+ except JSONDecodeError:
450
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
451
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
452
+
453
+ async def get_dashboard_by_id(
454
+ self, dashboard_id: str, *, request_options: typing.Optional[RequestOptions] = None
455
+ ) -> AsyncHttpResponse[DashboardPublic]:
456
+ """
457
+ Get dashboard by id
458
+
459
+ Parameters
460
+ ----------
461
+ dashboard_id : str
462
+
463
+ request_options : typing.Optional[RequestOptions]
464
+ Request-specific configuration.
465
+
466
+ Returns
467
+ -------
468
+ AsyncHttpResponse[DashboardPublic]
469
+ Dashboard resource
470
+ """
471
+ _response = await self._client_wrapper.httpx_client.request(
472
+ f"v1/private/dashboards/{jsonable_encoder(dashboard_id)}",
473
+ method="GET",
474
+ request_options=request_options,
475
+ )
476
+ try:
477
+ if 200 <= _response.status_code < 300:
478
+ _data = typing.cast(
479
+ DashboardPublic,
480
+ parse_obj_as(
481
+ type_=DashboardPublic, # type: ignore
482
+ object_=_response.json(),
483
+ ),
484
+ )
485
+ return AsyncHttpResponse(response=_response, data=_data)
486
+ if _response.status_code == 404:
487
+ raise NotFoundError(
488
+ headers=dict(_response.headers),
489
+ body=typing.cast(
490
+ typing.Optional[typing.Any],
491
+ parse_obj_as(
492
+ type_=typing.Optional[typing.Any], # type: ignore
493
+ object_=_response.json(),
494
+ ),
495
+ ),
496
+ )
497
+ _response_json = _response.json()
498
+ except JSONDecodeError:
499
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
500
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
501
+
502
+ async def delete_dashboard(
503
+ self, dashboard_id: str, *, request_options: typing.Optional[RequestOptions] = None
504
+ ) -> AsyncHttpResponse[None]:
505
+ """
506
+ Delete dashboard by id
507
+
508
+ Parameters
509
+ ----------
510
+ dashboard_id : str
511
+
512
+ request_options : typing.Optional[RequestOptions]
513
+ Request-specific configuration.
514
+
515
+ Returns
516
+ -------
517
+ AsyncHttpResponse[None]
518
+ """
519
+ _response = await self._client_wrapper.httpx_client.request(
520
+ f"v1/private/dashboards/{jsonable_encoder(dashboard_id)}",
521
+ method="DELETE",
522
+ request_options=request_options,
523
+ )
524
+ try:
525
+ if 200 <= _response.status_code < 300:
526
+ return AsyncHttpResponse(response=_response, data=None)
527
+ _response_json = _response.json()
528
+ except JSONDecodeError:
529
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
530
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
531
+
532
+ async def update_dashboard(
533
+ self,
534
+ dashboard_id: str,
535
+ *,
536
+ name: typing.Optional[str] = OMIT,
537
+ description: typing.Optional[str] = OMIT,
538
+ config: typing.Optional[JsonNodePublic] = OMIT,
539
+ request_options: typing.Optional[RequestOptions] = None,
540
+ ) -> AsyncHttpResponse[DashboardPublic]:
541
+ """
542
+ Update dashboard by id. Partial updates are supported - only provided fields will be updated.
543
+
544
+ Parameters
545
+ ----------
546
+ dashboard_id : str
547
+
548
+ name : typing.Optional[str]
549
+
550
+ description : typing.Optional[str]
551
+
552
+ config : typing.Optional[JsonNodePublic]
553
+
554
+ request_options : typing.Optional[RequestOptions]
555
+ Request-specific configuration.
556
+
557
+ Returns
558
+ -------
559
+ AsyncHttpResponse[DashboardPublic]
560
+ Updated dashboard
561
+ """
562
+ _response = await self._client_wrapper.httpx_client.request(
563
+ f"v1/private/dashboards/{jsonable_encoder(dashboard_id)}",
564
+ method="PATCH",
565
+ json={
566
+ "name": name,
567
+ "description": description,
568
+ "config": config,
569
+ },
570
+ headers={
571
+ "content-type": "application/json",
572
+ },
573
+ request_options=request_options,
574
+ omit=OMIT,
575
+ )
576
+ try:
577
+ if 200 <= _response.status_code < 300:
578
+ _data = typing.cast(
579
+ DashboardPublic,
580
+ parse_obj_as(
581
+ type_=DashboardPublic, # type: ignore
582
+ object_=_response.json(),
583
+ ),
584
+ )
585
+ return AsyncHttpResponse(response=_response, data=_data)
586
+ if _response.status_code == 404:
587
+ raise NotFoundError(
588
+ headers=dict(_response.headers),
589
+ body=typing.cast(
590
+ typing.Optional[typing.Any],
591
+ parse_obj_as(
592
+ type_=typing.Optional[typing.Any], # type: ignore
593
+ object_=_response.json(),
594
+ ),
595
+ ),
596
+ )
597
+ if _response.status_code == 409:
598
+ raise ConflictError(
599
+ headers=dict(_response.headers),
600
+ body=typing.cast(
601
+ typing.Optional[typing.Any],
602
+ parse_obj_as(
603
+ type_=typing.Optional[typing.Any], # type: ignore
604
+ object_=_response.json(),
605
+ ),
606
+ ),
607
+ )
608
+ _response_json = _response.json()
609
+ except JSONDecodeError:
610
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
611
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
612
+
613
+ async def delete_dashboards_batch(
614
+ self, *, ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
615
+ ) -> AsyncHttpResponse[None]:
616
+ """
617
+ Delete dashboards batch
618
+
619
+ Parameters
620
+ ----------
621
+ ids : typing.Sequence[str]
622
+
623
+ request_options : typing.Optional[RequestOptions]
624
+ Request-specific configuration.
625
+
626
+ Returns
627
+ -------
628
+ AsyncHttpResponse[None]
629
+ """
630
+ _response = await self._client_wrapper.httpx_client.request(
631
+ "v1/private/dashboards/delete-batch",
632
+ method="POST",
633
+ json={
634
+ "ids": ids,
635
+ },
636
+ headers={
637
+ "content-type": "application/json",
638
+ },
639
+ request_options=request_options,
640
+ omit=OMIT,
641
+ )
642
+ try:
643
+ if 200 <= _response.status_code < 300:
644
+ return AsyncHttpResponse(response=_response, data=None)
645
+ _response_json = _response.json()
646
+ except JSONDecodeError:
647
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
648
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)