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,1344 @@
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.evaluation import Evaluation
15
+ from ..types.evaluation_scenario import EvaluationScenario
16
+ from ..types.http_validation_error import HttpValidationError
17
+ from ..types.llm_run_rate_limit import LlmRunRateLimit
18
+
19
+ # this is used as the default value for optional parameters
20
+ OMIT = typing.cast(typing.Any, ...)
21
+
22
+
23
+ class RawEvaluationsClient:
24
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
25
+ self._client_wrapper = client_wrapper
26
+
27
+ def fetch_evaluation_ids(
28
+ self,
29
+ *,
30
+ resource_type: str,
31
+ resource_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
32
+ request_options: typing.Optional[RequestOptions] = None,
33
+ ) -> HttpResponse[typing.List[str]]:
34
+ """
35
+ Fetches evaluation ids for a given resource type and id.
36
+
37
+ Arguments:
38
+ app_id (str): The ID of the app for which to fetch evaluations.
39
+ resource_type (str): The type of resource for which to fetch evaluations.
40
+ resource_ids List[ObjectId]: The IDs of resource for which to fetch evaluations.
41
+
42
+ Raises:
43
+ HTTPException: If the resource_type is invalid or access is denied.
44
+
45
+ Returns:
46
+ List[str]: A list of evaluation ids.
47
+
48
+ Parameters
49
+ ----------
50
+ resource_type : str
51
+
52
+ resource_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
53
+
54
+ request_options : typing.Optional[RequestOptions]
55
+ Request-specific configuration.
56
+
57
+ Returns
58
+ -------
59
+ HttpResponse[typing.List[str]]
60
+ Successful Response
61
+ """
62
+ _response = self._client_wrapper.httpx_client.request(
63
+ "evaluations/by_resource",
64
+ method="GET",
65
+ params={
66
+ "resource_type": resource_type,
67
+ "resource_ids": resource_ids,
68
+ },
69
+ request_options=request_options,
70
+ )
71
+ try:
72
+ if 200 <= _response.status_code < 300:
73
+ _data = typing.cast(
74
+ typing.List[str],
75
+ parse_obj_as(
76
+ type_=typing.List[str], # type: ignore
77
+ object_=_response.json(),
78
+ ),
79
+ )
80
+ return HttpResponse(response=_response, data=_data)
81
+ if _response.status_code == 422:
82
+ raise UnprocessableEntityError(
83
+ headers=dict(_response.headers),
84
+ body=typing.cast(
85
+ HttpValidationError,
86
+ parse_obj_as(
87
+ type_=HttpValidationError, # type: ignore
88
+ object_=_response.json(),
89
+ ),
90
+ ),
91
+ )
92
+ _response_json = _response.json()
93
+ except JSONDecodeError:
94
+ raise ApiError(
95
+ status_code=_response.status_code,
96
+ headers=dict(_response.headers),
97
+ body=_response.text,
98
+ )
99
+ raise ApiError(
100
+ status_code=_response.status_code,
101
+ headers=dict(_response.headers),
102
+ body=_response_json,
103
+ )
104
+
105
+ def fetch_list_evaluations(
106
+ self, *, app_id: str, request_options: typing.Optional[RequestOptions] = None
107
+ ) -> HttpResponse[typing.List[Evaluation]]:
108
+ """
109
+ Fetches a list of evaluations, optionally filtered by an app ID.
110
+
111
+ Args:
112
+ app_id (Optional[str]): An optional app ID to filter the evaluations.
113
+
114
+ Returns:
115
+ List[Evaluation]: A list of evaluations.
116
+
117
+ Parameters
118
+ ----------
119
+ app_id : str
120
+
121
+ request_options : typing.Optional[RequestOptions]
122
+ Request-specific configuration.
123
+
124
+ Returns
125
+ -------
126
+ HttpResponse[typing.List[Evaluation]]
127
+ Successful Response
128
+ """
129
+ _response = self._client_wrapper.httpx_client.request(
130
+ "evaluations",
131
+ method="GET",
132
+ params={
133
+ "app_id": app_id,
134
+ },
135
+ request_options=request_options,
136
+ )
137
+ try:
138
+ if 200 <= _response.status_code < 300:
139
+ _data = typing.cast(
140
+ typing.List[Evaluation],
141
+ parse_obj_as(
142
+ type_=typing.List[Evaluation], # type: ignore
143
+ object_=_response.json(),
144
+ ),
145
+ )
146
+ return HttpResponse(response=_response, data=_data)
147
+ if _response.status_code == 422:
148
+ raise UnprocessableEntityError(
149
+ headers=dict(_response.headers),
150
+ body=typing.cast(
151
+ HttpValidationError,
152
+ parse_obj_as(
153
+ type_=HttpValidationError, # type: ignore
154
+ object_=_response.json(),
155
+ ),
156
+ ),
157
+ )
158
+ _response_json = _response.json()
159
+ except JSONDecodeError:
160
+ raise ApiError(
161
+ status_code=_response.status_code,
162
+ headers=dict(_response.headers),
163
+ body=_response.text,
164
+ )
165
+ raise ApiError(
166
+ status_code=_response.status_code,
167
+ headers=dict(_response.headers),
168
+ body=_response_json,
169
+ )
170
+
171
+ def create_evaluation(
172
+ self,
173
+ *,
174
+ app_id: str,
175
+ revisions_ids: typing.Sequence[str],
176
+ evaluators_configs: typing.Sequence[str],
177
+ testset_id: str,
178
+ rate_limit: LlmRunRateLimit,
179
+ correct_answer_column: typing.Optional[str] = OMIT,
180
+ request_options: typing.Optional[RequestOptions] = None,
181
+ ) -> HttpResponse[typing.List[Evaluation]]:
182
+ """
183
+ Creates a new comparison table document
184
+ Raises:
185
+ HTTPException: _description_
186
+ Returns:
187
+ _description_
188
+
189
+ Parameters
190
+ ----------
191
+ app_id : str
192
+
193
+ revisions_ids : typing.Sequence[str]
194
+
195
+ evaluators_configs : typing.Sequence[str]
196
+
197
+ testset_id : str
198
+
199
+ rate_limit : LlmRunRateLimit
200
+
201
+ correct_answer_column : typing.Optional[str]
202
+
203
+ request_options : typing.Optional[RequestOptions]
204
+ Request-specific configuration.
205
+
206
+ Returns
207
+ -------
208
+ HttpResponse[typing.List[Evaluation]]
209
+ Successful Response
210
+ """
211
+ _response = self._client_wrapper.httpx_client.request(
212
+ "evaluations",
213
+ method="POST",
214
+ json={
215
+ "app_id": app_id,
216
+ "revisions_ids": revisions_ids,
217
+ "evaluators_configs": evaluators_configs,
218
+ "testset_id": testset_id,
219
+ "rate_limit": convert_and_respect_annotation_metadata(
220
+ object_=rate_limit, annotation=LlmRunRateLimit, direction="write"
221
+ ),
222
+ "correct_answer_column": correct_answer_column,
223
+ },
224
+ headers={
225
+ "content-type": "application/json",
226
+ },
227
+ request_options=request_options,
228
+ omit=OMIT,
229
+ )
230
+ try:
231
+ if 200 <= _response.status_code < 300:
232
+ _data = typing.cast(
233
+ typing.List[Evaluation],
234
+ parse_obj_as(
235
+ type_=typing.List[Evaluation], # type: ignore
236
+ object_=_response.json(),
237
+ ),
238
+ )
239
+ return HttpResponse(response=_response, data=_data)
240
+ if _response.status_code == 422:
241
+ raise UnprocessableEntityError(
242
+ headers=dict(_response.headers),
243
+ body=typing.cast(
244
+ HttpValidationError,
245
+ parse_obj_as(
246
+ type_=HttpValidationError, # type: ignore
247
+ object_=_response.json(),
248
+ ),
249
+ ),
250
+ )
251
+ _response_json = _response.json()
252
+ except JSONDecodeError:
253
+ raise ApiError(
254
+ status_code=_response.status_code,
255
+ headers=dict(_response.headers),
256
+ body=_response.text,
257
+ )
258
+ raise ApiError(
259
+ status_code=_response.status_code,
260
+ headers=dict(_response.headers),
261
+ body=_response_json,
262
+ )
263
+
264
+ def delete_evaluations(
265
+ self,
266
+ *,
267
+ evaluations_ids: typing.Sequence[str],
268
+ request_options: typing.Optional[RequestOptions] = None,
269
+ ) -> HttpResponse[typing.List[str]]:
270
+ """
271
+ Delete specific comparison tables based on their unique IDs.
272
+
273
+ Args:
274
+ delete_evaluations (List[str]): The unique identifiers of the comparison tables to delete.
275
+
276
+ Returns:
277
+ A list of the deleted comparison tables' IDs.
278
+
279
+ Parameters
280
+ ----------
281
+ evaluations_ids : typing.Sequence[str]
282
+
283
+ request_options : typing.Optional[RequestOptions]
284
+ Request-specific configuration.
285
+
286
+ Returns
287
+ -------
288
+ HttpResponse[typing.List[str]]
289
+ Successful Response
290
+ """
291
+ _response = self._client_wrapper.httpx_client.request(
292
+ "evaluations",
293
+ method="DELETE",
294
+ json={
295
+ "evaluations_ids": evaluations_ids,
296
+ },
297
+ headers={
298
+ "content-type": "application/json",
299
+ },
300
+ request_options=request_options,
301
+ omit=OMIT,
302
+ )
303
+ try:
304
+ if 200 <= _response.status_code < 300:
305
+ _data = typing.cast(
306
+ typing.List[str],
307
+ parse_obj_as(
308
+ type_=typing.List[str], # type: ignore
309
+ object_=_response.json(),
310
+ ),
311
+ )
312
+ return HttpResponse(response=_response, data=_data)
313
+ if _response.status_code == 422:
314
+ raise UnprocessableEntityError(
315
+ headers=dict(_response.headers),
316
+ body=typing.cast(
317
+ HttpValidationError,
318
+ parse_obj_as(
319
+ type_=HttpValidationError, # type: ignore
320
+ object_=_response.json(),
321
+ ),
322
+ ),
323
+ )
324
+ _response_json = _response.json()
325
+ except JSONDecodeError:
326
+ raise ApiError(
327
+ status_code=_response.status_code,
328
+ headers=dict(_response.headers),
329
+ body=_response.text,
330
+ )
331
+ raise ApiError(
332
+ status_code=_response.status_code,
333
+ headers=dict(_response.headers),
334
+ body=_response_json,
335
+ )
336
+
337
+ def fetch_evaluation_status(
338
+ self,
339
+ evaluation_id: str,
340
+ *,
341
+ request_options: typing.Optional[RequestOptions] = None,
342
+ ) -> HttpResponse[typing.Optional[typing.Any]]:
343
+ """
344
+ Fetches the status of the evaluation.
345
+
346
+ Args:
347
+ evaluation_id (str): the evaluation id
348
+ request (Request): the request object
349
+
350
+ Returns:
351
+ (str): the evaluation status
352
+
353
+ Parameters
354
+ ----------
355
+ evaluation_id : str
356
+
357
+ request_options : typing.Optional[RequestOptions]
358
+ Request-specific configuration.
359
+
360
+ Returns
361
+ -------
362
+ HttpResponse[typing.Optional[typing.Any]]
363
+ Successful Response
364
+ """
365
+ _response = self._client_wrapper.httpx_client.request(
366
+ f"evaluations/{jsonable_encoder(evaluation_id)}/status",
367
+ method="GET",
368
+ request_options=request_options,
369
+ )
370
+ try:
371
+ if _response is None or not _response.text.strip():
372
+ return HttpResponse(response=_response, data=None)
373
+ if 200 <= _response.status_code < 300:
374
+ _data = typing.cast(
375
+ typing.Optional[typing.Any],
376
+ parse_obj_as(
377
+ type_=typing.Optional[typing.Any], # type: ignore
378
+ object_=_response.json(),
379
+ ),
380
+ )
381
+ return HttpResponse(response=_response, data=_data)
382
+ if _response.status_code == 422:
383
+ raise UnprocessableEntityError(
384
+ headers=dict(_response.headers),
385
+ body=typing.cast(
386
+ HttpValidationError,
387
+ parse_obj_as(
388
+ type_=HttpValidationError, # type: ignore
389
+ object_=_response.json(),
390
+ ),
391
+ ),
392
+ )
393
+ _response_json = _response.json()
394
+ except JSONDecodeError:
395
+ raise ApiError(
396
+ status_code=_response.status_code,
397
+ headers=dict(_response.headers),
398
+ body=_response.text,
399
+ )
400
+ raise ApiError(
401
+ status_code=_response.status_code,
402
+ headers=dict(_response.headers),
403
+ body=_response_json,
404
+ )
405
+
406
+ def fetch_evaluation_results(
407
+ self,
408
+ evaluation_id: str,
409
+ *,
410
+ request_options: typing.Optional[RequestOptions] = None,
411
+ ) -> HttpResponse[typing.Optional[typing.Any]]:
412
+ """
413
+ Fetches the results of the evaluation
414
+
415
+ Args:
416
+ evaluation_id (str): the evaluation id
417
+ request (Request): the request object
418
+
419
+ Returns:
420
+ _type_: _description_
421
+
422
+ Parameters
423
+ ----------
424
+ evaluation_id : str
425
+
426
+ request_options : typing.Optional[RequestOptions]
427
+ Request-specific configuration.
428
+
429
+ Returns
430
+ -------
431
+ HttpResponse[typing.Optional[typing.Any]]
432
+ Successful Response
433
+ """
434
+ _response = self._client_wrapper.httpx_client.request(
435
+ f"evaluations/{jsonable_encoder(evaluation_id)}/results",
436
+ method="GET",
437
+ request_options=request_options,
438
+ )
439
+ try:
440
+ if _response is None or not _response.text.strip():
441
+ return HttpResponse(response=_response, data=None)
442
+ if 200 <= _response.status_code < 300:
443
+ _data = typing.cast(
444
+ typing.Optional[typing.Any],
445
+ parse_obj_as(
446
+ type_=typing.Optional[typing.Any], # type: ignore
447
+ object_=_response.json(),
448
+ ),
449
+ )
450
+ return HttpResponse(response=_response, data=_data)
451
+ if _response.status_code == 422:
452
+ raise UnprocessableEntityError(
453
+ headers=dict(_response.headers),
454
+ body=typing.cast(
455
+ HttpValidationError,
456
+ parse_obj_as(
457
+ type_=HttpValidationError, # type: ignore
458
+ object_=_response.json(),
459
+ ),
460
+ ),
461
+ )
462
+ _response_json = _response.json()
463
+ except JSONDecodeError:
464
+ raise ApiError(
465
+ status_code=_response.status_code,
466
+ headers=dict(_response.headers),
467
+ body=_response.text,
468
+ )
469
+ raise ApiError(
470
+ status_code=_response.status_code,
471
+ headers=dict(_response.headers),
472
+ body=_response_json,
473
+ )
474
+
475
+ def fetch_evaluation_scenarios(
476
+ self,
477
+ evaluation_id: str,
478
+ *,
479
+ request_options: typing.Optional[RequestOptions] = None,
480
+ ) -> HttpResponse[typing.List[EvaluationScenario]]:
481
+ """
482
+ Fetches evaluation scenarios for a given evaluation ID.
483
+
484
+ Arguments:
485
+ evaluation_id (str): The ID of the evaluation for which to fetch scenarios.
486
+
487
+ Raises:
488
+ HTTPException: If the evaluation is not found or access is denied.
489
+
490
+ Returns:
491
+ List[EvaluationScenario]: A list of evaluation scenarios.
492
+
493
+ Parameters
494
+ ----------
495
+ evaluation_id : str
496
+
497
+ request_options : typing.Optional[RequestOptions]
498
+ Request-specific configuration.
499
+
500
+ Returns
501
+ -------
502
+ HttpResponse[typing.List[EvaluationScenario]]
503
+ Successful Response
504
+ """
505
+ _response = self._client_wrapper.httpx_client.request(
506
+ f"evaluations/{jsonable_encoder(evaluation_id)}/evaluation_scenarios",
507
+ method="GET",
508
+ request_options=request_options,
509
+ )
510
+ try:
511
+ if 200 <= _response.status_code < 300:
512
+ _data = typing.cast(
513
+ typing.List[EvaluationScenario],
514
+ parse_obj_as(
515
+ type_=typing.List[EvaluationScenario], # type: ignore
516
+ object_=_response.json(),
517
+ ),
518
+ )
519
+ return HttpResponse(response=_response, data=_data)
520
+ if _response.status_code == 422:
521
+ raise UnprocessableEntityError(
522
+ headers=dict(_response.headers),
523
+ body=typing.cast(
524
+ HttpValidationError,
525
+ parse_obj_as(
526
+ type_=HttpValidationError, # type: ignore
527
+ object_=_response.json(),
528
+ ),
529
+ ),
530
+ )
531
+ _response_json = _response.json()
532
+ except JSONDecodeError:
533
+ raise ApiError(
534
+ status_code=_response.status_code,
535
+ headers=dict(_response.headers),
536
+ body=_response.text,
537
+ )
538
+ raise ApiError(
539
+ status_code=_response.status_code,
540
+ headers=dict(_response.headers),
541
+ body=_response_json,
542
+ )
543
+
544
+ def fetch_evaluation(
545
+ self,
546
+ evaluation_id: str,
547
+ *,
548
+ request_options: typing.Optional[RequestOptions] = None,
549
+ ) -> HttpResponse[Evaluation]:
550
+ """
551
+ Fetches a single evaluation based on its ID.
552
+
553
+ Args:
554
+ evaluation_id (str): The ID of the evaluation to fetch.
555
+
556
+ Returns:
557
+ Evaluation: The fetched evaluation.
558
+
559
+ Parameters
560
+ ----------
561
+ evaluation_id : str
562
+
563
+ request_options : typing.Optional[RequestOptions]
564
+ Request-specific configuration.
565
+
566
+ Returns
567
+ -------
568
+ HttpResponse[Evaluation]
569
+ Successful Response
570
+ """
571
+ _response = self._client_wrapper.httpx_client.request(
572
+ f"evaluations/{jsonable_encoder(evaluation_id)}",
573
+ method="GET",
574
+ request_options=request_options,
575
+ )
576
+ try:
577
+ if 200 <= _response.status_code < 300:
578
+ _data = typing.cast(
579
+ Evaluation,
580
+ parse_obj_as(
581
+ type_=Evaluation, # type: ignore
582
+ object_=_response.json(),
583
+ ),
584
+ )
585
+ return HttpResponse(response=_response, data=_data)
586
+ if _response.status_code == 422:
587
+ raise UnprocessableEntityError(
588
+ headers=dict(_response.headers),
589
+ body=typing.cast(
590
+ HttpValidationError,
591
+ parse_obj_as(
592
+ type_=HttpValidationError, # type: ignore
593
+ object_=_response.json(),
594
+ ),
595
+ ),
596
+ )
597
+ _response_json = _response.json()
598
+ except JSONDecodeError:
599
+ raise ApiError(
600
+ status_code=_response.status_code,
601
+ headers=dict(_response.headers),
602
+ body=_response.text,
603
+ )
604
+ raise ApiError(
605
+ status_code=_response.status_code,
606
+ headers=dict(_response.headers),
607
+ body=_response_json,
608
+ )
609
+
610
+ def fetch_evaluation_scenarios_comparison_results(
611
+ self,
612
+ *,
613
+ evaluations_ids: str,
614
+ request_options: typing.Optional[RequestOptions] = None,
615
+ ) -> HttpResponse[typing.Optional[typing.Any]]:
616
+ """
617
+ Fetches evaluation scenarios for a given evaluation ID.
618
+
619
+ Arguments:
620
+ evaluation_id (str): The ID of the evaluation for which to fetch scenarios.
621
+
622
+ Raises:
623
+ HTTPException: If the evaluation is not found or access is denied.
624
+
625
+ Returns:
626
+ List[EvaluationScenario]: A list of evaluation scenarios.
627
+
628
+ Parameters
629
+ ----------
630
+ evaluations_ids : str
631
+
632
+ request_options : typing.Optional[RequestOptions]
633
+ Request-specific configuration.
634
+
635
+ Returns
636
+ -------
637
+ HttpResponse[typing.Optional[typing.Any]]
638
+ Successful Response
639
+ """
640
+ _response = self._client_wrapper.httpx_client.request(
641
+ "evaluations/evaluation_scenarios/comparison-results",
642
+ method="GET",
643
+ params={
644
+ "evaluations_ids": evaluations_ids,
645
+ },
646
+ request_options=request_options,
647
+ )
648
+ try:
649
+ if _response is None or not _response.text.strip():
650
+ return HttpResponse(response=_response, data=None)
651
+ if 200 <= _response.status_code < 300:
652
+ _data = typing.cast(
653
+ typing.Optional[typing.Any],
654
+ parse_obj_as(
655
+ type_=typing.Optional[typing.Any], # type: ignore
656
+ object_=_response.json(),
657
+ ),
658
+ )
659
+ return HttpResponse(response=_response, data=_data)
660
+ if _response.status_code == 422:
661
+ raise UnprocessableEntityError(
662
+ headers=dict(_response.headers),
663
+ body=typing.cast(
664
+ HttpValidationError,
665
+ parse_obj_as(
666
+ type_=HttpValidationError, # type: ignore
667
+ object_=_response.json(),
668
+ ),
669
+ ),
670
+ )
671
+ _response_json = _response.json()
672
+ except JSONDecodeError:
673
+ raise ApiError(
674
+ status_code=_response.status_code,
675
+ headers=dict(_response.headers),
676
+ body=_response.text,
677
+ )
678
+ raise ApiError(
679
+ status_code=_response.status_code,
680
+ headers=dict(_response.headers),
681
+ body=_response_json,
682
+ )
683
+
684
+
685
+ class AsyncRawEvaluationsClient:
686
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
687
+ self._client_wrapper = client_wrapper
688
+
689
+ async def fetch_evaluation_ids(
690
+ self,
691
+ *,
692
+ resource_type: str,
693
+ resource_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
694
+ request_options: typing.Optional[RequestOptions] = None,
695
+ ) -> AsyncHttpResponse[typing.List[str]]:
696
+ """
697
+ Fetches evaluation ids for a given resource type and id.
698
+
699
+ Arguments:
700
+ app_id (str): The ID of the app for which to fetch evaluations.
701
+ resource_type (str): The type of resource for which to fetch evaluations.
702
+ resource_ids List[ObjectId]: The IDs of resource for which to fetch evaluations.
703
+
704
+ Raises:
705
+ HTTPException: If the resource_type is invalid or access is denied.
706
+
707
+ Returns:
708
+ List[str]: A list of evaluation ids.
709
+
710
+ Parameters
711
+ ----------
712
+ resource_type : str
713
+
714
+ resource_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
715
+
716
+ request_options : typing.Optional[RequestOptions]
717
+ Request-specific configuration.
718
+
719
+ Returns
720
+ -------
721
+ AsyncHttpResponse[typing.List[str]]
722
+ Successful Response
723
+ """
724
+ _response = await self._client_wrapper.httpx_client.request(
725
+ "evaluations/by_resource",
726
+ method="GET",
727
+ params={
728
+ "resource_type": resource_type,
729
+ "resource_ids": resource_ids,
730
+ },
731
+ request_options=request_options,
732
+ )
733
+ try:
734
+ if 200 <= _response.status_code < 300:
735
+ _data = typing.cast(
736
+ typing.List[str],
737
+ parse_obj_as(
738
+ type_=typing.List[str], # type: ignore
739
+ object_=_response.json(),
740
+ ),
741
+ )
742
+ return AsyncHttpResponse(response=_response, data=_data)
743
+ if _response.status_code == 422:
744
+ raise UnprocessableEntityError(
745
+ headers=dict(_response.headers),
746
+ body=typing.cast(
747
+ HttpValidationError,
748
+ parse_obj_as(
749
+ type_=HttpValidationError, # type: ignore
750
+ object_=_response.json(),
751
+ ),
752
+ ),
753
+ )
754
+ _response_json = _response.json()
755
+ except JSONDecodeError:
756
+ raise ApiError(
757
+ status_code=_response.status_code,
758
+ headers=dict(_response.headers),
759
+ body=_response.text,
760
+ )
761
+ raise ApiError(
762
+ status_code=_response.status_code,
763
+ headers=dict(_response.headers),
764
+ body=_response_json,
765
+ )
766
+
767
+ async def fetch_list_evaluations(
768
+ self, *, app_id: str, request_options: typing.Optional[RequestOptions] = None
769
+ ) -> AsyncHttpResponse[typing.List[Evaluation]]:
770
+ """
771
+ Fetches a list of evaluations, optionally filtered by an app ID.
772
+
773
+ Args:
774
+ app_id (Optional[str]): An optional app ID to filter the evaluations.
775
+
776
+ Returns:
777
+ List[Evaluation]: A list of evaluations.
778
+
779
+ Parameters
780
+ ----------
781
+ app_id : str
782
+
783
+ request_options : typing.Optional[RequestOptions]
784
+ Request-specific configuration.
785
+
786
+ Returns
787
+ -------
788
+ AsyncHttpResponse[typing.List[Evaluation]]
789
+ Successful Response
790
+ """
791
+ _response = await self._client_wrapper.httpx_client.request(
792
+ "evaluations",
793
+ method="GET",
794
+ params={
795
+ "app_id": app_id,
796
+ },
797
+ request_options=request_options,
798
+ )
799
+ try:
800
+ if 200 <= _response.status_code < 300:
801
+ _data = typing.cast(
802
+ typing.List[Evaluation],
803
+ parse_obj_as(
804
+ type_=typing.List[Evaluation], # type: ignore
805
+ object_=_response.json(),
806
+ ),
807
+ )
808
+ return AsyncHttpResponse(response=_response, data=_data)
809
+ if _response.status_code == 422:
810
+ raise UnprocessableEntityError(
811
+ headers=dict(_response.headers),
812
+ body=typing.cast(
813
+ HttpValidationError,
814
+ parse_obj_as(
815
+ type_=HttpValidationError, # type: ignore
816
+ object_=_response.json(),
817
+ ),
818
+ ),
819
+ )
820
+ _response_json = _response.json()
821
+ except JSONDecodeError:
822
+ raise ApiError(
823
+ status_code=_response.status_code,
824
+ headers=dict(_response.headers),
825
+ body=_response.text,
826
+ )
827
+ raise ApiError(
828
+ status_code=_response.status_code,
829
+ headers=dict(_response.headers),
830
+ body=_response_json,
831
+ )
832
+
833
+ async def create_evaluation(
834
+ self,
835
+ *,
836
+ app_id: str,
837
+ revisions_ids: typing.Sequence[str],
838
+ evaluators_configs: typing.Sequence[str],
839
+ testset_id: str,
840
+ rate_limit: LlmRunRateLimit,
841
+ correct_answer_column: typing.Optional[str] = OMIT,
842
+ request_options: typing.Optional[RequestOptions] = None,
843
+ ) -> AsyncHttpResponse[typing.List[Evaluation]]:
844
+ """
845
+ Creates a new comparison table document
846
+ Raises:
847
+ HTTPException: _description_
848
+ Returns:
849
+ _description_
850
+
851
+ Parameters
852
+ ----------
853
+ app_id : str
854
+
855
+ revisions_ids : typing.Sequence[str]
856
+
857
+ evaluators_configs : typing.Sequence[str]
858
+
859
+ testset_id : str
860
+
861
+ rate_limit : LlmRunRateLimit
862
+
863
+ correct_answer_column : typing.Optional[str]
864
+
865
+ request_options : typing.Optional[RequestOptions]
866
+ Request-specific configuration.
867
+
868
+ Returns
869
+ -------
870
+ AsyncHttpResponse[typing.List[Evaluation]]
871
+ Successful Response
872
+ """
873
+ _response = await self._client_wrapper.httpx_client.request(
874
+ "evaluations",
875
+ method="POST",
876
+ json={
877
+ "app_id": app_id,
878
+ "revisions_ids": revisions_ids,
879
+ "evaluators_configs": evaluators_configs,
880
+ "testset_id": testset_id,
881
+ "rate_limit": convert_and_respect_annotation_metadata(
882
+ object_=rate_limit, annotation=LlmRunRateLimit, direction="write"
883
+ ),
884
+ "correct_answer_column": correct_answer_column,
885
+ },
886
+ headers={
887
+ "content-type": "application/json",
888
+ },
889
+ request_options=request_options,
890
+ omit=OMIT,
891
+ )
892
+ try:
893
+ if 200 <= _response.status_code < 300:
894
+ _data = typing.cast(
895
+ typing.List[Evaluation],
896
+ parse_obj_as(
897
+ type_=typing.List[Evaluation], # type: ignore
898
+ object_=_response.json(),
899
+ ),
900
+ )
901
+ return AsyncHttpResponse(response=_response, data=_data)
902
+ if _response.status_code == 422:
903
+ raise UnprocessableEntityError(
904
+ headers=dict(_response.headers),
905
+ body=typing.cast(
906
+ HttpValidationError,
907
+ parse_obj_as(
908
+ type_=HttpValidationError, # type: ignore
909
+ object_=_response.json(),
910
+ ),
911
+ ),
912
+ )
913
+ _response_json = _response.json()
914
+ except JSONDecodeError:
915
+ raise ApiError(
916
+ status_code=_response.status_code,
917
+ headers=dict(_response.headers),
918
+ body=_response.text,
919
+ )
920
+ raise ApiError(
921
+ status_code=_response.status_code,
922
+ headers=dict(_response.headers),
923
+ body=_response_json,
924
+ )
925
+
926
+ async def delete_evaluations(
927
+ self,
928
+ *,
929
+ evaluations_ids: typing.Sequence[str],
930
+ request_options: typing.Optional[RequestOptions] = None,
931
+ ) -> AsyncHttpResponse[typing.List[str]]:
932
+ """
933
+ Delete specific comparison tables based on their unique IDs.
934
+
935
+ Args:
936
+ delete_evaluations (List[str]): The unique identifiers of the comparison tables to delete.
937
+
938
+ Returns:
939
+ A list of the deleted comparison tables' IDs.
940
+
941
+ Parameters
942
+ ----------
943
+ evaluations_ids : typing.Sequence[str]
944
+
945
+ request_options : typing.Optional[RequestOptions]
946
+ Request-specific configuration.
947
+
948
+ Returns
949
+ -------
950
+ AsyncHttpResponse[typing.List[str]]
951
+ Successful Response
952
+ """
953
+ _response = await self._client_wrapper.httpx_client.request(
954
+ "evaluations",
955
+ method="DELETE",
956
+ json={
957
+ "evaluations_ids": evaluations_ids,
958
+ },
959
+ headers={
960
+ "content-type": "application/json",
961
+ },
962
+ request_options=request_options,
963
+ omit=OMIT,
964
+ )
965
+ try:
966
+ if 200 <= _response.status_code < 300:
967
+ _data = typing.cast(
968
+ typing.List[str],
969
+ parse_obj_as(
970
+ type_=typing.List[str], # type: ignore
971
+ object_=_response.json(),
972
+ ),
973
+ )
974
+ return AsyncHttpResponse(response=_response, data=_data)
975
+ if _response.status_code == 422:
976
+ raise UnprocessableEntityError(
977
+ headers=dict(_response.headers),
978
+ body=typing.cast(
979
+ HttpValidationError,
980
+ parse_obj_as(
981
+ type_=HttpValidationError, # type: ignore
982
+ object_=_response.json(),
983
+ ),
984
+ ),
985
+ )
986
+ _response_json = _response.json()
987
+ except JSONDecodeError:
988
+ raise ApiError(
989
+ status_code=_response.status_code,
990
+ headers=dict(_response.headers),
991
+ body=_response.text,
992
+ )
993
+ raise ApiError(
994
+ status_code=_response.status_code,
995
+ headers=dict(_response.headers),
996
+ body=_response_json,
997
+ )
998
+
999
+ async def fetch_evaluation_status(
1000
+ self,
1001
+ evaluation_id: str,
1002
+ *,
1003
+ request_options: typing.Optional[RequestOptions] = None,
1004
+ ) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
1005
+ """
1006
+ Fetches the status of the evaluation.
1007
+
1008
+ Args:
1009
+ evaluation_id (str): the evaluation id
1010
+ request (Request): the request object
1011
+
1012
+ Returns:
1013
+ (str): the evaluation status
1014
+
1015
+ Parameters
1016
+ ----------
1017
+ evaluation_id : str
1018
+
1019
+ request_options : typing.Optional[RequestOptions]
1020
+ Request-specific configuration.
1021
+
1022
+ Returns
1023
+ -------
1024
+ AsyncHttpResponse[typing.Optional[typing.Any]]
1025
+ Successful Response
1026
+ """
1027
+ _response = await self._client_wrapper.httpx_client.request(
1028
+ f"evaluations/{jsonable_encoder(evaluation_id)}/status",
1029
+ method="GET",
1030
+ request_options=request_options,
1031
+ )
1032
+ try:
1033
+ if _response is None or not _response.text.strip():
1034
+ return AsyncHttpResponse(response=_response, data=None)
1035
+ if 200 <= _response.status_code < 300:
1036
+ _data = typing.cast(
1037
+ typing.Optional[typing.Any],
1038
+ parse_obj_as(
1039
+ type_=typing.Optional[typing.Any], # type: ignore
1040
+ object_=_response.json(),
1041
+ ),
1042
+ )
1043
+ return AsyncHttpResponse(response=_response, data=_data)
1044
+ if _response.status_code == 422:
1045
+ raise UnprocessableEntityError(
1046
+ headers=dict(_response.headers),
1047
+ body=typing.cast(
1048
+ HttpValidationError,
1049
+ parse_obj_as(
1050
+ type_=HttpValidationError, # type: ignore
1051
+ object_=_response.json(),
1052
+ ),
1053
+ ),
1054
+ )
1055
+ _response_json = _response.json()
1056
+ except JSONDecodeError:
1057
+ raise ApiError(
1058
+ status_code=_response.status_code,
1059
+ headers=dict(_response.headers),
1060
+ body=_response.text,
1061
+ )
1062
+ raise ApiError(
1063
+ status_code=_response.status_code,
1064
+ headers=dict(_response.headers),
1065
+ body=_response_json,
1066
+ )
1067
+
1068
+ async def fetch_evaluation_results(
1069
+ self,
1070
+ evaluation_id: str,
1071
+ *,
1072
+ request_options: typing.Optional[RequestOptions] = None,
1073
+ ) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
1074
+ """
1075
+ Fetches the results of the evaluation
1076
+
1077
+ Args:
1078
+ evaluation_id (str): the evaluation id
1079
+ request (Request): the request object
1080
+
1081
+ Returns:
1082
+ _type_: _description_
1083
+
1084
+ Parameters
1085
+ ----------
1086
+ evaluation_id : str
1087
+
1088
+ request_options : typing.Optional[RequestOptions]
1089
+ Request-specific configuration.
1090
+
1091
+ Returns
1092
+ -------
1093
+ AsyncHttpResponse[typing.Optional[typing.Any]]
1094
+ Successful Response
1095
+ """
1096
+ _response = await self._client_wrapper.httpx_client.request(
1097
+ f"evaluations/{jsonable_encoder(evaluation_id)}/results",
1098
+ method="GET",
1099
+ request_options=request_options,
1100
+ )
1101
+ try:
1102
+ if _response is None or not _response.text.strip():
1103
+ return AsyncHttpResponse(response=_response, data=None)
1104
+ if 200 <= _response.status_code < 300:
1105
+ _data = typing.cast(
1106
+ typing.Optional[typing.Any],
1107
+ parse_obj_as(
1108
+ type_=typing.Optional[typing.Any], # type: ignore
1109
+ object_=_response.json(),
1110
+ ),
1111
+ )
1112
+ return AsyncHttpResponse(response=_response, data=_data)
1113
+ if _response.status_code == 422:
1114
+ raise UnprocessableEntityError(
1115
+ headers=dict(_response.headers),
1116
+ body=typing.cast(
1117
+ HttpValidationError,
1118
+ parse_obj_as(
1119
+ type_=HttpValidationError, # type: ignore
1120
+ object_=_response.json(),
1121
+ ),
1122
+ ),
1123
+ )
1124
+ _response_json = _response.json()
1125
+ except JSONDecodeError:
1126
+ raise ApiError(
1127
+ status_code=_response.status_code,
1128
+ headers=dict(_response.headers),
1129
+ body=_response.text,
1130
+ )
1131
+ raise ApiError(
1132
+ status_code=_response.status_code,
1133
+ headers=dict(_response.headers),
1134
+ body=_response_json,
1135
+ )
1136
+
1137
+ async def fetch_evaluation_scenarios(
1138
+ self,
1139
+ evaluation_id: str,
1140
+ *,
1141
+ request_options: typing.Optional[RequestOptions] = None,
1142
+ ) -> AsyncHttpResponse[typing.List[EvaluationScenario]]:
1143
+ """
1144
+ Fetches evaluation scenarios for a given evaluation ID.
1145
+
1146
+ Arguments:
1147
+ evaluation_id (str): The ID of the evaluation for which to fetch scenarios.
1148
+
1149
+ Raises:
1150
+ HTTPException: If the evaluation is not found or access is denied.
1151
+
1152
+ Returns:
1153
+ List[EvaluationScenario]: A list of evaluation scenarios.
1154
+
1155
+ Parameters
1156
+ ----------
1157
+ evaluation_id : str
1158
+
1159
+ request_options : typing.Optional[RequestOptions]
1160
+ Request-specific configuration.
1161
+
1162
+ Returns
1163
+ -------
1164
+ AsyncHttpResponse[typing.List[EvaluationScenario]]
1165
+ Successful Response
1166
+ """
1167
+ _response = await self._client_wrapper.httpx_client.request(
1168
+ f"evaluations/{jsonable_encoder(evaluation_id)}/evaluation_scenarios",
1169
+ method="GET",
1170
+ request_options=request_options,
1171
+ )
1172
+ try:
1173
+ if 200 <= _response.status_code < 300:
1174
+ _data = typing.cast(
1175
+ typing.List[EvaluationScenario],
1176
+ parse_obj_as(
1177
+ type_=typing.List[EvaluationScenario], # type: ignore
1178
+ object_=_response.json(),
1179
+ ),
1180
+ )
1181
+ return AsyncHttpResponse(response=_response, data=_data)
1182
+ if _response.status_code == 422:
1183
+ raise UnprocessableEntityError(
1184
+ headers=dict(_response.headers),
1185
+ body=typing.cast(
1186
+ HttpValidationError,
1187
+ parse_obj_as(
1188
+ type_=HttpValidationError, # type: ignore
1189
+ object_=_response.json(),
1190
+ ),
1191
+ ),
1192
+ )
1193
+ _response_json = _response.json()
1194
+ except JSONDecodeError:
1195
+ raise ApiError(
1196
+ status_code=_response.status_code,
1197
+ headers=dict(_response.headers),
1198
+ body=_response.text,
1199
+ )
1200
+ raise ApiError(
1201
+ status_code=_response.status_code,
1202
+ headers=dict(_response.headers),
1203
+ body=_response_json,
1204
+ )
1205
+
1206
+ async def fetch_evaluation(
1207
+ self,
1208
+ evaluation_id: str,
1209
+ *,
1210
+ request_options: typing.Optional[RequestOptions] = None,
1211
+ ) -> AsyncHttpResponse[Evaluation]:
1212
+ """
1213
+ Fetches a single evaluation based on its ID.
1214
+
1215
+ Args:
1216
+ evaluation_id (str): The ID of the evaluation to fetch.
1217
+
1218
+ Returns:
1219
+ Evaluation: The fetched evaluation.
1220
+
1221
+ Parameters
1222
+ ----------
1223
+ evaluation_id : str
1224
+
1225
+ request_options : typing.Optional[RequestOptions]
1226
+ Request-specific configuration.
1227
+
1228
+ Returns
1229
+ -------
1230
+ AsyncHttpResponse[Evaluation]
1231
+ Successful Response
1232
+ """
1233
+ _response = await self._client_wrapper.httpx_client.request(
1234
+ f"evaluations/{jsonable_encoder(evaluation_id)}",
1235
+ method="GET",
1236
+ request_options=request_options,
1237
+ )
1238
+ try:
1239
+ if 200 <= _response.status_code < 300:
1240
+ _data = typing.cast(
1241
+ Evaluation,
1242
+ parse_obj_as(
1243
+ type_=Evaluation, # type: ignore
1244
+ object_=_response.json(),
1245
+ ),
1246
+ )
1247
+ return AsyncHttpResponse(response=_response, data=_data)
1248
+ if _response.status_code == 422:
1249
+ raise UnprocessableEntityError(
1250
+ headers=dict(_response.headers),
1251
+ body=typing.cast(
1252
+ HttpValidationError,
1253
+ parse_obj_as(
1254
+ type_=HttpValidationError, # type: ignore
1255
+ object_=_response.json(),
1256
+ ),
1257
+ ),
1258
+ )
1259
+ _response_json = _response.json()
1260
+ except JSONDecodeError:
1261
+ raise ApiError(
1262
+ status_code=_response.status_code,
1263
+ headers=dict(_response.headers),
1264
+ body=_response.text,
1265
+ )
1266
+ raise ApiError(
1267
+ status_code=_response.status_code,
1268
+ headers=dict(_response.headers),
1269
+ body=_response_json,
1270
+ )
1271
+
1272
+ async def fetch_evaluation_scenarios_comparison_results(
1273
+ self,
1274
+ *,
1275
+ evaluations_ids: str,
1276
+ request_options: typing.Optional[RequestOptions] = None,
1277
+ ) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
1278
+ """
1279
+ Fetches evaluation scenarios for a given evaluation ID.
1280
+
1281
+ Arguments:
1282
+ evaluation_id (str): The ID of the evaluation for which to fetch scenarios.
1283
+
1284
+ Raises:
1285
+ HTTPException: If the evaluation is not found or access is denied.
1286
+
1287
+ Returns:
1288
+ List[EvaluationScenario]: A list of evaluation scenarios.
1289
+
1290
+ Parameters
1291
+ ----------
1292
+ evaluations_ids : str
1293
+
1294
+ request_options : typing.Optional[RequestOptions]
1295
+ Request-specific configuration.
1296
+
1297
+ Returns
1298
+ -------
1299
+ AsyncHttpResponse[typing.Optional[typing.Any]]
1300
+ Successful Response
1301
+ """
1302
+ _response = await self._client_wrapper.httpx_client.request(
1303
+ "evaluations/evaluation_scenarios/comparison-results",
1304
+ method="GET",
1305
+ params={
1306
+ "evaluations_ids": evaluations_ids,
1307
+ },
1308
+ request_options=request_options,
1309
+ )
1310
+ try:
1311
+ if _response is None or not _response.text.strip():
1312
+ return AsyncHttpResponse(response=_response, data=None)
1313
+ if 200 <= _response.status_code < 300:
1314
+ _data = typing.cast(
1315
+ typing.Optional[typing.Any],
1316
+ parse_obj_as(
1317
+ type_=typing.Optional[typing.Any], # type: ignore
1318
+ object_=_response.json(),
1319
+ ),
1320
+ )
1321
+ return AsyncHttpResponse(response=_response, data=_data)
1322
+ if _response.status_code == 422:
1323
+ raise UnprocessableEntityError(
1324
+ headers=dict(_response.headers),
1325
+ body=typing.cast(
1326
+ HttpValidationError,
1327
+ parse_obj_as(
1328
+ type_=HttpValidationError, # type: ignore
1329
+ object_=_response.json(),
1330
+ ),
1331
+ ),
1332
+ )
1333
+ _response_json = _response.json()
1334
+ except JSONDecodeError:
1335
+ raise ApiError(
1336
+ status_code=_response.status_code,
1337
+ headers=dict(_response.headers),
1338
+ body=_response.text,
1339
+ )
1340
+ raise ApiError(
1341
+ status_code=_response.status_code,
1342
+ headers=dict(_response.headers),
1343
+ body=_response_json,
1344
+ )