agenta 0.48.8__py3-none-any.whl → 0.48.10__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/decorators/tracing.py +2 -4
  285. agenta/sdk/tracing/processors.py +26 -39
  286. agenta/sdk/types.py +28 -1
  287. {agenta-0.48.8.dist-info → agenta-0.48.10.dist-info}/METADATA +1 -1
  288. agenta-0.48.10.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.8.dist-info/RECORD +0 -255
  297. {agenta-0.48.8.dist-info → agenta-0.48.10.dist-info}/WHEEL +0 -0
@@ -0,0 +1,1182 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.jsonable_encoder import jsonable_encoder
10
+ from ..core.pydantic_utilities import parse_obj_as
11
+ from ..core.request_options import RequestOptions
12
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
13
+ from ..types.evaluator_config import EvaluatorConfig
14
+ from ..types.evaluator_mapping_output_interface import EvaluatorMappingOutputInterface
15
+ from ..types.evaluator_output_interface import EvaluatorOutputInterface
16
+ from ..types.http_validation_error import HttpValidationError
17
+ from ..types.legacy_evaluator import LegacyEvaluator
18
+
19
+ # this is used as the default value for optional parameters
20
+ OMIT = typing.cast(typing.Any, ...)
21
+
22
+
23
+ class RawEvaluatorsClient:
24
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
25
+ self._client_wrapper = client_wrapper
26
+
27
+ def get_evaluators_endpoint(
28
+ self, *, request_options: typing.Optional[RequestOptions] = None
29
+ ) -> HttpResponse[typing.List[LegacyEvaluator]]:
30
+ """
31
+ Endpoint to fetch a list of evaluators.
32
+
33
+ Returns:
34
+ List[Evaluator]: A list of evaluator objects.
35
+
36
+ Parameters
37
+ ----------
38
+ request_options : typing.Optional[RequestOptions]
39
+ Request-specific configuration.
40
+
41
+ Returns
42
+ -------
43
+ HttpResponse[typing.List[LegacyEvaluator]]
44
+ Successful Response
45
+ """
46
+ _response = self._client_wrapper.httpx_client.request(
47
+ "evaluators",
48
+ method="GET",
49
+ request_options=request_options,
50
+ )
51
+ try:
52
+ if 200 <= _response.status_code < 300:
53
+ _data = typing.cast(
54
+ typing.List[LegacyEvaluator],
55
+ parse_obj_as(
56
+ type_=typing.List[LegacyEvaluator], # type: ignore
57
+ object_=_response.json(),
58
+ ),
59
+ )
60
+ return HttpResponse(response=_response, data=_data)
61
+ _response_json = _response.json()
62
+ except JSONDecodeError:
63
+ raise ApiError(
64
+ status_code=_response.status_code,
65
+ headers=dict(_response.headers),
66
+ body=_response.text,
67
+ )
68
+ raise ApiError(
69
+ status_code=_response.status_code,
70
+ headers=dict(_response.headers),
71
+ body=_response_json,
72
+ )
73
+
74
+ def evaluator_data_map(
75
+ self,
76
+ *,
77
+ inputs: typing.Dict[str, typing.Optional[typing.Any]],
78
+ mapping: typing.Dict[str, typing.Optional[typing.Any]],
79
+ request_options: typing.Optional[RequestOptions] = None,
80
+ ) -> HttpResponse[EvaluatorMappingOutputInterface]:
81
+ """
82
+ Endpoint to map the experiment data tree to evaluator interface.
83
+
84
+ Args:
85
+ request (Request): The request object.
86
+ payload (EvaluatorMappingInputInterface): The payload containing the request data.
87
+
88
+ Returns:
89
+ EvaluatorMappingOutputInterface: the evaluator mapping output object
90
+
91
+ Parameters
92
+ ----------
93
+ inputs : typing.Dict[str, typing.Optional[typing.Any]]
94
+
95
+ mapping : typing.Dict[str, typing.Optional[typing.Any]]
96
+
97
+ request_options : typing.Optional[RequestOptions]
98
+ Request-specific configuration.
99
+
100
+ Returns
101
+ -------
102
+ HttpResponse[EvaluatorMappingOutputInterface]
103
+ Successful Response
104
+ """
105
+ _response = self._client_wrapper.httpx_client.request(
106
+ "evaluators/map",
107
+ method="POST",
108
+ json={
109
+ "inputs": inputs,
110
+ "mapping": mapping,
111
+ },
112
+ headers={
113
+ "content-type": "application/json",
114
+ },
115
+ request_options=request_options,
116
+ omit=OMIT,
117
+ )
118
+ try:
119
+ if 200 <= _response.status_code < 300:
120
+ _data = typing.cast(
121
+ EvaluatorMappingOutputInterface,
122
+ parse_obj_as(
123
+ type_=EvaluatorMappingOutputInterface, # type: ignore
124
+ object_=_response.json(),
125
+ ),
126
+ )
127
+ return HttpResponse(response=_response, data=_data)
128
+ if _response.status_code == 422:
129
+ raise UnprocessableEntityError(
130
+ headers=dict(_response.headers),
131
+ body=typing.cast(
132
+ HttpValidationError,
133
+ parse_obj_as(
134
+ type_=HttpValidationError, # type: ignore
135
+ object_=_response.json(),
136
+ ),
137
+ ),
138
+ )
139
+ _response_json = _response.json()
140
+ except JSONDecodeError:
141
+ raise ApiError(
142
+ status_code=_response.status_code,
143
+ headers=dict(_response.headers),
144
+ body=_response.text,
145
+ )
146
+ raise ApiError(
147
+ status_code=_response.status_code,
148
+ headers=dict(_response.headers),
149
+ body=_response_json,
150
+ )
151
+
152
+ def evaluator_run(
153
+ self,
154
+ evaluator_key: str,
155
+ *,
156
+ inputs: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
157
+ settings: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
158
+ credentials: typing.Optional[
159
+ typing.Dict[str, typing.Optional[typing.Any]]
160
+ ] = OMIT,
161
+ request_options: typing.Optional[RequestOptions] = None,
162
+ ) -> HttpResponse[EvaluatorOutputInterface]:
163
+ """
164
+ Endpoint to evaluate LLM app run
165
+
166
+ Args:
167
+ request (Request): The request object.
168
+ evaluator_key (str): The key of the evaluator.
169
+ payload (EvaluatorInputInterface): The payload containing the request data.
170
+
171
+ Returns:
172
+ result: EvaluatorOutputInterface object containing the outputs.
173
+
174
+ Parameters
175
+ ----------
176
+ evaluator_key : str
177
+
178
+ inputs : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
179
+
180
+ settings : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
181
+
182
+ credentials : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
183
+
184
+ request_options : typing.Optional[RequestOptions]
185
+ Request-specific configuration.
186
+
187
+ Returns
188
+ -------
189
+ HttpResponse[EvaluatorOutputInterface]
190
+ Successful Response
191
+ """
192
+ _response = self._client_wrapper.httpx_client.request(
193
+ f"evaluators/{jsonable_encoder(evaluator_key)}/run",
194
+ method="POST",
195
+ json={
196
+ "inputs": inputs,
197
+ "settings": settings,
198
+ "credentials": credentials,
199
+ },
200
+ headers={
201
+ "content-type": "application/json",
202
+ },
203
+ request_options=request_options,
204
+ omit=OMIT,
205
+ )
206
+ try:
207
+ if 200 <= _response.status_code < 300:
208
+ _data = typing.cast(
209
+ EvaluatorOutputInterface,
210
+ parse_obj_as(
211
+ type_=EvaluatorOutputInterface, # type: ignore
212
+ object_=_response.json(),
213
+ ),
214
+ )
215
+ return HttpResponse(response=_response, data=_data)
216
+ if _response.status_code == 422:
217
+ raise UnprocessableEntityError(
218
+ headers=dict(_response.headers),
219
+ body=typing.cast(
220
+ HttpValidationError,
221
+ parse_obj_as(
222
+ type_=HttpValidationError, # type: ignore
223
+ object_=_response.json(),
224
+ ),
225
+ ),
226
+ )
227
+ _response_json = _response.json()
228
+ except JSONDecodeError:
229
+ raise ApiError(
230
+ status_code=_response.status_code,
231
+ headers=dict(_response.headers),
232
+ body=_response.text,
233
+ )
234
+ raise ApiError(
235
+ status_code=_response.status_code,
236
+ headers=dict(_response.headers),
237
+ body=_response_json,
238
+ )
239
+
240
+ def get_evaluator_configs(
241
+ self, *, app_id: str, request_options: typing.Optional[RequestOptions] = None
242
+ ) -> HttpResponse[typing.List[EvaluatorConfig]]:
243
+ """
244
+ Endpoint to fetch evaluator configurations for a specific app.
245
+
246
+ Args:
247
+ app_id (str): The ID of the app.
248
+
249
+ Returns:
250
+ List[EvaluatorConfigDB]: A list of evaluator configuration objects.
251
+
252
+ Parameters
253
+ ----------
254
+ app_id : str
255
+
256
+ request_options : typing.Optional[RequestOptions]
257
+ Request-specific configuration.
258
+
259
+ Returns
260
+ -------
261
+ HttpResponse[typing.List[EvaluatorConfig]]
262
+ Successful Response
263
+ """
264
+ _response = self._client_wrapper.httpx_client.request(
265
+ "evaluators/configs",
266
+ method="GET",
267
+ params={
268
+ "app_id": app_id,
269
+ },
270
+ request_options=request_options,
271
+ )
272
+ try:
273
+ if 200 <= _response.status_code < 300:
274
+ _data = typing.cast(
275
+ typing.List[EvaluatorConfig],
276
+ parse_obj_as(
277
+ type_=typing.List[EvaluatorConfig], # type: ignore
278
+ object_=_response.json(),
279
+ ),
280
+ )
281
+ return HttpResponse(response=_response, data=_data)
282
+ if _response.status_code == 422:
283
+ raise UnprocessableEntityError(
284
+ headers=dict(_response.headers),
285
+ body=typing.cast(
286
+ HttpValidationError,
287
+ parse_obj_as(
288
+ type_=HttpValidationError, # type: ignore
289
+ object_=_response.json(),
290
+ ),
291
+ ),
292
+ )
293
+ _response_json = _response.json()
294
+ except JSONDecodeError:
295
+ raise ApiError(
296
+ status_code=_response.status_code,
297
+ headers=dict(_response.headers),
298
+ body=_response.text,
299
+ )
300
+ raise ApiError(
301
+ status_code=_response.status_code,
302
+ headers=dict(_response.headers),
303
+ body=_response_json,
304
+ )
305
+
306
+ def create_new_evaluator_config(
307
+ self,
308
+ *,
309
+ app_id: str,
310
+ name: str,
311
+ evaluator_key: str,
312
+ settings_values: typing.Dict[str, typing.Optional[typing.Any]],
313
+ request_options: typing.Optional[RequestOptions] = None,
314
+ ) -> HttpResponse[EvaluatorConfig]:
315
+ """
316
+ Endpoint to fetch evaluator configurations for a specific app.
317
+
318
+ Args:
319
+ app_id (str): The ID of the app.
320
+
321
+ Returns:
322
+ EvaluatorConfigDB: Evaluator configuration api model.
323
+
324
+ Parameters
325
+ ----------
326
+ app_id : str
327
+
328
+ name : str
329
+
330
+ evaluator_key : str
331
+
332
+ settings_values : typing.Dict[str, typing.Optional[typing.Any]]
333
+
334
+ request_options : typing.Optional[RequestOptions]
335
+ Request-specific configuration.
336
+
337
+ Returns
338
+ -------
339
+ HttpResponse[EvaluatorConfig]
340
+ Successful Response
341
+ """
342
+ _response = self._client_wrapper.httpx_client.request(
343
+ "evaluators/configs",
344
+ method="POST",
345
+ json={
346
+ "app_id": app_id,
347
+ "name": name,
348
+ "evaluator_key": evaluator_key,
349
+ "settings_values": settings_values,
350
+ },
351
+ headers={
352
+ "content-type": "application/json",
353
+ },
354
+ request_options=request_options,
355
+ omit=OMIT,
356
+ )
357
+ try:
358
+ if 200 <= _response.status_code < 300:
359
+ _data = typing.cast(
360
+ EvaluatorConfig,
361
+ parse_obj_as(
362
+ type_=EvaluatorConfig, # type: ignore
363
+ object_=_response.json(),
364
+ ),
365
+ )
366
+ return HttpResponse(response=_response, data=_data)
367
+ if _response.status_code == 422:
368
+ raise UnprocessableEntityError(
369
+ headers=dict(_response.headers),
370
+ body=typing.cast(
371
+ HttpValidationError,
372
+ parse_obj_as(
373
+ type_=HttpValidationError, # type: ignore
374
+ object_=_response.json(),
375
+ ),
376
+ ),
377
+ )
378
+ _response_json = _response.json()
379
+ except JSONDecodeError:
380
+ raise ApiError(
381
+ status_code=_response.status_code,
382
+ headers=dict(_response.headers),
383
+ body=_response.text,
384
+ )
385
+ raise ApiError(
386
+ status_code=_response.status_code,
387
+ headers=dict(_response.headers),
388
+ body=_response_json,
389
+ )
390
+
391
+ def get_evaluator_config(
392
+ self,
393
+ evaluator_config_id: str,
394
+ *,
395
+ request_options: typing.Optional[RequestOptions] = None,
396
+ ) -> HttpResponse[EvaluatorConfig]:
397
+ """
398
+ Endpoint to fetch evaluator configurations for a specific app.
399
+
400
+ Returns:
401
+ List[EvaluatorConfigDB]: A list of evaluator configuration objects.
402
+
403
+ Parameters
404
+ ----------
405
+ evaluator_config_id : str
406
+
407
+ request_options : typing.Optional[RequestOptions]
408
+ Request-specific configuration.
409
+
410
+ Returns
411
+ -------
412
+ HttpResponse[EvaluatorConfig]
413
+ Successful Response
414
+ """
415
+ _response = self._client_wrapper.httpx_client.request(
416
+ f"evaluators/configs/{jsonable_encoder(evaluator_config_id)}",
417
+ method="GET",
418
+ request_options=request_options,
419
+ )
420
+ try:
421
+ if 200 <= _response.status_code < 300:
422
+ _data = typing.cast(
423
+ EvaluatorConfig,
424
+ parse_obj_as(
425
+ type_=EvaluatorConfig, # type: ignore
426
+ object_=_response.json(),
427
+ ),
428
+ )
429
+ return HttpResponse(response=_response, data=_data)
430
+ if _response.status_code == 422:
431
+ raise UnprocessableEntityError(
432
+ headers=dict(_response.headers),
433
+ body=typing.cast(
434
+ HttpValidationError,
435
+ parse_obj_as(
436
+ type_=HttpValidationError, # type: ignore
437
+ object_=_response.json(),
438
+ ),
439
+ ),
440
+ )
441
+ _response_json = _response.json()
442
+ except JSONDecodeError:
443
+ raise ApiError(
444
+ status_code=_response.status_code,
445
+ headers=dict(_response.headers),
446
+ body=_response.text,
447
+ )
448
+ raise ApiError(
449
+ status_code=_response.status_code,
450
+ headers=dict(_response.headers),
451
+ body=_response_json,
452
+ )
453
+
454
+ def update_evaluator_config(
455
+ self,
456
+ evaluator_config_id: str,
457
+ *,
458
+ name: typing.Optional[str] = OMIT,
459
+ evaluator_key: typing.Optional[str] = OMIT,
460
+ settings_values: typing.Optional[
461
+ typing.Dict[str, typing.Optional[typing.Any]]
462
+ ] = OMIT,
463
+ request_options: typing.Optional[RequestOptions] = None,
464
+ ) -> HttpResponse[EvaluatorConfig]:
465
+ """
466
+ Endpoint to update evaluator configurations for a specific app.
467
+
468
+ Returns:
469
+ List[EvaluatorConfigDB]: A list of evaluator configuration objects.
470
+
471
+ Parameters
472
+ ----------
473
+ evaluator_config_id : str
474
+
475
+ name : typing.Optional[str]
476
+
477
+ evaluator_key : typing.Optional[str]
478
+
479
+ settings_values : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
480
+
481
+ request_options : typing.Optional[RequestOptions]
482
+ Request-specific configuration.
483
+
484
+ Returns
485
+ -------
486
+ HttpResponse[EvaluatorConfig]
487
+ Successful Response
488
+ """
489
+ _response = self._client_wrapper.httpx_client.request(
490
+ f"evaluators/configs/{jsonable_encoder(evaluator_config_id)}",
491
+ method="PUT",
492
+ json={
493
+ "name": name,
494
+ "evaluator_key": evaluator_key,
495
+ "settings_values": settings_values,
496
+ },
497
+ headers={
498
+ "content-type": "application/json",
499
+ },
500
+ request_options=request_options,
501
+ omit=OMIT,
502
+ )
503
+ try:
504
+ if 200 <= _response.status_code < 300:
505
+ _data = typing.cast(
506
+ EvaluatorConfig,
507
+ parse_obj_as(
508
+ type_=EvaluatorConfig, # type: ignore
509
+ object_=_response.json(),
510
+ ),
511
+ )
512
+ return HttpResponse(response=_response, data=_data)
513
+ if _response.status_code == 422:
514
+ raise UnprocessableEntityError(
515
+ headers=dict(_response.headers),
516
+ body=typing.cast(
517
+ HttpValidationError,
518
+ parse_obj_as(
519
+ type_=HttpValidationError, # type: ignore
520
+ object_=_response.json(),
521
+ ),
522
+ ),
523
+ )
524
+ _response_json = _response.json()
525
+ except JSONDecodeError:
526
+ raise ApiError(
527
+ status_code=_response.status_code,
528
+ headers=dict(_response.headers),
529
+ body=_response.text,
530
+ )
531
+ raise ApiError(
532
+ status_code=_response.status_code,
533
+ headers=dict(_response.headers),
534
+ body=_response_json,
535
+ )
536
+
537
+ def delete_evaluator_config(
538
+ self,
539
+ evaluator_config_id: str,
540
+ *,
541
+ request_options: typing.Optional[RequestOptions] = None,
542
+ ) -> HttpResponse[bool]:
543
+ """
544
+ Endpoint to delete a specific evaluator configuration.
545
+
546
+ Args:
547
+ evaluator_config_id (str): The unique identifier of the evaluator configuration.
548
+
549
+ Returns:
550
+ bool: True if deletion was successful, False otherwise.
551
+
552
+ Parameters
553
+ ----------
554
+ evaluator_config_id : str
555
+
556
+ request_options : typing.Optional[RequestOptions]
557
+ Request-specific configuration.
558
+
559
+ Returns
560
+ -------
561
+ HttpResponse[bool]
562
+ Successful Response
563
+ """
564
+ _response = self._client_wrapper.httpx_client.request(
565
+ f"evaluators/configs/{jsonable_encoder(evaluator_config_id)}",
566
+ method="DELETE",
567
+ request_options=request_options,
568
+ )
569
+ try:
570
+ if 200 <= _response.status_code < 300:
571
+ _data = typing.cast(
572
+ bool,
573
+ parse_obj_as(
574
+ type_=bool, # type: ignore
575
+ object_=_response.json(),
576
+ ),
577
+ )
578
+ return HttpResponse(response=_response, data=_data)
579
+ if _response.status_code == 422:
580
+ raise UnprocessableEntityError(
581
+ headers=dict(_response.headers),
582
+ body=typing.cast(
583
+ HttpValidationError,
584
+ parse_obj_as(
585
+ type_=HttpValidationError, # type: ignore
586
+ object_=_response.json(),
587
+ ),
588
+ ),
589
+ )
590
+ _response_json = _response.json()
591
+ except JSONDecodeError:
592
+ raise ApiError(
593
+ status_code=_response.status_code,
594
+ headers=dict(_response.headers),
595
+ body=_response.text,
596
+ )
597
+ raise ApiError(
598
+ status_code=_response.status_code,
599
+ headers=dict(_response.headers),
600
+ body=_response_json,
601
+ )
602
+
603
+
604
+ class AsyncRawEvaluatorsClient:
605
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
606
+ self._client_wrapper = client_wrapper
607
+
608
+ async def get_evaluators_endpoint(
609
+ self, *, request_options: typing.Optional[RequestOptions] = None
610
+ ) -> AsyncHttpResponse[typing.List[LegacyEvaluator]]:
611
+ """
612
+ Endpoint to fetch a list of evaluators.
613
+
614
+ Returns:
615
+ List[Evaluator]: A list of evaluator objects.
616
+
617
+ Parameters
618
+ ----------
619
+ request_options : typing.Optional[RequestOptions]
620
+ Request-specific configuration.
621
+
622
+ Returns
623
+ -------
624
+ AsyncHttpResponse[typing.List[LegacyEvaluator]]
625
+ Successful Response
626
+ """
627
+ _response = await self._client_wrapper.httpx_client.request(
628
+ "evaluators",
629
+ method="GET",
630
+ request_options=request_options,
631
+ )
632
+ try:
633
+ if 200 <= _response.status_code < 300:
634
+ _data = typing.cast(
635
+ typing.List[LegacyEvaluator],
636
+ parse_obj_as(
637
+ type_=typing.List[LegacyEvaluator], # type: ignore
638
+ object_=_response.json(),
639
+ ),
640
+ )
641
+ return AsyncHttpResponse(response=_response, data=_data)
642
+ _response_json = _response.json()
643
+ except JSONDecodeError:
644
+ raise ApiError(
645
+ status_code=_response.status_code,
646
+ headers=dict(_response.headers),
647
+ body=_response.text,
648
+ )
649
+ raise ApiError(
650
+ status_code=_response.status_code,
651
+ headers=dict(_response.headers),
652
+ body=_response_json,
653
+ )
654
+
655
+ async def evaluator_data_map(
656
+ self,
657
+ *,
658
+ inputs: typing.Dict[str, typing.Optional[typing.Any]],
659
+ mapping: typing.Dict[str, typing.Optional[typing.Any]],
660
+ request_options: typing.Optional[RequestOptions] = None,
661
+ ) -> AsyncHttpResponse[EvaluatorMappingOutputInterface]:
662
+ """
663
+ Endpoint to map the experiment data tree to evaluator interface.
664
+
665
+ Args:
666
+ request (Request): The request object.
667
+ payload (EvaluatorMappingInputInterface): The payload containing the request data.
668
+
669
+ Returns:
670
+ EvaluatorMappingOutputInterface: the evaluator mapping output object
671
+
672
+ Parameters
673
+ ----------
674
+ inputs : typing.Dict[str, typing.Optional[typing.Any]]
675
+
676
+ mapping : typing.Dict[str, typing.Optional[typing.Any]]
677
+
678
+ request_options : typing.Optional[RequestOptions]
679
+ Request-specific configuration.
680
+
681
+ Returns
682
+ -------
683
+ AsyncHttpResponse[EvaluatorMappingOutputInterface]
684
+ Successful Response
685
+ """
686
+ _response = await self._client_wrapper.httpx_client.request(
687
+ "evaluators/map",
688
+ method="POST",
689
+ json={
690
+ "inputs": inputs,
691
+ "mapping": mapping,
692
+ },
693
+ headers={
694
+ "content-type": "application/json",
695
+ },
696
+ request_options=request_options,
697
+ omit=OMIT,
698
+ )
699
+ try:
700
+ if 200 <= _response.status_code < 300:
701
+ _data = typing.cast(
702
+ EvaluatorMappingOutputInterface,
703
+ parse_obj_as(
704
+ type_=EvaluatorMappingOutputInterface, # type: ignore
705
+ object_=_response.json(),
706
+ ),
707
+ )
708
+ return AsyncHttpResponse(response=_response, data=_data)
709
+ if _response.status_code == 422:
710
+ raise UnprocessableEntityError(
711
+ headers=dict(_response.headers),
712
+ body=typing.cast(
713
+ HttpValidationError,
714
+ parse_obj_as(
715
+ type_=HttpValidationError, # type: ignore
716
+ object_=_response.json(),
717
+ ),
718
+ ),
719
+ )
720
+ _response_json = _response.json()
721
+ except JSONDecodeError:
722
+ raise ApiError(
723
+ status_code=_response.status_code,
724
+ headers=dict(_response.headers),
725
+ body=_response.text,
726
+ )
727
+ raise ApiError(
728
+ status_code=_response.status_code,
729
+ headers=dict(_response.headers),
730
+ body=_response_json,
731
+ )
732
+
733
+ async def evaluator_run(
734
+ self,
735
+ evaluator_key: str,
736
+ *,
737
+ inputs: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
738
+ settings: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
739
+ credentials: typing.Optional[
740
+ typing.Dict[str, typing.Optional[typing.Any]]
741
+ ] = OMIT,
742
+ request_options: typing.Optional[RequestOptions] = None,
743
+ ) -> AsyncHttpResponse[EvaluatorOutputInterface]:
744
+ """
745
+ Endpoint to evaluate LLM app run
746
+
747
+ Args:
748
+ request (Request): The request object.
749
+ evaluator_key (str): The key of the evaluator.
750
+ payload (EvaluatorInputInterface): The payload containing the request data.
751
+
752
+ Returns:
753
+ result: EvaluatorOutputInterface object containing the outputs.
754
+
755
+ Parameters
756
+ ----------
757
+ evaluator_key : str
758
+
759
+ inputs : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
760
+
761
+ settings : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
762
+
763
+ credentials : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
764
+
765
+ request_options : typing.Optional[RequestOptions]
766
+ Request-specific configuration.
767
+
768
+ Returns
769
+ -------
770
+ AsyncHttpResponse[EvaluatorOutputInterface]
771
+ Successful Response
772
+ """
773
+ _response = await self._client_wrapper.httpx_client.request(
774
+ f"evaluators/{jsonable_encoder(evaluator_key)}/run",
775
+ method="POST",
776
+ json={
777
+ "inputs": inputs,
778
+ "settings": settings,
779
+ "credentials": credentials,
780
+ },
781
+ headers={
782
+ "content-type": "application/json",
783
+ },
784
+ request_options=request_options,
785
+ omit=OMIT,
786
+ )
787
+ try:
788
+ if 200 <= _response.status_code < 300:
789
+ _data = typing.cast(
790
+ EvaluatorOutputInterface,
791
+ parse_obj_as(
792
+ type_=EvaluatorOutputInterface, # type: ignore
793
+ object_=_response.json(),
794
+ ),
795
+ )
796
+ return AsyncHttpResponse(response=_response, data=_data)
797
+ if _response.status_code == 422:
798
+ raise UnprocessableEntityError(
799
+ headers=dict(_response.headers),
800
+ body=typing.cast(
801
+ HttpValidationError,
802
+ parse_obj_as(
803
+ type_=HttpValidationError, # type: ignore
804
+ object_=_response.json(),
805
+ ),
806
+ ),
807
+ )
808
+ _response_json = _response.json()
809
+ except JSONDecodeError:
810
+ raise ApiError(
811
+ status_code=_response.status_code,
812
+ headers=dict(_response.headers),
813
+ body=_response.text,
814
+ )
815
+ raise ApiError(
816
+ status_code=_response.status_code,
817
+ headers=dict(_response.headers),
818
+ body=_response_json,
819
+ )
820
+
821
+ async def get_evaluator_configs(
822
+ self, *, app_id: str, request_options: typing.Optional[RequestOptions] = None
823
+ ) -> AsyncHttpResponse[typing.List[EvaluatorConfig]]:
824
+ """
825
+ Endpoint to fetch evaluator configurations for a specific app.
826
+
827
+ Args:
828
+ app_id (str): The ID of the app.
829
+
830
+ Returns:
831
+ List[EvaluatorConfigDB]: A list of evaluator configuration objects.
832
+
833
+ Parameters
834
+ ----------
835
+ app_id : str
836
+
837
+ request_options : typing.Optional[RequestOptions]
838
+ Request-specific configuration.
839
+
840
+ Returns
841
+ -------
842
+ AsyncHttpResponse[typing.List[EvaluatorConfig]]
843
+ Successful Response
844
+ """
845
+ _response = await self._client_wrapper.httpx_client.request(
846
+ "evaluators/configs",
847
+ method="GET",
848
+ params={
849
+ "app_id": app_id,
850
+ },
851
+ request_options=request_options,
852
+ )
853
+ try:
854
+ if 200 <= _response.status_code < 300:
855
+ _data = typing.cast(
856
+ typing.List[EvaluatorConfig],
857
+ parse_obj_as(
858
+ type_=typing.List[EvaluatorConfig], # type: ignore
859
+ object_=_response.json(),
860
+ ),
861
+ )
862
+ return AsyncHttpResponse(response=_response, data=_data)
863
+ if _response.status_code == 422:
864
+ raise UnprocessableEntityError(
865
+ headers=dict(_response.headers),
866
+ body=typing.cast(
867
+ HttpValidationError,
868
+ parse_obj_as(
869
+ type_=HttpValidationError, # type: ignore
870
+ object_=_response.json(),
871
+ ),
872
+ ),
873
+ )
874
+ _response_json = _response.json()
875
+ except JSONDecodeError:
876
+ raise ApiError(
877
+ status_code=_response.status_code,
878
+ headers=dict(_response.headers),
879
+ body=_response.text,
880
+ )
881
+ raise ApiError(
882
+ status_code=_response.status_code,
883
+ headers=dict(_response.headers),
884
+ body=_response_json,
885
+ )
886
+
887
+ async def create_new_evaluator_config(
888
+ self,
889
+ *,
890
+ app_id: str,
891
+ name: str,
892
+ evaluator_key: str,
893
+ settings_values: typing.Dict[str, typing.Optional[typing.Any]],
894
+ request_options: typing.Optional[RequestOptions] = None,
895
+ ) -> AsyncHttpResponse[EvaluatorConfig]:
896
+ """
897
+ Endpoint to fetch evaluator configurations for a specific app.
898
+
899
+ Args:
900
+ app_id (str): The ID of the app.
901
+
902
+ Returns:
903
+ EvaluatorConfigDB: Evaluator configuration api model.
904
+
905
+ Parameters
906
+ ----------
907
+ app_id : str
908
+
909
+ name : str
910
+
911
+ evaluator_key : str
912
+
913
+ settings_values : typing.Dict[str, typing.Optional[typing.Any]]
914
+
915
+ request_options : typing.Optional[RequestOptions]
916
+ Request-specific configuration.
917
+
918
+ Returns
919
+ -------
920
+ AsyncHttpResponse[EvaluatorConfig]
921
+ Successful Response
922
+ """
923
+ _response = await self._client_wrapper.httpx_client.request(
924
+ "evaluators/configs",
925
+ method="POST",
926
+ json={
927
+ "app_id": app_id,
928
+ "name": name,
929
+ "evaluator_key": evaluator_key,
930
+ "settings_values": settings_values,
931
+ },
932
+ headers={
933
+ "content-type": "application/json",
934
+ },
935
+ request_options=request_options,
936
+ omit=OMIT,
937
+ )
938
+ try:
939
+ if 200 <= _response.status_code < 300:
940
+ _data = typing.cast(
941
+ EvaluatorConfig,
942
+ parse_obj_as(
943
+ type_=EvaluatorConfig, # type: ignore
944
+ object_=_response.json(),
945
+ ),
946
+ )
947
+ return AsyncHttpResponse(response=_response, data=_data)
948
+ if _response.status_code == 422:
949
+ raise UnprocessableEntityError(
950
+ headers=dict(_response.headers),
951
+ body=typing.cast(
952
+ HttpValidationError,
953
+ parse_obj_as(
954
+ type_=HttpValidationError, # type: ignore
955
+ object_=_response.json(),
956
+ ),
957
+ ),
958
+ )
959
+ _response_json = _response.json()
960
+ except JSONDecodeError:
961
+ raise ApiError(
962
+ status_code=_response.status_code,
963
+ headers=dict(_response.headers),
964
+ body=_response.text,
965
+ )
966
+ raise ApiError(
967
+ status_code=_response.status_code,
968
+ headers=dict(_response.headers),
969
+ body=_response_json,
970
+ )
971
+
972
+ async def get_evaluator_config(
973
+ self,
974
+ evaluator_config_id: str,
975
+ *,
976
+ request_options: typing.Optional[RequestOptions] = None,
977
+ ) -> AsyncHttpResponse[EvaluatorConfig]:
978
+ """
979
+ Endpoint to fetch evaluator configurations for a specific app.
980
+
981
+ Returns:
982
+ List[EvaluatorConfigDB]: A list of evaluator configuration objects.
983
+
984
+ Parameters
985
+ ----------
986
+ evaluator_config_id : str
987
+
988
+ request_options : typing.Optional[RequestOptions]
989
+ Request-specific configuration.
990
+
991
+ Returns
992
+ -------
993
+ AsyncHttpResponse[EvaluatorConfig]
994
+ Successful Response
995
+ """
996
+ _response = await self._client_wrapper.httpx_client.request(
997
+ f"evaluators/configs/{jsonable_encoder(evaluator_config_id)}",
998
+ method="GET",
999
+ request_options=request_options,
1000
+ )
1001
+ try:
1002
+ if 200 <= _response.status_code < 300:
1003
+ _data = typing.cast(
1004
+ EvaluatorConfig,
1005
+ parse_obj_as(
1006
+ type_=EvaluatorConfig, # type: ignore
1007
+ object_=_response.json(),
1008
+ ),
1009
+ )
1010
+ return AsyncHttpResponse(response=_response, data=_data)
1011
+ if _response.status_code == 422:
1012
+ raise UnprocessableEntityError(
1013
+ headers=dict(_response.headers),
1014
+ body=typing.cast(
1015
+ HttpValidationError,
1016
+ parse_obj_as(
1017
+ type_=HttpValidationError, # type: ignore
1018
+ object_=_response.json(),
1019
+ ),
1020
+ ),
1021
+ )
1022
+ _response_json = _response.json()
1023
+ except JSONDecodeError:
1024
+ raise ApiError(
1025
+ status_code=_response.status_code,
1026
+ headers=dict(_response.headers),
1027
+ body=_response.text,
1028
+ )
1029
+ raise ApiError(
1030
+ status_code=_response.status_code,
1031
+ headers=dict(_response.headers),
1032
+ body=_response_json,
1033
+ )
1034
+
1035
+ async def update_evaluator_config(
1036
+ self,
1037
+ evaluator_config_id: str,
1038
+ *,
1039
+ name: typing.Optional[str] = OMIT,
1040
+ evaluator_key: typing.Optional[str] = OMIT,
1041
+ settings_values: typing.Optional[
1042
+ typing.Dict[str, typing.Optional[typing.Any]]
1043
+ ] = OMIT,
1044
+ request_options: typing.Optional[RequestOptions] = None,
1045
+ ) -> AsyncHttpResponse[EvaluatorConfig]:
1046
+ """
1047
+ Endpoint to update evaluator configurations for a specific app.
1048
+
1049
+ Returns:
1050
+ List[EvaluatorConfigDB]: A list of evaluator configuration objects.
1051
+
1052
+ Parameters
1053
+ ----------
1054
+ evaluator_config_id : str
1055
+
1056
+ name : typing.Optional[str]
1057
+
1058
+ evaluator_key : typing.Optional[str]
1059
+
1060
+ settings_values : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
1061
+
1062
+ request_options : typing.Optional[RequestOptions]
1063
+ Request-specific configuration.
1064
+
1065
+ Returns
1066
+ -------
1067
+ AsyncHttpResponse[EvaluatorConfig]
1068
+ Successful Response
1069
+ """
1070
+ _response = await self._client_wrapper.httpx_client.request(
1071
+ f"evaluators/configs/{jsonable_encoder(evaluator_config_id)}",
1072
+ method="PUT",
1073
+ json={
1074
+ "name": name,
1075
+ "evaluator_key": evaluator_key,
1076
+ "settings_values": settings_values,
1077
+ },
1078
+ headers={
1079
+ "content-type": "application/json",
1080
+ },
1081
+ request_options=request_options,
1082
+ omit=OMIT,
1083
+ )
1084
+ try:
1085
+ if 200 <= _response.status_code < 300:
1086
+ _data = typing.cast(
1087
+ EvaluatorConfig,
1088
+ parse_obj_as(
1089
+ type_=EvaluatorConfig, # type: ignore
1090
+ object_=_response.json(),
1091
+ ),
1092
+ )
1093
+ return AsyncHttpResponse(response=_response, data=_data)
1094
+ if _response.status_code == 422:
1095
+ raise UnprocessableEntityError(
1096
+ headers=dict(_response.headers),
1097
+ body=typing.cast(
1098
+ HttpValidationError,
1099
+ parse_obj_as(
1100
+ type_=HttpValidationError, # type: ignore
1101
+ object_=_response.json(),
1102
+ ),
1103
+ ),
1104
+ )
1105
+ _response_json = _response.json()
1106
+ except JSONDecodeError:
1107
+ raise ApiError(
1108
+ status_code=_response.status_code,
1109
+ headers=dict(_response.headers),
1110
+ body=_response.text,
1111
+ )
1112
+ raise ApiError(
1113
+ status_code=_response.status_code,
1114
+ headers=dict(_response.headers),
1115
+ body=_response_json,
1116
+ )
1117
+
1118
+ async def delete_evaluator_config(
1119
+ self,
1120
+ evaluator_config_id: str,
1121
+ *,
1122
+ request_options: typing.Optional[RequestOptions] = None,
1123
+ ) -> AsyncHttpResponse[bool]:
1124
+ """
1125
+ Endpoint to delete a specific evaluator configuration.
1126
+
1127
+ Args:
1128
+ evaluator_config_id (str): The unique identifier of the evaluator configuration.
1129
+
1130
+ Returns:
1131
+ bool: True if deletion was successful, False otherwise.
1132
+
1133
+ Parameters
1134
+ ----------
1135
+ evaluator_config_id : str
1136
+
1137
+ request_options : typing.Optional[RequestOptions]
1138
+ Request-specific configuration.
1139
+
1140
+ Returns
1141
+ -------
1142
+ AsyncHttpResponse[bool]
1143
+ Successful Response
1144
+ """
1145
+ _response = await self._client_wrapper.httpx_client.request(
1146
+ f"evaluators/configs/{jsonable_encoder(evaluator_config_id)}",
1147
+ method="DELETE",
1148
+ request_options=request_options,
1149
+ )
1150
+ try:
1151
+ if 200 <= _response.status_code < 300:
1152
+ _data = typing.cast(
1153
+ bool,
1154
+ parse_obj_as(
1155
+ type_=bool, # type: ignore
1156
+ object_=_response.json(),
1157
+ ),
1158
+ )
1159
+ return AsyncHttpResponse(response=_response, data=_data)
1160
+ if _response.status_code == 422:
1161
+ raise UnprocessableEntityError(
1162
+ headers=dict(_response.headers),
1163
+ body=typing.cast(
1164
+ HttpValidationError,
1165
+ parse_obj_as(
1166
+ type_=HttpValidationError, # type: ignore
1167
+ object_=_response.json(),
1168
+ ),
1169
+ ),
1170
+ )
1171
+ _response_json = _response.json()
1172
+ except JSONDecodeError:
1173
+ raise ApiError(
1174
+ status_code=_response.status_code,
1175
+ headers=dict(_response.headers),
1176
+ body=_response.text,
1177
+ )
1178
+ raise ApiError(
1179
+ status_code=_response.status_code,
1180
+ headers=dict(_response.headers),
1181
+ body=_response_json,
1182
+ )