agenta 0.12.7__py3-none-any.whl → 0.13.0a0__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 (123) hide show
  1. agenta/__init__.py +3 -2
  2. agenta/cli/helper.py +1 -1
  3. agenta/cli/main.py +1 -1
  4. agenta/cli/variant_commands.py +7 -5
  5. agenta/client/api.py +1 -1
  6. agenta/client/backend/__init__.py +78 -18
  7. agenta/client/backend/client.py +961 -5575
  8. agenta/client/backend/core/api_error.py +1 -3
  9. agenta/client/backend/core/datetime_utils.py +1 -3
  10. agenta/client/backend/core/jsonable_encoder.py +3 -9
  11. agenta/client/backend/resources/__init__.py +20 -0
  12. agenta/client/backend/resources/apps/__init__.py +2 -0
  13. agenta/client/backend/resources/apps/client.py +915 -0
  14. agenta/client/backend/resources/bases/__init__.py +2 -0
  15. agenta/client/backend/resources/bases/client.py +121 -0
  16. agenta/client/backend/resources/configs/__init__.py +2 -0
  17. agenta/client/backend/resources/configs/client.py +333 -0
  18. agenta/client/backend/resources/containers/__init__.py +5 -0
  19. agenta/client/backend/resources/containers/client.py +351 -0
  20. agenta/client/backend/resources/containers/types/__init__.py +5 -0
  21. agenta/client/backend/{types → resources/containers/types}/container_templates_response.py +1 -1
  22. agenta/client/backend/resources/environments/__init__.py +2 -0
  23. agenta/client/backend/resources/environments/client.py +119 -0
  24. agenta/client/backend/resources/evaluations/__init__.py +2 -0
  25. agenta/client/backend/resources/evaluations/client.py +948 -0
  26. agenta/client/backend/resources/evaluators/__init__.py +2 -0
  27. agenta/client/backend/resources/evaluators/client.py +554 -0
  28. agenta/client/backend/resources/observability/__init__.py +2 -0
  29. agenta/client/backend/resources/observability/client.py +1114 -0
  30. agenta/client/backend/resources/testsets/__init__.py +2 -0
  31. agenta/client/backend/resources/testsets/client.py +649 -0
  32. agenta/client/backend/resources/variants/__init__.py +5 -0
  33. agenta/client/backend/resources/variants/client.py +730 -0
  34. agenta/client/backend/resources/variants/types/__init__.py +5 -0
  35. agenta/client/backend/resources/variants/types/add_variant_from_base_and_config_response.py +7 -0
  36. agenta/client/backend/types/__init__.py +54 -22
  37. agenta/client/backend/types/aggregated_result.py +4 -12
  38. agenta/client/backend/types/aggregated_result_evaluator_config.py +7 -0
  39. agenta/client/backend/types/app.py +2 -10
  40. agenta/client/backend/types/{app_variant_output.py → app_variant_response.py} +6 -12
  41. agenta/client/backend/types/app_variant_revision.py +2 -10
  42. agenta/client/backend/types/base_output.py +2 -10
  43. agenta/client/backend/types/body_import_testset.py +2 -10
  44. agenta/client/backend/types/config_db.py +2 -10
  45. agenta/client/backend/types/create_app_output.py +2 -10
  46. agenta/client/backend/types/{trace.py → create_span.py} +21 -20
  47. agenta/client/backend/types/{delete_evaluation.py → create_trace_response.py} +5 -12
  48. agenta/client/backend/types/docker_env_vars.py +2 -10
  49. agenta/client/backend/types/environment_output.py +5 -11
  50. agenta/client/backend/types/environment_output_extended.py +37 -0
  51. agenta/client/backend/types/environment_revision.py +33 -0
  52. agenta/client/backend/types/error.py +29 -0
  53. agenta/client/backend/types/evaluation.py +8 -13
  54. agenta/client/backend/types/evaluation_scenario.py +2 -10
  55. agenta/client/backend/types/evaluation_scenario_input.py +2 -10
  56. agenta/client/backend/types/evaluation_scenario_output.py +6 -12
  57. agenta/client/backend/types/evaluation_scenario_result.py +2 -10
  58. agenta/client/backend/types/evaluation_scenario_score_update.py +28 -0
  59. agenta/client/backend/types/evaluation_status_enum.py +4 -0
  60. agenta/client/backend/types/evaluation_type.py +1 -3
  61. agenta/client/backend/types/evaluation_webhook.py +2 -10
  62. agenta/client/backend/types/evaluator.py +3 -10
  63. agenta/client/backend/types/evaluator_config.py +2 -10
  64. agenta/client/backend/types/feedback.py +2 -10
  65. agenta/client/backend/types/{get_config_reponse.py → get_config_response.py} +4 -12
  66. agenta/client/backend/types/http_validation_error.py +2 -10
  67. agenta/client/backend/types/human_evaluation.py +2 -10
  68. agenta/client/backend/types/human_evaluation_scenario.py +4 -12
  69. agenta/client/backend/types/human_evaluation_scenario_input.py +2 -10
  70. agenta/client/backend/types/human_evaluation_scenario_output.py +2 -10
  71. agenta/client/backend/types/human_evaluation_scenario_update.py +37 -0
  72. agenta/client/backend/types/human_evaluation_update.py +29 -0
  73. agenta/client/backend/types/image.py +3 -10
  74. agenta/client/backend/types/invite_request.py +3 -10
  75. agenta/client/backend/types/{list_api_keys_output.py → list_api_keys_response.py} +3 -11
  76. agenta/client/backend/types/llm_run_rate_limit.py +2 -10
  77. agenta/client/backend/types/llm_tokens.py +30 -0
  78. agenta/client/backend/types/new_human_evaluation.py +34 -0
  79. agenta/client/backend/types/new_testset.py +2 -10
  80. agenta/client/backend/types/organization.py +3 -10
  81. agenta/client/backend/types/organization_output.py +2 -10
  82. agenta/client/backend/types/permission.py +141 -0
  83. agenta/client/backend/types/result.py +4 -10
  84. agenta/client/backend/types/{human_evaluation_scenario_score.py → score.py} +1 -1
  85. agenta/client/backend/types/simple_evaluation_output.py +2 -10
  86. agenta/client/backend/types/span.py +20 -26
  87. agenta/client/backend/types/span_detail.py +44 -0
  88. agenta/client/backend/types/span_kind.py +49 -0
  89. agenta/client/backend/types/span_status_code.py +29 -0
  90. agenta/client/backend/types/span_variant.py +30 -0
  91. agenta/client/backend/types/template.py +2 -10
  92. agenta/client/backend/types/template_image_info.py +2 -10
  93. agenta/client/backend/types/test_set_output_response.py +2 -10
  94. agenta/client/backend/types/test_set_simple_response.py +2 -10
  95. agenta/client/backend/types/trace_detail.py +44 -0
  96. agenta/client/backend/types/uri.py +2 -10
  97. agenta/client/backend/types/validation_error.py +2 -10
  98. agenta/client/backend/types/variant_action.py +2 -10
  99. agenta/client/backend/types/variant_action_enum.py +1 -3
  100. agenta/client/backend/types/with_pagination.py +32 -0
  101. agenta/client/backend/types/workspace_member_response.py +30 -0
  102. agenta/client/backend/types/workspace_permission.py +32 -0
  103. agenta/client/backend/types/workspace_response.py +36 -0
  104. agenta/client/backend/types/workspace_role.py +41 -0
  105. agenta/client/backend/types/workspace_role_response.py +30 -0
  106. agenta/docker/docker_utils.py +1 -5
  107. agenta/sdk/__init__.py +3 -2
  108. agenta/sdk/agenta_decorator.py +68 -26
  109. agenta/sdk/agenta_init.py +50 -20
  110. agenta/sdk/tracing/context_manager.py +13 -0
  111. agenta/sdk/tracing/decorators.py +41 -0
  112. agenta/sdk/tracing/llm_tracing.py +203 -0
  113. agenta/sdk/tracing/logger.py +19 -0
  114. agenta/sdk/tracing/tasks_manager.py +130 -0
  115. agenta/sdk/types.py +0 -38
  116. {agenta-0.12.7.dist-info → agenta-0.13.0a0.dist-info}/METADATA +2 -1
  117. agenta-0.13.0a0.dist-info/RECORD +161 -0
  118. agenta/client/backend/types/add_variant_from_base_and_config_response.py +0 -7
  119. agenta/client/backend/types/app_variant_output_extended.py +0 -50
  120. agenta/client/backend/types/human_evaluation_scenario_update_score.py +0 -5
  121. agenta-0.12.7.dist-info/RECORD +0 -114
  122. {agenta-0.12.7.dist-info → agenta-0.13.0a0.dist-info}/WHEEL +0 -0
  123. {agenta-0.12.7.dist-info → agenta-0.13.0a0.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,2 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
@@ -0,0 +1,554 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ import urllib.parse
5
+ from json.decoder import JSONDecodeError
6
+
7
+ from ...core.api_error import ApiError
8
+ from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
+ from ...core.jsonable_encoder import jsonable_encoder
10
+ from ...core.remove_none_from_dict import remove_none_from_dict
11
+ from ...errors.unprocessable_entity_error import UnprocessableEntityError
12
+ from ...types.evaluator import Evaluator
13
+ from ...types.evaluator_config import EvaluatorConfig
14
+ from ...types.http_validation_error import HttpValidationError
15
+
16
+ try:
17
+ import pydantic.v1 as pydantic # type: ignore
18
+ except ImportError:
19
+ import pydantic # type: ignore
20
+
21
+ # this is used as the default value for optional parameters
22
+ OMIT = typing.cast(typing.Any, ...)
23
+
24
+
25
+ class EvaluatorsClient:
26
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
27
+ self._client_wrapper = client_wrapper
28
+
29
+ def get_evaluators_endpoint(self) -> typing.List[Evaluator]:
30
+ """
31
+ Endpoint to fetch a list of evaluators.
32
+
33
+ Returns:
34
+ List[Evaluator]: A list of evaluator objects.
35
+
36
+ ---
37
+ from agenta.client import AgentaApi
38
+
39
+ client = AgentaApi(
40
+ api_key="YOUR_API_KEY",
41
+ base_url="https://yourhost.com/path/to/api",
42
+ )
43
+ client.evaluators.get_evaluators_endpoint()
44
+ """
45
+ _response = self._client_wrapper.httpx_client.request(
46
+ "GET",
47
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "evaluators"),
48
+ headers=self._client_wrapper.get_headers(),
49
+ timeout=60,
50
+ )
51
+ if 200 <= _response.status_code < 300:
52
+ return pydantic.parse_obj_as(typing.List[Evaluator], _response.json()) # type: ignore
53
+ try:
54
+ _response_json = _response.json()
55
+ except JSONDecodeError:
56
+ raise ApiError(status_code=_response.status_code, body=_response.text)
57
+ raise ApiError(status_code=_response.status_code, body=_response_json)
58
+
59
+ def get_evaluator_configs(self, *, app_id: str) -> typing.List[EvaluatorConfig]:
60
+ """
61
+ Endpoint to fetch evaluator configurations for a specific app.
62
+
63
+ Args:
64
+ app_id (str): The ID of the app.
65
+
66
+ Returns:
67
+ List[EvaluatorConfigDB]: A list of evaluator configuration objects.
68
+
69
+ Parameters:
70
+ - app_id: str.
71
+ ---
72
+ from agenta.client import AgentaApi
73
+
74
+ client = AgentaApi(
75
+ api_key="YOUR_API_KEY",
76
+ base_url="https://yourhost.com/path/to/api",
77
+ )
78
+ client.evaluators.get_evaluator_configs(
79
+ app_id="app_id",
80
+ )
81
+ """
82
+ _response = self._client_wrapper.httpx_client.request(
83
+ "GET",
84
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "evaluators/configs"),
85
+ params=remove_none_from_dict({"app_id": app_id}),
86
+ headers=self._client_wrapper.get_headers(),
87
+ timeout=60,
88
+ )
89
+ if 200 <= _response.status_code < 300:
90
+ return pydantic.parse_obj_as(typing.List[EvaluatorConfig], _response.json()) # type: ignore
91
+ if _response.status_code == 422:
92
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
93
+ try:
94
+ _response_json = _response.json()
95
+ except JSONDecodeError:
96
+ raise ApiError(status_code=_response.status_code, body=_response.text)
97
+ raise ApiError(status_code=_response.status_code, body=_response_json)
98
+
99
+ def create_new_evaluator_config(
100
+ self, *, app_id: str, name: str, evaluator_key: str, settings_values: typing.Dict[str, typing.Any]
101
+ ) -> EvaluatorConfig:
102
+ """
103
+ Endpoint to fetch evaluator configurations for a specific app.
104
+
105
+ Args:
106
+ app_id (str): The ID of the app.
107
+
108
+ Returns:
109
+ EvaluatorConfigDB: Evaluator configuration api model.
110
+
111
+ Parameters:
112
+ - app_id: str.
113
+
114
+ - name: str.
115
+
116
+ - evaluator_key: str.
117
+
118
+ - settings_values: typing.Dict[str, typing.Any].
119
+ ---
120
+ from agenta.client import AgentaApi
121
+
122
+ client = AgentaApi(
123
+ api_key="YOUR_API_KEY",
124
+ base_url="https://yourhost.com/path/to/api",
125
+ )
126
+ client.evaluators.create_new_evaluator_config(
127
+ app_id="app_id",
128
+ name="name",
129
+ evaluator_key="evaluator_key",
130
+ settings_values={},
131
+ )
132
+ """
133
+ _response = self._client_wrapper.httpx_client.request(
134
+ "POST",
135
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "evaluators/configs"),
136
+ json=jsonable_encoder(
137
+ {"app_id": app_id, "name": name, "evaluator_key": evaluator_key, "settings_values": settings_values}
138
+ ),
139
+ headers=self._client_wrapper.get_headers(),
140
+ timeout=60,
141
+ )
142
+ if 200 <= _response.status_code < 300:
143
+ return pydantic.parse_obj_as(EvaluatorConfig, _response.json()) # type: ignore
144
+ if _response.status_code == 422:
145
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
146
+ try:
147
+ _response_json = _response.json()
148
+ except JSONDecodeError:
149
+ raise ApiError(status_code=_response.status_code, body=_response.text)
150
+ raise ApiError(status_code=_response.status_code, body=_response_json)
151
+
152
+ def get_evaluator_config(self, evaluator_config_id: str) -> EvaluatorConfig:
153
+ """
154
+ Endpoint to fetch evaluator configurations for a specific app.
155
+
156
+ Returns:
157
+ List[EvaluatorConfigDB]: A list of evaluator configuration objects.
158
+
159
+ Parameters:
160
+ - evaluator_config_id: str.
161
+ ---
162
+ from agenta.client import AgentaApi
163
+
164
+ client = AgentaApi(
165
+ api_key="YOUR_API_KEY",
166
+ base_url="https://yourhost.com/path/to/api",
167
+ )
168
+ client.evaluators.get_evaluator_config(
169
+ evaluator_config_id="evaluator_config_id",
170
+ )
171
+ """
172
+ _response = self._client_wrapper.httpx_client.request(
173
+ "GET",
174
+ urllib.parse.urljoin(
175
+ f"{self._client_wrapper.get_base_url()}/", f"evaluators/configs/{evaluator_config_id}"
176
+ ),
177
+ headers=self._client_wrapper.get_headers(),
178
+ timeout=60,
179
+ )
180
+ if 200 <= _response.status_code < 300:
181
+ return pydantic.parse_obj_as(EvaluatorConfig, _response.json()) # type: ignore
182
+ if _response.status_code == 422:
183
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
184
+ try:
185
+ _response_json = _response.json()
186
+ except JSONDecodeError:
187
+ raise ApiError(status_code=_response.status_code, body=_response.text)
188
+ raise ApiError(status_code=_response.status_code, body=_response_json)
189
+
190
+ def update_evaluator_config(
191
+ self,
192
+ evaluator_config_id: str,
193
+ *,
194
+ name: typing.Optional[str] = OMIT,
195
+ evaluator_key: typing.Optional[str] = OMIT,
196
+ settings_values: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
197
+ ) -> EvaluatorConfig:
198
+ """
199
+ Endpoint to update evaluator configurations for a specific app.
200
+
201
+ Returns:
202
+ List[EvaluatorConfigDB]: A list of evaluator configuration objects.
203
+
204
+ Parameters:
205
+ - evaluator_config_id: str.
206
+
207
+ - name: typing.Optional[str].
208
+
209
+ - evaluator_key: typing.Optional[str].
210
+
211
+ - settings_values: typing.Optional[typing.Dict[str, typing.Any]].
212
+ ---
213
+ from agenta.client import AgentaApi
214
+
215
+ client = AgentaApi(
216
+ api_key="YOUR_API_KEY",
217
+ base_url="https://yourhost.com/path/to/api",
218
+ )
219
+ client.evaluators.update_evaluator_config(
220
+ evaluator_config_id="evaluator_config_id",
221
+ )
222
+ """
223
+ _request: typing.Dict[str, typing.Any] = {}
224
+ if name is not OMIT:
225
+ _request["name"] = name
226
+ if evaluator_key is not OMIT:
227
+ _request["evaluator_key"] = evaluator_key
228
+ if settings_values is not OMIT:
229
+ _request["settings_values"] = settings_values
230
+ _response = self._client_wrapper.httpx_client.request(
231
+ "PUT",
232
+ urllib.parse.urljoin(
233
+ f"{self._client_wrapper.get_base_url()}/", f"evaluators/configs/{evaluator_config_id}"
234
+ ),
235
+ json=jsonable_encoder(_request),
236
+ headers=self._client_wrapper.get_headers(),
237
+ timeout=60,
238
+ )
239
+ if 200 <= _response.status_code < 300:
240
+ return pydantic.parse_obj_as(EvaluatorConfig, _response.json()) # type: ignore
241
+ if _response.status_code == 422:
242
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
243
+ try:
244
+ _response_json = _response.json()
245
+ except JSONDecodeError:
246
+ raise ApiError(status_code=_response.status_code, body=_response.text)
247
+ raise ApiError(status_code=_response.status_code, body=_response_json)
248
+
249
+ def delete_evaluator_config(self, evaluator_config_id: str) -> bool:
250
+ """
251
+ Endpoint to delete a specific evaluator configuration.
252
+
253
+ Args:
254
+ evaluator_config_id (str): The unique identifier of the evaluator configuration.
255
+
256
+ Returns:
257
+ bool: True if deletion was successful, False otherwise.
258
+
259
+ Parameters:
260
+ - evaluator_config_id: str.
261
+ ---
262
+ from agenta.client import AgentaApi
263
+
264
+ client = AgentaApi(
265
+ api_key="YOUR_API_KEY",
266
+ base_url="https://yourhost.com/path/to/api",
267
+ )
268
+ client.evaluators.delete_evaluator_config(
269
+ evaluator_config_id="evaluator_config_id",
270
+ )
271
+ """
272
+ _response = self._client_wrapper.httpx_client.request(
273
+ "DELETE",
274
+ urllib.parse.urljoin(
275
+ f"{self._client_wrapper.get_base_url()}/", f"evaluators/configs/{evaluator_config_id}"
276
+ ),
277
+ headers=self._client_wrapper.get_headers(),
278
+ timeout=60,
279
+ )
280
+ if 200 <= _response.status_code < 300:
281
+ return pydantic.parse_obj_as(bool, _response.json()) # type: ignore
282
+ if _response.status_code == 422:
283
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
284
+ try:
285
+ _response_json = _response.json()
286
+ except JSONDecodeError:
287
+ raise ApiError(status_code=_response.status_code, body=_response.text)
288
+ raise ApiError(status_code=_response.status_code, body=_response_json)
289
+
290
+
291
+ class AsyncEvaluatorsClient:
292
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
293
+ self._client_wrapper = client_wrapper
294
+
295
+ async def get_evaluators_endpoint(self) -> typing.List[Evaluator]:
296
+ """
297
+ Endpoint to fetch a list of evaluators.
298
+
299
+ Returns:
300
+ List[Evaluator]: A list of evaluator objects.
301
+
302
+ ---
303
+ from agenta.client import AsyncAgentaApi
304
+
305
+ client = AsyncAgentaApi(
306
+ api_key="YOUR_API_KEY",
307
+ base_url="https://yourhost.com/path/to/api",
308
+ )
309
+ await client.evaluators.get_evaluators_endpoint()
310
+ """
311
+ _response = await self._client_wrapper.httpx_client.request(
312
+ "GET",
313
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "evaluators"),
314
+ headers=self._client_wrapper.get_headers(),
315
+ timeout=60,
316
+ )
317
+ if 200 <= _response.status_code < 300:
318
+ return pydantic.parse_obj_as(typing.List[Evaluator], _response.json()) # type: ignore
319
+ try:
320
+ _response_json = _response.json()
321
+ except JSONDecodeError:
322
+ raise ApiError(status_code=_response.status_code, body=_response.text)
323
+ raise ApiError(status_code=_response.status_code, body=_response_json)
324
+
325
+ async def get_evaluator_configs(self, *, app_id: str) -> typing.List[EvaluatorConfig]:
326
+ """
327
+ Endpoint to fetch evaluator configurations for a specific app.
328
+
329
+ Args:
330
+ app_id (str): The ID of the app.
331
+
332
+ Returns:
333
+ List[EvaluatorConfigDB]: A list of evaluator configuration objects.
334
+
335
+ Parameters:
336
+ - app_id: str.
337
+ ---
338
+ from agenta.client import AsyncAgentaApi
339
+
340
+ client = AsyncAgentaApi(
341
+ api_key="YOUR_API_KEY",
342
+ base_url="https://yourhost.com/path/to/api",
343
+ )
344
+ await client.evaluators.get_evaluator_configs(
345
+ app_id="app_id",
346
+ )
347
+ """
348
+ _response = await self._client_wrapper.httpx_client.request(
349
+ "GET",
350
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "evaluators/configs"),
351
+ params=remove_none_from_dict({"app_id": app_id}),
352
+ headers=self._client_wrapper.get_headers(),
353
+ timeout=60,
354
+ )
355
+ if 200 <= _response.status_code < 300:
356
+ return pydantic.parse_obj_as(typing.List[EvaluatorConfig], _response.json()) # type: ignore
357
+ if _response.status_code == 422:
358
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
359
+ try:
360
+ _response_json = _response.json()
361
+ except JSONDecodeError:
362
+ raise ApiError(status_code=_response.status_code, body=_response.text)
363
+ raise ApiError(status_code=_response.status_code, body=_response_json)
364
+
365
+ async def create_new_evaluator_config(
366
+ self, *, app_id: str, name: str, evaluator_key: str, settings_values: typing.Dict[str, typing.Any]
367
+ ) -> EvaluatorConfig:
368
+ """
369
+ Endpoint to fetch evaluator configurations for a specific app.
370
+
371
+ Args:
372
+ app_id (str): The ID of the app.
373
+
374
+ Returns:
375
+ EvaluatorConfigDB: Evaluator configuration api model.
376
+
377
+ Parameters:
378
+ - app_id: str.
379
+
380
+ - name: str.
381
+
382
+ - evaluator_key: str.
383
+
384
+ - settings_values: typing.Dict[str, typing.Any].
385
+ ---
386
+ from agenta.client import AsyncAgentaApi
387
+
388
+ client = AsyncAgentaApi(
389
+ api_key="YOUR_API_KEY",
390
+ base_url="https://yourhost.com/path/to/api",
391
+ )
392
+ await client.evaluators.create_new_evaluator_config(
393
+ app_id="app_id",
394
+ name="name",
395
+ evaluator_key="evaluator_key",
396
+ settings_values={},
397
+ )
398
+ """
399
+ _response = await self._client_wrapper.httpx_client.request(
400
+ "POST",
401
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "evaluators/configs"),
402
+ json=jsonable_encoder(
403
+ {"app_id": app_id, "name": name, "evaluator_key": evaluator_key, "settings_values": settings_values}
404
+ ),
405
+ headers=self._client_wrapper.get_headers(),
406
+ timeout=60,
407
+ )
408
+ if 200 <= _response.status_code < 300:
409
+ return pydantic.parse_obj_as(EvaluatorConfig, _response.json()) # type: ignore
410
+ if _response.status_code == 422:
411
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
412
+ try:
413
+ _response_json = _response.json()
414
+ except JSONDecodeError:
415
+ raise ApiError(status_code=_response.status_code, body=_response.text)
416
+ raise ApiError(status_code=_response.status_code, body=_response_json)
417
+
418
+ async def get_evaluator_config(self, evaluator_config_id: str) -> EvaluatorConfig:
419
+ """
420
+ Endpoint to fetch evaluator configurations for a specific app.
421
+
422
+ Returns:
423
+ List[EvaluatorConfigDB]: A list of evaluator configuration objects.
424
+
425
+ Parameters:
426
+ - evaluator_config_id: str.
427
+ ---
428
+ from agenta.client import AsyncAgentaApi
429
+
430
+ client = AsyncAgentaApi(
431
+ api_key="YOUR_API_KEY",
432
+ base_url="https://yourhost.com/path/to/api",
433
+ )
434
+ await client.evaluators.get_evaluator_config(
435
+ evaluator_config_id="evaluator_config_id",
436
+ )
437
+ """
438
+ _response = await self._client_wrapper.httpx_client.request(
439
+ "GET",
440
+ urllib.parse.urljoin(
441
+ f"{self._client_wrapper.get_base_url()}/", f"evaluators/configs/{evaluator_config_id}"
442
+ ),
443
+ headers=self._client_wrapper.get_headers(),
444
+ timeout=60,
445
+ )
446
+ if 200 <= _response.status_code < 300:
447
+ return pydantic.parse_obj_as(EvaluatorConfig, _response.json()) # type: ignore
448
+ if _response.status_code == 422:
449
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
450
+ try:
451
+ _response_json = _response.json()
452
+ except JSONDecodeError:
453
+ raise ApiError(status_code=_response.status_code, body=_response.text)
454
+ raise ApiError(status_code=_response.status_code, body=_response_json)
455
+
456
+ async def update_evaluator_config(
457
+ self,
458
+ evaluator_config_id: str,
459
+ *,
460
+ name: typing.Optional[str] = OMIT,
461
+ evaluator_key: typing.Optional[str] = OMIT,
462
+ settings_values: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
463
+ ) -> EvaluatorConfig:
464
+ """
465
+ Endpoint to update evaluator configurations for a specific app.
466
+
467
+ Returns:
468
+ List[EvaluatorConfigDB]: A list of evaluator configuration objects.
469
+
470
+ Parameters:
471
+ - evaluator_config_id: str.
472
+
473
+ - name: typing.Optional[str].
474
+
475
+ - evaluator_key: typing.Optional[str].
476
+
477
+ - settings_values: typing.Optional[typing.Dict[str, typing.Any]].
478
+ ---
479
+ from agenta.client import AsyncAgentaApi
480
+
481
+ client = AsyncAgentaApi(
482
+ api_key="YOUR_API_KEY",
483
+ base_url="https://yourhost.com/path/to/api",
484
+ )
485
+ await client.evaluators.update_evaluator_config(
486
+ evaluator_config_id="evaluator_config_id",
487
+ )
488
+ """
489
+ _request: typing.Dict[str, typing.Any] = {}
490
+ if name is not OMIT:
491
+ _request["name"] = name
492
+ if evaluator_key is not OMIT:
493
+ _request["evaluator_key"] = evaluator_key
494
+ if settings_values is not OMIT:
495
+ _request["settings_values"] = settings_values
496
+ _response = await self._client_wrapper.httpx_client.request(
497
+ "PUT",
498
+ urllib.parse.urljoin(
499
+ f"{self._client_wrapper.get_base_url()}/", f"evaluators/configs/{evaluator_config_id}"
500
+ ),
501
+ json=jsonable_encoder(_request),
502
+ headers=self._client_wrapper.get_headers(),
503
+ timeout=60,
504
+ )
505
+ if 200 <= _response.status_code < 300:
506
+ return pydantic.parse_obj_as(EvaluatorConfig, _response.json()) # type: ignore
507
+ if _response.status_code == 422:
508
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
509
+ try:
510
+ _response_json = _response.json()
511
+ except JSONDecodeError:
512
+ raise ApiError(status_code=_response.status_code, body=_response.text)
513
+ raise ApiError(status_code=_response.status_code, body=_response_json)
514
+
515
+ async def delete_evaluator_config(self, evaluator_config_id: str) -> bool:
516
+ """
517
+ Endpoint to delete a specific evaluator configuration.
518
+
519
+ Args:
520
+ evaluator_config_id (str): The unique identifier of the evaluator configuration.
521
+
522
+ Returns:
523
+ bool: True if deletion was successful, False otherwise.
524
+
525
+ Parameters:
526
+ - evaluator_config_id: str.
527
+ ---
528
+ from agenta.client import AsyncAgentaApi
529
+
530
+ client = AsyncAgentaApi(
531
+ api_key="YOUR_API_KEY",
532
+ base_url="https://yourhost.com/path/to/api",
533
+ )
534
+ await client.evaluators.delete_evaluator_config(
535
+ evaluator_config_id="evaluator_config_id",
536
+ )
537
+ """
538
+ _response = await self._client_wrapper.httpx_client.request(
539
+ "DELETE",
540
+ urllib.parse.urljoin(
541
+ f"{self._client_wrapper.get_base_url()}/", f"evaluators/configs/{evaluator_config_id}"
542
+ ),
543
+ headers=self._client_wrapper.get_headers(),
544
+ timeout=60,
545
+ )
546
+ if 200 <= _response.status_code < 300:
547
+ return pydantic.parse_obj_as(bool, _response.json()) # type: ignore
548
+ if _response.status_code == 422:
549
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
550
+ try:
551
+ _response_json = _response.json()
552
+ except JSONDecodeError:
553
+ raise ApiError(status_code=_response.status_code, body=_response.text)
554
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -0,0 +1,2 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+