agenta 0.48.9__py3-none-any.whl → 0.49.0__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.

Potentially problematic release.


This version of agenta might be problematic. Click here for more details.

Files changed (297) hide show
  1. agenta/__init__.py +3 -2
  2. agenta/client/Readme.md +258 -80
  3. agenta/client/__init__.py +205 -29
  4. agenta/client/backend/__init__.py +461 -0
  5. agenta/client/backend/access_control/__init__.py +2 -0
  6. agenta/client/backend/access_control/client.py +53 -73
  7. agenta/client/backend/access_control/raw_client.py +180 -0
  8. agenta/client/backend/admin/__init__.py +2 -0
  9. agenta/client/backend/admin/client.py +473 -268
  10. agenta/client/backend/admin/raw_client.py +1017 -0
  11. agenta/client/backend/api_keys/__init__.py +2 -0
  12. agenta/client/backend/api_keys/client.py +43 -276
  13. agenta/client/backend/api_keys/raw_client.py +364 -0
  14. agenta/client/backend/apps/__init__.py +2 -0
  15. agenta/client/backend/apps/client.py +132 -895
  16. agenta/client/backend/apps/raw_client.py +1516 -0
  17. agenta/client/backend/bases/__init__.py +2 -0
  18. agenta/client/backend/bases/client.py +33 -73
  19. agenta/client/backend/bases/raw_client.py +179 -0
  20. agenta/client/backend/billing/__init__.py +3 -0
  21. agenta/client/backend/billing/client.py +564 -0
  22. agenta/client/backend/billing/raw_client.py +805 -0
  23. agenta/client/backend/client.py +1268 -0
  24. agenta/client/backend/configs/__init__.py +2 -0
  25. agenta/client/backend/configs/client.py +49 -361
  26. agenta/client/backend/configs/raw_client.py +402 -0
  27. agenta/client/backend/containers/__init__.py +1 -3
  28. agenta/client/backend/containers/client.py +25 -548
  29. agenta/client/backend/containers/raw_client.py +112 -0
  30. agenta/client/backend/core/__init__.py +5 -0
  31. agenta/client/backend/core/api_error.py +12 -6
  32. agenta/client/backend/core/client_wrapper.py +4 -4
  33. agenta/client/backend/core/file.py +1 -3
  34. agenta/client/backend/core/force_multipart.py +16 -0
  35. agenta/client/backend/core/http_client.py +78 -34
  36. agenta/client/backend/core/http_response.py +55 -0
  37. agenta/client/backend/core/jsonable_encoder.py +0 -1
  38. agenta/client/backend/core/pydantic_utilities.py +88 -113
  39. agenta/client/backend/core/serialization.py +9 -3
  40. agenta/client/backend/environment.py +7 -0
  41. agenta/client/backend/environments/__init__.py +2 -0
  42. agenta/client/backend/environments/client.py +43 -79
  43. agenta/client/backend/environments/raw_client.py +193 -0
  44. agenta/client/backend/errors/__init__.py +2 -0
  45. agenta/client/backend/errors/unprocessable_entity_error.py +8 -2
  46. agenta/client/backend/evals/__init__.py +3 -0
  47. agenta/client/backend/evals/client.py +1042 -0
  48. agenta/client/backend/evals/raw_client.py +1549 -0
  49. agenta/client/backend/evaluations/__init__.py +2 -0
  50. agenta/client/backend/evaluations/client.py +106 -590
  51. agenta/client/backend/evaluations/raw_client.py +1344 -0
  52. agenta/client/backend/evaluators/__init__.py +2 -0
  53. agenta/client/backend/evaluators/client.py +99 -516
  54. agenta/client/backend/evaluators/raw_client.py +1182 -0
  55. agenta/client/backend/human_evaluations/__init__.py +2 -0
  56. agenta/client/backend/human_evaluations/client.py +120 -680
  57. agenta/client/backend/human_evaluations/raw_client.py +1577 -0
  58. agenta/client/backend/observability/__init__.py +14 -2
  59. agenta/client/backend/observability/client.py +185 -341
  60. agenta/client/backend/observability/raw_client.py +943 -0
  61. agenta/client/backend/observability/types/__init__.py +10 -2
  62. agenta/client/backend/observability/types/{format.py → fetch_trace_by_id_request_trace_id.py} +1 -1
  63. agenta/client/backend/observability/types/fetch_trace_by_id_response.py +15 -0
  64. agenta/client/backend/observability/types/query_analytics_response.py +2 -1
  65. agenta/client/backend/observability/types/query_traces_response.py +7 -3
  66. agenta/client/backend/organization/__init__.py +2 -0
  67. agenta/client/backend/organization/client.py +105 -361
  68. agenta/client/backend/organization/raw_client.py +774 -0
  69. agenta/client/backend/raw_client.py +1432 -0
  70. agenta/client/backend/scopes/__init__.py +2 -0
  71. agenta/client/backend/scopes/client.py +31 -45
  72. agenta/client/backend/scopes/raw_client.py +105 -0
  73. agenta/client/backend/testsets/__init__.py +14 -0
  74. agenta/client/backend/testsets/client.py +1098 -653
  75. agenta/client/backend/testsets/raw_client.py +2348 -0
  76. agenta/client/backend/testsets/types/__init__.py +17 -0
  77. agenta/client/backend/testsets/types/create_testset_from_file_request_file_type.py +7 -0
  78. agenta/client/backend/testsets/types/fetch_testset_to_file_request_file_type.py +7 -0
  79. agenta/client/backend/testsets/types/update_testset_from_file_request_file_type.py +7 -0
  80. agenta/client/backend/tracing/__init__.py +7 -0
  81. agenta/client/backend/tracing/client.py +782 -0
  82. agenta/client/backend/tracing/raw_client.py +1223 -0
  83. agenta/client/backend/tracing/types/__init__.py +8 -0
  84. agenta/client/backend/{types/variant_action_enum.py → tracing/types/fetch_trace_request_trace_id.py} +1 -1
  85. agenta/client/backend/tracing/types/remove_trace_request_trace_id.py +5 -0
  86. agenta/client/backend/types/__init__.py +153 -26
  87. agenta/client/backend/types/account_request.py +24 -0
  88. agenta/client/backend/types/account_response.py +5 -7
  89. agenta/client/backend/types/agenta_node_dto.py +13 -13
  90. agenta/client/backend/types/agenta_node_dto_nodes_value.py +1 -0
  91. agenta/client/backend/types/agenta_nodes_response.py +14 -8
  92. agenta/client/backend/types/agenta_root_dto.py +16 -8
  93. agenta/client/backend/types/agenta_roots_response.py +16 -8
  94. agenta/client/backend/types/agenta_tree_dto.py +16 -8
  95. agenta/client/backend/types/agenta_trees_response.py +16 -8
  96. agenta/client/backend/types/aggregated_result.py +5 -7
  97. agenta/client/backend/types/aggregated_result_evaluator_config.py +1 -0
  98. agenta/client/backend/types/analytics_response.py +4 -6
  99. agenta/client/backend/types/annotation.py +50 -0
  100. agenta/client/backend/types/annotation_create.py +39 -0
  101. agenta/client/backend/types/annotation_edit.py +31 -0
  102. agenta/client/backend/types/annotation_kind.py +5 -0
  103. agenta/client/backend/types/{uri.py → annotation_link.py} +6 -7
  104. agenta/client/backend/types/{provider_key_dto.py → annotation_link_response.py} +6 -7
  105. agenta/client/backend/types/annotation_query.py +40 -0
  106. agenta/client/backend/types/annotation_query_request.py +20 -0
  107. agenta/client/backend/types/annotation_reference.py +21 -0
  108. agenta/client/backend/types/annotation_references.py +22 -0
  109. agenta/client/backend/types/{docker_env_vars.py → annotation_response.py} +6 -7
  110. agenta/client/backend/types/annotation_source.py +5 -0
  111. agenta/client/backend/types/annotations_response.py +24 -0
  112. agenta/client/backend/types/app.py +3 -5
  113. agenta/client/backend/types/app_variant_response.py +3 -6
  114. agenta/client/backend/types/app_variant_revision.py +5 -6
  115. agenta/client/backend/types/artifact.py +44 -0
  116. agenta/client/backend/types/base_output.py +3 -5
  117. agenta/client/backend/types/body_fetch_workflow_revision.py +21 -0
  118. agenta/client/backend/types/body_import_testset.py +3 -5
  119. agenta/client/backend/types/bucket_dto.py +4 -6
  120. agenta/client/backend/types/collect_status_response.py +3 -5
  121. agenta/client/backend/types/config_db.py +3 -5
  122. agenta/client/backend/types/config_dto.py +5 -7
  123. agenta/client/backend/types/config_response_model.py +5 -7
  124. agenta/client/backend/types/correct_answer.py +3 -5
  125. agenta/client/backend/types/create_app_output.py +3 -5
  126. agenta/client/backend/types/custom_model_settings_dto.py +3 -5
  127. agenta/client/backend/types/custom_provider_dto.py +6 -9
  128. agenta/client/backend/types/custom_provider_kind.py +5 -5
  129. agenta/client/backend/types/custom_provider_settings_dto.py +3 -5
  130. agenta/client/backend/types/data.py +2 -1
  131. agenta/client/backend/types/delete_evaluation.py +3 -5
  132. agenta/client/backend/types/environment_output.py +3 -5
  133. agenta/client/backend/types/environment_output_extended.py +4 -6
  134. agenta/client/backend/types/environment_revision.py +5 -5
  135. agenta/client/backend/types/error.py +3 -5
  136. agenta/client/backend/types/evaluation.py +6 -8
  137. agenta/client/backend/types/evaluation_scenario.py +5 -7
  138. agenta/client/backend/types/evaluation_scenario_input.py +3 -5
  139. agenta/client/backend/types/evaluation_scenario_output.py +4 -6
  140. agenta/client/backend/types/evaluation_scenario_result.py +4 -6
  141. agenta/client/backend/types/evaluator.py +31 -12
  142. agenta/client/backend/types/evaluator_config.py +3 -5
  143. agenta/client/backend/types/evaluator_flags.py +21 -0
  144. agenta/client/backend/types/evaluator_mapping_output_interface.py +3 -5
  145. agenta/client/backend/types/evaluator_output_interface.py +3 -5
  146. agenta/client/backend/types/evaluator_query.py +32 -0
  147. agenta/client/backend/types/evaluator_query_request.py +30 -0
  148. agenta/client/backend/types/evaluator_request.py +20 -0
  149. agenta/client/backend/types/evaluator_response.py +21 -0
  150. agenta/client/backend/types/evaluators_response.py +21 -0
  151. agenta/client/backend/types/exception_dto.py +3 -5
  152. agenta/client/backend/types/{o_tel_spans_response.py → extended_o_tel_tracing_response.py} +5 -7
  153. agenta/client/backend/types/focus.py +5 -0
  154. agenta/client/backend/types/format.py +5 -0
  155. agenta/client/backend/types/full_json_input.py +34 -0
  156. agenta/client/backend/types/full_json_output.py +29 -0
  157. agenta/client/backend/types/get_config_response.py +3 -5
  158. agenta/client/backend/types/{header_dto.py → header.py} +4 -6
  159. agenta/client/backend/types/http_validation_error.py +4 -6
  160. agenta/client/backend/types/human_evaluation.py +3 -5
  161. agenta/client/backend/types/human_evaluation_scenario.py +4 -6
  162. agenta/client/backend/types/human_evaluation_scenario_input.py +3 -5
  163. agenta/client/backend/types/human_evaluation_scenario_output.py +3 -5
  164. agenta/client/backend/types/invite_request.py +4 -6
  165. agenta/client/backend/types/legacy_analytics_response.py +4 -6
  166. agenta/client/backend/types/legacy_data_point.py +3 -5
  167. agenta/client/backend/types/legacy_evaluator.py +26 -0
  168. agenta/client/backend/types/legacy_scope_request.py +4 -6
  169. agenta/client/backend/types/legacy_scopes_response.py +3 -5
  170. agenta/client/backend/types/legacy_subscription_request.py +19 -0
  171. agenta/client/backend/types/legacy_user_request.py +5 -7
  172. agenta/client/backend/types/legacy_user_response.py +3 -5
  173. agenta/client/backend/types/lifecycle_dto.py +3 -5
  174. agenta/client/backend/types/link_dto.py +4 -6
  175. agenta/client/backend/types/list_api_keys_response.py +3 -5
  176. agenta/client/backend/types/llm_run_rate_limit.py +3 -5
  177. agenta/client/backend/types/meta_request.py +30 -0
  178. agenta/client/backend/types/metrics_dto.py +3 -5
  179. agenta/client/backend/types/new_testset.py +3 -5
  180. agenta/client/backend/types/node_dto.py +4 -6
  181. agenta/client/backend/types/o_tel_context_dto.py +3 -5
  182. agenta/client/backend/types/o_tel_event.py +35 -0
  183. agenta/client/backend/types/o_tel_event_dto.py +3 -5
  184. agenta/client/backend/types/o_tel_extra_dto.py +4 -6
  185. agenta/client/backend/types/o_tel_flat_span.py +56 -0
  186. agenta/client/backend/types/o_tel_flat_span_input_end_time.py +6 -0
  187. agenta/client/backend/types/o_tel_flat_span_input_start_time.py +6 -0
  188. agenta/client/backend/types/o_tel_flat_span_output_end_time.py +6 -0
  189. agenta/client/backend/types/o_tel_flat_span_output_start_time.py +6 -0
  190. agenta/client/backend/types/o_tel_link.py +34 -0
  191. agenta/client/backend/types/o_tel_link_dto.py +4 -6
  192. agenta/client/backend/types/o_tel_links_response.py +22 -0
  193. agenta/client/backend/types/o_tel_span.py +58 -0
  194. agenta/client/backend/types/o_tel_span_dto.py +8 -10
  195. agenta/client/backend/types/o_tel_span_input_end_time.py +6 -0
  196. agenta/client/backend/types/o_tel_span_input_spans_value.py +7 -0
  197. agenta/client/backend/types/o_tel_span_input_start_time.py +6 -0
  198. agenta/client/backend/types/o_tel_span_output_end_time.py +6 -0
  199. agenta/client/backend/types/o_tel_span_output_spans_value.py +30 -0
  200. agenta/client/backend/types/o_tel_span_output_start_time.py +6 -0
  201. agenta/client/backend/types/o_tel_spans_tree.py +22 -0
  202. agenta/client/backend/types/o_tel_spans_tree_input_spans_value.py +7 -0
  203. agenta/client/backend/types/o_tel_spans_tree_output_spans_value.py +5 -0
  204. agenta/client/backend/types/o_tel_status_code.py +1 -1
  205. agenta/client/backend/types/o_tel_tracing_data_response.py +22 -0
  206. agenta/client/backend/types/o_tel_tracing_request.py +22 -0
  207. agenta/client/backend/types/o_tel_tracing_response.py +27 -0
  208. agenta/client/backend/types/organization.py +3 -5
  209. agenta/client/backend/types/organization_details.py +3 -5
  210. agenta/client/backend/types/organization_membership_request.py +5 -7
  211. agenta/client/backend/types/organization_output.py +3 -5
  212. agenta/client/backend/types/organization_request.py +3 -5
  213. agenta/client/backend/types/parent_dto.py +3 -5
  214. agenta/client/backend/types/permission.py +11 -0
  215. agenta/client/backend/types/plan.py +14 -0
  216. agenta/client/backend/types/project_membership_request.py +5 -7
  217. agenta/client/backend/types/project_request.py +4 -6
  218. agenta/client/backend/types/project_scope.py +5 -7
  219. agenta/client/backend/types/projects_response.py +3 -5
  220. agenta/client/backend/types/recursive_types.py +23 -0
  221. agenta/client/backend/types/reference.py +18 -5
  222. agenta/client/backend/types/reference_dto.py +4 -5
  223. agenta/client/backend/types/reference_request_model.py +4 -5
  224. agenta/client/backend/types/result.py +4 -6
  225. agenta/client/backend/types/root_dto.py +3 -5
  226. agenta/client/backend/types/scopes_response_model.py +4 -6
  227. agenta/client/backend/types/secret_dto.py +5 -7
  228. agenta/client/backend/types/secret_response_dto.py +11 -11
  229. agenta/client/backend/types/simple_evaluation_output.py +4 -6
  230. agenta/client/backend/types/span_dto.py +18 -14
  231. agenta/client/backend/types/span_dto_nodes_value.py +1 -1
  232. agenta/client/backend/types/standard_provider_dto.py +5 -7
  233. agenta/client/backend/types/standard_provider_settings_dto.py +3 -5
  234. agenta/client/backend/types/status_dto.py +4 -6
  235. agenta/client/backend/types/tags_request.py +30 -0
  236. agenta/client/backend/types/test_set_output_response.py +5 -7
  237. agenta/client/backend/types/test_set_simple_response.py +3 -5
  238. agenta/client/backend/types/testcase_response.py +33 -0
  239. agenta/client/backend/types/testset.py +46 -0
  240. agenta/client/backend/types/testset_request.py +20 -0
  241. agenta/client/backend/types/testset_response.py +21 -0
  242. agenta/client/backend/types/testsets_response.py +21 -0
  243. agenta/client/backend/types/time_dto.py +3 -5
  244. agenta/client/backend/types/timestamp.py +6 -0
  245. agenta/client/backend/types/tree_dto.py +4 -6
  246. agenta/client/backend/types/update_app_output.py +3 -5
  247. agenta/client/backend/types/user_request.py +3 -5
  248. agenta/client/backend/types/validation_error.py +4 -6
  249. agenta/client/backend/types/workflow_artifact.py +45 -0
  250. agenta/client/backend/types/workflow_data.py +20 -0
  251. agenta/client/backend/types/workflow_flags.py +21 -0
  252. agenta/client/backend/types/workflow_request.py +20 -0
  253. agenta/client/backend/types/workflow_response.py +21 -0
  254. agenta/client/backend/types/workflow_revision.py +57 -0
  255. agenta/client/backend/types/workflow_revision_request.py +20 -0
  256. agenta/client/backend/types/workflow_revision_response.py +21 -0
  257. agenta/client/backend/types/workflow_revisions_response.py +21 -0
  258. agenta/client/backend/types/workflow_variant.py +48 -0
  259. agenta/client/backend/types/workflow_variant_request.py +20 -0
  260. agenta/client/backend/types/workflow_variant_response.py +21 -0
  261. agenta/client/backend/types/workflow_variants_response.py +21 -0
  262. agenta/client/backend/types/workflows_response.py +21 -0
  263. agenta/client/backend/types/workspace.py +3 -5
  264. agenta/client/backend/types/workspace_member_response.py +4 -6
  265. agenta/client/backend/types/workspace_membership_request.py +5 -7
  266. agenta/client/backend/types/workspace_permission.py +5 -7
  267. agenta/client/backend/types/workspace_request.py +4 -6
  268. agenta/client/backend/types/workspace_response.py +4 -6
  269. agenta/client/backend/variants/__init__.py +2 -0
  270. agenta/client/backend/variants/client.py +306 -1651
  271. agenta/client/backend/variants/raw_client.py +2482 -0
  272. agenta/client/backend/variants/types/__init__.py +2 -0
  273. agenta/client/backend/variants/types/add_variant_from_base_and_config_response.py +1 -0
  274. agenta/client/backend/vault/__init__.py +2 -0
  275. agenta/client/backend/vault/client.py +69 -323
  276. agenta/client/backend/vault/raw_client.py +616 -0
  277. agenta/client/backend/workflows/__init__.py +3 -0
  278. agenta/client/backend/workflows/client.py +2398 -0
  279. agenta/client/backend/workflows/raw_client.py +3639 -0
  280. agenta/client/backend/workspace/__init__.py +2 -0
  281. agenta/client/backend/workspace/client.py +46 -147
  282. agenta/client/backend/workspace/raw_client.py +376 -0
  283. agenta/client/types.py +4 -0
  284. agenta/sdk/litellm/mocks/__init__.py +144 -0
  285. agenta/sdk/middleware/auth.py +26 -25
  286. agenta/sdk/types.py +28 -1
  287. {agenta-0.48.9.dist-info → agenta-0.49.0.dist-info}/METADATA +1 -1
  288. agenta-0.49.0.dist-info/RECORD +362 -0
  289. agenta/client/backend/containers/types/__init__.py +0 -5
  290. agenta/client/backend/containers/types/container_templates_response.py +0 -6
  291. agenta/client/backend/types/image.py +0 -25
  292. agenta/client/backend/types/provider_kind.py +0 -21
  293. agenta/client/backend/types/template.py +0 -23
  294. agenta/client/backend/types/template_image_info.py +0 -29
  295. agenta/client/backend/types/variant_action.py +0 -22
  296. agenta-0.48.9.dist-info/RECORD +0 -255
  297. {agenta-0.48.9.dist-info → agenta-0.49.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,1549 @@
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 ..core.serialization import convert_and_respect_annotation_metadata
13
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
14
+ from ..types.annotation_create import AnnotationCreate
15
+ from ..types.annotation_edit import AnnotationEdit
16
+ from ..types.annotation_link_response import AnnotationLinkResponse
17
+ from ..types.annotation_query_request import AnnotationQueryRequest
18
+ from ..types.annotation_response import AnnotationResponse
19
+ from ..types.annotations_response import AnnotationsResponse
20
+ from ..types.evaluator import Evaluator
21
+ from ..types.evaluator_query_request import EvaluatorQueryRequest
22
+ from ..types.evaluator_response import EvaluatorResponse
23
+ from ..types.evaluators_response import EvaluatorsResponse
24
+ from ..types.http_validation_error import HttpValidationError
25
+
26
+ # this is used as the default value for optional parameters
27
+ OMIT = typing.cast(typing.Any, ...)
28
+
29
+
30
+ class RawEvalsClient:
31
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
32
+ self._client_wrapper = client_wrapper
33
+
34
+ def list_evaluators(
35
+ self, *, request_options: typing.Optional[RequestOptions] = None
36
+ ) -> HttpResponse[EvaluatorsResponse]:
37
+ """
38
+ Parameters
39
+ ----------
40
+ request_options : typing.Optional[RequestOptions]
41
+ Request-specific configuration.
42
+
43
+ Returns
44
+ -------
45
+ HttpResponse[EvaluatorsResponse]
46
+ Successful Response
47
+ """
48
+ _response = self._client_wrapper.httpx_client.request(
49
+ "preview/evaluators/",
50
+ method="GET",
51
+ request_options=request_options,
52
+ )
53
+ try:
54
+ if 200 <= _response.status_code < 300:
55
+ _data = typing.cast(
56
+ EvaluatorsResponse,
57
+ parse_obj_as(
58
+ type_=EvaluatorsResponse, # type: ignore
59
+ object_=_response.json(),
60
+ ),
61
+ )
62
+ return HttpResponse(response=_response, data=_data)
63
+ if _response.status_code == 422:
64
+ raise UnprocessableEntityError(
65
+ headers=dict(_response.headers),
66
+ body=typing.cast(
67
+ HttpValidationError,
68
+ parse_obj_as(
69
+ type_=HttpValidationError, # type: ignore
70
+ object_=_response.json(),
71
+ ),
72
+ ),
73
+ )
74
+ _response_json = _response.json()
75
+ except JSONDecodeError:
76
+ raise ApiError(
77
+ status_code=_response.status_code,
78
+ headers=dict(_response.headers),
79
+ body=_response.text,
80
+ )
81
+ raise ApiError(
82
+ status_code=_response.status_code,
83
+ headers=dict(_response.headers),
84
+ body=_response_json,
85
+ )
86
+
87
+ def create_evaluator(
88
+ self,
89
+ *,
90
+ evaluator: Evaluator,
91
+ request_options: typing.Optional[RequestOptions] = None,
92
+ ) -> HttpResponse[EvaluatorResponse]:
93
+ """
94
+ Parameters
95
+ ----------
96
+ evaluator : Evaluator
97
+
98
+ request_options : typing.Optional[RequestOptions]
99
+ Request-specific configuration.
100
+
101
+ Returns
102
+ -------
103
+ HttpResponse[EvaluatorResponse]
104
+ Successful Response
105
+ """
106
+ _response = self._client_wrapper.httpx_client.request(
107
+ "preview/evaluators/",
108
+ method="POST",
109
+ json={
110
+ "evaluator": convert_and_respect_annotation_metadata(
111
+ object_=evaluator, annotation=Evaluator, direction="write"
112
+ ),
113
+ },
114
+ headers={
115
+ "content-type": "application/json",
116
+ },
117
+ request_options=request_options,
118
+ omit=OMIT,
119
+ )
120
+ try:
121
+ if 200 <= _response.status_code < 300:
122
+ _data = typing.cast(
123
+ EvaluatorResponse,
124
+ parse_obj_as(
125
+ type_=EvaluatorResponse, # type: ignore
126
+ object_=_response.json(),
127
+ ),
128
+ )
129
+ return HttpResponse(response=_response, data=_data)
130
+ if _response.status_code == 422:
131
+ raise UnprocessableEntityError(
132
+ headers=dict(_response.headers),
133
+ body=typing.cast(
134
+ HttpValidationError,
135
+ parse_obj_as(
136
+ type_=HttpValidationError, # type: ignore
137
+ object_=_response.json(),
138
+ ),
139
+ ),
140
+ )
141
+ _response_json = _response.json()
142
+ except JSONDecodeError:
143
+ raise ApiError(
144
+ status_code=_response.status_code,
145
+ headers=dict(_response.headers),
146
+ body=_response.text,
147
+ )
148
+ raise ApiError(
149
+ status_code=_response.status_code,
150
+ headers=dict(_response.headers),
151
+ body=_response_json,
152
+ )
153
+
154
+ def fetch_evaluator(
155
+ self,
156
+ evaluator_id: str,
157
+ *,
158
+ request_options: typing.Optional[RequestOptions] = None,
159
+ ) -> HttpResponse[EvaluatorResponse]:
160
+ """
161
+ Parameters
162
+ ----------
163
+ evaluator_id : str
164
+
165
+ request_options : typing.Optional[RequestOptions]
166
+ Request-specific configuration.
167
+
168
+ Returns
169
+ -------
170
+ HttpResponse[EvaluatorResponse]
171
+ Successful Response
172
+ """
173
+ _response = self._client_wrapper.httpx_client.request(
174
+ f"preview/evaluators/{jsonable_encoder(evaluator_id)}",
175
+ method="GET",
176
+ request_options=request_options,
177
+ )
178
+ try:
179
+ if 200 <= _response.status_code < 300:
180
+ _data = typing.cast(
181
+ EvaluatorResponse,
182
+ parse_obj_as(
183
+ type_=EvaluatorResponse, # type: ignore
184
+ object_=_response.json(),
185
+ ),
186
+ )
187
+ return HttpResponse(response=_response, data=_data)
188
+ if _response.status_code == 422:
189
+ raise UnprocessableEntityError(
190
+ headers=dict(_response.headers),
191
+ body=typing.cast(
192
+ HttpValidationError,
193
+ parse_obj_as(
194
+ type_=HttpValidationError, # type: ignore
195
+ object_=_response.json(),
196
+ ),
197
+ ),
198
+ )
199
+ _response_json = _response.json()
200
+ except JSONDecodeError:
201
+ raise ApiError(
202
+ status_code=_response.status_code,
203
+ headers=dict(_response.headers),
204
+ body=_response.text,
205
+ )
206
+ raise ApiError(
207
+ status_code=_response.status_code,
208
+ headers=dict(_response.headers),
209
+ body=_response_json,
210
+ )
211
+
212
+ def edit_evaluator(
213
+ self,
214
+ evaluator_id: str,
215
+ *,
216
+ evaluator: Evaluator,
217
+ request_options: typing.Optional[RequestOptions] = None,
218
+ ) -> HttpResponse[EvaluatorResponse]:
219
+ """
220
+ Parameters
221
+ ----------
222
+ evaluator_id : str
223
+
224
+ evaluator : Evaluator
225
+
226
+ request_options : typing.Optional[RequestOptions]
227
+ Request-specific configuration.
228
+
229
+ Returns
230
+ -------
231
+ HttpResponse[EvaluatorResponse]
232
+ Successful Response
233
+ """
234
+ _response = self._client_wrapper.httpx_client.request(
235
+ f"preview/evaluators/{jsonable_encoder(evaluator_id)}",
236
+ method="PUT",
237
+ json={
238
+ "evaluator": convert_and_respect_annotation_metadata(
239
+ object_=evaluator, annotation=Evaluator, direction="write"
240
+ ),
241
+ },
242
+ headers={
243
+ "content-type": "application/json",
244
+ },
245
+ request_options=request_options,
246
+ omit=OMIT,
247
+ )
248
+ try:
249
+ if 200 <= _response.status_code < 300:
250
+ _data = typing.cast(
251
+ EvaluatorResponse,
252
+ parse_obj_as(
253
+ type_=EvaluatorResponse, # type: ignore
254
+ object_=_response.json(),
255
+ ),
256
+ )
257
+ return HttpResponse(response=_response, data=_data)
258
+ if _response.status_code == 422:
259
+ raise UnprocessableEntityError(
260
+ headers=dict(_response.headers),
261
+ body=typing.cast(
262
+ HttpValidationError,
263
+ parse_obj_as(
264
+ type_=HttpValidationError, # type: ignore
265
+ object_=_response.json(),
266
+ ),
267
+ ),
268
+ )
269
+ _response_json = _response.json()
270
+ except JSONDecodeError:
271
+ raise ApiError(
272
+ status_code=_response.status_code,
273
+ headers=dict(_response.headers),
274
+ body=_response.text,
275
+ )
276
+ raise ApiError(
277
+ status_code=_response.status_code,
278
+ headers=dict(_response.headers),
279
+ body=_response_json,
280
+ )
281
+
282
+ def archive_evaluator(
283
+ self,
284
+ evaluator_id: str,
285
+ *,
286
+ request_options: typing.Optional[RequestOptions] = None,
287
+ ) -> HttpResponse[EvaluatorResponse]:
288
+ """
289
+ Parameters
290
+ ----------
291
+ evaluator_id : str
292
+
293
+ request_options : typing.Optional[RequestOptions]
294
+ Request-specific configuration.
295
+
296
+ Returns
297
+ -------
298
+ HttpResponse[EvaluatorResponse]
299
+ Successful Response
300
+ """
301
+ _response = self._client_wrapper.httpx_client.request(
302
+ f"preview/evaluators/{jsonable_encoder(evaluator_id)}/archive",
303
+ method="POST",
304
+ request_options=request_options,
305
+ )
306
+ try:
307
+ if 200 <= _response.status_code < 300:
308
+ _data = typing.cast(
309
+ EvaluatorResponse,
310
+ parse_obj_as(
311
+ type_=EvaluatorResponse, # type: ignore
312
+ object_=_response.json(),
313
+ ),
314
+ )
315
+ return HttpResponse(response=_response, data=_data)
316
+ if _response.status_code == 422:
317
+ raise UnprocessableEntityError(
318
+ headers=dict(_response.headers),
319
+ body=typing.cast(
320
+ HttpValidationError,
321
+ parse_obj_as(
322
+ type_=HttpValidationError, # type: ignore
323
+ object_=_response.json(),
324
+ ),
325
+ ),
326
+ )
327
+ _response_json = _response.json()
328
+ except JSONDecodeError:
329
+ raise ApiError(
330
+ status_code=_response.status_code,
331
+ headers=dict(_response.headers),
332
+ body=_response.text,
333
+ )
334
+ raise ApiError(
335
+ status_code=_response.status_code,
336
+ headers=dict(_response.headers),
337
+ body=_response_json,
338
+ )
339
+
340
+ def unarchive_evaluator(
341
+ self,
342
+ evaluator_id: str,
343
+ *,
344
+ request_options: typing.Optional[RequestOptions] = None,
345
+ ) -> HttpResponse[EvaluatorResponse]:
346
+ """
347
+ Parameters
348
+ ----------
349
+ evaluator_id : str
350
+
351
+ request_options : typing.Optional[RequestOptions]
352
+ Request-specific configuration.
353
+
354
+ Returns
355
+ -------
356
+ HttpResponse[EvaluatorResponse]
357
+ Successful Response
358
+ """
359
+ _response = self._client_wrapper.httpx_client.request(
360
+ f"preview/evaluators/{jsonable_encoder(evaluator_id)}/unarchive",
361
+ method="POST",
362
+ request_options=request_options,
363
+ )
364
+ try:
365
+ if 200 <= _response.status_code < 300:
366
+ _data = typing.cast(
367
+ EvaluatorResponse,
368
+ parse_obj_as(
369
+ type_=EvaluatorResponse, # type: ignore
370
+ object_=_response.json(),
371
+ ),
372
+ )
373
+ return HttpResponse(response=_response, data=_data)
374
+ if _response.status_code == 422:
375
+ raise UnprocessableEntityError(
376
+ headers=dict(_response.headers),
377
+ body=typing.cast(
378
+ HttpValidationError,
379
+ parse_obj_as(
380
+ type_=HttpValidationError, # type: ignore
381
+ object_=_response.json(),
382
+ ),
383
+ ),
384
+ )
385
+ _response_json = _response.json()
386
+ except JSONDecodeError:
387
+ raise ApiError(
388
+ status_code=_response.status_code,
389
+ headers=dict(_response.headers),
390
+ body=_response.text,
391
+ )
392
+ raise ApiError(
393
+ status_code=_response.status_code,
394
+ headers=dict(_response.headers),
395
+ body=_response_json,
396
+ )
397
+
398
+ def query_evaluators(
399
+ self,
400
+ *,
401
+ request: typing.Optional[EvaluatorQueryRequest] = None,
402
+ request_options: typing.Optional[RequestOptions] = None,
403
+ ) -> HttpResponse[EvaluatorsResponse]:
404
+ """
405
+ Parameters
406
+ ----------
407
+ request : typing.Optional[EvaluatorQueryRequest]
408
+
409
+ request_options : typing.Optional[RequestOptions]
410
+ Request-specific configuration.
411
+
412
+ Returns
413
+ -------
414
+ HttpResponse[EvaluatorsResponse]
415
+ Successful Response
416
+ """
417
+ _response = self._client_wrapper.httpx_client.request(
418
+ "preview/evaluators/query",
419
+ method="POST",
420
+ json=convert_and_respect_annotation_metadata(
421
+ object_=request, annotation=EvaluatorQueryRequest, direction="write"
422
+ ),
423
+ headers={
424
+ "content-type": "application/json",
425
+ },
426
+ request_options=request_options,
427
+ omit=OMIT,
428
+ )
429
+ try:
430
+ if 200 <= _response.status_code < 300:
431
+ _data = typing.cast(
432
+ EvaluatorsResponse,
433
+ parse_obj_as(
434
+ type_=EvaluatorsResponse, # type: ignore
435
+ object_=_response.json(),
436
+ ),
437
+ )
438
+ return HttpResponse(response=_response, data=_data)
439
+ if _response.status_code == 422:
440
+ raise UnprocessableEntityError(
441
+ headers=dict(_response.headers),
442
+ body=typing.cast(
443
+ HttpValidationError,
444
+ parse_obj_as(
445
+ type_=HttpValidationError, # type: ignore
446
+ object_=_response.json(),
447
+ ),
448
+ ),
449
+ )
450
+ _response_json = _response.json()
451
+ except JSONDecodeError:
452
+ raise ApiError(
453
+ status_code=_response.status_code,
454
+ headers=dict(_response.headers),
455
+ body=_response.text,
456
+ )
457
+ raise ApiError(
458
+ status_code=_response.status_code,
459
+ headers=dict(_response.headers),
460
+ body=_response_json,
461
+ )
462
+
463
+ def query_annotations(
464
+ self,
465
+ *,
466
+ request: typing.Optional[AnnotationQueryRequest] = None,
467
+ request_options: typing.Optional[RequestOptions] = None,
468
+ ) -> HttpResponse[AnnotationsResponse]:
469
+ """
470
+ Parameters
471
+ ----------
472
+ request : typing.Optional[AnnotationQueryRequest]
473
+
474
+ request_options : typing.Optional[RequestOptions]
475
+ Request-specific configuration.
476
+
477
+ Returns
478
+ -------
479
+ HttpResponse[AnnotationsResponse]
480
+ Successful Response
481
+ """
482
+ _response = self._client_wrapper.httpx_client.request(
483
+ "preview/annotations/query",
484
+ method="POST",
485
+ json=convert_and_respect_annotation_metadata(
486
+ object_=request, annotation=AnnotationQueryRequest, direction="write"
487
+ ),
488
+ headers={
489
+ "content-type": "application/json",
490
+ },
491
+ request_options=request_options,
492
+ omit=OMIT,
493
+ )
494
+ try:
495
+ if 200 <= _response.status_code < 300:
496
+ _data = typing.cast(
497
+ AnnotationsResponse,
498
+ parse_obj_as(
499
+ type_=AnnotationsResponse, # type: ignore
500
+ object_=_response.json(),
501
+ ),
502
+ )
503
+ return HttpResponse(response=_response, data=_data)
504
+ if _response.status_code == 422:
505
+ raise UnprocessableEntityError(
506
+ headers=dict(_response.headers),
507
+ body=typing.cast(
508
+ HttpValidationError,
509
+ parse_obj_as(
510
+ type_=HttpValidationError, # type: ignore
511
+ object_=_response.json(),
512
+ ),
513
+ ),
514
+ )
515
+ _response_json = _response.json()
516
+ except JSONDecodeError:
517
+ raise ApiError(
518
+ status_code=_response.status_code,
519
+ headers=dict(_response.headers),
520
+ body=_response.text,
521
+ )
522
+ raise ApiError(
523
+ status_code=_response.status_code,
524
+ headers=dict(_response.headers),
525
+ body=_response_json,
526
+ )
527
+
528
+ def create_annotation(
529
+ self,
530
+ *,
531
+ annotation: AnnotationCreate,
532
+ request_options: typing.Optional[RequestOptions] = None,
533
+ ) -> HttpResponse[AnnotationResponse]:
534
+ """
535
+ Parameters
536
+ ----------
537
+ annotation : AnnotationCreate
538
+
539
+ request_options : typing.Optional[RequestOptions]
540
+ Request-specific configuration.
541
+
542
+ Returns
543
+ -------
544
+ HttpResponse[AnnotationResponse]
545
+ Successful Response
546
+ """
547
+ _response = self._client_wrapper.httpx_client.request(
548
+ "preview/annotations/",
549
+ method="POST",
550
+ json={
551
+ "annotation": convert_and_respect_annotation_metadata(
552
+ object_=annotation, annotation=AnnotationCreate, direction="write"
553
+ ),
554
+ },
555
+ headers={
556
+ "content-type": "application/json",
557
+ },
558
+ request_options=request_options,
559
+ omit=OMIT,
560
+ )
561
+ try:
562
+ if 200 <= _response.status_code < 300:
563
+ _data = typing.cast(
564
+ AnnotationResponse,
565
+ parse_obj_as(
566
+ type_=AnnotationResponse, # type: ignore
567
+ object_=_response.json(),
568
+ ),
569
+ )
570
+ return HttpResponse(response=_response, data=_data)
571
+ if _response.status_code == 422:
572
+ raise UnprocessableEntityError(
573
+ headers=dict(_response.headers),
574
+ body=typing.cast(
575
+ HttpValidationError,
576
+ parse_obj_as(
577
+ type_=HttpValidationError, # type: ignore
578
+ object_=_response.json(),
579
+ ),
580
+ ),
581
+ )
582
+ _response_json = _response.json()
583
+ except JSONDecodeError:
584
+ raise ApiError(
585
+ status_code=_response.status_code,
586
+ headers=dict(_response.headers),
587
+ body=_response.text,
588
+ )
589
+ raise ApiError(
590
+ status_code=_response.status_code,
591
+ headers=dict(_response.headers),
592
+ body=_response_json,
593
+ )
594
+
595
+ def fetch_annotation(
596
+ self,
597
+ trace_id: str,
598
+ span_id: str,
599
+ *,
600
+ request_options: typing.Optional[RequestOptions] = None,
601
+ ) -> HttpResponse[AnnotationResponse]:
602
+ """
603
+ Parameters
604
+ ----------
605
+ trace_id : str
606
+
607
+ span_id : str
608
+
609
+ request_options : typing.Optional[RequestOptions]
610
+ Request-specific configuration.
611
+
612
+ Returns
613
+ -------
614
+ HttpResponse[AnnotationResponse]
615
+ Successful Response
616
+ """
617
+ _response = self._client_wrapper.httpx_client.request(
618
+ f"preview/annotations/{jsonable_encoder(trace_id)}/{jsonable_encoder(span_id)}",
619
+ method="GET",
620
+ request_options=request_options,
621
+ )
622
+ try:
623
+ if 200 <= _response.status_code < 300:
624
+ _data = typing.cast(
625
+ AnnotationResponse,
626
+ parse_obj_as(
627
+ type_=AnnotationResponse, # type: ignore
628
+ object_=_response.json(),
629
+ ),
630
+ )
631
+ return HttpResponse(response=_response, data=_data)
632
+ if _response.status_code == 422:
633
+ raise UnprocessableEntityError(
634
+ headers=dict(_response.headers),
635
+ body=typing.cast(
636
+ HttpValidationError,
637
+ parse_obj_as(
638
+ type_=HttpValidationError, # type: ignore
639
+ object_=_response.json(),
640
+ ),
641
+ ),
642
+ )
643
+ _response_json = _response.json()
644
+ except JSONDecodeError:
645
+ raise ApiError(
646
+ status_code=_response.status_code,
647
+ headers=dict(_response.headers),
648
+ body=_response.text,
649
+ )
650
+ raise ApiError(
651
+ status_code=_response.status_code,
652
+ headers=dict(_response.headers),
653
+ body=_response_json,
654
+ )
655
+
656
+ def delete_annotation(
657
+ self,
658
+ trace_id: str,
659
+ span_id: str,
660
+ *,
661
+ request_options: typing.Optional[RequestOptions] = None,
662
+ ) -> HttpResponse[AnnotationLinkResponse]:
663
+ """
664
+ Parameters
665
+ ----------
666
+ trace_id : str
667
+
668
+ span_id : str
669
+
670
+ request_options : typing.Optional[RequestOptions]
671
+ Request-specific configuration.
672
+
673
+ Returns
674
+ -------
675
+ HttpResponse[AnnotationLinkResponse]
676
+ Successful Response
677
+ """
678
+ _response = self._client_wrapper.httpx_client.request(
679
+ f"preview/annotations/{jsonable_encoder(trace_id)}/{jsonable_encoder(span_id)}",
680
+ method="DELETE",
681
+ request_options=request_options,
682
+ )
683
+ try:
684
+ if 200 <= _response.status_code < 300:
685
+ _data = typing.cast(
686
+ AnnotationLinkResponse,
687
+ parse_obj_as(
688
+ type_=AnnotationLinkResponse, # type: ignore
689
+ object_=_response.json(),
690
+ ),
691
+ )
692
+ return HttpResponse(response=_response, data=_data)
693
+ if _response.status_code == 422:
694
+ raise UnprocessableEntityError(
695
+ headers=dict(_response.headers),
696
+ body=typing.cast(
697
+ HttpValidationError,
698
+ parse_obj_as(
699
+ type_=HttpValidationError, # type: ignore
700
+ object_=_response.json(),
701
+ ),
702
+ ),
703
+ )
704
+ _response_json = _response.json()
705
+ except JSONDecodeError:
706
+ raise ApiError(
707
+ status_code=_response.status_code,
708
+ headers=dict(_response.headers),
709
+ body=_response.text,
710
+ )
711
+ raise ApiError(
712
+ status_code=_response.status_code,
713
+ headers=dict(_response.headers),
714
+ body=_response_json,
715
+ )
716
+
717
+ def edit_annotation(
718
+ self,
719
+ trace_id: str,
720
+ span_id: str,
721
+ *,
722
+ annotation: AnnotationEdit,
723
+ request_options: typing.Optional[RequestOptions] = None,
724
+ ) -> HttpResponse[AnnotationResponse]:
725
+ """
726
+ Parameters
727
+ ----------
728
+ trace_id : str
729
+
730
+ span_id : str
731
+
732
+ annotation : AnnotationEdit
733
+
734
+ request_options : typing.Optional[RequestOptions]
735
+ Request-specific configuration.
736
+
737
+ Returns
738
+ -------
739
+ HttpResponse[AnnotationResponse]
740
+ Successful Response
741
+ """
742
+ _response = self._client_wrapper.httpx_client.request(
743
+ f"preview/annotations/{jsonable_encoder(trace_id)}/{jsonable_encoder(span_id)}",
744
+ method="PATCH",
745
+ json={
746
+ "annotation": convert_and_respect_annotation_metadata(
747
+ object_=annotation, annotation=AnnotationEdit, direction="write"
748
+ ),
749
+ },
750
+ headers={
751
+ "content-type": "application/json",
752
+ },
753
+ request_options=request_options,
754
+ omit=OMIT,
755
+ )
756
+ try:
757
+ if 200 <= _response.status_code < 300:
758
+ _data = typing.cast(
759
+ AnnotationResponse,
760
+ parse_obj_as(
761
+ type_=AnnotationResponse, # type: ignore
762
+ object_=_response.json(),
763
+ ),
764
+ )
765
+ return HttpResponse(response=_response, data=_data)
766
+ if _response.status_code == 422:
767
+ raise UnprocessableEntityError(
768
+ headers=dict(_response.headers),
769
+ body=typing.cast(
770
+ HttpValidationError,
771
+ parse_obj_as(
772
+ type_=HttpValidationError, # type: ignore
773
+ object_=_response.json(),
774
+ ),
775
+ ),
776
+ )
777
+ _response_json = _response.json()
778
+ except JSONDecodeError:
779
+ raise ApiError(
780
+ status_code=_response.status_code,
781
+ headers=dict(_response.headers),
782
+ body=_response.text,
783
+ )
784
+ raise ApiError(
785
+ status_code=_response.status_code,
786
+ headers=dict(_response.headers),
787
+ body=_response_json,
788
+ )
789
+
790
+
791
+ class AsyncRawEvalsClient:
792
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
793
+ self._client_wrapper = client_wrapper
794
+
795
+ async def list_evaluators(
796
+ self, *, request_options: typing.Optional[RequestOptions] = None
797
+ ) -> AsyncHttpResponse[EvaluatorsResponse]:
798
+ """
799
+ Parameters
800
+ ----------
801
+ request_options : typing.Optional[RequestOptions]
802
+ Request-specific configuration.
803
+
804
+ Returns
805
+ -------
806
+ AsyncHttpResponse[EvaluatorsResponse]
807
+ Successful Response
808
+ """
809
+ _response = await self._client_wrapper.httpx_client.request(
810
+ "preview/evaluators/",
811
+ method="GET",
812
+ request_options=request_options,
813
+ )
814
+ try:
815
+ if 200 <= _response.status_code < 300:
816
+ _data = typing.cast(
817
+ EvaluatorsResponse,
818
+ parse_obj_as(
819
+ type_=EvaluatorsResponse, # type: ignore
820
+ object_=_response.json(),
821
+ ),
822
+ )
823
+ return AsyncHttpResponse(response=_response, data=_data)
824
+ if _response.status_code == 422:
825
+ raise UnprocessableEntityError(
826
+ headers=dict(_response.headers),
827
+ body=typing.cast(
828
+ HttpValidationError,
829
+ parse_obj_as(
830
+ type_=HttpValidationError, # type: ignore
831
+ object_=_response.json(),
832
+ ),
833
+ ),
834
+ )
835
+ _response_json = _response.json()
836
+ except JSONDecodeError:
837
+ raise ApiError(
838
+ status_code=_response.status_code,
839
+ headers=dict(_response.headers),
840
+ body=_response.text,
841
+ )
842
+ raise ApiError(
843
+ status_code=_response.status_code,
844
+ headers=dict(_response.headers),
845
+ body=_response_json,
846
+ )
847
+
848
+ async def create_evaluator(
849
+ self,
850
+ *,
851
+ evaluator: Evaluator,
852
+ request_options: typing.Optional[RequestOptions] = None,
853
+ ) -> AsyncHttpResponse[EvaluatorResponse]:
854
+ """
855
+ Parameters
856
+ ----------
857
+ evaluator : Evaluator
858
+
859
+ request_options : typing.Optional[RequestOptions]
860
+ Request-specific configuration.
861
+
862
+ Returns
863
+ -------
864
+ AsyncHttpResponse[EvaluatorResponse]
865
+ Successful Response
866
+ """
867
+ _response = await self._client_wrapper.httpx_client.request(
868
+ "preview/evaluators/",
869
+ method="POST",
870
+ json={
871
+ "evaluator": convert_and_respect_annotation_metadata(
872
+ object_=evaluator, annotation=Evaluator, direction="write"
873
+ ),
874
+ },
875
+ headers={
876
+ "content-type": "application/json",
877
+ },
878
+ request_options=request_options,
879
+ omit=OMIT,
880
+ )
881
+ try:
882
+ if 200 <= _response.status_code < 300:
883
+ _data = typing.cast(
884
+ EvaluatorResponse,
885
+ parse_obj_as(
886
+ type_=EvaluatorResponse, # type: ignore
887
+ object_=_response.json(),
888
+ ),
889
+ )
890
+ return AsyncHttpResponse(response=_response, data=_data)
891
+ if _response.status_code == 422:
892
+ raise UnprocessableEntityError(
893
+ headers=dict(_response.headers),
894
+ body=typing.cast(
895
+ HttpValidationError,
896
+ parse_obj_as(
897
+ type_=HttpValidationError, # type: ignore
898
+ object_=_response.json(),
899
+ ),
900
+ ),
901
+ )
902
+ _response_json = _response.json()
903
+ except JSONDecodeError:
904
+ raise ApiError(
905
+ status_code=_response.status_code,
906
+ headers=dict(_response.headers),
907
+ body=_response.text,
908
+ )
909
+ raise ApiError(
910
+ status_code=_response.status_code,
911
+ headers=dict(_response.headers),
912
+ body=_response_json,
913
+ )
914
+
915
+ async def fetch_evaluator(
916
+ self,
917
+ evaluator_id: str,
918
+ *,
919
+ request_options: typing.Optional[RequestOptions] = None,
920
+ ) -> AsyncHttpResponse[EvaluatorResponse]:
921
+ """
922
+ Parameters
923
+ ----------
924
+ evaluator_id : str
925
+
926
+ request_options : typing.Optional[RequestOptions]
927
+ Request-specific configuration.
928
+
929
+ Returns
930
+ -------
931
+ AsyncHttpResponse[EvaluatorResponse]
932
+ Successful Response
933
+ """
934
+ _response = await self._client_wrapper.httpx_client.request(
935
+ f"preview/evaluators/{jsonable_encoder(evaluator_id)}",
936
+ method="GET",
937
+ request_options=request_options,
938
+ )
939
+ try:
940
+ if 200 <= _response.status_code < 300:
941
+ _data = typing.cast(
942
+ EvaluatorResponse,
943
+ parse_obj_as(
944
+ type_=EvaluatorResponse, # type: ignore
945
+ object_=_response.json(),
946
+ ),
947
+ )
948
+ return AsyncHttpResponse(response=_response, data=_data)
949
+ if _response.status_code == 422:
950
+ raise UnprocessableEntityError(
951
+ headers=dict(_response.headers),
952
+ body=typing.cast(
953
+ HttpValidationError,
954
+ parse_obj_as(
955
+ type_=HttpValidationError, # type: ignore
956
+ object_=_response.json(),
957
+ ),
958
+ ),
959
+ )
960
+ _response_json = _response.json()
961
+ except JSONDecodeError:
962
+ raise ApiError(
963
+ status_code=_response.status_code,
964
+ headers=dict(_response.headers),
965
+ body=_response.text,
966
+ )
967
+ raise ApiError(
968
+ status_code=_response.status_code,
969
+ headers=dict(_response.headers),
970
+ body=_response_json,
971
+ )
972
+
973
+ async def edit_evaluator(
974
+ self,
975
+ evaluator_id: str,
976
+ *,
977
+ evaluator: Evaluator,
978
+ request_options: typing.Optional[RequestOptions] = None,
979
+ ) -> AsyncHttpResponse[EvaluatorResponse]:
980
+ """
981
+ Parameters
982
+ ----------
983
+ evaluator_id : str
984
+
985
+ evaluator : Evaluator
986
+
987
+ request_options : typing.Optional[RequestOptions]
988
+ Request-specific configuration.
989
+
990
+ Returns
991
+ -------
992
+ AsyncHttpResponse[EvaluatorResponse]
993
+ Successful Response
994
+ """
995
+ _response = await self._client_wrapper.httpx_client.request(
996
+ f"preview/evaluators/{jsonable_encoder(evaluator_id)}",
997
+ method="PUT",
998
+ json={
999
+ "evaluator": convert_and_respect_annotation_metadata(
1000
+ object_=evaluator, annotation=Evaluator, direction="write"
1001
+ ),
1002
+ },
1003
+ headers={
1004
+ "content-type": "application/json",
1005
+ },
1006
+ request_options=request_options,
1007
+ omit=OMIT,
1008
+ )
1009
+ try:
1010
+ if 200 <= _response.status_code < 300:
1011
+ _data = typing.cast(
1012
+ EvaluatorResponse,
1013
+ parse_obj_as(
1014
+ type_=EvaluatorResponse, # type: ignore
1015
+ object_=_response.json(),
1016
+ ),
1017
+ )
1018
+ return AsyncHttpResponse(response=_response, data=_data)
1019
+ if _response.status_code == 422:
1020
+ raise UnprocessableEntityError(
1021
+ headers=dict(_response.headers),
1022
+ body=typing.cast(
1023
+ HttpValidationError,
1024
+ parse_obj_as(
1025
+ type_=HttpValidationError, # type: ignore
1026
+ object_=_response.json(),
1027
+ ),
1028
+ ),
1029
+ )
1030
+ _response_json = _response.json()
1031
+ except JSONDecodeError:
1032
+ raise ApiError(
1033
+ status_code=_response.status_code,
1034
+ headers=dict(_response.headers),
1035
+ body=_response.text,
1036
+ )
1037
+ raise ApiError(
1038
+ status_code=_response.status_code,
1039
+ headers=dict(_response.headers),
1040
+ body=_response_json,
1041
+ )
1042
+
1043
+ async def archive_evaluator(
1044
+ self,
1045
+ evaluator_id: str,
1046
+ *,
1047
+ request_options: typing.Optional[RequestOptions] = None,
1048
+ ) -> AsyncHttpResponse[EvaluatorResponse]:
1049
+ """
1050
+ Parameters
1051
+ ----------
1052
+ evaluator_id : str
1053
+
1054
+ request_options : typing.Optional[RequestOptions]
1055
+ Request-specific configuration.
1056
+
1057
+ Returns
1058
+ -------
1059
+ AsyncHttpResponse[EvaluatorResponse]
1060
+ Successful Response
1061
+ """
1062
+ _response = await self._client_wrapper.httpx_client.request(
1063
+ f"preview/evaluators/{jsonable_encoder(evaluator_id)}/archive",
1064
+ method="POST",
1065
+ request_options=request_options,
1066
+ )
1067
+ try:
1068
+ if 200 <= _response.status_code < 300:
1069
+ _data = typing.cast(
1070
+ EvaluatorResponse,
1071
+ parse_obj_as(
1072
+ type_=EvaluatorResponse, # type: ignore
1073
+ object_=_response.json(),
1074
+ ),
1075
+ )
1076
+ return AsyncHttpResponse(response=_response, data=_data)
1077
+ if _response.status_code == 422:
1078
+ raise UnprocessableEntityError(
1079
+ headers=dict(_response.headers),
1080
+ body=typing.cast(
1081
+ HttpValidationError,
1082
+ parse_obj_as(
1083
+ type_=HttpValidationError, # type: ignore
1084
+ object_=_response.json(),
1085
+ ),
1086
+ ),
1087
+ )
1088
+ _response_json = _response.json()
1089
+ except JSONDecodeError:
1090
+ raise ApiError(
1091
+ status_code=_response.status_code,
1092
+ headers=dict(_response.headers),
1093
+ body=_response.text,
1094
+ )
1095
+ raise ApiError(
1096
+ status_code=_response.status_code,
1097
+ headers=dict(_response.headers),
1098
+ body=_response_json,
1099
+ )
1100
+
1101
+ async def unarchive_evaluator(
1102
+ self,
1103
+ evaluator_id: str,
1104
+ *,
1105
+ request_options: typing.Optional[RequestOptions] = None,
1106
+ ) -> AsyncHttpResponse[EvaluatorResponse]:
1107
+ """
1108
+ Parameters
1109
+ ----------
1110
+ evaluator_id : str
1111
+
1112
+ request_options : typing.Optional[RequestOptions]
1113
+ Request-specific configuration.
1114
+
1115
+ Returns
1116
+ -------
1117
+ AsyncHttpResponse[EvaluatorResponse]
1118
+ Successful Response
1119
+ """
1120
+ _response = await self._client_wrapper.httpx_client.request(
1121
+ f"preview/evaluators/{jsonable_encoder(evaluator_id)}/unarchive",
1122
+ method="POST",
1123
+ request_options=request_options,
1124
+ )
1125
+ try:
1126
+ if 200 <= _response.status_code < 300:
1127
+ _data = typing.cast(
1128
+ EvaluatorResponse,
1129
+ parse_obj_as(
1130
+ type_=EvaluatorResponse, # type: ignore
1131
+ object_=_response.json(),
1132
+ ),
1133
+ )
1134
+ return AsyncHttpResponse(response=_response, data=_data)
1135
+ if _response.status_code == 422:
1136
+ raise UnprocessableEntityError(
1137
+ headers=dict(_response.headers),
1138
+ body=typing.cast(
1139
+ HttpValidationError,
1140
+ parse_obj_as(
1141
+ type_=HttpValidationError, # type: ignore
1142
+ object_=_response.json(),
1143
+ ),
1144
+ ),
1145
+ )
1146
+ _response_json = _response.json()
1147
+ except JSONDecodeError:
1148
+ raise ApiError(
1149
+ status_code=_response.status_code,
1150
+ headers=dict(_response.headers),
1151
+ body=_response.text,
1152
+ )
1153
+ raise ApiError(
1154
+ status_code=_response.status_code,
1155
+ headers=dict(_response.headers),
1156
+ body=_response_json,
1157
+ )
1158
+
1159
+ async def query_evaluators(
1160
+ self,
1161
+ *,
1162
+ request: typing.Optional[EvaluatorQueryRequest] = None,
1163
+ request_options: typing.Optional[RequestOptions] = None,
1164
+ ) -> AsyncHttpResponse[EvaluatorsResponse]:
1165
+ """
1166
+ Parameters
1167
+ ----------
1168
+ request : typing.Optional[EvaluatorQueryRequest]
1169
+
1170
+ request_options : typing.Optional[RequestOptions]
1171
+ Request-specific configuration.
1172
+
1173
+ Returns
1174
+ -------
1175
+ AsyncHttpResponse[EvaluatorsResponse]
1176
+ Successful Response
1177
+ """
1178
+ _response = await self._client_wrapper.httpx_client.request(
1179
+ "preview/evaluators/query",
1180
+ method="POST",
1181
+ json=convert_and_respect_annotation_metadata(
1182
+ object_=request, annotation=EvaluatorQueryRequest, direction="write"
1183
+ ),
1184
+ headers={
1185
+ "content-type": "application/json",
1186
+ },
1187
+ request_options=request_options,
1188
+ omit=OMIT,
1189
+ )
1190
+ try:
1191
+ if 200 <= _response.status_code < 300:
1192
+ _data = typing.cast(
1193
+ EvaluatorsResponse,
1194
+ parse_obj_as(
1195
+ type_=EvaluatorsResponse, # type: ignore
1196
+ object_=_response.json(),
1197
+ ),
1198
+ )
1199
+ return AsyncHttpResponse(response=_response, data=_data)
1200
+ if _response.status_code == 422:
1201
+ raise UnprocessableEntityError(
1202
+ headers=dict(_response.headers),
1203
+ body=typing.cast(
1204
+ HttpValidationError,
1205
+ parse_obj_as(
1206
+ type_=HttpValidationError, # type: ignore
1207
+ object_=_response.json(),
1208
+ ),
1209
+ ),
1210
+ )
1211
+ _response_json = _response.json()
1212
+ except JSONDecodeError:
1213
+ raise ApiError(
1214
+ status_code=_response.status_code,
1215
+ headers=dict(_response.headers),
1216
+ body=_response.text,
1217
+ )
1218
+ raise ApiError(
1219
+ status_code=_response.status_code,
1220
+ headers=dict(_response.headers),
1221
+ body=_response_json,
1222
+ )
1223
+
1224
+ async def query_annotations(
1225
+ self,
1226
+ *,
1227
+ request: typing.Optional[AnnotationQueryRequest] = None,
1228
+ request_options: typing.Optional[RequestOptions] = None,
1229
+ ) -> AsyncHttpResponse[AnnotationsResponse]:
1230
+ """
1231
+ Parameters
1232
+ ----------
1233
+ request : typing.Optional[AnnotationQueryRequest]
1234
+
1235
+ request_options : typing.Optional[RequestOptions]
1236
+ Request-specific configuration.
1237
+
1238
+ Returns
1239
+ -------
1240
+ AsyncHttpResponse[AnnotationsResponse]
1241
+ Successful Response
1242
+ """
1243
+ _response = await self._client_wrapper.httpx_client.request(
1244
+ "preview/annotations/query",
1245
+ method="POST",
1246
+ json=convert_and_respect_annotation_metadata(
1247
+ object_=request, annotation=AnnotationQueryRequest, direction="write"
1248
+ ),
1249
+ headers={
1250
+ "content-type": "application/json",
1251
+ },
1252
+ request_options=request_options,
1253
+ omit=OMIT,
1254
+ )
1255
+ try:
1256
+ if 200 <= _response.status_code < 300:
1257
+ _data = typing.cast(
1258
+ AnnotationsResponse,
1259
+ parse_obj_as(
1260
+ type_=AnnotationsResponse, # type: ignore
1261
+ object_=_response.json(),
1262
+ ),
1263
+ )
1264
+ return AsyncHttpResponse(response=_response, data=_data)
1265
+ if _response.status_code == 422:
1266
+ raise UnprocessableEntityError(
1267
+ headers=dict(_response.headers),
1268
+ body=typing.cast(
1269
+ HttpValidationError,
1270
+ parse_obj_as(
1271
+ type_=HttpValidationError, # type: ignore
1272
+ object_=_response.json(),
1273
+ ),
1274
+ ),
1275
+ )
1276
+ _response_json = _response.json()
1277
+ except JSONDecodeError:
1278
+ raise ApiError(
1279
+ status_code=_response.status_code,
1280
+ headers=dict(_response.headers),
1281
+ body=_response.text,
1282
+ )
1283
+ raise ApiError(
1284
+ status_code=_response.status_code,
1285
+ headers=dict(_response.headers),
1286
+ body=_response_json,
1287
+ )
1288
+
1289
+ async def create_annotation(
1290
+ self,
1291
+ *,
1292
+ annotation: AnnotationCreate,
1293
+ request_options: typing.Optional[RequestOptions] = None,
1294
+ ) -> AsyncHttpResponse[AnnotationResponse]:
1295
+ """
1296
+ Parameters
1297
+ ----------
1298
+ annotation : AnnotationCreate
1299
+
1300
+ request_options : typing.Optional[RequestOptions]
1301
+ Request-specific configuration.
1302
+
1303
+ Returns
1304
+ -------
1305
+ AsyncHttpResponse[AnnotationResponse]
1306
+ Successful Response
1307
+ """
1308
+ _response = await self._client_wrapper.httpx_client.request(
1309
+ "preview/annotations/",
1310
+ method="POST",
1311
+ json={
1312
+ "annotation": convert_and_respect_annotation_metadata(
1313
+ object_=annotation, annotation=AnnotationCreate, direction="write"
1314
+ ),
1315
+ },
1316
+ headers={
1317
+ "content-type": "application/json",
1318
+ },
1319
+ request_options=request_options,
1320
+ omit=OMIT,
1321
+ )
1322
+ try:
1323
+ if 200 <= _response.status_code < 300:
1324
+ _data = typing.cast(
1325
+ AnnotationResponse,
1326
+ parse_obj_as(
1327
+ type_=AnnotationResponse, # type: ignore
1328
+ object_=_response.json(),
1329
+ ),
1330
+ )
1331
+ return AsyncHttpResponse(response=_response, data=_data)
1332
+ if _response.status_code == 422:
1333
+ raise UnprocessableEntityError(
1334
+ headers=dict(_response.headers),
1335
+ body=typing.cast(
1336
+ HttpValidationError,
1337
+ parse_obj_as(
1338
+ type_=HttpValidationError, # type: ignore
1339
+ object_=_response.json(),
1340
+ ),
1341
+ ),
1342
+ )
1343
+ _response_json = _response.json()
1344
+ except JSONDecodeError:
1345
+ raise ApiError(
1346
+ status_code=_response.status_code,
1347
+ headers=dict(_response.headers),
1348
+ body=_response.text,
1349
+ )
1350
+ raise ApiError(
1351
+ status_code=_response.status_code,
1352
+ headers=dict(_response.headers),
1353
+ body=_response_json,
1354
+ )
1355
+
1356
+ async def fetch_annotation(
1357
+ self,
1358
+ trace_id: str,
1359
+ span_id: str,
1360
+ *,
1361
+ request_options: typing.Optional[RequestOptions] = None,
1362
+ ) -> AsyncHttpResponse[AnnotationResponse]:
1363
+ """
1364
+ Parameters
1365
+ ----------
1366
+ trace_id : str
1367
+
1368
+ span_id : str
1369
+
1370
+ request_options : typing.Optional[RequestOptions]
1371
+ Request-specific configuration.
1372
+
1373
+ Returns
1374
+ -------
1375
+ AsyncHttpResponse[AnnotationResponse]
1376
+ Successful Response
1377
+ """
1378
+ _response = await self._client_wrapper.httpx_client.request(
1379
+ f"preview/annotations/{jsonable_encoder(trace_id)}/{jsonable_encoder(span_id)}",
1380
+ method="GET",
1381
+ request_options=request_options,
1382
+ )
1383
+ try:
1384
+ if 200 <= _response.status_code < 300:
1385
+ _data = typing.cast(
1386
+ AnnotationResponse,
1387
+ parse_obj_as(
1388
+ type_=AnnotationResponse, # type: ignore
1389
+ object_=_response.json(),
1390
+ ),
1391
+ )
1392
+ return AsyncHttpResponse(response=_response, data=_data)
1393
+ if _response.status_code == 422:
1394
+ raise UnprocessableEntityError(
1395
+ headers=dict(_response.headers),
1396
+ body=typing.cast(
1397
+ HttpValidationError,
1398
+ parse_obj_as(
1399
+ type_=HttpValidationError, # type: ignore
1400
+ object_=_response.json(),
1401
+ ),
1402
+ ),
1403
+ )
1404
+ _response_json = _response.json()
1405
+ except JSONDecodeError:
1406
+ raise ApiError(
1407
+ status_code=_response.status_code,
1408
+ headers=dict(_response.headers),
1409
+ body=_response.text,
1410
+ )
1411
+ raise ApiError(
1412
+ status_code=_response.status_code,
1413
+ headers=dict(_response.headers),
1414
+ body=_response_json,
1415
+ )
1416
+
1417
+ async def delete_annotation(
1418
+ self,
1419
+ trace_id: str,
1420
+ span_id: str,
1421
+ *,
1422
+ request_options: typing.Optional[RequestOptions] = None,
1423
+ ) -> AsyncHttpResponse[AnnotationLinkResponse]:
1424
+ """
1425
+ Parameters
1426
+ ----------
1427
+ trace_id : str
1428
+
1429
+ span_id : str
1430
+
1431
+ request_options : typing.Optional[RequestOptions]
1432
+ Request-specific configuration.
1433
+
1434
+ Returns
1435
+ -------
1436
+ AsyncHttpResponse[AnnotationLinkResponse]
1437
+ Successful Response
1438
+ """
1439
+ _response = await self._client_wrapper.httpx_client.request(
1440
+ f"preview/annotations/{jsonable_encoder(trace_id)}/{jsonable_encoder(span_id)}",
1441
+ method="DELETE",
1442
+ request_options=request_options,
1443
+ )
1444
+ try:
1445
+ if 200 <= _response.status_code < 300:
1446
+ _data = typing.cast(
1447
+ AnnotationLinkResponse,
1448
+ parse_obj_as(
1449
+ type_=AnnotationLinkResponse, # type: ignore
1450
+ object_=_response.json(),
1451
+ ),
1452
+ )
1453
+ return AsyncHttpResponse(response=_response, data=_data)
1454
+ if _response.status_code == 422:
1455
+ raise UnprocessableEntityError(
1456
+ headers=dict(_response.headers),
1457
+ body=typing.cast(
1458
+ HttpValidationError,
1459
+ parse_obj_as(
1460
+ type_=HttpValidationError, # type: ignore
1461
+ object_=_response.json(),
1462
+ ),
1463
+ ),
1464
+ )
1465
+ _response_json = _response.json()
1466
+ except JSONDecodeError:
1467
+ raise ApiError(
1468
+ status_code=_response.status_code,
1469
+ headers=dict(_response.headers),
1470
+ body=_response.text,
1471
+ )
1472
+ raise ApiError(
1473
+ status_code=_response.status_code,
1474
+ headers=dict(_response.headers),
1475
+ body=_response_json,
1476
+ )
1477
+
1478
+ async def edit_annotation(
1479
+ self,
1480
+ trace_id: str,
1481
+ span_id: str,
1482
+ *,
1483
+ annotation: AnnotationEdit,
1484
+ request_options: typing.Optional[RequestOptions] = None,
1485
+ ) -> AsyncHttpResponse[AnnotationResponse]:
1486
+ """
1487
+ Parameters
1488
+ ----------
1489
+ trace_id : str
1490
+
1491
+ span_id : str
1492
+
1493
+ annotation : AnnotationEdit
1494
+
1495
+ request_options : typing.Optional[RequestOptions]
1496
+ Request-specific configuration.
1497
+
1498
+ Returns
1499
+ -------
1500
+ AsyncHttpResponse[AnnotationResponse]
1501
+ Successful Response
1502
+ """
1503
+ _response = await self._client_wrapper.httpx_client.request(
1504
+ f"preview/annotations/{jsonable_encoder(trace_id)}/{jsonable_encoder(span_id)}",
1505
+ method="PATCH",
1506
+ json={
1507
+ "annotation": convert_and_respect_annotation_metadata(
1508
+ object_=annotation, annotation=AnnotationEdit, direction="write"
1509
+ ),
1510
+ },
1511
+ headers={
1512
+ "content-type": "application/json",
1513
+ },
1514
+ request_options=request_options,
1515
+ omit=OMIT,
1516
+ )
1517
+ try:
1518
+ if 200 <= _response.status_code < 300:
1519
+ _data = typing.cast(
1520
+ AnnotationResponse,
1521
+ parse_obj_as(
1522
+ type_=AnnotationResponse, # type: ignore
1523
+ object_=_response.json(),
1524
+ ),
1525
+ )
1526
+ return AsyncHttpResponse(response=_response, data=_data)
1527
+ if _response.status_code == 422:
1528
+ raise UnprocessableEntityError(
1529
+ headers=dict(_response.headers),
1530
+ body=typing.cast(
1531
+ HttpValidationError,
1532
+ parse_obj_as(
1533
+ type_=HttpValidationError, # type: ignore
1534
+ object_=_response.json(),
1535
+ ),
1536
+ ),
1537
+ )
1538
+ _response_json = _response.json()
1539
+ except JSONDecodeError:
1540
+ raise ApiError(
1541
+ status_code=_response.status_code,
1542
+ headers=dict(_response.headers),
1543
+ body=_response.text,
1544
+ )
1545
+ raise ApiError(
1546
+ status_code=_response.status_code,
1547
+ headers=dict(_response.headers),
1548
+ body=_response_json,
1549
+ )