agenta 0.8.4__py3-none-any.whl → 0.10.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.
- agenta/client/backend/__init__.py +32 -14
- agenta/client/backend/client.py +1462 -654
- agenta/client/backend/types/__init__.py +32 -14
- agenta/client/backend/types/aggregated_result.py +39 -0
- agenta/client/backend/types/app_variant_output.py +0 -1
- agenta/client/backend/types/app_variant_output_extended.py +50 -0
- agenta/client/backend/types/app_variant_revision.py +40 -0
- agenta/client/backend/types/{custom_evaluation_output.py → config_db.py} +3 -5
- agenta/client/backend/types/{custom_evaluation_names.py → delete_evaluation.py} +2 -3
- agenta/client/backend/types/environment_output.py +2 -0
- agenta/client/backend/types/evaluation.py +4 -4
- agenta/client/backend/types/evaluation_scenario.py +2 -3
- agenta/client/backend/types/evaluation_scenario_input.py +3 -2
- agenta/client/backend/types/evaluation_scenario_output.py +2 -2
- agenta/client/backend/types/evaluation_scenario_result.py +38 -0
- agenta/client/backend/types/evaluation_status_enum.py +4 -4
- agenta/client/backend/types/evaluation_type.py +0 -28
- agenta/client/backend/types/evaluator.py +39 -0
- agenta/client/backend/types/{custom_evaluation_detail.py → evaluator_config.py} +4 -4
- agenta/client/backend/types/human_evaluation.py +49 -0
- agenta/client/backend/types/human_evaluation_scenario.py +48 -0
- agenta/client/backend/types/{create_custom_evaluation.py → human_evaluation_scenario_input.py} +3 -4
- agenta/client/backend/types/human_evaluation_scenario_output.py +37 -0
- agenta/client/backend/types/{evaluation_scenario_score.py → human_evaluation_scenario_score.py} +1 -1
- agenta/client/backend/types/{evaluation_scenario_update_score.py → human_evaluation_scenario_update_score.py} +1 -1
- agenta/client/backend/types/llm_run_rate_limit.py +39 -0
- agenta/client/backend/types/result.py +37 -0
- {agenta-0.8.4.dist-info → agenta-0.10.0.dist-info}/METADATA +1 -1
- {agenta-0.8.4.dist-info → agenta-0.10.0.dist-info}/RECORD +31 -22
- agenta/client/backend/types/evaluation_type_settings.py +0 -42
- {agenta-0.8.4.dist-info → agenta-0.10.0.dist-info}/WHEEL +0 -0
- {agenta-0.8.4.dist-info → agenta-0.10.0.dist-info}/entry_points.txt +0 -0
agenta/client/backend/client.py
CHANGED
|
@@ -17,27 +17,29 @@ from .types.add_variant_from_base_and_config_response import (
|
|
|
17
17
|
)
|
|
18
18
|
from .types.app import App
|
|
19
19
|
from .types.app_variant_output import AppVariantOutput
|
|
20
|
+
from .types.app_variant_output_extended import AppVariantOutputExtended
|
|
20
21
|
from .types.base_output import BaseOutput
|
|
21
22
|
from .types.container_templates_response import ContainerTemplatesResponse
|
|
22
23
|
from .types.create_app_output import CreateAppOutput
|
|
23
|
-
from .types.
|
|
24
|
-
from .types.custom_evaluation_detail import CustomEvaluationDetail
|
|
25
|
-
from .types.custom_evaluation_names import CustomEvaluationNames
|
|
26
|
-
from .types.custom_evaluation_output import CustomEvaluationOutput
|
|
24
|
+
from .types.delete_evaluation import DeleteEvaluation
|
|
27
25
|
from .types.docker_env_vars import DockerEnvVars
|
|
28
26
|
from .types.environment_output import EnvironmentOutput
|
|
29
27
|
from .types.evaluation import Evaluation
|
|
30
|
-
from .types.evaluation_scenario import EvaluationScenario
|
|
31
|
-
from .types.evaluation_scenario_input import EvaluationScenarioInput
|
|
32
|
-
from .types.evaluation_scenario_output import EvaluationScenarioOutput
|
|
33
|
-
from .types.evaluation_scenario_update_score import EvaluationScenarioUpdateScore
|
|
34
28
|
from .types.evaluation_status_enum import EvaluationStatusEnum
|
|
35
29
|
from .types.evaluation_type import EvaluationType
|
|
36
|
-
from .types.evaluation_type_settings import EvaluationTypeSettings
|
|
37
30
|
from .types.evaluation_webhook import EvaluationWebhook
|
|
31
|
+
from .types.evaluator import Evaluator
|
|
32
|
+
from .types.evaluator_config import EvaluatorConfig
|
|
38
33
|
from .types.feedback import Feedback
|
|
39
34
|
from .types.get_config_reponse import GetConfigReponse
|
|
40
35
|
from .types.http_validation_error import HttpValidationError
|
|
36
|
+
from .types.human_evaluation import HumanEvaluation
|
|
37
|
+
from .types.human_evaluation_scenario import HumanEvaluationScenario
|
|
38
|
+
from .types.human_evaluation_scenario_input import HumanEvaluationScenarioInput
|
|
39
|
+
from .types.human_evaluation_scenario_output import HumanEvaluationScenarioOutput
|
|
40
|
+
from .types.human_evaluation_scenario_update_score import (
|
|
41
|
+
HumanEvaluationScenarioUpdateScore,
|
|
42
|
+
)
|
|
41
43
|
from .types.image import Image
|
|
42
44
|
from .types.invite_request import InviteRequest
|
|
43
45
|
from .types.list_api_keys_output import ListApiKeysOutput
|
|
@@ -110,6 +112,12 @@ class AgentaApi:
|
|
|
110
112
|
|
|
111
113
|
Returns:
|
|
112
114
|
str: The created API key.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
from agenta.client import AgentaApi
|
|
118
|
+
|
|
119
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
120
|
+
client.create_api_key()
|
|
113
121
|
"""
|
|
114
122
|
_response = self._client_wrapper.httpx_client.request(
|
|
115
123
|
"POST",
|
|
@@ -145,7 +153,7 @@ class AgentaApi:
|
|
|
145
153
|
from agenta.client import AgentaApi
|
|
146
154
|
|
|
147
155
|
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
148
|
-
client.delete_api_key(key_prefix="
|
|
156
|
+
client.delete_api_key(key_prefix="string")
|
|
149
157
|
"""
|
|
150
158
|
_response = self._client_wrapper.httpx_client.request(
|
|
151
159
|
"DELETE",
|
|
@@ -173,6 +181,11 @@ class AgentaApi:
|
|
|
173
181
|
|
|
174
182
|
Parameters:
|
|
175
183
|
- key_prefix: str.
|
|
184
|
+
---
|
|
185
|
+
from agenta.client import AgentaApi
|
|
186
|
+
|
|
187
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
188
|
+
client.validate_api_key(key_prefix="string")
|
|
176
189
|
"""
|
|
177
190
|
_response = self._client_wrapper.httpx_client.request(
|
|
178
191
|
"GET",
|
|
@@ -205,6 +218,11 @@ class AgentaApi:
|
|
|
205
218
|
|
|
206
219
|
Parameters:
|
|
207
220
|
- org_id: str.
|
|
221
|
+
---
|
|
222
|
+
from agenta.client import AgentaApi
|
|
223
|
+
|
|
224
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
225
|
+
client.fetch_organization_details(org_id="string")
|
|
208
226
|
"""
|
|
209
227
|
_response = self._client_wrapper.httpx_client.request(
|
|
210
228
|
"GET",
|
|
@@ -242,6 +260,12 @@ class AgentaApi:
|
|
|
242
260
|
- org_id: str.
|
|
243
261
|
|
|
244
262
|
- request: InviteRequest.
|
|
263
|
+
---
|
|
264
|
+
from agenta import InviteRequest
|
|
265
|
+
from agenta.client import AgentaApi
|
|
266
|
+
|
|
267
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
268
|
+
client.invite_to_org(org_id="string", request=InviteRequest(email="string"))
|
|
245
269
|
"""
|
|
246
270
|
_response = self._client_wrapper.httpx_client.request(
|
|
247
271
|
"POST",
|
|
@@ -279,6 +303,12 @@ class AgentaApi:
|
|
|
279
303
|
- org_id: str.
|
|
280
304
|
|
|
281
305
|
- request: InviteRequest.
|
|
306
|
+
---
|
|
307
|
+
from agenta import InviteRequest
|
|
308
|
+
from agenta.client import AgentaApi
|
|
309
|
+
|
|
310
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
311
|
+
client.resend_invitation(org_id="string", request=InviteRequest(email="string"))
|
|
282
312
|
"""
|
|
283
313
|
_response = self._client_wrapper.httpx_client.request(
|
|
284
314
|
"POST",
|
|
@@ -316,6 +346,11 @@ class AgentaApi:
|
|
|
316
346
|
- org_id: str.
|
|
317
347
|
|
|
318
348
|
- token: str.
|
|
349
|
+
---
|
|
350
|
+
from agenta.client import AgentaApi
|
|
351
|
+
|
|
352
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
353
|
+
client.add_user_to_org(org_id="string", token="string")
|
|
319
354
|
"""
|
|
320
355
|
_response = self._client_wrapper.httpx_client.request(
|
|
321
356
|
"POST",
|
|
@@ -341,6 +376,12 @@ class AgentaApi:
|
|
|
341
376
|
"""
|
|
342
377
|
Parameters:
|
|
343
378
|
- request: Organization.
|
|
379
|
+
---
|
|
380
|
+
from agenta import Organization
|
|
381
|
+
from agenta.client import AgentaApi
|
|
382
|
+
|
|
383
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
384
|
+
client.create_organization(request=Organization(name="string", owner="string"))
|
|
344
385
|
"""
|
|
345
386
|
_response = self._client_wrapper.httpx_client.request(
|
|
346
387
|
"POST",
|
|
@@ -375,6 +416,11 @@ class AgentaApi:
|
|
|
375
416
|
- name: typing.Optional[str].
|
|
376
417
|
|
|
377
418
|
- description: typing.Optional[str].
|
|
419
|
+
---
|
|
420
|
+
from agenta.client import AgentaApi
|
|
421
|
+
|
|
422
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
423
|
+
client.update_organization(org_id="string")
|
|
378
424
|
"""
|
|
379
425
|
_request: typing.Dict[str, typing.Any] = {}
|
|
380
426
|
if name is not OMIT:
|
|
@@ -402,6 +448,12 @@ class AgentaApi:
|
|
|
402
448
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
403
449
|
|
|
404
450
|
def health_check(self) -> typing.Any:
|
|
451
|
+
"""
|
|
452
|
+
from agenta.client import AgentaApi
|
|
453
|
+
|
|
454
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
455
|
+
client.health_check()
|
|
456
|
+
"""
|
|
405
457
|
_response = self._client_wrapper.httpx_client.request(
|
|
406
458
|
"GET",
|
|
407
459
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "health"),
|
|
@@ -417,6 +469,12 @@ class AgentaApi:
|
|
|
417
469
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
418
470
|
|
|
419
471
|
def user_profile(self) -> typing.Any:
|
|
472
|
+
"""
|
|
473
|
+
from agenta.client import AgentaApi
|
|
474
|
+
|
|
475
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
476
|
+
client.user_profile()
|
|
477
|
+
"""
|
|
420
478
|
_response = self._client_wrapper.httpx_client.request(
|
|
421
479
|
"GET",
|
|
422
480
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "profile"),
|
|
@@ -448,7 +506,7 @@ class AgentaApi:
|
|
|
448
506
|
from agenta.client import AgentaApi
|
|
449
507
|
|
|
450
508
|
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
451
|
-
client.list_app_variants(app_id="
|
|
509
|
+
client.list_app_variants(app_id="string")
|
|
452
510
|
"""
|
|
453
511
|
_response = self._client_wrapper.httpx_client.request(
|
|
454
512
|
"GET",
|
|
@@ -468,47 +526,6 @@ class AgentaApi:
|
|
|
468
526
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
469
527
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
470
528
|
|
|
471
|
-
def get_variant_by_env(self, *, app_id: str, environment: str) -> AppVariantOutput:
|
|
472
|
-
"""
|
|
473
|
-
Retrieve the app variant based on the provided app_id and environment.
|
|
474
|
-
|
|
475
|
-
Args:
|
|
476
|
-
app_id (str): The ID of the app to retrieve the variant for.
|
|
477
|
-
environment (str): The environment of the app variant to retrieve.
|
|
478
|
-
stoken_session (SessionContainer, optional): The session token container. Defaults to Depends(verify_session()).
|
|
479
|
-
|
|
480
|
-
Raises:
|
|
481
|
-
HTTPException: If the app variant is not found (status_code=500), or if a ValueError is raised (status_code=400), or if any other exception is raised (status_code=500).
|
|
482
|
-
|
|
483
|
-
Returns:
|
|
484
|
-
AppVariantOutput: The retrieved app variant.
|
|
485
|
-
|
|
486
|
-
Parameters:
|
|
487
|
-
- app_id: str.
|
|
488
|
-
|
|
489
|
-
- environment: str.
|
|
490
|
-
"""
|
|
491
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
492
|
-
"GET",
|
|
493
|
-
urllib.parse.urljoin(
|
|
494
|
-
f"{self._client_wrapper.get_base_url()}/", "apps/get_variant_by_env"
|
|
495
|
-
),
|
|
496
|
-
params=remove_none_from_dict(
|
|
497
|
-
{"app_id": app_id, "environment": environment}
|
|
498
|
-
),
|
|
499
|
-
headers=self._client_wrapper.get_headers(),
|
|
500
|
-
timeout=60,
|
|
501
|
-
)
|
|
502
|
-
if 200 <= _response.status_code < 300:
|
|
503
|
-
return pydantic.parse_obj_as(AppVariantOutput, _response.json()) # type: ignore
|
|
504
|
-
if _response.status_code == 422:
|
|
505
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
506
|
-
try:
|
|
507
|
-
_response_json = _response.json()
|
|
508
|
-
except JSONDecodeError:
|
|
509
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
510
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
511
|
-
|
|
512
529
|
def list_apps(
|
|
513
530
|
self,
|
|
514
531
|
*,
|
|
@@ -576,6 +593,11 @@ class AgentaApi:
|
|
|
576
593
|
- app_name: str.
|
|
577
594
|
|
|
578
595
|
- organization_id: typing.Optional[str].
|
|
596
|
+
---
|
|
597
|
+
from agenta.client import AgentaApi
|
|
598
|
+
|
|
599
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
600
|
+
client.create_app(app_name="string")
|
|
579
601
|
"""
|
|
580
602
|
_request: typing.Dict[str, typing.Any] = {"app_name": app_name}
|
|
581
603
|
if organization_id is not OMIT:
|
|
@@ -633,6 +655,11 @@ class AgentaApi:
|
|
|
633
655
|
- base_name: typing.Optional[str].
|
|
634
656
|
|
|
635
657
|
- config_name: typing.Optional[str].
|
|
658
|
+
---
|
|
659
|
+
from agenta.client import AgentaApi
|
|
660
|
+
|
|
661
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
662
|
+
client.add_variant_from_image(app_id="string", variant_name="string", docker_id="string", tags="string")
|
|
636
663
|
"""
|
|
637
664
|
_request: typing.Dict[str, typing.Any] = {
|
|
638
665
|
"variant_name": variant_name,
|
|
@@ -672,6 +699,11 @@ class AgentaApi:
|
|
|
672
699
|
|
|
673
700
|
Parameters:
|
|
674
701
|
- app_id: str.
|
|
702
|
+
---
|
|
703
|
+
from agenta.client import AgentaApi
|
|
704
|
+
|
|
705
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
706
|
+
client.remove_app(app_id="string")
|
|
675
707
|
"""
|
|
676
708
|
_response = self._client_wrapper.httpx_client.request(
|
|
677
709
|
"DELETE",
|
|
@@ -720,6 +752,11 @@ class AgentaApi:
|
|
|
720
752
|
- env_vars: typing.Dict[str, str].
|
|
721
753
|
|
|
722
754
|
- organization_id: typing.Optional[str].
|
|
755
|
+
---
|
|
756
|
+
from agenta.client import AgentaApi
|
|
757
|
+
|
|
758
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
759
|
+
client.create_app_and_variant_from_template(app_name="string", template_id="string", env_vars={"string": "string"})
|
|
723
760
|
"""
|
|
724
761
|
_request: typing.Dict[str, typing.Any] = {
|
|
725
762
|
"app_name": app_name,
|
|
@@ -765,7 +802,7 @@ class AgentaApi:
|
|
|
765
802
|
from agenta.client import AgentaApi
|
|
766
803
|
|
|
767
804
|
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
768
|
-
client.list_environments(app_id="
|
|
805
|
+
client.list_environments(app_id="string")
|
|
769
806
|
"""
|
|
770
807
|
_response = self._client_wrapper.httpx_client.request(
|
|
771
808
|
"GET",
|
|
@@ -842,6 +879,34 @@ class AgentaApi:
|
|
|
842
879
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
843
880
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
844
881
|
|
|
882
|
+
def get_variant(self, variant_id: str) -> AppVariantOutputExtended:
|
|
883
|
+
"""
|
|
884
|
+
Parameters:
|
|
885
|
+
- variant_id: str.
|
|
886
|
+
---
|
|
887
|
+
from agenta.client import AgentaApi
|
|
888
|
+
|
|
889
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
890
|
+
client.get_variant(variant_id="string")
|
|
891
|
+
"""
|
|
892
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
893
|
+
"GET",
|
|
894
|
+
urllib.parse.urljoin(
|
|
895
|
+
f"{self._client_wrapper.get_base_url()}/", f"variants/{variant_id}"
|
|
896
|
+
),
|
|
897
|
+
headers=self._client_wrapper.get_headers(),
|
|
898
|
+
timeout=60,
|
|
899
|
+
)
|
|
900
|
+
if 200 <= _response.status_code < 300:
|
|
901
|
+
return pydantic.parse_obj_as(AppVariantOutputExtended, _response.json()) # type: ignore
|
|
902
|
+
if _response.status_code == 422:
|
|
903
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
904
|
+
try:
|
|
905
|
+
_response_json = _response.json()
|
|
906
|
+
except JSONDecodeError:
|
|
907
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
908
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
909
|
+
|
|
845
910
|
def start_variant(
|
|
846
911
|
self,
|
|
847
912
|
variant_id: str,
|
|
@@ -870,6 +935,16 @@ class AgentaApi:
|
|
|
870
935
|
- action: VariantAction.
|
|
871
936
|
|
|
872
937
|
- env_vars: typing.Optional[DockerEnvVars].
|
|
938
|
+
---
|
|
939
|
+
from agenta import DockerEnvVars, VariantAction, VariantActionEnum
|
|
940
|
+
from agenta.client import AgentaApi
|
|
941
|
+
|
|
942
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
943
|
+
client.start_variant(
|
|
944
|
+
variant_id="string",
|
|
945
|
+
action=VariantAction(action=VariantActionEnum.START),
|
|
946
|
+
env_vars=DockerEnvVars(env_vars={"string": "string"}),
|
|
947
|
+
)
|
|
873
948
|
"""
|
|
874
949
|
_request: typing.Dict[str, typing.Any] = {"action": action}
|
|
875
950
|
if env_vars is not OMIT:
|
|
@@ -906,6 +981,11 @@ class AgentaApi:
|
|
|
906
981
|
|
|
907
982
|
Parameters:
|
|
908
983
|
- variant_id: str.
|
|
984
|
+
---
|
|
985
|
+
from agenta.client import AgentaApi
|
|
986
|
+
|
|
987
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
988
|
+
client.remove_variant(variant_id="string")
|
|
909
989
|
"""
|
|
910
990
|
_response = self._client_wrapper.httpx_client.request(
|
|
911
991
|
"DELETE",
|
|
@@ -946,6 +1026,11 @@ class AgentaApi:
|
|
|
946
1026
|
- variant_id: str.
|
|
947
1027
|
|
|
948
1028
|
- parameters: typing.Dict[str, typing.Any].
|
|
1029
|
+
---
|
|
1030
|
+
from agenta.client import AgentaApi
|
|
1031
|
+
|
|
1032
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1033
|
+
client.update_variant_parameters(variant_id="string", parameters={"string": {"unknown": "string", "type": "unknown"}})
|
|
949
1034
|
"""
|
|
950
1035
|
_response = self._client_wrapper.httpx_client.request(
|
|
951
1036
|
"PUT",
|
|
@@ -985,6 +1070,12 @@ class AgentaApi:
|
|
|
985
1070
|
- variant_id: str.
|
|
986
1071
|
|
|
987
1072
|
- request: Image.
|
|
1073
|
+
---
|
|
1074
|
+
from agenta import Image
|
|
1075
|
+
from agenta.client import AgentaApi
|
|
1076
|
+
|
|
1077
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1078
|
+
client.update_variant_image(variant_id="string", request=Image(docker_id="string", tags="string"))
|
|
988
1079
|
"""
|
|
989
1080
|
_response = self._client_wrapper.httpx_client.request(
|
|
990
1081
|
"PUT",
|
|
@@ -1006,7 +1097,9 @@ class AgentaApi:
|
|
|
1006
1097
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1007
1098
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1008
1099
|
|
|
1009
|
-
def
|
|
1100
|
+
def fetch_list_evaluations_evaluations_get(
|
|
1101
|
+
self, *, app_id: str
|
|
1102
|
+
) -> typing.List[Evaluation]:
|
|
1010
1103
|
"""
|
|
1011
1104
|
Fetches a list of evaluations, optionally filtered by an app ID.
|
|
1012
1105
|
|
|
@@ -1022,7 +1115,7 @@ class AgentaApi:
|
|
|
1022
1115
|
from agenta.client import AgentaApi
|
|
1023
1116
|
|
|
1024
1117
|
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1025
|
-
client.
|
|
1118
|
+
client.fetch_list_evaluations_evaluations_get(app_id="string")
|
|
1026
1119
|
"""
|
|
1027
1120
|
_response = self._client_wrapper.httpx_client.request(
|
|
1028
1121
|
"GET",
|
|
@@ -1049,7 +1142,6 @@ class AgentaApi:
|
|
|
1049
1142
|
app_id: str,
|
|
1050
1143
|
variant_ids: typing.List[str],
|
|
1051
1144
|
evaluation_type: EvaluationType,
|
|
1052
|
-
evaluation_type_settings: typing.Optional[EvaluationTypeSettings] = OMIT,
|
|
1053
1145
|
inputs: typing.List[str],
|
|
1054
1146
|
testset_id: str,
|
|
1055
1147
|
status: str,
|
|
@@ -1068,30 +1160,40 @@ class AgentaApi:
|
|
|
1068
1160
|
|
|
1069
1161
|
- evaluation_type: EvaluationType.
|
|
1070
1162
|
|
|
1071
|
-
- evaluation_type_settings: typing.Optional[EvaluationTypeSettings].
|
|
1072
|
-
|
|
1073
1163
|
- inputs: typing.List[str].
|
|
1074
1164
|
|
|
1075
1165
|
- testset_id: str.
|
|
1076
1166
|
|
|
1077
1167
|
- status: str.
|
|
1168
|
+
---
|
|
1169
|
+
from agenta import EvaluationType
|
|
1170
|
+
from agenta.client import AgentaApi
|
|
1171
|
+
|
|
1172
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1173
|
+
client.create_evaluation(
|
|
1174
|
+
app_id="string",
|
|
1175
|
+
variant_ids=[],
|
|
1176
|
+
evaluation_type=EvaluationType.HUMAN_A_B_TESTING,
|
|
1177
|
+
inputs=[],
|
|
1178
|
+
testset_id="string",
|
|
1179
|
+
status="string",
|
|
1180
|
+
)
|
|
1078
1181
|
"""
|
|
1079
|
-
_request: typing.Dict[str, typing.Any] = {
|
|
1080
|
-
"app_id": app_id,
|
|
1081
|
-
"variant_ids": variant_ids,
|
|
1082
|
-
"evaluation_type": evaluation_type,
|
|
1083
|
-
"inputs": inputs,
|
|
1084
|
-
"testset_id": testset_id,
|
|
1085
|
-
"status": status,
|
|
1086
|
-
}
|
|
1087
|
-
if evaluation_type_settings is not OMIT:
|
|
1088
|
-
_request["evaluation_type_settings"] = evaluation_type_settings
|
|
1089
1182
|
_response = self._client_wrapper.httpx_client.request(
|
|
1090
1183
|
"POST",
|
|
1091
1184
|
urllib.parse.urljoin(
|
|
1092
|
-
f"{self._client_wrapper.get_base_url()}/", "evaluations"
|
|
1185
|
+
f"{self._client_wrapper.get_base_url()}/", "human-evaluations"
|
|
1186
|
+
),
|
|
1187
|
+
json=jsonable_encoder(
|
|
1188
|
+
{
|
|
1189
|
+
"app_id": app_id,
|
|
1190
|
+
"variant_ids": variant_ids,
|
|
1191
|
+
"evaluation_type": evaluation_type,
|
|
1192
|
+
"inputs": inputs,
|
|
1193
|
+
"testset_id": testset_id,
|
|
1194
|
+
"status": status,
|
|
1195
|
+
}
|
|
1093
1196
|
),
|
|
1094
|
-
json=jsonable_encoder(_request),
|
|
1095
1197
|
headers=self._client_wrapper.get_headers(),
|
|
1096
1198
|
timeout=60,
|
|
1097
1199
|
)
|
|
@@ -1105,9 +1207,7 @@ class AgentaApi:
|
|
|
1105
1207
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1106
1208
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1107
1209
|
|
|
1108
|
-
def delete_evaluations(
|
|
1109
|
-
self, *, evaluations_ids: typing.List[str]
|
|
1110
|
-
) -> typing.List[str]:
|
|
1210
|
+
def delete_evaluations(self, *, request: DeleteEvaluation) -> typing.List[str]:
|
|
1111
1211
|
"""
|
|
1112
1212
|
Delete specific comparison tables based on their unique IDs.
|
|
1113
1213
|
|
|
@@ -1118,19 +1218,20 @@ class AgentaApi:
|
|
|
1118
1218
|
A list of the deleted comparison tables' IDs.
|
|
1119
1219
|
|
|
1120
1220
|
Parameters:
|
|
1121
|
-
-
|
|
1221
|
+
- request: DeleteEvaluation.
|
|
1122
1222
|
---
|
|
1223
|
+
from agenta import DeleteEvaluation
|
|
1123
1224
|
from agenta.client import AgentaApi
|
|
1124
1225
|
|
|
1125
1226
|
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1126
|
-
client.delete_evaluations(evaluations_ids=[])
|
|
1227
|
+
client.delete_evaluations(request=DeleteEvaluation(evaluations_ids=[]))
|
|
1127
1228
|
"""
|
|
1128
1229
|
_response = self._client_wrapper.httpx_client.request(
|
|
1129
1230
|
"DELETE",
|
|
1130
1231
|
urllib.parse.urljoin(
|
|
1131
1232
|
f"{self._client_wrapper.get_base_url()}/", "evaluations"
|
|
1132
1233
|
),
|
|
1133
|
-
json=jsonable_encoder(
|
|
1234
|
+
json=jsonable_encoder(request),
|
|
1134
1235
|
headers=self._client_wrapper.get_headers(),
|
|
1135
1236
|
timeout=60,
|
|
1136
1237
|
)
|
|
@@ -1144,30 +1245,36 @@ class AgentaApi:
|
|
|
1144
1245
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1145
1246
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1146
1247
|
|
|
1147
|
-
def
|
|
1248
|
+
def fetch_evaluation_status(self, evaluation_id: str) -> typing.Any:
|
|
1148
1249
|
"""
|
|
1149
|
-
Fetches
|
|
1250
|
+
Fetches the status of the evaluation.
|
|
1150
1251
|
|
|
1151
1252
|
Args:
|
|
1152
|
-
evaluation_id (str):
|
|
1253
|
+
evaluation_id (str): the evaluation id
|
|
1254
|
+
request (Request): the request object
|
|
1153
1255
|
|
|
1154
1256
|
Returns:
|
|
1155
|
-
|
|
1257
|
+
(str): the evaluation status
|
|
1156
1258
|
|
|
1157
1259
|
Parameters:
|
|
1158
1260
|
- evaluation_id: str.
|
|
1261
|
+
---
|
|
1262
|
+
from agenta.client import AgentaApi
|
|
1263
|
+
|
|
1264
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1265
|
+
client.fetch_evaluation_status(evaluation_id="string")
|
|
1159
1266
|
"""
|
|
1160
1267
|
_response = self._client_wrapper.httpx_client.request(
|
|
1161
1268
|
"GET",
|
|
1162
1269
|
urllib.parse.urljoin(
|
|
1163
1270
|
f"{self._client_wrapper.get_base_url()}/",
|
|
1164
|
-
f"evaluations/{evaluation_id}",
|
|
1271
|
+
f"evaluations/{evaluation_id}/status",
|
|
1165
1272
|
),
|
|
1166
1273
|
headers=self._client_wrapper.get_headers(),
|
|
1167
1274
|
timeout=60,
|
|
1168
1275
|
)
|
|
1169
1276
|
if 200 <= _response.status_code < 300:
|
|
1170
|
-
return pydantic.parse_obj_as(
|
|
1277
|
+
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
1171
1278
|
if _response.status_code == 422:
|
|
1172
1279
|
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1173
1280
|
try:
|
|
@@ -1176,41 +1283,31 @@ class AgentaApi:
|
|
|
1176
1283
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1177
1284
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1178
1285
|
|
|
1179
|
-
def
|
|
1180
|
-
self,
|
|
1181
|
-
evaluation_id: str,
|
|
1182
|
-
*,
|
|
1183
|
-
status: typing.Optional[EvaluationStatusEnum] = OMIT,
|
|
1184
|
-
evaluation_type_settings: typing.Optional[EvaluationTypeSettings] = OMIT,
|
|
1185
|
-
) -> typing.Any:
|
|
1286
|
+
def fetch_evaluation_results(self, evaluation_id: str) -> typing.Any:
|
|
1186
1287
|
"""
|
|
1187
|
-
|
|
1288
|
+
Fetches the results of the evaluation
|
|
1188
1289
|
|
|
1189
|
-
|
|
1190
|
-
|
|
1290
|
+
Args:
|
|
1291
|
+
evaluation_id (str): the evaluation id
|
|
1292
|
+
request (Request): the request object
|
|
1191
1293
|
|
|
1192
1294
|
Returns:
|
|
1193
|
-
|
|
1295
|
+
_type_: _description_
|
|
1194
1296
|
|
|
1195
1297
|
Parameters:
|
|
1196
1298
|
- evaluation_id: str.
|
|
1299
|
+
---
|
|
1300
|
+
from agenta.client import AgentaApi
|
|
1197
1301
|
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
- evaluation_type_settings: typing.Optional[EvaluationTypeSettings].
|
|
1302
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1303
|
+
client.fetch_evaluation_results(evaluation_id="string")
|
|
1201
1304
|
"""
|
|
1202
|
-
_request: typing.Dict[str, typing.Any] = {}
|
|
1203
|
-
if status is not OMIT:
|
|
1204
|
-
_request["status"] = status
|
|
1205
|
-
if evaluation_type_settings is not OMIT:
|
|
1206
|
-
_request["evaluation_type_settings"] = evaluation_type_settings
|
|
1207
1305
|
_response = self._client_wrapper.httpx_client.request(
|
|
1208
|
-
"
|
|
1306
|
+
"GET",
|
|
1209
1307
|
urllib.parse.urljoin(
|
|
1210
1308
|
f"{self._client_wrapper.get_base_url()}/",
|
|
1211
|
-
f"evaluations/{evaluation_id}",
|
|
1309
|
+
f"evaluations/{evaluation_id}/results",
|
|
1212
1310
|
),
|
|
1213
|
-
json=jsonable_encoder(_request),
|
|
1214
1311
|
headers=self._client_wrapper.get_headers(),
|
|
1215
1312
|
timeout=60,
|
|
1216
1313
|
)
|
|
@@ -1226,7 +1323,7 @@ class AgentaApi:
|
|
|
1226
1323
|
|
|
1227
1324
|
def fetch_evaluation_scenarios(
|
|
1228
1325
|
self, evaluation_id: str
|
|
1229
|
-
) -> typing.List[
|
|
1326
|
+
) -> typing.List[HumanEvaluationScenario]:
|
|
1230
1327
|
"""
|
|
1231
1328
|
Fetches evaluation scenarios for a given evaluation ID.
|
|
1232
1329
|
|
|
@@ -1245,19 +1342,19 @@ class AgentaApi:
|
|
|
1245
1342
|
from agenta.client import AgentaApi
|
|
1246
1343
|
|
|
1247
1344
|
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1248
|
-
client.fetch_evaluation_scenarios(evaluation_id="
|
|
1345
|
+
client.fetch_evaluation_scenarios(evaluation_id="string")
|
|
1249
1346
|
"""
|
|
1250
1347
|
_response = self._client_wrapper.httpx_client.request(
|
|
1251
1348
|
"GET",
|
|
1252
1349
|
urllib.parse.urljoin(
|
|
1253
1350
|
f"{self._client_wrapper.get_base_url()}/",
|
|
1254
|
-
f"evaluations/{evaluation_id}/evaluation_scenarios",
|
|
1351
|
+
f"human-evaluations/{evaluation_id}/evaluation_scenarios",
|
|
1255
1352
|
),
|
|
1256
1353
|
headers=self._client_wrapper.get_headers(),
|
|
1257
1354
|
timeout=60,
|
|
1258
1355
|
)
|
|
1259
1356
|
if 200 <= _response.status_code < 300:
|
|
1260
|
-
return pydantic.parse_obj_as(typing.List[
|
|
1357
|
+
return pydantic.parse_obj_as(typing.List[HumanEvaluationScenario], _response.json()) # type: ignore
|
|
1261
1358
|
if _response.status_code == 422:
|
|
1262
1359
|
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1263
1360
|
try:
|
|
@@ -1266,35 +1363,35 @@ class AgentaApi:
|
|
|
1266
1363
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1267
1364
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1268
1365
|
|
|
1269
|
-
def
|
|
1270
|
-
self, evaluation_id: str, *, request: EvaluationScenario
|
|
1271
|
-
) -> typing.Any:
|
|
1366
|
+
def fetch_evaluation(self, evaluation_id: str) -> Evaluation:
|
|
1272
1367
|
"""
|
|
1273
|
-
|
|
1368
|
+
Fetches a single evaluation based on its ID.
|
|
1274
1369
|
|
|
1275
|
-
|
|
1276
|
-
|
|
1370
|
+
Args:
|
|
1371
|
+
evaluation_id (str): The ID of the evaluation to fetch.
|
|
1277
1372
|
|
|
1278
1373
|
Returns:
|
|
1279
|
-
|
|
1374
|
+
Evaluation: The fetched evaluation.
|
|
1280
1375
|
|
|
1281
1376
|
Parameters:
|
|
1282
1377
|
- evaluation_id: str.
|
|
1378
|
+
---
|
|
1379
|
+
from agenta.client import AgentaApi
|
|
1283
1380
|
|
|
1284
|
-
|
|
1381
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1382
|
+
client.fetch_evaluation(evaluation_id="string")
|
|
1285
1383
|
"""
|
|
1286
1384
|
_response = self._client_wrapper.httpx_client.request(
|
|
1287
|
-
"
|
|
1385
|
+
"GET",
|
|
1288
1386
|
urllib.parse.urljoin(
|
|
1289
1387
|
f"{self._client_wrapper.get_base_url()}/",
|
|
1290
|
-
f"evaluations/{evaluation_id}
|
|
1388
|
+
f"evaluations/{evaluation_id}",
|
|
1291
1389
|
),
|
|
1292
|
-
json=jsonable_encoder(request),
|
|
1293
1390
|
headers=self._client_wrapper.get_headers(),
|
|
1294
1391
|
timeout=60,
|
|
1295
1392
|
)
|
|
1296
1393
|
if 200 <= _response.status_code < 300:
|
|
1297
|
-
return pydantic.parse_obj_as(
|
|
1394
|
+
return pydantic.parse_obj_as(Evaluation, _response.json()) # type: ignore
|
|
1298
1395
|
if _response.status_code == 422:
|
|
1299
1396
|
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1300
1397
|
try:
|
|
@@ -1303,72 +1400,66 @@ class AgentaApi:
|
|
|
1303
1400
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1304
1401
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1305
1402
|
|
|
1306
|
-
def
|
|
1307
|
-
self,
|
|
1308
|
-
evaluation_id: str,
|
|
1309
|
-
evaluation_scenario_id: str,
|
|
1310
|
-
evaluation_type: EvaluationType,
|
|
1311
|
-
*,
|
|
1312
|
-
vote: typing.Optional[str] = OMIT,
|
|
1313
|
-
score: typing.Optional[EvaluationScenarioUpdateScore] = OMIT,
|
|
1314
|
-
correct_answer: typing.Optional[str] = OMIT,
|
|
1315
|
-
outputs: typing.Optional[typing.List[EvaluationScenarioOutput]] = OMIT,
|
|
1316
|
-
inputs: typing.Optional[typing.List[EvaluationScenarioInput]] = OMIT,
|
|
1317
|
-
is_pinned: typing.Optional[bool] = OMIT,
|
|
1318
|
-
note: typing.Optional[str] = OMIT,
|
|
1319
|
-
) -> typing.Any:
|
|
1403
|
+
def webhook_example_fake(self) -> EvaluationWebhook:
|
|
1320
1404
|
"""
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
Raises:
|
|
1324
|
-
HTTPException: If update fails or unauthorized.
|
|
1405
|
+
Returns a fake score response for example webhook evaluation
|
|
1325
1406
|
|
|
1326
1407
|
Returns:
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
Parameters:
|
|
1330
|
-
- evaluation_id: str.
|
|
1408
|
+
_description_
|
|
1331
1409
|
|
|
1332
|
-
|
|
1410
|
+
---
|
|
1411
|
+
from agenta.client import AgentaApi
|
|
1333
1412
|
|
|
1334
|
-
|
|
1413
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1414
|
+
client.webhook_example_fake()
|
|
1415
|
+
"""
|
|
1416
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1417
|
+
"POST",
|
|
1418
|
+
urllib.parse.urljoin(
|
|
1419
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
1420
|
+
"evaluations/webhook_example_fake",
|
|
1421
|
+
),
|
|
1422
|
+
headers=self._client_wrapper.get_headers(),
|
|
1423
|
+
timeout=60,
|
|
1424
|
+
)
|
|
1425
|
+
if 200 <= _response.status_code < 300:
|
|
1426
|
+
return pydantic.parse_obj_as(EvaluationWebhook, _response.json()) # type: ignore
|
|
1427
|
+
try:
|
|
1428
|
+
_response_json = _response.json()
|
|
1429
|
+
except JSONDecodeError:
|
|
1430
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1431
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1335
1432
|
|
|
1336
|
-
|
|
1433
|
+
def fetch_evaluation_scenarios_evaluations_evaluation_scenarios_comparison_results_get(
|
|
1434
|
+
self, *, evaluations_ids: str
|
|
1435
|
+
) -> typing.Any:
|
|
1436
|
+
"""
|
|
1437
|
+
Fetches evaluation scenarios for a given evaluation ID.
|
|
1337
1438
|
|
|
1338
|
-
|
|
1439
|
+
Arguments:
|
|
1440
|
+
evaluation_id (str): The ID of the evaluation for which to fetch scenarios.
|
|
1339
1441
|
|
|
1340
|
-
|
|
1442
|
+
Raises:
|
|
1443
|
+
HTTPException: If the evaluation is not found or access is denied.
|
|
1341
1444
|
|
|
1342
|
-
|
|
1445
|
+
Returns:
|
|
1446
|
+
List[EvaluationScenario]: A list of evaluation scenarios.
|
|
1343
1447
|
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1448
|
+
Parameters:
|
|
1449
|
+
- evaluations_ids: str.
|
|
1450
|
+
---
|
|
1451
|
+
from agenta.client import AgentaApi
|
|
1347
1452
|
|
|
1348
|
-
|
|
1453
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1454
|
+
client.fetch_evaluation_scenarios_evaluations_evaluation_scenarios_comparison_results_get(evaluations_ids="string")
|
|
1349
1455
|
"""
|
|
1350
|
-
_request: typing.Dict[str, typing.Any] = {}
|
|
1351
|
-
if vote is not OMIT:
|
|
1352
|
-
_request["vote"] = vote
|
|
1353
|
-
if score is not OMIT:
|
|
1354
|
-
_request["score"] = score
|
|
1355
|
-
if correct_answer is not OMIT:
|
|
1356
|
-
_request["correct_answer"] = correct_answer
|
|
1357
|
-
if outputs is not OMIT:
|
|
1358
|
-
_request["outputs"] = outputs
|
|
1359
|
-
if inputs is not OMIT:
|
|
1360
|
-
_request["inputs"] = inputs
|
|
1361
|
-
if is_pinned is not OMIT:
|
|
1362
|
-
_request["is_pinned"] = is_pinned
|
|
1363
|
-
if note is not OMIT:
|
|
1364
|
-
_request["note"] = note
|
|
1365
1456
|
_response = self._client_wrapper.httpx_client.request(
|
|
1366
|
-
"
|
|
1457
|
+
"GET",
|
|
1367
1458
|
urllib.parse.urljoin(
|
|
1368
1459
|
f"{self._client_wrapper.get_base_url()}/",
|
|
1369
|
-
|
|
1460
|
+
"evaluations/evaluation_scenarios/comparison-results",
|
|
1370
1461
|
),
|
|
1371
|
-
|
|
1462
|
+
params=remove_none_from_dict({"evaluations_ids": evaluations_ids}),
|
|
1372
1463
|
headers=self._client_wrapper.get_headers(),
|
|
1373
1464
|
timeout=60,
|
|
1374
1465
|
)
|
|
@@ -1382,65 +1473,37 @@ class AgentaApi:
|
|
|
1382
1473
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1383
1474
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1384
1475
|
|
|
1385
|
-
def
|
|
1386
|
-
self,
|
|
1387
|
-
|
|
1388
|
-
correct_answer: str,
|
|
1389
|
-
llm_app_prompt_template: typing.Optional[str] = OMIT,
|
|
1390
|
-
inputs: typing.List[EvaluationScenarioInput],
|
|
1391
|
-
outputs: typing.List[EvaluationScenarioOutput],
|
|
1392
|
-
evaluation_prompt_template: typing.Optional[str] = OMIT,
|
|
1393
|
-
open_ai_key: typing.Optional[str] = OMIT,
|
|
1394
|
-
) -> str:
|
|
1476
|
+
def fetch_list_human_evaluations_human_evaluations_get(
|
|
1477
|
+
self, *, app_id: str
|
|
1478
|
+
) -> typing.List[HumanEvaluation]:
|
|
1395
1479
|
"""
|
|
1396
|
-
|
|
1480
|
+
Fetches a list of evaluations, optionally filtered by an app ID.
|
|
1397
1481
|
|
|
1398
1482
|
Args:
|
|
1399
|
-
|
|
1400
|
-
stoken_session (SessionContainer): The session container verified by `verify_session`.
|
|
1483
|
+
app_id (Optional[str]): An optional app ID to filter the evaluations.
|
|
1401
1484
|
|
|
1402
1485
|
Returns:
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
Raises:
|
|
1406
|
-
HTTPException: If any exception occurs during the evaluation.
|
|
1486
|
+
List[HumanEvaluation]: A list of evaluations.
|
|
1407
1487
|
|
|
1408
1488
|
Parameters:
|
|
1409
|
-
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
- inputs: typing.List[EvaluationScenarioInput].
|
|
1414
|
-
|
|
1415
|
-
- outputs: typing.List[EvaluationScenarioOutput].
|
|
1416
|
-
|
|
1417
|
-
- evaluation_prompt_template: typing.Optional[str].
|
|
1489
|
+
- app_id: str.
|
|
1490
|
+
---
|
|
1491
|
+
from agenta.client import AgentaApi
|
|
1418
1492
|
|
|
1419
|
-
|
|
1493
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1494
|
+
client.fetch_list_human_evaluations_human_evaluations_get(app_id="string")
|
|
1420
1495
|
"""
|
|
1421
|
-
_request: typing.Dict[str, typing.Any] = {
|
|
1422
|
-
"correct_answer": correct_answer,
|
|
1423
|
-
"inputs": inputs,
|
|
1424
|
-
"outputs": outputs,
|
|
1425
|
-
}
|
|
1426
|
-
if llm_app_prompt_template is not OMIT:
|
|
1427
|
-
_request["llm_app_prompt_template"] = llm_app_prompt_template
|
|
1428
|
-
if evaluation_prompt_template is not OMIT:
|
|
1429
|
-
_request["evaluation_prompt_template"] = evaluation_prompt_template
|
|
1430
|
-
if open_ai_key is not OMIT:
|
|
1431
|
-
_request["open_ai_key"] = open_ai_key
|
|
1432
1496
|
_response = self._client_wrapper.httpx_client.request(
|
|
1433
|
-
"
|
|
1497
|
+
"GET",
|
|
1434
1498
|
urllib.parse.urljoin(
|
|
1435
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
1436
|
-
"evaluations/evaluation_scenario/ai_critique",
|
|
1499
|
+
f"{self._client_wrapper.get_base_url()}/", "human-evaluations"
|
|
1437
1500
|
),
|
|
1438
|
-
|
|
1501
|
+
params=remove_none_from_dict({"app_id": app_id}),
|
|
1439
1502
|
headers=self._client_wrapper.get_headers(),
|
|
1440
1503
|
timeout=60,
|
|
1441
1504
|
)
|
|
1442
1505
|
if 200 <= _response.status_code < 300:
|
|
1443
|
-
return pydantic.parse_obj_as(
|
|
1506
|
+
return pydantic.parse_obj_as(typing.List[HumanEvaluation], _response.json()) # type: ignore
|
|
1444
1507
|
if _response.status_code == 422:
|
|
1445
1508
|
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1446
1509
|
try:
|
|
@@ -1449,38 +1512,38 @@ class AgentaApi:
|
|
|
1449
1512
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1450
1513
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1451
1514
|
|
|
1452
|
-
def
|
|
1453
|
-
self,
|
|
1454
|
-
) -> typing.
|
|
1515
|
+
def delete_evaluations_human_evaluations_delete(
|
|
1516
|
+
self, *, request: DeleteEvaluation
|
|
1517
|
+
) -> typing.List[str]:
|
|
1455
1518
|
"""
|
|
1456
|
-
|
|
1519
|
+
Delete specific comparison tables based on their unique IDs.
|
|
1457
1520
|
|
|
1458
1521
|
Args:
|
|
1459
|
-
|
|
1460
|
-
stoken_session: Session data, verified by `verify_session`.
|
|
1522
|
+
delete_evaluations (List[str]): The unique identifiers of the comparison tables to delete.
|
|
1461
1523
|
|
|
1462
1524
|
Returns:
|
|
1463
|
-
|
|
1525
|
+
A list of the deleted comparison tables' IDs.
|
|
1464
1526
|
|
|
1465
1527
|
Parameters:
|
|
1466
|
-
-
|
|
1528
|
+
- request: DeleteEvaluation.
|
|
1467
1529
|
---
|
|
1530
|
+
from agenta import DeleteEvaluation
|
|
1468
1531
|
from agenta.client import AgentaApi
|
|
1469
1532
|
|
|
1470
1533
|
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1471
|
-
client.
|
|
1534
|
+
client.delete_evaluations_human_evaluations_delete(request=DeleteEvaluation(evaluations_ids=[]))
|
|
1472
1535
|
"""
|
|
1473
1536
|
_response = self._client_wrapper.httpx_client.request(
|
|
1474
|
-
"
|
|
1537
|
+
"DELETE",
|
|
1475
1538
|
urllib.parse.urljoin(
|
|
1476
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
1477
|
-
f"evaluations/evaluation_scenario/{evaluation_scenario_id}/score",
|
|
1539
|
+
f"{self._client_wrapper.get_base_url()}/", "human-evaluations"
|
|
1478
1540
|
),
|
|
1541
|
+
json=jsonable_encoder(request),
|
|
1479
1542
|
headers=self._client_wrapper.get_headers(),
|
|
1480
1543
|
timeout=60,
|
|
1481
1544
|
)
|
|
1482
1545
|
if 200 <= _response.status_code < 300:
|
|
1483
|
-
return pydantic.parse_obj_as(typing.
|
|
1546
|
+
return pydantic.parse_obj_as(typing.List[str], _response.json()) # type: ignore
|
|
1484
1547
|
if _response.status_code == 422:
|
|
1485
1548
|
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1486
1549
|
try:
|
|
@@ -1489,35 +1552,37 @@ class AgentaApi:
|
|
|
1489
1552
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1490
1553
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1491
1554
|
|
|
1492
|
-
def
|
|
1493
|
-
self,
|
|
1494
|
-
) ->
|
|
1555
|
+
def fetch_human_evaluation_human_evaluations_evaluation_id_get(
|
|
1556
|
+
self, evaluation_id: str
|
|
1557
|
+
) -> HumanEvaluation:
|
|
1495
1558
|
"""
|
|
1496
|
-
|
|
1559
|
+
Fetches a single evaluation based on its ID.
|
|
1497
1560
|
|
|
1498
|
-
|
|
1499
|
-
|
|
1561
|
+
Args:
|
|
1562
|
+
evaluation_id (str): The ID of the evaluation to fetch.
|
|
1500
1563
|
|
|
1501
1564
|
Returns:
|
|
1502
|
-
|
|
1565
|
+
HumanEvaluation: The fetched evaluation.
|
|
1503
1566
|
|
|
1504
1567
|
Parameters:
|
|
1505
|
-
-
|
|
1568
|
+
- evaluation_id: str.
|
|
1569
|
+
---
|
|
1570
|
+
from agenta.client import AgentaApi
|
|
1506
1571
|
|
|
1507
|
-
|
|
1572
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1573
|
+
client.fetch_human_evaluation_human_evaluations_evaluation_id_get(evaluation_id="string")
|
|
1508
1574
|
"""
|
|
1509
1575
|
_response = self._client_wrapper.httpx_client.request(
|
|
1510
|
-
"
|
|
1576
|
+
"GET",
|
|
1511
1577
|
urllib.parse.urljoin(
|
|
1512
1578
|
f"{self._client_wrapper.get_base_url()}/",
|
|
1513
|
-
f"evaluations/
|
|
1579
|
+
f"human-evaluations/{evaluation_id}",
|
|
1514
1580
|
),
|
|
1515
|
-
json=jsonable_encoder({"score": score}),
|
|
1516
1581
|
headers=self._client_wrapper.get_headers(),
|
|
1517
1582
|
timeout=60,
|
|
1518
1583
|
)
|
|
1519
1584
|
if 200 <= _response.status_code < 300:
|
|
1520
|
-
return pydantic.parse_obj_as(
|
|
1585
|
+
return pydantic.parse_obj_as(HumanEvaluation, _response.json()) # type: ignore
|
|
1521
1586
|
if _response.status_code == 422:
|
|
1522
1587
|
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1523
1588
|
try:
|
|
@@ -1526,25 +1591,42 @@ class AgentaApi:
|
|
|
1526
1591
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1527
1592
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1528
1593
|
|
|
1529
|
-
def
|
|
1594
|
+
def update_human_evaluation(
|
|
1595
|
+
self,
|
|
1596
|
+
evaluation_id: str,
|
|
1597
|
+
*,
|
|
1598
|
+
status: typing.Optional[EvaluationStatusEnum] = OMIT,
|
|
1599
|
+
) -> typing.Any:
|
|
1530
1600
|
"""
|
|
1531
|
-
|
|
1601
|
+
Updates an evaluation's status.
|
|
1532
1602
|
|
|
1533
|
-
|
|
1534
|
-
|
|
1603
|
+
Raises:
|
|
1604
|
+
HTTPException: If the columns in the test set do not match with the inputs in the variant.
|
|
1535
1605
|
|
|
1536
1606
|
Returns:
|
|
1537
|
-
|
|
1607
|
+
None: A 204 No Content status code, indicating that the update was successful.
|
|
1538
1608
|
|
|
1539
1609
|
Parameters:
|
|
1540
1610
|
- evaluation_id: str.
|
|
1611
|
+
|
|
1612
|
+
- status: typing.Optional[EvaluationStatusEnum].
|
|
1613
|
+
---
|
|
1614
|
+
from agenta import EvaluationStatusEnum
|
|
1615
|
+
from agenta.client import AgentaApi
|
|
1616
|
+
|
|
1617
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1618
|
+
client.update_human_evaluation(evaluation_id="string", status=EvaluationStatusEnum.EVALUATION_INITIALIZED)
|
|
1541
1619
|
"""
|
|
1620
|
+
_request: typing.Dict[str, typing.Any] = {}
|
|
1621
|
+
if status is not OMIT:
|
|
1622
|
+
_request["status"] = status
|
|
1542
1623
|
_response = self._client_wrapper.httpx_client.request(
|
|
1543
|
-
"
|
|
1624
|
+
"PUT",
|
|
1544
1625
|
urllib.parse.urljoin(
|
|
1545
1626
|
f"{self._client_wrapper.get_base_url()}/",
|
|
1546
|
-
f"evaluations/{evaluation_id}
|
|
1627
|
+
f"human-evaluations/{evaluation_id}",
|
|
1547
1628
|
),
|
|
1629
|
+
json=jsonable_encoder(_request),
|
|
1548
1630
|
headers=self._client_wrapper.get_headers(),
|
|
1549
1631
|
timeout=60,
|
|
1550
1632
|
)
|
|
@@ -1558,26 +1640,84 @@ class AgentaApi:
|
|
|
1558
1640
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1559
1641
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1560
1642
|
|
|
1561
|
-
def
|
|
1562
|
-
self,
|
|
1643
|
+
def update_evaluation_scenario_router_human_evaluations_evaluation_id_evaluation_scenario_evaluation_scenario_id_evaluation_type_put(
|
|
1644
|
+
self,
|
|
1645
|
+
evaluation_id: str,
|
|
1646
|
+
evaluation_scenario_id: str,
|
|
1647
|
+
evaluation_type: EvaluationType,
|
|
1648
|
+
*,
|
|
1649
|
+
vote: typing.Optional[str] = OMIT,
|
|
1650
|
+
score: typing.Optional[HumanEvaluationScenarioUpdateScore] = OMIT,
|
|
1651
|
+
correct_answer: typing.Optional[str] = OMIT,
|
|
1652
|
+
outputs: typing.Optional[typing.List[HumanEvaluationScenarioOutput]] = OMIT,
|
|
1653
|
+
inputs: typing.Optional[typing.List[HumanEvaluationScenarioInput]] = OMIT,
|
|
1654
|
+
is_pinned: typing.Optional[bool] = OMIT,
|
|
1655
|
+
note: typing.Optional[str] = OMIT,
|
|
1563
1656
|
) -> typing.Any:
|
|
1564
1657
|
"""
|
|
1565
|
-
|
|
1658
|
+
Updates an evaluation scenario's vote or score based on its type.
|
|
1566
1659
|
|
|
1567
|
-
|
|
1660
|
+
Raises:
|
|
1661
|
+
HTTPException: If update fails or unauthorized.
|
|
1568
1662
|
|
|
1569
|
-
|
|
1663
|
+
Returns:
|
|
1664
|
+
None: 204 No Content status code upon successful update.
|
|
1570
1665
|
|
|
1571
1666
|
Parameters:
|
|
1572
|
-
-
|
|
1667
|
+
- evaluation_id: str.
|
|
1668
|
+
|
|
1669
|
+
- evaluation_scenario_id: str.
|
|
1670
|
+
|
|
1671
|
+
- evaluation_type: EvaluationType.
|
|
1672
|
+
|
|
1673
|
+
- vote: typing.Optional[str].
|
|
1674
|
+
|
|
1675
|
+
- score: typing.Optional[HumanEvaluationScenarioUpdateScore].
|
|
1676
|
+
|
|
1677
|
+
- correct_answer: typing.Optional[str].
|
|
1678
|
+
|
|
1679
|
+
- outputs: typing.Optional[typing.List[HumanEvaluationScenarioOutput]].
|
|
1680
|
+
|
|
1681
|
+
- inputs: typing.Optional[typing.List[HumanEvaluationScenarioInput]].
|
|
1682
|
+
|
|
1683
|
+
- is_pinned: typing.Optional[bool].
|
|
1684
|
+
|
|
1685
|
+
- note: typing.Optional[str].
|
|
1686
|
+
---
|
|
1687
|
+
from agenta import EvaluationType, HumanEvaluationScenarioInput, HumanEvaluationScenarioOutput
|
|
1688
|
+
from agenta.client import AgentaApi
|
|
1689
|
+
|
|
1690
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1691
|
+
client.update_evaluation_scenario_router_human_evaluations_evaluation_id_evaluation_scenario_evaluation_scenario_id_evaluation_type_put(
|
|
1692
|
+
evaluation_id="string",
|
|
1693
|
+
evaluation_scenario_id="string",
|
|
1694
|
+
evaluation_type=EvaluationType.HUMAN_A_B_TESTING,
|
|
1695
|
+
outputs=[HumanEvaluationScenarioOutput(variant_id="string", variant_output="string")],
|
|
1696
|
+
inputs=[HumanEvaluationScenarioInput(input_name="string", input_value="string")],
|
|
1697
|
+
)
|
|
1573
1698
|
"""
|
|
1699
|
+
_request: typing.Dict[str, typing.Any] = {}
|
|
1700
|
+
if vote is not OMIT:
|
|
1701
|
+
_request["vote"] = vote
|
|
1702
|
+
if score is not OMIT:
|
|
1703
|
+
_request["score"] = score
|
|
1704
|
+
if correct_answer is not OMIT:
|
|
1705
|
+
_request["correct_answer"] = correct_answer
|
|
1706
|
+
if outputs is not OMIT:
|
|
1707
|
+
_request["outputs"] = outputs
|
|
1708
|
+
if inputs is not OMIT:
|
|
1709
|
+
_request["inputs"] = inputs
|
|
1710
|
+
if is_pinned is not OMIT:
|
|
1711
|
+
_request["is_pinned"] = is_pinned
|
|
1712
|
+
if note is not OMIT:
|
|
1713
|
+
_request["note"] = note
|
|
1574
1714
|
_response = self._client_wrapper.httpx_client.request(
|
|
1575
|
-
"
|
|
1715
|
+
"PUT",
|
|
1576
1716
|
urllib.parse.urljoin(
|
|
1577
1717
|
f"{self._client_wrapper.get_base_url()}/",
|
|
1578
|
-
"evaluations/
|
|
1718
|
+
f"human-evaluations/{evaluation_id}/evaluation_scenario/{evaluation_scenario_id}/{evaluation_type}",
|
|
1579
1719
|
),
|
|
1580
|
-
json=jsonable_encoder(
|
|
1720
|
+
json=jsonable_encoder(_request),
|
|
1581
1721
|
headers=self._client_wrapper.get_headers(),
|
|
1582
1722
|
timeout=60,
|
|
1583
1723
|
)
|
|
@@ -1591,30 +1731,40 @@ class AgentaApi:
|
|
|
1591
1731
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1592
1732
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1593
1733
|
|
|
1594
|
-
def
|
|
1734
|
+
def get_evaluation_scenario_score_router_human_evaluations_evaluation_scenario_evaluation_scenario_id_score_get(
|
|
1735
|
+
self, evaluation_scenario_id: str
|
|
1736
|
+
) -> typing.Dict[str, str]:
|
|
1595
1737
|
"""
|
|
1596
|
-
|
|
1738
|
+
Fetch the score of a specific evaluation scenario.
|
|
1597
1739
|
|
|
1598
1740
|
Args:
|
|
1599
|
-
|
|
1741
|
+
evaluation_scenario_id: The ID of the evaluation scenario to fetch.
|
|
1742
|
+
stoken_session: Session data, verified by `verify_session`.
|
|
1600
1743
|
|
|
1601
1744
|
Returns:
|
|
1602
|
-
|
|
1745
|
+
Dictionary containing the scenario ID and its score.
|
|
1603
1746
|
|
|
1604
1747
|
Parameters:
|
|
1605
|
-
-
|
|
1748
|
+
- evaluation_scenario_id: str.
|
|
1749
|
+
---
|
|
1750
|
+
from agenta.client import AgentaApi
|
|
1751
|
+
|
|
1752
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1753
|
+
client.get_evaluation_scenario_score_router_human_evaluations_evaluation_scenario_evaluation_scenario_id_score_get(
|
|
1754
|
+
evaluation_scenario_id="string"
|
|
1755
|
+
)
|
|
1606
1756
|
"""
|
|
1607
1757
|
_response = self._client_wrapper.httpx_client.request(
|
|
1608
1758
|
"GET",
|
|
1609
1759
|
urllib.parse.urljoin(
|
|
1610
1760
|
f"{self._client_wrapper.get_base_url()}/",
|
|
1611
|
-
f"evaluations/
|
|
1761
|
+
f"human-evaluations/evaluation_scenario/{evaluation_scenario_id}/score",
|
|
1612
1762
|
),
|
|
1613
1763
|
headers=self._client_wrapper.get_headers(),
|
|
1614
1764
|
timeout=60,
|
|
1615
1765
|
)
|
|
1616
1766
|
if 200 <= _response.status_code < 300:
|
|
1617
|
-
return pydantic.parse_obj_as(
|
|
1767
|
+
return pydantic.parse_obj_as(typing.Dict[str, str], _response.json()) # type: ignore
|
|
1618
1768
|
if _response.status_code == 422:
|
|
1619
1769
|
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1620
1770
|
try:
|
|
@@ -1623,28 +1773,37 @@ class AgentaApi:
|
|
|
1623
1773
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1624
1774
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1625
1775
|
|
|
1626
|
-
def
|
|
1627
|
-
self,
|
|
1776
|
+
def update_evaluation_scenario_score_router_human_evaluations_evaluation_scenario_evaluation_scenario_id_score_put(
|
|
1777
|
+
self, evaluation_scenario_id: str, *, score: float
|
|
1628
1778
|
) -> typing.Any:
|
|
1629
1779
|
"""
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1780
|
+
Updates the score of an evaluation scenario.
|
|
1781
|
+
|
|
1782
|
+
Raises:
|
|
1783
|
+
HTTPException: Server error if the evaluation update fails.
|
|
1784
|
+
|
|
1785
|
+
Returns:
|
|
1786
|
+
None: 204 No Content status code upon successful update.
|
|
1635
1787
|
|
|
1636
1788
|
Parameters:
|
|
1637
|
-
-
|
|
1789
|
+
- evaluation_scenario_id: str.
|
|
1790
|
+
|
|
1791
|
+
- score: float.
|
|
1792
|
+
---
|
|
1793
|
+
from agenta.client import AgentaApi
|
|
1638
1794
|
|
|
1639
|
-
|
|
1795
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1796
|
+
client.update_evaluation_scenario_score_router_human_evaluations_evaluation_scenario_evaluation_scenario_id_score_put(
|
|
1797
|
+
evaluation_scenario_id="string", score=1.1
|
|
1798
|
+
)
|
|
1640
1799
|
"""
|
|
1641
1800
|
_response = self._client_wrapper.httpx_client.request(
|
|
1642
1801
|
"PUT",
|
|
1643
1802
|
urllib.parse.urljoin(
|
|
1644
1803
|
f"{self._client_wrapper.get_base_url()}/",
|
|
1645
|
-
f"evaluations/
|
|
1804
|
+
f"human-evaluations/evaluation_scenario/{evaluation_scenario_id}/score",
|
|
1646
1805
|
),
|
|
1647
|
-
json=jsonable_encoder(
|
|
1806
|
+
json=jsonable_encoder({"score": score}),
|
|
1648
1807
|
headers=self._client_wrapper.get_headers(),
|
|
1649
1808
|
timeout=60,
|
|
1650
1809
|
)
|
|
@@ -1658,37 +1817,35 @@ class AgentaApi:
|
|
|
1658
1817
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1659
1818
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1660
1819
|
|
|
1661
|
-
def
|
|
1662
|
-
self, app_id: str
|
|
1663
|
-
) -> typing.List[CustomEvaluationOutput]:
|
|
1820
|
+
def fetch_results(self, evaluation_id: str) -> typing.Any:
|
|
1664
1821
|
"""
|
|
1665
|
-
|
|
1822
|
+
Fetch all the results for one the comparison table
|
|
1666
1823
|
|
|
1667
|
-
|
|
1668
|
-
|
|
1824
|
+
Arguments:
|
|
1825
|
+
evaluation*id -- \_description*
|
|
1669
1826
|
|
|
1670
1827
|
Returns:
|
|
1671
|
-
|
|
1828
|
+
_description_
|
|
1672
1829
|
|
|
1673
1830
|
Parameters:
|
|
1674
|
-
-
|
|
1831
|
+
- evaluation_id: str.
|
|
1675
1832
|
---
|
|
1676
1833
|
from agenta.client import AgentaApi
|
|
1677
1834
|
|
|
1678
1835
|
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1679
|
-
client.
|
|
1836
|
+
client.fetch_results(evaluation_id="string")
|
|
1680
1837
|
"""
|
|
1681
1838
|
_response = self._client_wrapper.httpx_client.request(
|
|
1682
1839
|
"GET",
|
|
1683
1840
|
urllib.parse.urljoin(
|
|
1684
1841
|
f"{self._client_wrapper.get_base_url()}/",
|
|
1685
|
-
f"evaluations/
|
|
1842
|
+
f"human-evaluations/{evaluation_id}/results",
|
|
1686
1843
|
),
|
|
1687
1844
|
headers=self._client_wrapper.get_headers(),
|
|
1688
1845
|
timeout=60,
|
|
1689
1846
|
)
|
|
1690
1847
|
if 200 <= _response.status_code < 300:
|
|
1691
|
-
return pydantic.parse_obj_as(typing.
|
|
1848
|
+
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
1692
1849
|
if _response.status_code == 422:
|
|
1693
1850
|
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1694
1851
|
try:
|
|
@@ -1697,37 +1854,66 @@ class AgentaApi:
|
|
|
1697
1854
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1698
1855
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1699
1856
|
|
|
1700
|
-
def
|
|
1701
|
-
|
|
1702
|
-
|
|
1857
|
+
def get_evaluators_endpoint_evaluators_get(self) -> typing.List[Evaluator]:
|
|
1858
|
+
"""
|
|
1859
|
+
Endpoint to fetch a list of evaluators.
|
|
1860
|
+
|
|
1861
|
+
Returns:
|
|
1862
|
+
List[Evaluator]: A list of evaluator objects.
|
|
1863
|
+
|
|
1864
|
+
---
|
|
1865
|
+
from agenta.client import AgentaApi
|
|
1866
|
+
|
|
1867
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1868
|
+
client.get_evaluators_endpoint_evaluators_get()
|
|
1869
|
+
"""
|
|
1870
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1871
|
+
"GET",
|
|
1872
|
+
urllib.parse.urljoin(
|
|
1873
|
+
f"{self._client_wrapper.get_base_url()}/", "evaluators"
|
|
1874
|
+
),
|
|
1875
|
+
headers=self._client_wrapper.get_headers(),
|
|
1876
|
+
timeout=60,
|
|
1877
|
+
)
|
|
1878
|
+
if 200 <= _response.status_code < 300:
|
|
1879
|
+
return pydantic.parse_obj_as(typing.List[Evaluator], _response.json()) # type: ignore
|
|
1880
|
+
try:
|
|
1881
|
+
_response_json = _response.json()
|
|
1882
|
+
except JSONDecodeError:
|
|
1883
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1884
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1885
|
+
|
|
1886
|
+
def get_evaluator_configs_evaluators_configs_get(
|
|
1887
|
+
self, *, app_id: str
|
|
1888
|
+
) -> typing.List[EvaluatorConfig]:
|
|
1703
1889
|
"""
|
|
1704
|
-
|
|
1890
|
+
Endpoint to fetch evaluator configurations for a specific app.
|
|
1705
1891
|
|
|
1706
1892
|
Args:
|
|
1707
|
-
|
|
1893
|
+
app_id (str): The ID of the app.
|
|
1708
1894
|
|
|
1709
1895
|
Returns:
|
|
1710
|
-
List[
|
|
1896
|
+
List[EvaluatorConfigDB]: A list of evaluator configuration objects.
|
|
1711
1897
|
|
|
1712
1898
|
Parameters:
|
|
1713
|
-
-
|
|
1899
|
+
- app_id: str.
|
|
1714
1900
|
---
|
|
1715
1901
|
from agenta.client import AgentaApi
|
|
1716
1902
|
|
|
1717
1903
|
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1718
|
-
client.
|
|
1904
|
+
client.get_evaluator_configs_evaluators_configs_get(app_id="string")
|
|
1719
1905
|
"""
|
|
1720
1906
|
_response = self._client_wrapper.httpx_client.request(
|
|
1721
1907
|
"GET",
|
|
1722
1908
|
urllib.parse.urljoin(
|
|
1723
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
1724
|
-
f"evaluations/custom_evaluation/{app_name}/names",
|
|
1909
|
+
f"{self._client_wrapper.get_base_url()}/", "evaluators/configs"
|
|
1725
1910
|
),
|
|
1911
|
+
params=remove_none_from_dict({"app_id": app_id}),
|
|
1726
1912
|
headers=self._client_wrapper.get_headers(),
|
|
1727
1913
|
timeout=60,
|
|
1728
1914
|
)
|
|
1729
1915
|
if 200 <= _response.status_code < 300:
|
|
1730
|
-
return pydantic.parse_obj_as(typing.List[
|
|
1916
|
+
return pydantic.parse_obj_as(typing.List[EvaluatorConfig], _response.json()) # type: ignore
|
|
1731
1917
|
if _response.status_code == 422:
|
|
1732
1918
|
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1733
1919
|
try:
|
|
@@ -1736,59 +1922,60 @@ class AgentaApi:
|
|
|
1736
1922
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1737
1923
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1738
1924
|
|
|
1739
|
-
def
|
|
1925
|
+
def create_new_evaluator_config_evaluators_configs_post(
|
|
1740
1926
|
self,
|
|
1741
|
-
evaluation_id: str,
|
|
1742
1927
|
*,
|
|
1743
|
-
inputs: typing.List[typing.Dict[str, typing.Any]],
|
|
1744
1928
|
app_id: str,
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
) ->
|
|
1929
|
+
name: str,
|
|
1930
|
+
evaluator_key: str,
|
|
1931
|
+
settings_values: typing.Dict[str, typing.Any],
|
|
1932
|
+
) -> EvaluatorConfig:
|
|
1749
1933
|
"""
|
|
1750
|
-
|
|
1934
|
+
Endpoint to fetch evaluator configurations for a specific app.
|
|
1751
1935
|
|
|
1752
1936
|
Args:
|
|
1753
|
-
|
|
1754
|
-
payload (ExecuteCustomEvaluationCode): the required payload
|
|
1937
|
+
app_id (str): The ID of the app.
|
|
1755
1938
|
|
|
1756
1939
|
Returns:
|
|
1757
|
-
|
|
1940
|
+
EvaluatorConfigDB: Evaluator configuration api model.
|
|
1758
1941
|
|
|
1759
1942
|
Parameters:
|
|
1760
|
-
- evaluation_id: str.
|
|
1761
|
-
|
|
1762
|
-
- inputs: typing.List[typing.Dict[str, typing.Any]].
|
|
1763
|
-
|
|
1764
1943
|
- app_id: str.
|
|
1765
1944
|
|
|
1766
|
-
-
|
|
1945
|
+
- name: str.
|
|
1946
|
+
|
|
1947
|
+
- evaluator_key: str.
|
|
1767
1948
|
|
|
1768
|
-
-
|
|
1949
|
+
- settings_values: typing.Dict[str, typing.Any].
|
|
1950
|
+
---
|
|
1951
|
+
from agenta.client import AgentaApi
|
|
1769
1952
|
|
|
1770
|
-
|
|
1953
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
1954
|
+
client.create_new_evaluator_config_evaluators_configs_post(
|
|
1955
|
+
app_id="string",
|
|
1956
|
+
name="string",
|
|
1957
|
+
evaluator_key="string",
|
|
1958
|
+
settings_values={"string": {"unknown": "string", "type": "unknown"}},
|
|
1959
|
+
)
|
|
1771
1960
|
"""
|
|
1772
1961
|
_response = self._client_wrapper.httpx_client.request(
|
|
1773
1962
|
"POST",
|
|
1774
1963
|
urllib.parse.urljoin(
|
|
1775
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
1776
|
-
f"evaluations/custom_evaluation/execute/{evaluation_id}",
|
|
1964
|
+
f"{self._client_wrapper.get_base_url()}/", "evaluators/configs"
|
|
1777
1965
|
),
|
|
1778
1966
|
json=jsonable_encoder(
|
|
1779
1967
|
{
|
|
1780
|
-
"inputs": inputs,
|
|
1781
1968
|
"app_id": app_id,
|
|
1782
|
-
"
|
|
1783
|
-
"
|
|
1784
|
-
"
|
|
1969
|
+
"name": name,
|
|
1970
|
+
"evaluator_key": evaluator_key,
|
|
1971
|
+
"settings_values": settings_values,
|
|
1785
1972
|
}
|
|
1786
1973
|
),
|
|
1787
1974
|
headers=self._client_wrapper.get_headers(),
|
|
1788
1975
|
timeout=60,
|
|
1789
1976
|
)
|
|
1790
1977
|
if 200 <= _response.status_code < 300:
|
|
1791
|
-
return pydantic.parse_obj_as(
|
|
1978
|
+
return pydantic.parse_obj_as(EvaluatorConfig, _response.json()) # type: ignore
|
|
1792
1979
|
if _response.status_code == 422:
|
|
1793
1980
|
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1794
1981
|
try:
|
|
@@ -1797,24 +1984,130 @@ class AgentaApi:
|
|
|
1797
1984
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1798
1985
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1799
1986
|
|
|
1800
|
-
def
|
|
1987
|
+
def get_evaluator_config_evaluators_configs_evaluator_config_id_get(
|
|
1988
|
+
self, evaluator_config_id: str
|
|
1989
|
+
) -> EvaluatorConfig:
|
|
1801
1990
|
"""
|
|
1802
|
-
|
|
1991
|
+
Endpoint to fetch evaluator configurations for a specific app.
|
|
1803
1992
|
|
|
1804
1993
|
Returns:
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1994
|
+
List[EvaluatorConfigDB]: A list of evaluator configuration objects.
|
|
1995
|
+
|
|
1996
|
+
Parameters:
|
|
1997
|
+
- evaluator_config_id: str.
|
|
1998
|
+
---
|
|
1999
|
+
from agenta.client import AgentaApi
|
|
2000
|
+
|
|
2001
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
2002
|
+
client.get_evaluator_config_evaluators_configs_evaluator_config_id_get(evaluator_config_id="string")
|
|
2003
|
+
"""
|
|
2004
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
2005
|
+
"GET",
|
|
2006
|
+
urllib.parse.urljoin(
|
|
1810
2007
|
f"{self._client_wrapper.get_base_url()}/",
|
|
1811
|
-
"
|
|
2008
|
+
f"evaluators/configs/{evaluator_config_id}",
|
|
1812
2009
|
),
|
|
1813
2010
|
headers=self._client_wrapper.get_headers(),
|
|
1814
2011
|
timeout=60,
|
|
1815
2012
|
)
|
|
1816
2013
|
if 200 <= _response.status_code < 300:
|
|
1817
|
-
return pydantic.parse_obj_as(
|
|
2014
|
+
return pydantic.parse_obj_as(EvaluatorConfig, _response.json()) # type: ignore
|
|
2015
|
+
if _response.status_code == 422:
|
|
2016
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
2017
|
+
try:
|
|
2018
|
+
_response_json = _response.json()
|
|
2019
|
+
except JSONDecodeError:
|
|
2020
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2021
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2022
|
+
|
|
2023
|
+
def update_evaluator_config_evaluators_configs_evaluator_config_id_put(
|
|
2024
|
+
self,
|
|
2025
|
+
evaluator_config_id: str,
|
|
2026
|
+
*,
|
|
2027
|
+
name: typing.Optional[str] = OMIT,
|
|
2028
|
+
evaluator_key: typing.Optional[str] = OMIT,
|
|
2029
|
+
settings_values: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
2030
|
+
) -> EvaluatorConfig:
|
|
2031
|
+
"""
|
|
2032
|
+
Endpoint to update evaluator configurations for a specific app.
|
|
2033
|
+
|
|
2034
|
+
Returns:
|
|
2035
|
+
List[EvaluatorConfigDB]: A list of evaluator configuration objects.
|
|
2036
|
+
|
|
2037
|
+
Parameters:
|
|
2038
|
+
- evaluator_config_id: str.
|
|
2039
|
+
|
|
2040
|
+
- name: typing.Optional[str].
|
|
2041
|
+
|
|
2042
|
+
- evaluator_key: typing.Optional[str].
|
|
2043
|
+
|
|
2044
|
+
- settings_values: typing.Optional[typing.Dict[str, typing.Any]].
|
|
2045
|
+
---
|
|
2046
|
+
from agenta.client import AgentaApi
|
|
2047
|
+
|
|
2048
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
2049
|
+
client.update_evaluator_config_evaluators_configs_evaluator_config_id_put(evaluator_config_id="string")
|
|
2050
|
+
"""
|
|
2051
|
+
_request: typing.Dict[str, typing.Any] = {}
|
|
2052
|
+
if name is not OMIT:
|
|
2053
|
+
_request["name"] = name
|
|
2054
|
+
if evaluator_key is not OMIT:
|
|
2055
|
+
_request["evaluator_key"] = evaluator_key
|
|
2056
|
+
if settings_values is not OMIT:
|
|
2057
|
+
_request["settings_values"] = settings_values
|
|
2058
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
2059
|
+
"PUT",
|
|
2060
|
+
urllib.parse.urljoin(
|
|
2061
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
2062
|
+
f"evaluators/configs/{evaluator_config_id}",
|
|
2063
|
+
),
|
|
2064
|
+
json=jsonable_encoder(_request),
|
|
2065
|
+
headers=self._client_wrapper.get_headers(),
|
|
2066
|
+
timeout=60,
|
|
2067
|
+
)
|
|
2068
|
+
if 200 <= _response.status_code < 300:
|
|
2069
|
+
return pydantic.parse_obj_as(EvaluatorConfig, _response.json()) # type: ignore
|
|
2070
|
+
if _response.status_code == 422:
|
|
2071
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
2072
|
+
try:
|
|
2073
|
+
_response_json = _response.json()
|
|
2074
|
+
except JSONDecodeError:
|
|
2075
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2076
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2077
|
+
|
|
2078
|
+
def delete_evaluator_config_evaluators_configs_evaluator_config_id_delete(
|
|
2079
|
+
self, evaluator_config_id: str
|
|
2080
|
+
) -> bool:
|
|
2081
|
+
"""
|
|
2082
|
+
Endpoint to delete a specific evaluator configuration.
|
|
2083
|
+
|
|
2084
|
+
Args:
|
|
2085
|
+
evaluator_config_id (str): The unique identifier of the evaluator configuration.
|
|
2086
|
+
|
|
2087
|
+
Returns:
|
|
2088
|
+
bool: True if deletion was successful, False otherwise.
|
|
2089
|
+
|
|
2090
|
+
Parameters:
|
|
2091
|
+
- evaluator_config_id: str.
|
|
2092
|
+
---
|
|
2093
|
+
from agenta.client import AgentaApi
|
|
2094
|
+
|
|
2095
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
2096
|
+
client.delete_evaluator_config_evaluators_configs_evaluator_config_id_delete(evaluator_config_id="string")
|
|
2097
|
+
"""
|
|
2098
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
2099
|
+
"DELETE",
|
|
2100
|
+
urllib.parse.urljoin(
|
|
2101
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
2102
|
+
f"evaluators/configs/{evaluator_config_id}",
|
|
2103
|
+
),
|
|
2104
|
+
headers=self._client_wrapper.get_headers(),
|
|
2105
|
+
timeout=60,
|
|
2106
|
+
)
|
|
2107
|
+
if 200 <= _response.status_code < 300:
|
|
2108
|
+
return pydantic.parse_obj_as(bool, _response.json()) # type: ignore
|
|
2109
|
+
if _response.status_code == 422:
|
|
2110
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1818
2111
|
try:
|
|
1819
2112
|
_response_json = _response.json()
|
|
1820
2113
|
except JSONDecodeError:
|
|
@@ -1880,6 +2173,12 @@ class AgentaApi:
|
|
|
1880
2173
|
|
|
1881
2174
|
Returns:
|
|
1882
2175
|
dict: The result of the import process.
|
|
2176
|
+
|
|
2177
|
+
---
|
|
2178
|
+
from agenta.client import AgentaApi
|
|
2179
|
+
|
|
2180
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
2181
|
+
client.import_testset()
|
|
1883
2182
|
"""
|
|
1884
2183
|
_response = self._client_wrapper.httpx_client.request(
|
|
1885
2184
|
"POST",
|
|
@@ -1917,6 +2216,12 @@ class AgentaApi:
|
|
|
1917
2216
|
- app_id: str.
|
|
1918
2217
|
|
|
1919
2218
|
- request: NewTestset.
|
|
2219
|
+
---
|
|
2220
|
+
from agenta import NewTestset
|
|
2221
|
+
from agenta.client import AgentaApi
|
|
2222
|
+
|
|
2223
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
2224
|
+
client.create_testset(app_id="string", request=NewTestset(name="string", csvdata=[]))
|
|
1920
2225
|
"""
|
|
1921
2226
|
_response = self._client_wrapper.httpx_client.request(
|
|
1922
2227
|
"POST",
|
|
@@ -1949,6 +2254,11 @@ class AgentaApi:
|
|
|
1949
2254
|
|
|
1950
2255
|
Parameters:
|
|
1951
2256
|
- testset_id: str.
|
|
2257
|
+
---
|
|
2258
|
+
from agenta.client import AgentaApi
|
|
2259
|
+
|
|
2260
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
2261
|
+
client.get_single_testset(testset_id="string")
|
|
1952
2262
|
"""
|
|
1953
2263
|
_response = self._client_wrapper.httpx_client.request(
|
|
1954
2264
|
"GET",
|
|
@@ -1983,6 +2293,12 @@ class AgentaApi:
|
|
|
1983
2293
|
- testset_id: str.
|
|
1984
2294
|
|
|
1985
2295
|
- request: NewTestset.
|
|
2296
|
+
---
|
|
2297
|
+
from agenta import NewTestset
|
|
2298
|
+
from agenta.client import AgentaApi
|
|
2299
|
+
|
|
2300
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
2301
|
+
client.update_testset(testset_id="string", request=NewTestset(name="string", csvdata=[]))
|
|
1986
2302
|
"""
|
|
1987
2303
|
_response = self._client_wrapper.httpx_client.request(
|
|
1988
2304
|
"PUT",
|
|
@@ -2021,7 +2337,7 @@ class AgentaApi:
|
|
|
2021
2337
|
from agenta.client import AgentaApi
|
|
2022
2338
|
|
|
2023
2339
|
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
2024
|
-
client.get_testsets(app_id="
|
|
2340
|
+
client.get_testsets(app_id="string")
|
|
2025
2341
|
"""
|
|
2026
2342
|
_response = self._client_wrapper.httpx_client.request(
|
|
2027
2343
|
"GET",
|
|
@@ -2125,6 +2441,11 @@ class AgentaApi:
|
|
|
2125
2441
|
|
|
2126
2442
|
Parameters:
|
|
2127
2443
|
- variant_id: str.
|
|
2444
|
+
---
|
|
2445
|
+
from agenta.client import AgentaApi
|
|
2446
|
+
|
|
2447
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
2448
|
+
client.restart_container(variant_id="string")
|
|
2128
2449
|
"""
|
|
2129
2450
|
_response = self._client_wrapper.httpx_client.request(
|
|
2130
2451
|
"POST",
|
|
@@ -2197,6 +2518,11 @@ class AgentaApi:
|
|
|
2197
2518
|
- base_id: typing.Optional[str].
|
|
2198
2519
|
|
|
2199
2520
|
- variant_id: typing.Optional[str].
|
|
2521
|
+
---
|
|
2522
|
+
from agenta.client import AgentaApi
|
|
2523
|
+
|
|
2524
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
2525
|
+
client.construct_app_container_url()
|
|
2200
2526
|
"""
|
|
2201
2527
|
_response = self._client_wrapper.httpx_client.request(
|
|
2202
2528
|
"GET",
|
|
@@ -2237,6 +2563,11 @@ class AgentaApi:
|
|
|
2237
2563
|
- environment_name: str.
|
|
2238
2564
|
|
|
2239
2565
|
- variant_id: str.
|
|
2566
|
+
---
|
|
2567
|
+
from agenta.client import AgentaApi
|
|
2568
|
+
|
|
2569
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
2570
|
+
client.deploy_to_environment(environment_name="string", variant_id="string")
|
|
2240
2571
|
"""
|
|
2241
2572
|
_response = self._client_wrapper.httpx_client.request(
|
|
2242
2573
|
"POST",
|
|
@@ -2294,6 +2625,19 @@ class AgentaApi:
|
|
|
2294
2625
|
- end_time: dt.datetime.
|
|
2295
2626
|
|
|
2296
2627
|
- spans: typing.List[str].
|
|
2628
|
+
---
|
|
2629
|
+
import datetime
|
|
2630
|
+
|
|
2631
|
+
from agenta.client import AgentaApi
|
|
2632
|
+
|
|
2633
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
2634
|
+
client.create_trace(
|
|
2635
|
+
latency=1.1,
|
|
2636
|
+
status="string",
|
|
2637
|
+
start_time=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00"),
|
|
2638
|
+
end_time=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00"),
|
|
2639
|
+
spans=[],
|
|
2640
|
+
)
|
|
2297
2641
|
"""
|
|
2298
2642
|
_request: typing.Dict[str, typing.Any] = {
|
|
2299
2643
|
"latency": latency,
|
|
@@ -2341,7 +2685,7 @@ class AgentaApi:
|
|
|
2341
2685
|
from agenta.client import AgentaApi
|
|
2342
2686
|
|
|
2343
2687
|
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
2344
|
-
client.get_traces(app_id="
|
|
2688
|
+
client.get_traces(app_id="string", variant_id="string")
|
|
2345
2689
|
"""
|
|
2346
2690
|
_response = self._client_wrapper.httpx_client.request(
|
|
2347
2691
|
"GET",
|
|
@@ -2366,6 +2710,11 @@ class AgentaApi:
|
|
|
2366
2710
|
"""
|
|
2367
2711
|
Parameters:
|
|
2368
2712
|
- trace_id: str.
|
|
2713
|
+
---
|
|
2714
|
+
from agenta.client import AgentaApi
|
|
2715
|
+
|
|
2716
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
2717
|
+
client.get_single_trace(trace_id="string")
|
|
2369
2718
|
"""
|
|
2370
2719
|
_response = self._client_wrapper.httpx_client.request(
|
|
2371
2720
|
"GET",
|
|
@@ -2392,6 +2741,11 @@ class AgentaApi:
|
|
|
2392
2741
|
- trace_id: str.
|
|
2393
2742
|
|
|
2394
2743
|
- status: str.
|
|
2744
|
+
---
|
|
2745
|
+
from agenta.client import AgentaApi
|
|
2746
|
+
|
|
2747
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
2748
|
+
client.update_trace_status(trace_id="string", status="string")
|
|
2395
2749
|
"""
|
|
2396
2750
|
_response = self._client_wrapper.httpx_client.request(
|
|
2397
2751
|
"PUT",
|
|
@@ -2466,6 +2820,18 @@ class AgentaApi:
|
|
|
2466
2820
|
- cost: typing.Optional[float].
|
|
2467
2821
|
|
|
2468
2822
|
- tags: typing.Optional[typing.List[str]].
|
|
2823
|
+
---
|
|
2824
|
+
import datetime
|
|
2825
|
+
|
|
2826
|
+
from agenta.client import AgentaApi
|
|
2827
|
+
|
|
2828
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
2829
|
+
client.create_span(
|
|
2830
|
+
event_name="string",
|
|
2831
|
+
start_time=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00"),
|
|
2832
|
+
status="string",
|
|
2833
|
+
end_time=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00"),
|
|
2834
|
+
)
|
|
2469
2835
|
"""
|
|
2470
2836
|
_request: typing.Dict[str, typing.Any] = {
|
|
2471
2837
|
"event_name": event_name,
|
|
@@ -2524,7 +2890,7 @@ class AgentaApi:
|
|
|
2524
2890
|
from agenta.client import AgentaApi
|
|
2525
2891
|
|
|
2526
2892
|
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
2527
|
-
client.get_spans_of_trace(trace_id="
|
|
2893
|
+
client.get_spans_of_trace(trace_id="string")
|
|
2528
2894
|
"""
|
|
2529
2895
|
_response = self._client_wrapper.httpx_client.request(
|
|
2530
2896
|
"GET",
|
|
@@ -2553,7 +2919,7 @@ class AgentaApi:
|
|
|
2553
2919
|
from agenta.client import AgentaApi
|
|
2554
2920
|
|
|
2555
2921
|
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
2556
|
-
client.get_feedbacks(trace_id="
|
|
2922
|
+
client.get_feedbacks(trace_id="string")
|
|
2557
2923
|
"""
|
|
2558
2924
|
_response = self._client_wrapper.httpx_client.request(
|
|
2559
2925
|
"GET",
|
|
@@ -2591,6 +2957,11 @@ class AgentaApi:
|
|
|
2591
2957
|
- score: typing.Optional[float].
|
|
2592
2958
|
|
|
2593
2959
|
- meta: typing.Optional[typing.Dict[str, typing.Any]].
|
|
2960
|
+
---
|
|
2961
|
+
from agenta.client import AgentaApi
|
|
2962
|
+
|
|
2963
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
2964
|
+
client.create_feedback(trace_id="string")
|
|
2594
2965
|
"""
|
|
2595
2966
|
_request: typing.Dict[str, typing.Any] = {}
|
|
2596
2967
|
if feedback is not OMIT:
|
|
@@ -2625,6 +2996,11 @@ class AgentaApi:
|
|
|
2625
2996
|
- trace_id: str.
|
|
2626
2997
|
|
|
2627
2998
|
- feedback_id: str.
|
|
2999
|
+
---
|
|
3000
|
+
from agenta.client import AgentaApi
|
|
3001
|
+
|
|
3002
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3003
|
+
client.get_feedback(trace_id="string", feedback_id="string")
|
|
2628
3004
|
"""
|
|
2629
3005
|
_response = self._client_wrapper.httpx_client.request(
|
|
2630
3006
|
"GET",
|
|
@@ -2665,6 +3041,11 @@ class AgentaApi:
|
|
|
2665
3041
|
- score: typing.Optional[float].
|
|
2666
3042
|
|
|
2667
3043
|
- meta: typing.Optional[typing.Dict[str, typing.Any]].
|
|
3044
|
+
---
|
|
3045
|
+
from agenta.client import AgentaApi
|
|
3046
|
+
|
|
3047
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3048
|
+
client.update_feedback(trace_id="string", feedback_id="string", feedback="string")
|
|
2668
3049
|
"""
|
|
2669
3050
|
_request: typing.Dict[str, typing.Any] = {"feedback": feedback}
|
|
2670
3051
|
if score is not OMIT:
|
|
@@ -2727,6 +3108,12 @@ class AgentaApi:
|
|
|
2727
3108
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2728
3109
|
|
|
2729
3110
|
def get_own_org(self) -> OrganizationOutput:
|
|
3111
|
+
"""
|
|
3112
|
+
from agenta.client import AgentaApi
|
|
3113
|
+
|
|
3114
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3115
|
+
client.get_own_org()
|
|
3116
|
+
"""
|
|
2730
3117
|
_response = self._client_wrapper.httpx_client.request(
|
|
2731
3118
|
"GET",
|
|
2732
3119
|
urllib.parse.urljoin(
|
|
@@ -2804,6 +3191,11 @@ class AgentaApi:
|
|
|
2804
3191
|
- config_name: typing.Optional[str].
|
|
2805
3192
|
|
|
2806
3193
|
- environment_name: typing.Optional[str].
|
|
3194
|
+
---
|
|
3195
|
+
from agenta.client import AgentaApi
|
|
3196
|
+
|
|
3197
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3198
|
+
client.get_config(base_id="string")
|
|
2807
3199
|
"""
|
|
2808
3200
|
_response = self._client_wrapper.httpx_client.request(
|
|
2809
3201
|
"GET",
|
|
@@ -2845,6 +3237,16 @@ class AgentaApi:
|
|
|
2845
3237
|
- parameters: typing.Dict[str, typing.Any].
|
|
2846
3238
|
|
|
2847
3239
|
- overwrite: bool.
|
|
3240
|
+
---
|
|
3241
|
+
from agenta.client import AgentaApi
|
|
3242
|
+
|
|
3243
|
+
client = AgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3244
|
+
client.save_config(
|
|
3245
|
+
base_id="string",
|
|
3246
|
+
config_name="string",
|
|
3247
|
+
parameters={"string": {"unknown": "string", "type": "unknown"}},
|
|
3248
|
+
overwrite=True,
|
|
3249
|
+
)
|
|
2848
3250
|
"""
|
|
2849
3251
|
_response = self._client_wrapper.httpx_client.request(
|
|
2850
3252
|
"POST",
|
|
@@ -2920,6 +3322,12 @@ class AsyncAgentaApi:
|
|
|
2920
3322
|
|
|
2921
3323
|
Returns:
|
|
2922
3324
|
str: The created API key.
|
|
3325
|
+
|
|
3326
|
+
---
|
|
3327
|
+
from agenta.client import AsyncAgentaApi
|
|
3328
|
+
|
|
3329
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3330
|
+
await client.create_api_key()
|
|
2923
3331
|
"""
|
|
2924
3332
|
_response = await self._client_wrapper.httpx_client.request(
|
|
2925
3333
|
"POST",
|
|
@@ -2955,7 +3363,7 @@ class AsyncAgentaApi:
|
|
|
2955
3363
|
from agenta.client import AsyncAgentaApi
|
|
2956
3364
|
|
|
2957
3365
|
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
2958
|
-
await client.delete_api_key(key_prefix="
|
|
3366
|
+
await client.delete_api_key(key_prefix="string")
|
|
2959
3367
|
"""
|
|
2960
3368
|
_response = await self._client_wrapper.httpx_client.request(
|
|
2961
3369
|
"DELETE",
|
|
@@ -2983,6 +3391,11 @@ class AsyncAgentaApi:
|
|
|
2983
3391
|
|
|
2984
3392
|
Parameters:
|
|
2985
3393
|
- key_prefix: str.
|
|
3394
|
+
---
|
|
3395
|
+
from agenta.client import AsyncAgentaApi
|
|
3396
|
+
|
|
3397
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3398
|
+
await client.validate_api_key(key_prefix="string")
|
|
2986
3399
|
"""
|
|
2987
3400
|
_response = await self._client_wrapper.httpx_client.request(
|
|
2988
3401
|
"GET",
|
|
@@ -3015,6 +3428,11 @@ class AsyncAgentaApi:
|
|
|
3015
3428
|
|
|
3016
3429
|
Parameters:
|
|
3017
3430
|
- org_id: str.
|
|
3431
|
+
---
|
|
3432
|
+
from agenta.client import AsyncAgentaApi
|
|
3433
|
+
|
|
3434
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3435
|
+
await client.fetch_organization_details(org_id="string")
|
|
3018
3436
|
"""
|
|
3019
3437
|
_response = await self._client_wrapper.httpx_client.request(
|
|
3020
3438
|
"GET",
|
|
@@ -3052,6 +3470,12 @@ class AsyncAgentaApi:
|
|
|
3052
3470
|
- org_id: str.
|
|
3053
3471
|
|
|
3054
3472
|
- request: InviteRequest.
|
|
3473
|
+
---
|
|
3474
|
+
from agenta import InviteRequest
|
|
3475
|
+
from agenta.client import AsyncAgentaApi
|
|
3476
|
+
|
|
3477
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3478
|
+
await client.invite_to_org(org_id="string", request=InviteRequest(email="string"))
|
|
3055
3479
|
"""
|
|
3056
3480
|
_response = await self._client_wrapper.httpx_client.request(
|
|
3057
3481
|
"POST",
|
|
@@ -3091,6 +3515,12 @@ class AsyncAgentaApi:
|
|
|
3091
3515
|
- org_id: str.
|
|
3092
3516
|
|
|
3093
3517
|
- request: InviteRequest.
|
|
3518
|
+
---
|
|
3519
|
+
from agenta import InviteRequest
|
|
3520
|
+
from agenta.client import AsyncAgentaApi
|
|
3521
|
+
|
|
3522
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3523
|
+
await client.resend_invitation(org_id="string", request=InviteRequest(email="string"))
|
|
3094
3524
|
"""
|
|
3095
3525
|
_response = await self._client_wrapper.httpx_client.request(
|
|
3096
3526
|
"POST",
|
|
@@ -3128,6 +3558,11 @@ class AsyncAgentaApi:
|
|
|
3128
3558
|
- org_id: str.
|
|
3129
3559
|
|
|
3130
3560
|
- token: str.
|
|
3561
|
+
---
|
|
3562
|
+
from agenta.client import AsyncAgentaApi
|
|
3563
|
+
|
|
3564
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3565
|
+
await client.add_user_to_org(org_id="string", token="string")
|
|
3131
3566
|
"""
|
|
3132
3567
|
_response = await self._client_wrapper.httpx_client.request(
|
|
3133
3568
|
"POST",
|
|
@@ -3153,6 +3588,12 @@ class AsyncAgentaApi:
|
|
|
3153
3588
|
"""
|
|
3154
3589
|
Parameters:
|
|
3155
3590
|
- request: Organization.
|
|
3591
|
+
---
|
|
3592
|
+
from agenta import Organization
|
|
3593
|
+
from agenta.client import AsyncAgentaApi
|
|
3594
|
+
|
|
3595
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3596
|
+
await client.create_organization(request=Organization(name="string", owner="string"))
|
|
3156
3597
|
"""
|
|
3157
3598
|
_response = await self._client_wrapper.httpx_client.request(
|
|
3158
3599
|
"POST",
|
|
@@ -3187,6 +3628,11 @@ class AsyncAgentaApi:
|
|
|
3187
3628
|
- name: typing.Optional[str].
|
|
3188
3629
|
|
|
3189
3630
|
- description: typing.Optional[str].
|
|
3631
|
+
---
|
|
3632
|
+
from agenta.client import AsyncAgentaApi
|
|
3633
|
+
|
|
3634
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3635
|
+
await client.update_organization(org_id="string")
|
|
3190
3636
|
"""
|
|
3191
3637
|
_request: typing.Dict[str, typing.Any] = {}
|
|
3192
3638
|
if name is not OMIT:
|
|
@@ -3214,6 +3660,12 @@ class AsyncAgentaApi:
|
|
|
3214
3660
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
3215
3661
|
|
|
3216
3662
|
async def health_check(self) -> typing.Any:
|
|
3663
|
+
"""
|
|
3664
|
+
from agenta.client import AsyncAgentaApi
|
|
3665
|
+
|
|
3666
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3667
|
+
await client.health_check()
|
|
3668
|
+
"""
|
|
3217
3669
|
_response = await self._client_wrapper.httpx_client.request(
|
|
3218
3670
|
"GET",
|
|
3219
3671
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "health"),
|
|
@@ -3229,6 +3681,12 @@ class AsyncAgentaApi:
|
|
|
3229
3681
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
3230
3682
|
|
|
3231
3683
|
async def user_profile(self) -> typing.Any:
|
|
3684
|
+
"""
|
|
3685
|
+
from agenta.client import AsyncAgentaApi
|
|
3686
|
+
|
|
3687
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3688
|
+
await client.user_profile()
|
|
3689
|
+
"""
|
|
3232
3690
|
_response = await self._client_wrapper.httpx_client.request(
|
|
3233
3691
|
"GET",
|
|
3234
3692
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "profile"),
|
|
@@ -3260,7 +3718,7 @@ class AsyncAgentaApi:
|
|
|
3260
3718
|
from agenta.client import AsyncAgentaApi
|
|
3261
3719
|
|
|
3262
3720
|
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3263
|
-
await client.list_app_variants(app_id="
|
|
3721
|
+
await client.list_app_variants(app_id="string")
|
|
3264
3722
|
"""
|
|
3265
3723
|
_response = await self._client_wrapper.httpx_client.request(
|
|
3266
3724
|
"GET",
|
|
@@ -3280,49 +3738,6 @@ class AsyncAgentaApi:
|
|
|
3280
3738
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
3281
3739
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
3282
3740
|
|
|
3283
|
-
async def get_variant_by_env(
|
|
3284
|
-
self, *, app_id: str, environment: str
|
|
3285
|
-
) -> AppVariantOutput:
|
|
3286
|
-
"""
|
|
3287
|
-
Retrieve the app variant based on the provided app_id and environment.
|
|
3288
|
-
|
|
3289
|
-
Args:
|
|
3290
|
-
app_id (str): The ID of the app to retrieve the variant for.
|
|
3291
|
-
environment (str): The environment of the app variant to retrieve.
|
|
3292
|
-
stoken_session (SessionContainer, optional): The session token container. Defaults to Depends(verify_session()).
|
|
3293
|
-
|
|
3294
|
-
Raises:
|
|
3295
|
-
HTTPException: If the app variant is not found (status_code=500), or if a ValueError is raised (status_code=400), or if any other exception is raised (status_code=500).
|
|
3296
|
-
|
|
3297
|
-
Returns:
|
|
3298
|
-
AppVariantOutput: The retrieved app variant.
|
|
3299
|
-
|
|
3300
|
-
Parameters:
|
|
3301
|
-
- app_id: str.
|
|
3302
|
-
|
|
3303
|
-
- environment: str.
|
|
3304
|
-
"""
|
|
3305
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
3306
|
-
"GET",
|
|
3307
|
-
urllib.parse.urljoin(
|
|
3308
|
-
f"{self._client_wrapper.get_base_url()}/", "apps/get_variant_by_env"
|
|
3309
|
-
),
|
|
3310
|
-
params=remove_none_from_dict(
|
|
3311
|
-
{"app_id": app_id, "environment": environment}
|
|
3312
|
-
),
|
|
3313
|
-
headers=self._client_wrapper.get_headers(),
|
|
3314
|
-
timeout=60,
|
|
3315
|
-
)
|
|
3316
|
-
if 200 <= _response.status_code < 300:
|
|
3317
|
-
return pydantic.parse_obj_as(AppVariantOutput, _response.json()) # type: ignore
|
|
3318
|
-
if _response.status_code == 422:
|
|
3319
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
3320
|
-
try:
|
|
3321
|
-
_response_json = _response.json()
|
|
3322
|
-
except JSONDecodeError:
|
|
3323
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
3324
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
3325
|
-
|
|
3326
3741
|
async def list_apps(
|
|
3327
3742
|
self,
|
|
3328
3743
|
*,
|
|
@@ -3390,6 +3805,11 @@ class AsyncAgentaApi:
|
|
|
3390
3805
|
- app_name: str.
|
|
3391
3806
|
|
|
3392
3807
|
- organization_id: typing.Optional[str].
|
|
3808
|
+
---
|
|
3809
|
+
from agenta.client import AsyncAgentaApi
|
|
3810
|
+
|
|
3811
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3812
|
+
await client.create_app(app_name="string")
|
|
3393
3813
|
"""
|
|
3394
3814
|
_request: typing.Dict[str, typing.Any] = {"app_name": app_name}
|
|
3395
3815
|
if organization_id is not OMIT:
|
|
@@ -3447,6 +3867,11 @@ class AsyncAgentaApi:
|
|
|
3447
3867
|
- base_name: typing.Optional[str].
|
|
3448
3868
|
|
|
3449
3869
|
- config_name: typing.Optional[str].
|
|
3870
|
+
---
|
|
3871
|
+
from agenta.client import AsyncAgentaApi
|
|
3872
|
+
|
|
3873
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3874
|
+
await client.add_variant_from_image(app_id="string", variant_name="string", docker_id="string", tags="string")
|
|
3450
3875
|
"""
|
|
3451
3876
|
_request: typing.Dict[str, typing.Any] = {
|
|
3452
3877
|
"variant_name": variant_name,
|
|
@@ -3486,6 +3911,11 @@ class AsyncAgentaApi:
|
|
|
3486
3911
|
|
|
3487
3912
|
Parameters:
|
|
3488
3913
|
- app_id: str.
|
|
3914
|
+
---
|
|
3915
|
+
from agenta.client import AsyncAgentaApi
|
|
3916
|
+
|
|
3917
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3918
|
+
await client.remove_app(app_id="string")
|
|
3489
3919
|
"""
|
|
3490
3920
|
_response = await self._client_wrapper.httpx_client.request(
|
|
3491
3921
|
"DELETE",
|
|
@@ -3534,6 +3964,13 @@ class AsyncAgentaApi:
|
|
|
3534
3964
|
- env_vars: typing.Dict[str, str].
|
|
3535
3965
|
|
|
3536
3966
|
- organization_id: typing.Optional[str].
|
|
3967
|
+
---
|
|
3968
|
+
from agenta.client import AsyncAgentaApi
|
|
3969
|
+
|
|
3970
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3971
|
+
await client.create_app_and_variant_from_template(
|
|
3972
|
+
app_name="string", template_id="string", env_vars={"string": "string"}
|
|
3973
|
+
)
|
|
3537
3974
|
"""
|
|
3538
3975
|
_request: typing.Dict[str, typing.Any] = {
|
|
3539
3976
|
"app_name": app_name,
|
|
@@ -3579,7 +4016,7 @@ class AsyncAgentaApi:
|
|
|
3579
4016
|
from agenta.client import AsyncAgentaApi
|
|
3580
4017
|
|
|
3581
4018
|
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3582
|
-
await client.list_environments(app_id="
|
|
4019
|
+
await client.list_environments(app_id="string")
|
|
3583
4020
|
"""
|
|
3584
4021
|
_response = await self._client_wrapper.httpx_client.request(
|
|
3585
4022
|
"GET",
|
|
@@ -3656,13 +4093,41 @@ class AsyncAgentaApi:
|
|
|
3656
4093
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
3657
4094
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
3658
4095
|
|
|
3659
|
-
async def
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
4096
|
+
async def get_variant(self, variant_id: str) -> AppVariantOutputExtended:
|
|
4097
|
+
"""
|
|
4098
|
+
Parameters:
|
|
4099
|
+
- variant_id: str.
|
|
4100
|
+
---
|
|
4101
|
+
from agenta.client import AsyncAgentaApi
|
|
4102
|
+
|
|
4103
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4104
|
+
await client.get_variant(variant_id="string")
|
|
4105
|
+
"""
|
|
4106
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
4107
|
+
"GET",
|
|
4108
|
+
urllib.parse.urljoin(
|
|
4109
|
+
f"{self._client_wrapper.get_base_url()}/", f"variants/{variant_id}"
|
|
4110
|
+
),
|
|
4111
|
+
headers=self._client_wrapper.get_headers(),
|
|
4112
|
+
timeout=60,
|
|
4113
|
+
)
|
|
4114
|
+
if 200 <= _response.status_code < 300:
|
|
4115
|
+
return pydantic.parse_obj_as(AppVariantOutputExtended, _response.json()) # type: ignore
|
|
4116
|
+
if _response.status_code == 422:
|
|
4117
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
4118
|
+
try:
|
|
4119
|
+
_response_json = _response.json()
|
|
4120
|
+
except JSONDecodeError:
|
|
4121
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
4122
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
4123
|
+
|
|
4124
|
+
async def start_variant(
|
|
4125
|
+
self,
|
|
4126
|
+
variant_id: str,
|
|
4127
|
+
*,
|
|
4128
|
+
action: VariantAction,
|
|
4129
|
+
env_vars: typing.Optional[DockerEnvVars] = OMIT,
|
|
4130
|
+
) -> Uri:
|
|
3666
4131
|
"""
|
|
3667
4132
|
Start a variant of an app.
|
|
3668
4133
|
|
|
@@ -3684,6 +4149,16 @@ class AsyncAgentaApi:
|
|
|
3684
4149
|
- action: VariantAction.
|
|
3685
4150
|
|
|
3686
4151
|
- env_vars: typing.Optional[DockerEnvVars].
|
|
4152
|
+
---
|
|
4153
|
+
from agenta import DockerEnvVars, VariantAction, VariantActionEnum
|
|
4154
|
+
from agenta.client import AsyncAgentaApi
|
|
4155
|
+
|
|
4156
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4157
|
+
await client.start_variant(
|
|
4158
|
+
variant_id="string",
|
|
4159
|
+
action=VariantAction(action=VariantActionEnum.START),
|
|
4160
|
+
env_vars=DockerEnvVars(env_vars={"string": "string"}),
|
|
4161
|
+
)
|
|
3687
4162
|
"""
|
|
3688
4163
|
_request: typing.Dict[str, typing.Any] = {"action": action}
|
|
3689
4164
|
if env_vars is not OMIT:
|
|
@@ -3720,6 +4195,11 @@ class AsyncAgentaApi:
|
|
|
3720
4195
|
|
|
3721
4196
|
Parameters:
|
|
3722
4197
|
- variant_id: str.
|
|
4198
|
+
---
|
|
4199
|
+
from agenta.client import AsyncAgentaApi
|
|
4200
|
+
|
|
4201
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4202
|
+
await client.remove_variant(variant_id="string")
|
|
3723
4203
|
"""
|
|
3724
4204
|
_response = await self._client_wrapper.httpx_client.request(
|
|
3725
4205
|
"DELETE",
|
|
@@ -3760,6 +4240,13 @@ class AsyncAgentaApi:
|
|
|
3760
4240
|
- variant_id: str.
|
|
3761
4241
|
|
|
3762
4242
|
- parameters: typing.Dict[str, typing.Any].
|
|
4243
|
+
---
|
|
4244
|
+
from agenta.client import AsyncAgentaApi
|
|
4245
|
+
|
|
4246
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4247
|
+
await client.update_variant_parameters(
|
|
4248
|
+
variant_id="string", parameters={"string": {"unknown": "string", "type": "unknown"}}
|
|
4249
|
+
)
|
|
3763
4250
|
"""
|
|
3764
4251
|
_response = await self._client_wrapper.httpx_client.request(
|
|
3765
4252
|
"PUT",
|
|
@@ -3801,6 +4288,12 @@ class AsyncAgentaApi:
|
|
|
3801
4288
|
- variant_id: str.
|
|
3802
4289
|
|
|
3803
4290
|
- request: Image.
|
|
4291
|
+
---
|
|
4292
|
+
from agenta import Image
|
|
4293
|
+
from agenta.client import AsyncAgentaApi
|
|
4294
|
+
|
|
4295
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4296
|
+
await client.update_variant_image(variant_id="string", request=Image(docker_id="string", tags="string"))
|
|
3804
4297
|
"""
|
|
3805
4298
|
_response = await self._client_wrapper.httpx_client.request(
|
|
3806
4299
|
"PUT",
|
|
@@ -3822,7 +4315,9 @@ class AsyncAgentaApi:
|
|
|
3822
4315
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
3823
4316
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
3824
4317
|
|
|
3825
|
-
async def
|
|
4318
|
+
async def fetch_list_evaluations_evaluations_get(
|
|
4319
|
+
self, *, app_id: str
|
|
4320
|
+
) -> typing.List[Evaluation]:
|
|
3826
4321
|
"""
|
|
3827
4322
|
Fetches a list of evaluations, optionally filtered by an app ID.
|
|
3828
4323
|
|
|
@@ -3838,7 +4333,7 @@ class AsyncAgentaApi:
|
|
|
3838
4333
|
from agenta.client import AsyncAgentaApi
|
|
3839
4334
|
|
|
3840
4335
|
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3841
|
-
await client.
|
|
4336
|
+
await client.fetch_list_evaluations_evaluations_get(app_id="string")
|
|
3842
4337
|
"""
|
|
3843
4338
|
_response = await self._client_wrapper.httpx_client.request(
|
|
3844
4339
|
"GET",
|
|
@@ -3865,7 +4360,6 @@ class AsyncAgentaApi:
|
|
|
3865
4360
|
app_id: str,
|
|
3866
4361
|
variant_ids: typing.List[str],
|
|
3867
4362
|
evaluation_type: EvaluationType,
|
|
3868
|
-
evaluation_type_settings: typing.Optional[EvaluationTypeSettings] = OMIT,
|
|
3869
4363
|
inputs: typing.List[str],
|
|
3870
4364
|
testset_id: str,
|
|
3871
4365
|
status: str,
|
|
@@ -3884,30 +4378,40 @@ class AsyncAgentaApi:
|
|
|
3884
4378
|
|
|
3885
4379
|
- evaluation_type: EvaluationType.
|
|
3886
4380
|
|
|
3887
|
-
- evaluation_type_settings: typing.Optional[EvaluationTypeSettings].
|
|
3888
|
-
|
|
3889
4381
|
- inputs: typing.List[str].
|
|
3890
4382
|
|
|
3891
4383
|
- testset_id: str.
|
|
3892
4384
|
|
|
3893
4385
|
- status: str.
|
|
4386
|
+
---
|
|
4387
|
+
from agenta import EvaluationType
|
|
4388
|
+
from agenta.client import AsyncAgentaApi
|
|
4389
|
+
|
|
4390
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4391
|
+
await client.create_evaluation(
|
|
4392
|
+
app_id="string",
|
|
4393
|
+
variant_ids=[],
|
|
4394
|
+
evaluation_type=EvaluationType.HUMAN_A_B_TESTING,
|
|
4395
|
+
inputs=[],
|
|
4396
|
+
testset_id="string",
|
|
4397
|
+
status="string",
|
|
4398
|
+
)
|
|
3894
4399
|
"""
|
|
3895
|
-
_request: typing.Dict[str, typing.Any] = {
|
|
3896
|
-
"app_id": app_id,
|
|
3897
|
-
"variant_ids": variant_ids,
|
|
3898
|
-
"evaluation_type": evaluation_type,
|
|
3899
|
-
"inputs": inputs,
|
|
3900
|
-
"testset_id": testset_id,
|
|
3901
|
-
"status": status,
|
|
3902
|
-
}
|
|
3903
|
-
if evaluation_type_settings is not OMIT:
|
|
3904
|
-
_request["evaluation_type_settings"] = evaluation_type_settings
|
|
3905
4400
|
_response = await self._client_wrapper.httpx_client.request(
|
|
3906
4401
|
"POST",
|
|
3907
4402
|
urllib.parse.urljoin(
|
|
3908
|
-
f"{self._client_wrapper.get_base_url()}/", "evaluations"
|
|
4403
|
+
f"{self._client_wrapper.get_base_url()}/", "human-evaluations"
|
|
4404
|
+
),
|
|
4405
|
+
json=jsonable_encoder(
|
|
4406
|
+
{
|
|
4407
|
+
"app_id": app_id,
|
|
4408
|
+
"variant_ids": variant_ids,
|
|
4409
|
+
"evaluation_type": evaluation_type,
|
|
4410
|
+
"inputs": inputs,
|
|
4411
|
+
"testset_id": testset_id,
|
|
4412
|
+
"status": status,
|
|
4413
|
+
}
|
|
3909
4414
|
),
|
|
3910
|
-
json=jsonable_encoder(_request),
|
|
3911
4415
|
headers=self._client_wrapper.get_headers(),
|
|
3912
4416
|
timeout=60,
|
|
3913
4417
|
)
|
|
@@ -3922,7 +4426,7 @@ class AsyncAgentaApi:
|
|
|
3922
4426
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
3923
4427
|
|
|
3924
4428
|
async def delete_evaluations(
|
|
3925
|
-
self, *,
|
|
4429
|
+
self, *, request: DeleteEvaluation
|
|
3926
4430
|
) -> typing.List[str]:
|
|
3927
4431
|
"""
|
|
3928
4432
|
Delete specific comparison tables based on their unique IDs.
|
|
@@ -3934,19 +4438,20 @@ class AsyncAgentaApi:
|
|
|
3934
4438
|
A list of the deleted comparison tables' IDs.
|
|
3935
4439
|
|
|
3936
4440
|
Parameters:
|
|
3937
|
-
-
|
|
4441
|
+
- request: DeleteEvaluation.
|
|
3938
4442
|
---
|
|
4443
|
+
from agenta import DeleteEvaluation
|
|
3939
4444
|
from agenta.client import AsyncAgentaApi
|
|
3940
4445
|
|
|
3941
4446
|
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
3942
|
-
await client.delete_evaluations(evaluations_ids=[])
|
|
4447
|
+
await client.delete_evaluations(request=DeleteEvaluation(evaluations_ids=[]))
|
|
3943
4448
|
"""
|
|
3944
4449
|
_response = await self._client_wrapper.httpx_client.request(
|
|
3945
4450
|
"DELETE",
|
|
3946
4451
|
urllib.parse.urljoin(
|
|
3947
4452
|
f"{self._client_wrapper.get_base_url()}/", "evaluations"
|
|
3948
4453
|
),
|
|
3949
|
-
json=jsonable_encoder(
|
|
4454
|
+
json=jsonable_encoder(request),
|
|
3950
4455
|
headers=self._client_wrapper.get_headers(),
|
|
3951
4456
|
timeout=60,
|
|
3952
4457
|
)
|
|
@@ -3960,30 +4465,36 @@ class AsyncAgentaApi:
|
|
|
3960
4465
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
3961
4466
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
3962
4467
|
|
|
3963
|
-
async def
|
|
4468
|
+
async def fetch_evaluation_status(self, evaluation_id: str) -> typing.Any:
|
|
3964
4469
|
"""
|
|
3965
|
-
Fetches
|
|
4470
|
+
Fetches the status of the evaluation.
|
|
3966
4471
|
|
|
3967
4472
|
Args:
|
|
3968
|
-
evaluation_id (str):
|
|
4473
|
+
evaluation_id (str): the evaluation id
|
|
4474
|
+
request (Request): the request object
|
|
3969
4475
|
|
|
3970
4476
|
Returns:
|
|
3971
|
-
|
|
4477
|
+
(str): the evaluation status
|
|
3972
4478
|
|
|
3973
4479
|
Parameters:
|
|
3974
4480
|
- evaluation_id: str.
|
|
4481
|
+
---
|
|
4482
|
+
from agenta.client import AsyncAgentaApi
|
|
4483
|
+
|
|
4484
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4485
|
+
await client.fetch_evaluation_status(evaluation_id="string")
|
|
3975
4486
|
"""
|
|
3976
4487
|
_response = await self._client_wrapper.httpx_client.request(
|
|
3977
4488
|
"GET",
|
|
3978
4489
|
urllib.parse.urljoin(
|
|
3979
4490
|
f"{self._client_wrapper.get_base_url()}/",
|
|
3980
|
-
f"evaluations/{evaluation_id}",
|
|
4491
|
+
f"evaluations/{evaluation_id}/status",
|
|
3981
4492
|
),
|
|
3982
4493
|
headers=self._client_wrapper.get_headers(),
|
|
3983
4494
|
timeout=60,
|
|
3984
4495
|
)
|
|
3985
4496
|
if 200 <= _response.status_code < 300:
|
|
3986
|
-
return pydantic.parse_obj_as(
|
|
4497
|
+
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
3987
4498
|
if _response.status_code == 422:
|
|
3988
4499
|
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
3989
4500
|
try:
|
|
@@ -3992,41 +4503,31 @@ class AsyncAgentaApi:
|
|
|
3992
4503
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
3993
4504
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
3994
4505
|
|
|
3995
|
-
async def
|
|
3996
|
-
self,
|
|
3997
|
-
evaluation_id: str,
|
|
3998
|
-
*,
|
|
3999
|
-
status: typing.Optional[EvaluationStatusEnum] = OMIT,
|
|
4000
|
-
evaluation_type_settings: typing.Optional[EvaluationTypeSettings] = OMIT,
|
|
4001
|
-
) -> typing.Any:
|
|
4506
|
+
async def fetch_evaluation_results(self, evaluation_id: str) -> typing.Any:
|
|
4002
4507
|
"""
|
|
4003
|
-
|
|
4508
|
+
Fetches the results of the evaluation
|
|
4004
4509
|
|
|
4005
|
-
|
|
4006
|
-
|
|
4510
|
+
Args:
|
|
4511
|
+
evaluation_id (str): the evaluation id
|
|
4512
|
+
request (Request): the request object
|
|
4007
4513
|
|
|
4008
4514
|
Returns:
|
|
4009
|
-
|
|
4515
|
+
_type_: _description_
|
|
4010
4516
|
|
|
4011
4517
|
Parameters:
|
|
4012
4518
|
- evaluation_id: str.
|
|
4519
|
+
---
|
|
4520
|
+
from agenta.client import AsyncAgentaApi
|
|
4013
4521
|
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
- evaluation_type_settings: typing.Optional[EvaluationTypeSettings].
|
|
4522
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4523
|
+
await client.fetch_evaluation_results(evaluation_id="string")
|
|
4017
4524
|
"""
|
|
4018
|
-
_request: typing.Dict[str, typing.Any] = {}
|
|
4019
|
-
if status is not OMIT:
|
|
4020
|
-
_request["status"] = status
|
|
4021
|
-
if evaluation_type_settings is not OMIT:
|
|
4022
|
-
_request["evaluation_type_settings"] = evaluation_type_settings
|
|
4023
4525
|
_response = await self._client_wrapper.httpx_client.request(
|
|
4024
|
-
"
|
|
4526
|
+
"GET",
|
|
4025
4527
|
urllib.parse.urljoin(
|
|
4026
4528
|
f"{self._client_wrapper.get_base_url()}/",
|
|
4027
|
-
f"evaluations/{evaluation_id}",
|
|
4529
|
+
f"evaluations/{evaluation_id}/results",
|
|
4028
4530
|
),
|
|
4029
|
-
json=jsonable_encoder(_request),
|
|
4030
4531
|
headers=self._client_wrapper.get_headers(),
|
|
4031
4532
|
timeout=60,
|
|
4032
4533
|
)
|
|
@@ -4042,7 +4543,116 @@ class AsyncAgentaApi:
|
|
|
4042
4543
|
|
|
4043
4544
|
async def fetch_evaluation_scenarios(
|
|
4044
4545
|
self, evaluation_id: str
|
|
4045
|
-
) -> typing.List[
|
|
4546
|
+
) -> typing.List[HumanEvaluationScenario]:
|
|
4547
|
+
"""
|
|
4548
|
+
Fetches evaluation scenarios for a given evaluation ID.
|
|
4549
|
+
|
|
4550
|
+
Arguments:
|
|
4551
|
+
evaluation_id (str): The ID of the evaluation for which to fetch scenarios.
|
|
4552
|
+
|
|
4553
|
+
Raises:
|
|
4554
|
+
HTTPException: If the evaluation is not found or access is denied.
|
|
4555
|
+
|
|
4556
|
+
Returns:
|
|
4557
|
+
List[EvaluationScenario]: A list of evaluation scenarios.
|
|
4558
|
+
|
|
4559
|
+
Parameters:
|
|
4560
|
+
- evaluation_id: str.
|
|
4561
|
+
---
|
|
4562
|
+
from agenta.client import AsyncAgentaApi
|
|
4563
|
+
|
|
4564
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4565
|
+
await client.fetch_evaluation_scenarios(evaluation_id="string")
|
|
4566
|
+
"""
|
|
4567
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
4568
|
+
"GET",
|
|
4569
|
+
urllib.parse.urljoin(
|
|
4570
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
4571
|
+
f"human-evaluations/{evaluation_id}/evaluation_scenarios",
|
|
4572
|
+
),
|
|
4573
|
+
headers=self._client_wrapper.get_headers(),
|
|
4574
|
+
timeout=60,
|
|
4575
|
+
)
|
|
4576
|
+
if 200 <= _response.status_code < 300:
|
|
4577
|
+
return pydantic.parse_obj_as(typing.List[HumanEvaluationScenario], _response.json()) # type: ignore
|
|
4578
|
+
if _response.status_code == 422:
|
|
4579
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
4580
|
+
try:
|
|
4581
|
+
_response_json = _response.json()
|
|
4582
|
+
except JSONDecodeError:
|
|
4583
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
4584
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
4585
|
+
|
|
4586
|
+
async def fetch_evaluation(self, evaluation_id: str) -> Evaluation:
|
|
4587
|
+
"""
|
|
4588
|
+
Fetches a single evaluation based on its ID.
|
|
4589
|
+
|
|
4590
|
+
Args:
|
|
4591
|
+
evaluation_id (str): The ID of the evaluation to fetch.
|
|
4592
|
+
|
|
4593
|
+
Returns:
|
|
4594
|
+
Evaluation: The fetched evaluation.
|
|
4595
|
+
|
|
4596
|
+
Parameters:
|
|
4597
|
+
- evaluation_id: str.
|
|
4598
|
+
---
|
|
4599
|
+
from agenta.client import AsyncAgentaApi
|
|
4600
|
+
|
|
4601
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4602
|
+
await client.fetch_evaluation(evaluation_id="string")
|
|
4603
|
+
"""
|
|
4604
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
4605
|
+
"GET",
|
|
4606
|
+
urllib.parse.urljoin(
|
|
4607
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
4608
|
+
f"evaluations/{evaluation_id}",
|
|
4609
|
+
),
|
|
4610
|
+
headers=self._client_wrapper.get_headers(),
|
|
4611
|
+
timeout=60,
|
|
4612
|
+
)
|
|
4613
|
+
if 200 <= _response.status_code < 300:
|
|
4614
|
+
return pydantic.parse_obj_as(Evaluation, _response.json()) # type: ignore
|
|
4615
|
+
if _response.status_code == 422:
|
|
4616
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
4617
|
+
try:
|
|
4618
|
+
_response_json = _response.json()
|
|
4619
|
+
except JSONDecodeError:
|
|
4620
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
4621
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
4622
|
+
|
|
4623
|
+
async def webhook_example_fake(self) -> EvaluationWebhook:
|
|
4624
|
+
"""
|
|
4625
|
+
Returns a fake score response for example webhook evaluation
|
|
4626
|
+
|
|
4627
|
+
Returns:
|
|
4628
|
+
_description_
|
|
4629
|
+
|
|
4630
|
+
---
|
|
4631
|
+
from agenta.client import AsyncAgentaApi
|
|
4632
|
+
|
|
4633
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4634
|
+
await client.webhook_example_fake()
|
|
4635
|
+
"""
|
|
4636
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
4637
|
+
"POST",
|
|
4638
|
+
urllib.parse.urljoin(
|
|
4639
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
4640
|
+
"evaluations/webhook_example_fake",
|
|
4641
|
+
),
|
|
4642
|
+
headers=self._client_wrapper.get_headers(),
|
|
4643
|
+
timeout=60,
|
|
4644
|
+
)
|
|
4645
|
+
if 200 <= _response.status_code < 300:
|
|
4646
|
+
return pydantic.parse_obj_as(EvaluationWebhook, _response.json()) # type: ignore
|
|
4647
|
+
try:
|
|
4648
|
+
_response_json = _response.json()
|
|
4649
|
+
except JSONDecodeError:
|
|
4650
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
4651
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
4652
|
+
|
|
4653
|
+
async def fetch_evaluation_scenarios_evaluations_evaluation_scenarios_comparison_results_get(
|
|
4654
|
+
self, *, evaluations_ids: str
|
|
4655
|
+
) -> typing.Any:
|
|
4046
4656
|
"""
|
|
4047
4657
|
Fetches evaluation scenarios for a given evaluation ID.
|
|
4048
4658
|
|
|
@@ -4055,25 +4665,146 @@ class AsyncAgentaApi:
|
|
|
4055
4665
|
Returns:
|
|
4056
4666
|
List[EvaluationScenario]: A list of evaluation scenarios.
|
|
4057
4667
|
|
|
4668
|
+
Parameters:
|
|
4669
|
+
- evaluations_ids: str.
|
|
4670
|
+
---
|
|
4671
|
+
from agenta.client import AsyncAgentaApi
|
|
4672
|
+
|
|
4673
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4674
|
+
await client.fetch_evaluation_scenarios_evaluations_evaluation_scenarios_comparison_results_get(
|
|
4675
|
+
evaluations_ids="string"
|
|
4676
|
+
)
|
|
4677
|
+
"""
|
|
4678
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
4679
|
+
"GET",
|
|
4680
|
+
urllib.parse.urljoin(
|
|
4681
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
4682
|
+
"evaluations/evaluation_scenarios/comparison-results",
|
|
4683
|
+
),
|
|
4684
|
+
params=remove_none_from_dict({"evaluations_ids": evaluations_ids}),
|
|
4685
|
+
headers=self._client_wrapper.get_headers(),
|
|
4686
|
+
timeout=60,
|
|
4687
|
+
)
|
|
4688
|
+
if 200 <= _response.status_code < 300:
|
|
4689
|
+
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
4690
|
+
if _response.status_code == 422:
|
|
4691
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
4692
|
+
try:
|
|
4693
|
+
_response_json = _response.json()
|
|
4694
|
+
except JSONDecodeError:
|
|
4695
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
4696
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
4697
|
+
|
|
4698
|
+
async def fetch_list_human_evaluations_human_evaluations_get(
|
|
4699
|
+
self, *, app_id: str
|
|
4700
|
+
) -> typing.List[HumanEvaluation]:
|
|
4701
|
+
"""
|
|
4702
|
+
Fetches a list of evaluations, optionally filtered by an app ID.
|
|
4703
|
+
|
|
4704
|
+
Args:
|
|
4705
|
+
app_id (Optional[str]): An optional app ID to filter the evaluations.
|
|
4706
|
+
|
|
4707
|
+
Returns:
|
|
4708
|
+
List[HumanEvaluation]: A list of evaluations.
|
|
4709
|
+
|
|
4710
|
+
Parameters:
|
|
4711
|
+
- app_id: str.
|
|
4712
|
+
---
|
|
4713
|
+
from agenta.client import AsyncAgentaApi
|
|
4714
|
+
|
|
4715
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4716
|
+
await client.fetch_list_human_evaluations_human_evaluations_get(app_id="string")
|
|
4717
|
+
"""
|
|
4718
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
4719
|
+
"GET",
|
|
4720
|
+
urllib.parse.urljoin(
|
|
4721
|
+
f"{self._client_wrapper.get_base_url()}/", "human-evaluations"
|
|
4722
|
+
),
|
|
4723
|
+
params=remove_none_from_dict({"app_id": app_id}),
|
|
4724
|
+
headers=self._client_wrapper.get_headers(),
|
|
4725
|
+
timeout=60,
|
|
4726
|
+
)
|
|
4727
|
+
if 200 <= _response.status_code < 300:
|
|
4728
|
+
return pydantic.parse_obj_as(typing.List[HumanEvaluation], _response.json()) # type: ignore
|
|
4729
|
+
if _response.status_code == 422:
|
|
4730
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
4731
|
+
try:
|
|
4732
|
+
_response_json = _response.json()
|
|
4733
|
+
except JSONDecodeError:
|
|
4734
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
4735
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
4736
|
+
|
|
4737
|
+
async def delete_evaluations_human_evaluations_delete(
|
|
4738
|
+
self, *, request: DeleteEvaluation
|
|
4739
|
+
) -> typing.List[str]:
|
|
4740
|
+
"""
|
|
4741
|
+
Delete specific comparison tables based on their unique IDs.
|
|
4742
|
+
|
|
4743
|
+
Args:
|
|
4744
|
+
delete_evaluations (List[str]): The unique identifiers of the comparison tables to delete.
|
|
4745
|
+
|
|
4746
|
+
Returns:
|
|
4747
|
+
A list of the deleted comparison tables' IDs.
|
|
4748
|
+
|
|
4749
|
+
Parameters:
|
|
4750
|
+
- request: DeleteEvaluation.
|
|
4751
|
+
---
|
|
4752
|
+
from agenta import DeleteEvaluation
|
|
4753
|
+
from agenta.client import AsyncAgentaApi
|
|
4754
|
+
|
|
4755
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4756
|
+
await client.delete_evaluations_human_evaluations_delete(request=DeleteEvaluation(evaluations_ids=[]))
|
|
4757
|
+
"""
|
|
4758
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
4759
|
+
"DELETE",
|
|
4760
|
+
urllib.parse.urljoin(
|
|
4761
|
+
f"{self._client_wrapper.get_base_url()}/", "human-evaluations"
|
|
4762
|
+
),
|
|
4763
|
+
json=jsonable_encoder(request),
|
|
4764
|
+
headers=self._client_wrapper.get_headers(),
|
|
4765
|
+
timeout=60,
|
|
4766
|
+
)
|
|
4767
|
+
if 200 <= _response.status_code < 300:
|
|
4768
|
+
return pydantic.parse_obj_as(typing.List[str], _response.json()) # type: ignore
|
|
4769
|
+
if _response.status_code == 422:
|
|
4770
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
4771
|
+
try:
|
|
4772
|
+
_response_json = _response.json()
|
|
4773
|
+
except JSONDecodeError:
|
|
4774
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
4775
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
4776
|
+
|
|
4777
|
+
async def fetch_human_evaluation_human_evaluations_evaluation_id_get(
|
|
4778
|
+
self, evaluation_id: str
|
|
4779
|
+
) -> HumanEvaluation:
|
|
4780
|
+
"""
|
|
4781
|
+
Fetches a single evaluation based on its ID.
|
|
4782
|
+
|
|
4783
|
+
Args:
|
|
4784
|
+
evaluation_id (str): The ID of the evaluation to fetch.
|
|
4785
|
+
|
|
4786
|
+
Returns:
|
|
4787
|
+
HumanEvaluation: The fetched evaluation.
|
|
4788
|
+
|
|
4058
4789
|
Parameters:
|
|
4059
4790
|
- evaluation_id: str.
|
|
4060
4791
|
---
|
|
4061
4792
|
from agenta.client import AsyncAgentaApi
|
|
4062
4793
|
|
|
4063
4794
|
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4064
|
-
await client.
|
|
4795
|
+
await client.fetch_human_evaluation_human_evaluations_evaluation_id_get(evaluation_id="string")
|
|
4065
4796
|
"""
|
|
4066
4797
|
_response = await self._client_wrapper.httpx_client.request(
|
|
4067
4798
|
"GET",
|
|
4068
4799
|
urllib.parse.urljoin(
|
|
4069
4800
|
f"{self._client_wrapper.get_base_url()}/",
|
|
4070
|
-
f"evaluations/{evaluation_id}
|
|
4801
|
+
f"human-evaluations/{evaluation_id}",
|
|
4071
4802
|
),
|
|
4072
4803
|
headers=self._client_wrapper.get_headers(),
|
|
4073
4804
|
timeout=60,
|
|
4074
4805
|
)
|
|
4075
4806
|
if 200 <= _response.status_code < 300:
|
|
4076
|
-
return pydantic.parse_obj_as(
|
|
4807
|
+
return pydantic.parse_obj_as(HumanEvaluation, _response.json()) # type: ignore
|
|
4077
4808
|
if _response.status_code == 422:
|
|
4078
4809
|
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
4079
4810
|
try:
|
|
@@ -4082,30 +4813,42 @@ class AsyncAgentaApi:
|
|
|
4082
4813
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
4083
4814
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
4084
4815
|
|
|
4085
|
-
async def
|
|
4086
|
-
self,
|
|
4816
|
+
async def update_human_evaluation(
|
|
4817
|
+
self,
|
|
4818
|
+
evaluation_id: str,
|
|
4819
|
+
*,
|
|
4820
|
+
status: typing.Optional[EvaluationStatusEnum] = OMIT,
|
|
4087
4821
|
) -> typing.Any:
|
|
4088
4822
|
"""
|
|
4089
|
-
|
|
4823
|
+
Updates an evaluation's status.
|
|
4090
4824
|
|
|
4091
4825
|
Raises:
|
|
4092
|
-
HTTPException: If
|
|
4826
|
+
HTTPException: If the columns in the test set do not match with the inputs in the variant.
|
|
4093
4827
|
|
|
4094
4828
|
Returns:
|
|
4095
|
-
None: 204 No Content status code
|
|
4829
|
+
None: A 204 No Content status code, indicating that the update was successful.
|
|
4096
4830
|
|
|
4097
4831
|
Parameters:
|
|
4098
4832
|
- evaluation_id: str.
|
|
4099
4833
|
|
|
4100
|
-
-
|
|
4834
|
+
- status: typing.Optional[EvaluationStatusEnum].
|
|
4835
|
+
---
|
|
4836
|
+
from agenta import EvaluationStatusEnum
|
|
4837
|
+
from agenta.client import AsyncAgentaApi
|
|
4838
|
+
|
|
4839
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4840
|
+
await client.update_human_evaluation(evaluation_id="string", status=EvaluationStatusEnum.EVALUATION_INITIALIZED)
|
|
4101
4841
|
"""
|
|
4842
|
+
_request: typing.Dict[str, typing.Any] = {}
|
|
4843
|
+
if status is not OMIT:
|
|
4844
|
+
_request["status"] = status
|
|
4102
4845
|
_response = await self._client_wrapper.httpx_client.request(
|
|
4103
|
-
"
|
|
4846
|
+
"PUT",
|
|
4104
4847
|
urllib.parse.urljoin(
|
|
4105
4848
|
f"{self._client_wrapper.get_base_url()}/",
|
|
4106
|
-
f"evaluations/{evaluation_id}
|
|
4849
|
+
f"human-evaluations/{evaluation_id}",
|
|
4107
4850
|
),
|
|
4108
|
-
json=jsonable_encoder(
|
|
4851
|
+
json=jsonable_encoder(_request),
|
|
4109
4852
|
headers=self._client_wrapper.get_headers(),
|
|
4110
4853
|
timeout=60,
|
|
4111
4854
|
)
|
|
@@ -4119,17 +4862,17 @@ class AsyncAgentaApi:
|
|
|
4119
4862
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
4120
4863
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
4121
4864
|
|
|
4122
|
-
async def
|
|
4865
|
+
async def update_evaluation_scenario_router_human_evaluations_evaluation_id_evaluation_scenario_evaluation_scenario_id_evaluation_type_put(
|
|
4123
4866
|
self,
|
|
4124
4867
|
evaluation_id: str,
|
|
4125
4868
|
evaluation_scenario_id: str,
|
|
4126
4869
|
evaluation_type: EvaluationType,
|
|
4127
4870
|
*,
|
|
4128
4871
|
vote: typing.Optional[str] = OMIT,
|
|
4129
|
-
score: typing.Optional[
|
|
4872
|
+
score: typing.Optional[HumanEvaluationScenarioUpdateScore] = OMIT,
|
|
4130
4873
|
correct_answer: typing.Optional[str] = OMIT,
|
|
4131
|
-
outputs: typing.Optional[typing.List[
|
|
4132
|
-
inputs: typing.Optional[typing.List[
|
|
4874
|
+
outputs: typing.Optional[typing.List[HumanEvaluationScenarioOutput]] = OMIT,
|
|
4875
|
+
inputs: typing.Optional[typing.List[HumanEvaluationScenarioInput]] = OMIT,
|
|
4133
4876
|
is_pinned: typing.Optional[bool] = OMIT,
|
|
4134
4877
|
note: typing.Optional[str] = OMIT,
|
|
4135
4878
|
) -> typing.Any:
|
|
@@ -4151,17 +4894,29 @@ class AsyncAgentaApi:
|
|
|
4151
4894
|
|
|
4152
4895
|
- vote: typing.Optional[str].
|
|
4153
4896
|
|
|
4154
|
-
- score: typing.Optional[
|
|
4897
|
+
- score: typing.Optional[HumanEvaluationScenarioUpdateScore].
|
|
4155
4898
|
|
|
4156
4899
|
- correct_answer: typing.Optional[str].
|
|
4157
4900
|
|
|
4158
|
-
- outputs: typing.Optional[typing.List[
|
|
4901
|
+
- outputs: typing.Optional[typing.List[HumanEvaluationScenarioOutput]].
|
|
4159
4902
|
|
|
4160
|
-
- inputs: typing.Optional[typing.List[
|
|
4903
|
+
- inputs: typing.Optional[typing.List[HumanEvaluationScenarioInput]].
|
|
4161
4904
|
|
|
4162
4905
|
- is_pinned: typing.Optional[bool].
|
|
4163
4906
|
|
|
4164
4907
|
- note: typing.Optional[str].
|
|
4908
|
+
---
|
|
4909
|
+
from agenta import EvaluationType, HumanEvaluationScenarioInput, HumanEvaluationScenarioOutput
|
|
4910
|
+
from agenta.client import AsyncAgentaApi
|
|
4911
|
+
|
|
4912
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4913
|
+
await client.update_evaluation_scenario_router_human_evaluations_evaluation_id_evaluation_scenario_evaluation_scenario_id_evaluation_type_put(
|
|
4914
|
+
evaluation_id="string",
|
|
4915
|
+
evaluation_scenario_id="string",
|
|
4916
|
+
evaluation_type=EvaluationType.HUMAN_A_B_TESTING,
|
|
4917
|
+
outputs=[HumanEvaluationScenarioOutput(variant_id="string", variant_output="string")],
|
|
4918
|
+
inputs=[HumanEvaluationScenarioInput(input_name="string", input_value="string")],
|
|
4919
|
+
)
|
|
4165
4920
|
"""
|
|
4166
4921
|
_request: typing.Dict[str, typing.Any] = {}
|
|
4167
4922
|
if vote is not OMIT:
|
|
@@ -4182,7 +4937,7 @@ class AsyncAgentaApi:
|
|
|
4182
4937
|
"PUT",
|
|
4183
4938
|
urllib.parse.urljoin(
|
|
4184
4939
|
f"{self._client_wrapper.get_base_url()}/",
|
|
4185
|
-
f"evaluations/{evaluation_id}/evaluation_scenario/{evaluation_scenario_id}/{evaluation_type}",
|
|
4940
|
+
f"human-evaluations/{evaluation_id}/evaluation_scenario/{evaluation_scenario_id}/{evaluation_type}",
|
|
4186
4941
|
),
|
|
4187
4942
|
json=jsonable_encoder(_request),
|
|
4188
4943
|
headers=self._client_wrapper.get_headers(),
|
|
@@ -4198,74 +4953,7 @@ class AsyncAgentaApi:
|
|
|
4198
4953
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
4199
4954
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
4200
4955
|
|
|
4201
|
-
async def
|
|
4202
|
-
self,
|
|
4203
|
-
*,
|
|
4204
|
-
correct_answer: str,
|
|
4205
|
-
llm_app_prompt_template: typing.Optional[str] = OMIT,
|
|
4206
|
-
inputs: typing.List[EvaluationScenarioInput],
|
|
4207
|
-
outputs: typing.List[EvaluationScenarioOutput],
|
|
4208
|
-
evaluation_prompt_template: typing.Optional[str] = OMIT,
|
|
4209
|
-
open_ai_key: typing.Optional[str] = OMIT,
|
|
4210
|
-
) -> str:
|
|
4211
|
-
"""
|
|
4212
|
-
Evaluate AI critique based on the given payload.
|
|
4213
|
-
|
|
4214
|
-
Args:
|
|
4215
|
-
payload (AICritiqueCreate): The payload containing data for AI critique evaluation.
|
|
4216
|
-
stoken_session (SessionContainer): The session container verified by `verify_session`.
|
|
4217
|
-
|
|
4218
|
-
Returns:
|
|
4219
|
-
str: The output of the AI critique evaluation.
|
|
4220
|
-
|
|
4221
|
-
Raises:
|
|
4222
|
-
HTTPException: If any exception occurs during the evaluation.
|
|
4223
|
-
|
|
4224
|
-
Parameters:
|
|
4225
|
-
- correct_answer: str.
|
|
4226
|
-
|
|
4227
|
-
- llm_app_prompt_template: typing.Optional[str].
|
|
4228
|
-
|
|
4229
|
-
- inputs: typing.List[EvaluationScenarioInput].
|
|
4230
|
-
|
|
4231
|
-
- outputs: typing.List[EvaluationScenarioOutput].
|
|
4232
|
-
|
|
4233
|
-
- evaluation_prompt_template: typing.Optional[str].
|
|
4234
|
-
|
|
4235
|
-
- open_ai_key: typing.Optional[str].
|
|
4236
|
-
"""
|
|
4237
|
-
_request: typing.Dict[str, typing.Any] = {
|
|
4238
|
-
"correct_answer": correct_answer,
|
|
4239
|
-
"inputs": inputs,
|
|
4240
|
-
"outputs": outputs,
|
|
4241
|
-
}
|
|
4242
|
-
if llm_app_prompt_template is not OMIT:
|
|
4243
|
-
_request["llm_app_prompt_template"] = llm_app_prompt_template
|
|
4244
|
-
if evaluation_prompt_template is not OMIT:
|
|
4245
|
-
_request["evaluation_prompt_template"] = evaluation_prompt_template
|
|
4246
|
-
if open_ai_key is not OMIT:
|
|
4247
|
-
_request["open_ai_key"] = open_ai_key
|
|
4248
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
4249
|
-
"POST",
|
|
4250
|
-
urllib.parse.urljoin(
|
|
4251
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
4252
|
-
"evaluations/evaluation_scenario/ai_critique",
|
|
4253
|
-
),
|
|
4254
|
-
json=jsonable_encoder(_request),
|
|
4255
|
-
headers=self._client_wrapper.get_headers(),
|
|
4256
|
-
timeout=60,
|
|
4257
|
-
)
|
|
4258
|
-
if 200 <= _response.status_code < 300:
|
|
4259
|
-
return pydantic.parse_obj_as(str, _response.json()) # type: ignore
|
|
4260
|
-
if _response.status_code == 422:
|
|
4261
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
4262
|
-
try:
|
|
4263
|
-
_response_json = _response.json()
|
|
4264
|
-
except JSONDecodeError:
|
|
4265
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
4266
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
4267
|
-
|
|
4268
|
-
async def get_evaluation_scenario_score(
|
|
4956
|
+
async def get_evaluation_scenario_score_router_human_evaluations_evaluation_scenario_evaluation_scenario_id_score_get(
|
|
4269
4957
|
self, evaluation_scenario_id: str
|
|
4270
4958
|
) -> typing.Dict[str, str]:
|
|
4271
4959
|
"""
|
|
@@ -4284,13 +4972,15 @@ class AsyncAgentaApi:
|
|
|
4284
4972
|
from agenta.client import AsyncAgentaApi
|
|
4285
4973
|
|
|
4286
4974
|
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4287
|
-
await client.
|
|
4975
|
+
await client.get_evaluation_scenario_score_router_human_evaluations_evaluation_scenario_evaluation_scenario_id_score_get(
|
|
4976
|
+
evaluation_scenario_id="string"
|
|
4977
|
+
)
|
|
4288
4978
|
"""
|
|
4289
4979
|
_response = await self._client_wrapper.httpx_client.request(
|
|
4290
4980
|
"GET",
|
|
4291
4981
|
urllib.parse.urljoin(
|
|
4292
4982
|
f"{self._client_wrapper.get_base_url()}/",
|
|
4293
|
-
f"evaluations/evaluation_scenario/{evaluation_scenario_id}/score",
|
|
4983
|
+
f"human-evaluations/evaluation_scenario/{evaluation_scenario_id}/score",
|
|
4294
4984
|
),
|
|
4295
4985
|
headers=self._client_wrapper.get_headers(),
|
|
4296
4986
|
timeout=60,
|
|
@@ -4305,7 +4995,7 @@ class AsyncAgentaApi:
|
|
|
4305
4995
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
4306
4996
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
4307
4997
|
|
|
4308
|
-
async def
|
|
4998
|
+
async def update_evaluation_scenario_score_router_human_evaluations_evaluation_scenario_evaluation_scenario_id_score_put(
|
|
4309
4999
|
self, evaluation_scenario_id: str, *, score: float
|
|
4310
5000
|
) -> typing.Any:
|
|
4311
5001
|
"""
|
|
@@ -4321,12 +5011,19 @@ class AsyncAgentaApi:
|
|
|
4321
5011
|
- evaluation_scenario_id: str.
|
|
4322
5012
|
|
|
4323
5013
|
- score: float.
|
|
5014
|
+
---
|
|
5015
|
+
from agenta.client import AsyncAgentaApi
|
|
5016
|
+
|
|
5017
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
5018
|
+
await client.update_evaluation_scenario_score_router_human_evaluations_evaluation_scenario_evaluation_scenario_id_score_put(
|
|
5019
|
+
evaluation_scenario_id="string", score=1.1
|
|
5020
|
+
)
|
|
4324
5021
|
"""
|
|
4325
5022
|
_response = await self._client_wrapper.httpx_client.request(
|
|
4326
5023
|
"PUT",
|
|
4327
5024
|
urllib.parse.urljoin(
|
|
4328
5025
|
f"{self._client_wrapper.get_base_url()}/",
|
|
4329
|
-
f"evaluations/evaluation_scenario/{evaluation_scenario_id}/score",
|
|
5026
|
+
f"human-evaluations/evaluation_scenario/{evaluation_scenario_id}/score",
|
|
4330
5027
|
),
|
|
4331
5028
|
json=jsonable_encoder({"score": score}),
|
|
4332
5029
|
headers=self._client_wrapper.get_headers(),
|
|
@@ -4354,12 +5051,17 @@ class AsyncAgentaApi:
|
|
|
4354
5051
|
|
|
4355
5052
|
Parameters:
|
|
4356
5053
|
- evaluation_id: str.
|
|
5054
|
+
---
|
|
5055
|
+
from agenta.client import AsyncAgentaApi
|
|
5056
|
+
|
|
5057
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
5058
|
+
await client.fetch_results(evaluation_id="string")
|
|
4357
5059
|
"""
|
|
4358
5060
|
_response = await self._client_wrapper.httpx_client.request(
|
|
4359
5061
|
"GET",
|
|
4360
5062
|
urllib.parse.urljoin(
|
|
4361
5063
|
f"{self._client_wrapper.get_base_url()}/",
|
|
4362
|
-
f"evaluations/{evaluation_id}/results",
|
|
5064
|
+
f"human-evaluations/{evaluation_id}/results",
|
|
4363
5065
|
),
|
|
4364
5066
|
headers=self._client_wrapper.get_headers(),
|
|
4365
5067
|
timeout=60,
|
|
@@ -4374,98 +5076,66 @@ class AsyncAgentaApi:
|
|
|
4374
5076
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
4375
5077
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
4376
5078
|
|
|
4377
|
-
async def
|
|
4378
|
-
self, *, request: CreateCustomEvaluation
|
|
4379
|
-
) -> typing.Any:
|
|
5079
|
+
async def get_evaluators_endpoint_evaluators_get(self) -> typing.List[Evaluator]:
|
|
4380
5080
|
"""
|
|
4381
|
-
|
|
5081
|
+
Endpoint to fetch a list of evaluators.
|
|
4382
5082
|
|
|
4383
|
-
|
|
5083
|
+
Returns:
|
|
5084
|
+
List[Evaluator]: A list of evaluator objects.
|
|
4384
5085
|
|
|
4385
|
-
|
|
5086
|
+
---
|
|
5087
|
+
from agenta.client import AsyncAgentaApi
|
|
4386
5088
|
|
|
4387
|
-
|
|
4388
|
-
|
|
5089
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
5090
|
+
await client.get_evaluators_endpoint_evaluators_get()
|
|
4389
5091
|
"""
|
|
4390
5092
|
_response = await self._client_wrapper.httpx_client.request(
|
|
4391
|
-
"
|
|
5093
|
+
"GET",
|
|
4392
5094
|
urllib.parse.urljoin(
|
|
4393
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
4394
|
-
"evaluations/custom_evaluation",
|
|
5095
|
+
f"{self._client_wrapper.get_base_url()}/", "evaluators"
|
|
4395
5096
|
),
|
|
4396
|
-
json=jsonable_encoder(request),
|
|
4397
5097
|
headers=self._client_wrapper.get_headers(),
|
|
4398
5098
|
timeout=60,
|
|
4399
5099
|
)
|
|
4400
5100
|
if 200 <= _response.status_code < 300:
|
|
4401
|
-
return pydantic.parse_obj_as(typing.
|
|
4402
|
-
if _response.status_code == 422:
|
|
4403
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
5101
|
+
return pydantic.parse_obj_as(typing.List[Evaluator], _response.json()) # type: ignore
|
|
4404
5102
|
try:
|
|
4405
5103
|
_response_json = _response.json()
|
|
4406
5104
|
except JSONDecodeError:
|
|
4407
5105
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
4408
5106
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
4409
5107
|
|
|
4410
|
-
async def
|
|
5108
|
+
async def get_evaluator_configs_evaluators_configs_get(
|
|
5109
|
+
self, *, app_id: str
|
|
5110
|
+
) -> typing.List[EvaluatorConfig]:
|
|
4411
5111
|
"""
|
|
4412
|
-
|
|
5112
|
+
Endpoint to fetch evaluator configurations for a specific app.
|
|
4413
5113
|
|
|
4414
5114
|
Args:
|
|
4415
|
-
|
|
5115
|
+
app_id (str): The ID of the app.
|
|
4416
5116
|
|
|
4417
5117
|
Returns:
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
Parameters:
|
|
4421
|
-
- id: str.
|
|
4422
|
-
"""
|
|
4423
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
4424
|
-
"GET",
|
|
4425
|
-
urllib.parse.urljoin(
|
|
4426
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
4427
|
-
f"evaluations/custom_evaluation/{id}",
|
|
4428
|
-
),
|
|
4429
|
-
headers=self._client_wrapper.get_headers(),
|
|
4430
|
-
timeout=60,
|
|
4431
|
-
)
|
|
4432
|
-
if 200 <= _response.status_code < 300:
|
|
4433
|
-
return pydantic.parse_obj_as(CustomEvaluationDetail, _response.json()) # type: ignore
|
|
4434
|
-
if _response.status_code == 422:
|
|
4435
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
4436
|
-
try:
|
|
4437
|
-
_response_json = _response.json()
|
|
4438
|
-
except JSONDecodeError:
|
|
4439
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
4440
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
4441
|
-
|
|
4442
|
-
async def update_custom_evaluation(
|
|
4443
|
-
self, id: str, *, request: CreateCustomEvaluation
|
|
4444
|
-
) -> typing.Any:
|
|
4445
|
-
"""
|
|
4446
|
-
Update a custom code evaluation.
|
|
4447
|
-
Args:
|
|
4448
|
-
id (str): the ID of the custom evaluation to update
|
|
4449
|
-
updated_data (CreateCustomEvaluation): the payload with updated data
|
|
4450
|
-
stoken_session (SessionContainer): session container for authentication
|
|
5118
|
+
List[EvaluatorConfigDB]: A list of evaluator configuration objects.
|
|
4451
5119
|
|
|
4452
5120
|
Parameters:
|
|
4453
|
-
-
|
|
5121
|
+
- app_id: str.
|
|
5122
|
+
---
|
|
5123
|
+
from agenta.client import AsyncAgentaApi
|
|
4454
5124
|
|
|
4455
|
-
|
|
5125
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
5126
|
+
await client.get_evaluator_configs_evaluators_configs_get(app_id="string")
|
|
4456
5127
|
"""
|
|
4457
5128
|
_response = await self._client_wrapper.httpx_client.request(
|
|
4458
|
-
"
|
|
5129
|
+
"GET",
|
|
4459
5130
|
urllib.parse.urljoin(
|
|
4460
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
4461
|
-
f"evaluations/custom_evaluation/{id}",
|
|
5131
|
+
f"{self._client_wrapper.get_base_url()}/", "evaluators/configs"
|
|
4462
5132
|
),
|
|
4463
|
-
|
|
5133
|
+
params=remove_none_from_dict({"app_id": app_id}),
|
|
4464
5134
|
headers=self._client_wrapper.get_headers(),
|
|
4465
5135
|
timeout=60,
|
|
4466
5136
|
)
|
|
4467
5137
|
if 200 <= _response.status_code < 300:
|
|
4468
|
-
return pydantic.parse_obj_as(typing.
|
|
5138
|
+
return pydantic.parse_obj_as(typing.List[EvaluatorConfig], _response.json()) # type: ignore
|
|
4469
5139
|
if _response.status_code == 422:
|
|
4470
5140
|
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
4471
5141
|
try:
|
|
@@ -4474,37 +5144,60 @@ class AsyncAgentaApi:
|
|
|
4474
5144
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
4475
5145
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
4476
5146
|
|
|
4477
|
-
async def
|
|
4478
|
-
self,
|
|
4479
|
-
|
|
5147
|
+
async def create_new_evaluator_config_evaluators_configs_post(
|
|
5148
|
+
self,
|
|
5149
|
+
*,
|
|
5150
|
+
app_id: str,
|
|
5151
|
+
name: str,
|
|
5152
|
+
evaluator_key: str,
|
|
5153
|
+
settings_values: typing.Dict[str, typing.Any],
|
|
5154
|
+
) -> EvaluatorConfig:
|
|
4480
5155
|
"""
|
|
4481
|
-
|
|
5156
|
+
Endpoint to fetch evaluator configurations for a specific app.
|
|
4482
5157
|
|
|
4483
5158
|
Args:
|
|
4484
|
-
app_id (str):
|
|
5159
|
+
app_id (str): The ID of the app.
|
|
4485
5160
|
|
|
4486
5161
|
Returns:
|
|
4487
|
-
|
|
5162
|
+
EvaluatorConfigDB: Evaluator configuration api model.
|
|
4488
5163
|
|
|
4489
5164
|
Parameters:
|
|
4490
5165
|
- app_id: str.
|
|
5166
|
+
|
|
5167
|
+
- name: str.
|
|
5168
|
+
|
|
5169
|
+
- evaluator_key: str.
|
|
5170
|
+
|
|
5171
|
+
- settings_values: typing.Dict[str, typing.Any].
|
|
4491
5172
|
---
|
|
4492
5173
|
from agenta.client import AsyncAgentaApi
|
|
4493
5174
|
|
|
4494
5175
|
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4495
|
-
await client.
|
|
5176
|
+
await client.create_new_evaluator_config_evaluators_configs_post(
|
|
5177
|
+
app_id="string",
|
|
5178
|
+
name="string",
|
|
5179
|
+
evaluator_key="string",
|
|
5180
|
+
settings_values={"string": {"unknown": "string", "type": "unknown"}},
|
|
5181
|
+
)
|
|
4496
5182
|
"""
|
|
4497
5183
|
_response = await self._client_wrapper.httpx_client.request(
|
|
4498
|
-
"
|
|
5184
|
+
"POST",
|
|
4499
5185
|
urllib.parse.urljoin(
|
|
4500
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
4501
|
-
|
|
5186
|
+
f"{self._client_wrapper.get_base_url()}/", "evaluators/configs"
|
|
5187
|
+
),
|
|
5188
|
+
json=jsonable_encoder(
|
|
5189
|
+
{
|
|
5190
|
+
"app_id": app_id,
|
|
5191
|
+
"name": name,
|
|
5192
|
+
"evaluator_key": evaluator_key,
|
|
5193
|
+
"settings_values": settings_values,
|
|
5194
|
+
}
|
|
4502
5195
|
),
|
|
4503
5196
|
headers=self._client_wrapper.get_headers(),
|
|
4504
5197
|
timeout=60,
|
|
4505
5198
|
)
|
|
4506
5199
|
if 200 <= _response.status_code < 300:
|
|
4507
|
-
return pydantic.parse_obj_as(
|
|
5200
|
+
return pydantic.parse_obj_as(EvaluatorConfig, _response.json()) # type: ignore
|
|
4508
5201
|
if _response.status_code == 422:
|
|
4509
5202
|
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
4510
5203
|
try:
|
|
@@ -4513,37 +5206,34 @@ class AsyncAgentaApi:
|
|
|
4513
5206
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
4514
5207
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
4515
5208
|
|
|
4516
|
-
async def
|
|
4517
|
-
self,
|
|
4518
|
-
) ->
|
|
5209
|
+
async def get_evaluator_config_evaluators_configs_evaluator_config_id_get(
|
|
5210
|
+
self, evaluator_config_id: str
|
|
5211
|
+
) -> EvaluatorConfig:
|
|
4519
5212
|
"""
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
Args:
|
|
4523
|
-
app_name (str): the name of the app the evaluation belongs to
|
|
5213
|
+
Endpoint to fetch evaluator configurations for a specific app.
|
|
4524
5214
|
|
|
4525
5215
|
Returns:
|
|
4526
|
-
List[
|
|
5216
|
+
List[EvaluatorConfigDB]: A list of evaluator configuration objects.
|
|
4527
5217
|
|
|
4528
5218
|
Parameters:
|
|
4529
|
-
-
|
|
5219
|
+
- evaluator_config_id: str.
|
|
4530
5220
|
---
|
|
4531
5221
|
from agenta.client import AsyncAgentaApi
|
|
4532
5222
|
|
|
4533
5223
|
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4534
|
-
await client.
|
|
5224
|
+
await client.get_evaluator_config_evaluators_configs_evaluator_config_id_get(evaluator_config_id="string")
|
|
4535
5225
|
"""
|
|
4536
5226
|
_response = await self._client_wrapper.httpx_client.request(
|
|
4537
5227
|
"GET",
|
|
4538
5228
|
urllib.parse.urljoin(
|
|
4539
5229
|
f"{self._client_wrapper.get_base_url()}/",
|
|
4540
|
-
f"
|
|
5230
|
+
f"evaluators/configs/{evaluator_config_id}",
|
|
4541
5231
|
),
|
|
4542
5232
|
headers=self._client_wrapper.get_headers(),
|
|
4543
5233
|
timeout=60,
|
|
4544
5234
|
)
|
|
4545
5235
|
if 200 <= _response.status_code < 300:
|
|
4546
|
-
return pydantic.parse_obj_as(
|
|
5236
|
+
return pydantic.parse_obj_as(EvaluatorConfig, _response.json()) # type: ignore
|
|
4547
5237
|
if _response.status_code == 422:
|
|
4548
5238
|
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
4549
5239
|
try:
|
|
@@ -4552,59 +5242,53 @@ class AsyncAgentaApi:
|
|
|
4552
5242
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
4553
5243
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
4554
5244
|
|
|
4555
|
-
async def
|
|
5245
|
+
async def update_evaluator_config_evaluators_configs_evaluator_config_id_put(
|
|
4556
5246
|
self,
|
|
4557
|
-
|
|
5247
|
+
evaluator_config_id: str,
|
|
4558
5248
|
*,
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
outputs: typing.List[typing.Dict[str, typing.Any]],
|
|
4564
|
-
) -> typing.Any:
|
|
5249
|
+
name: typing.Optional[str] = OMIT,
|
|
5250
|
+
evaluator_key: typing.Optional[str] = OMIT,
|
|
5251
|
+
settings_values: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
5252
|
+
) -> EvaluatorConfig:
|
|
4565
5253
|
"""
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
Args:
|
|
4569
|
-
evaluation_id (str): the custom evaluation id
|
|
4570
|
-
payload (ExecuteCustomEvaluationCode): the required payload
|
|
5254
|
+
Endpoint to update evaluator configurations for a specific app.
|
|
4571
5255
|
|
|
4572
5256
|
Returns:
|
|
4573
|
-
|
|
5257
|
+
List[EvaluatorConfigDB]: A list of evaluator configuration objects.
|
|
4574
5258
|
|
|
4575
5259
|
Parameters:
|
|
4576
|
-
-
|
|
4577
|
-
|
|
4578
|
-
- inputs: typing.List[typing.Dict[str, typing.Any]].
|
|
5260
|
+
- evaluator_config_id: str.
|
|
4579
5261
|
|
|
4580
|
-
-
|
|
5262
|
+
- name: typing.Optional[str].
|
|
4581
5263
|
|
|
4582
|
-
-
|
|
5264
|
+
- evaluator_key: typing.Optional[str].
|
|
4583
5265
|
|
|
4584
|
-
-
|
|
5266
|
+
- settings_values: typing.Optional[typing.Dict[str, typing.Any]].
|
|
5267
|
+
---
|
|
5268
|
+
from agenta.client import AsyncAgentaApi
|
|
4585
5269
|
|
|
4586
|
-
|
|
5270
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
5271
|
+
await client.update_evaluator_config_evaluators_configs_evaluator_config_id_put(evaluator_config_id="string")
|
|
4587
5272
|
"""
|
|
5273
|
+
_request: typing.Dict[str, typing.Any] = {}
|
|
5274
|
+
if name is not OMIT:
|
|
5275
|
+
_request["name"] = name
|
|
5276
|
+
if evaluator_key is not OMIT:
|
|
5277
|
+
_request["evaluator_key"] = evaluator_key
|
|
5278
|
+
if settings_values is not OMIT:
|
|
5279
|
+
_request["settings_values"] = settings_values
|
|
4588
5280
|
_response = await self._client_wrapper.httpx_client.request(
|
|
4589
|
-
"
|
|
5281
|
+
"PUT",
|
|
4590
5282
|
urllib.parse.urljoin(
|
|
4591
5283
|
f"{self._client_wrapper.get_base_url()}/",
|
|
4592
|
-
f"
|
|
4593
|
-
),
|
|
4594
|
-
json=jsonable_encoder(
|
|
4595
|
-
{
|
|
4596
|
-
"inputs": inputs,
|
|
4597
|
-
"app_id": app_id,
|
|
4598
|
-
"variant_id": variant_id,
|
|
4599
|
-
"correct_answer": correct_answer,
|
|
4600
|
-
"outputs": outputs,
|
|
4601
|
-
}
|
|
5284
|
+
f"evaluators/configs/{evaluator_config_id}",
|
|
4602
5285
|
),
|
|
5286
|
+
json=jsonable_encoder(_request),
|
|
4603
5287
|
headers=self._client_wrapper.get_headers(),
|
|
4604
5288
|
timeout=60,
|
|
4605
5289
|
)
|
|
4606
5290
|
if 200 <= _response.status_code < 300:
|
|
4607
|
-
return pydantic.parse_obj_as(
|
|
5291
|
+
return pydantic.parse_obj_as(EvaluatorConfig, _response.json()) # type: ignore
|
|
4608
5292
|
if _response.status_code == 422:
|
|
4609
5293
|
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
4610
5294
|
try:
|
|
@@ -4613,24 +5297,39 @@ class AsyncAgentaApi:
|
|
|
4613
5297
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
4614
5298
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
4615
5299
|
|
|
4616
|
-
async def
|
|
5300
|
+
async def delete_evaluator_config_evaluators_configs_evaluator_config_id_delete(
|
|
5301
|
+
self, evaluator_config_id: str
|
|
5302
|
+
) -> bool:
|
|
4617
5303
|
"""
|
|
4618
|
-
|
|
5304
|
+
Endpoint to delete a specific evaluator configuration.
|
|
5305
|
+
|
|
5306
|
+
Args:
|
|
5307
|
+
evaluator_config_id (str): The unique identifier of the evaluator configuration.
|
|
4619
5308
|
|
|
4620
5309
|
Returns:
|
|
4621
|
-
|
|
5310
|
+
bool: True if deletion was successful, False otherwise.
|
|
5311
|
+
|
|
5312
|
+
Parameters:
|
|
5313
|
+
- evaluator_config_id: str.
|
|
5314
|
+
---
|
|
5315
|
+
from agenta.client import AsyncAgentaApi
|
|
5316
|
+
|
|
5317
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
5318
|
+
await client.delete_evaluator_config_evaluators_configs_evaluator_config_id_delete(evaluator_config_id="string")
|
|
4622
5319
|
"""
|
|
4623
5320
|
_response = await self._client_wrapper.httpx_client.request(
|
|
4624
|
-
"
|
|
5321
|
+
"DELETE",
|
|
4625
5322
|
urllib.parse.urljoin(
|
|
4626
5323
|
f"{self._client_wrapper.get_base_url()}/",
|
|
4627
|
-
"
|
|
5324
|
+
f"evaluators/configs/{evaluator_config_id}",
|
|
4628
5325
|
),
|
|
4629
5326
|
headers=self._client_wrapper.get_headers(),
|
|
4630
5327
|
timeout=60,
|
|
4631
5328
|
)
|
|
4632
5329
|
if 200 <= _response.status_code < 300:
|
|
4633
|
-
return pydantic.parse_obj_as(
|
|
5330
|
+
return pydantic.parse_obj_as(bool, _response.json()) # type: ignore
|
|
5331
|
+
if _response.status_code == 422:
|
|
5332
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
4634
5333
|
try:
|
|
4635
5334
|
_response_json = _response.json()
|
|
4636
5335
|
except JSONDecodeError:
|
|
@@ -4696,6 +5395,12 @@ class AsyncAgentaApi:
|
|
|
4696
5395
|
|
|
4697
5396
|
Returns:
|
|
4698
5397
|
dict: The result of the import process.
|
|
5398
|
+
|
|
5399
|
+
---
|
|
5400
|
+
from agenta.client import AsyncAgentaApi
|
|
5401
|
+
|
|
5402
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
5403
|
+
await client.import_testset()
|
|
4699
5404
|
"""
|
|
4700
5405
|
_response = await self._client_wrapper.httpx_client.request(
|
|
4701
5406
|
"POST",
|
|
@@ -4733,6 +5438,12 @@ class AsyncAgentaApi:
|
|
|
4733
5438
|
- app_id: str.
|
|
4734
5439
|
|
|
4735
5440
|
- request: NewTestset.
|
|
5441
|
+
---
|
|
5442
|
+
from agenta import NewTestset
|
|
5443
|
+
from agenta.client import AsyncAgentaApi
|
|
5444
|
+
|
|
5445
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
5446
|
+
await client.create_testset(app_id="string", request=NewTestset(name="string", csvdata=[]))
|
|
4736
5447
|
"""
|
|
4737
5448
|
_response = await self._client_wrapper.httpx_client.request(
|
|
4738
5449
|
"POST",
|
|
@@ -4765,6 +5476,11 @@ class AsyncAgentaApi:
|
|
|
4765
5476
|
|
|
4766
5477
|
Parameters:
|
|
4767
5478
|
- testset_id: str.
|
|
5479
|
+
---
|
|
5480
|
+
from agenta.client import AsyncAgentaApi
|
|
5481
|
+
|
|
5482
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
5483
|
+
await client.get_single_testset(testset_id="string")
|
|
4768
5484
|
"""
|
|
4769
5485
|
_response = await self._client_wrapper.httpx_client.request(
|
|
4770
5486
|
"GET",
|
|
@@ -4801,6 +5517,12 @@ class AsyncAgentaApi:
|
|
|
4801
5517
|
- testset_id: str.
|
|
4802
5518
|
|
|
4803
5519
|
- request: NewTestset.
|
|
5520
|
+
---
|
|
5521
|
+
from agenta import NewTestset
|
|
5522
|
+
from agenta.client import AsyncAgentaApi
|
|
5523
|
+
|
|
5524
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
5525
|
+
await client.update_testset(testset_id="string", request=NewTestset(name="string", csvdata=[]))
|
|
4804
5526
|
"""
|
|
4805
5527
|
_response = await self._client_wrapper.httpx_client.request(
|
|
4806
5528
|
"PUT",
|
|
@@ -4839,7 +5561,7 @@ class AsyncAgentaApi:
|
|
|
4839
5561
|
from agenta.client import AsyncAgentaApi
|
|
4840
5562
|
|
|
4841
5563
|
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
4842
|
-
await client.get_testsets(app_id="
|
|
5564
|
+
await client.get_testsets(app_id="string")
|
|
4843
5565
|
"""
|
|
4844
5566
|
_response = await self._client_wrapper.httpx_client.request(
|
|
4845
5567
|
"GET",
|
|
@@ -4926,7 +5648,7 @@ class AsyncAgentaApi:
|
|
|
4926
5648
|
data=jsonable_encoder({}),
|
|
4927
5649
|
files={"tar_file": tar_file},
|
|
4928
5650
|
headers=self._client_wrapper.get_headers(),
|
|
4929
|
-
timeout=
|
|
5651
|
+
timeout=600,
|
|
4930
5652
|
)
|
|
4931
5653
|
if 200 <= _response.status_code < 300:
|
|
4932
5654
|
return pydantic.parse_obj_as(Image, _response.json()) # type: ignore
|
|
@@ -4949,6 +5671,11 @@ class AsyncAgentaApi:
|
|
|
4949
5671
|
|
|
4950
5672
|
Parameters:
|
|
4951
5673
|
- variant_id: str.
|
|
5674
|
+
---
|
|
5675
|
+
from agenta.client import AsyncAgentaApi
|
|
5676
|
+
|
|
5677
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
5678
|
+
await client.restart_container(variant_id="string")
|
|
4952
5679
|
"""
|
|
4953
5680
|
_response = await self._client_wrapper.httpx_client.request(
|
|
4954
5681
|
"POST",
|
|
@@ -5021,6 +5748,11 @@ class AsyncAgentaApi:
|
|
|
5021
5748
|
- base_id: typing.Optional[str].
|
|
5022
5749
|
|
|
5023
5750
|
- variant_id: typing.Optional[str].
|
|
5751
|
+
---
|
|
5752
|
+
from agenta.client import AsyncAgentaApi
|
|
5753
|
+
|
|
5754
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
5755
|
+
await client.construct_app_container_url()
|
|
5024
5756
|
"""
|
|
5025
5757
|
_response = await self._client_wrapper.httpx_client.request(
|
|
5026
5758
|
"GET",
|
|
@@ -5061,6 +5793,11 @@ class AsyncAgentaApi:
|
|
|
5061
5793
|
- environment_name: str.
|
|
5062
5794
|
|
|
5063
5795
|
- variant_id: str.
|
|
5796
|
+
---
|
|
5797
|
+
from agenta.client import AsyncAgentaApi
|
|
5798
|
+
|
|
5799
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
5800
|
+
await client.deploy_to_environment(environment_name="string", variant_id="string")
|
|
5064
5801
|
"""
|
|
5065
5802
|
_response = await self._client_wrapper.httpx_client.request(
|
|
5066
5803
|
"POST",
|
|
@@ -5118,6 +5855,19 @@ class AsyncAgentaApi:
|
|
|
5118
5855
|
- end_time: dt.datetime.
|
|
5119
5856
|
|
|
5120
5857
|
- spans: typing.List[str].
|
|
5858
|
+
---
|
|
5859
|
+
import datetime
|
|
5860
|
+
|
|
5861
|
+
from agenta.client import AsyncAgentaApi
|
|
5862
|
+
|
|
5863
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
5864
|
+
await client.create_trace(
|
|
5865
|
+
latency=1.1,
|
|
5866
|
+
status="string",
|
|
5867
|
+
start_time=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00"),
|
|
5868
|
+
end_time=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00"),
|
|
5869
|
+
spans=[],
|
|
5870
|
+
)
|
|
5121
5871
|
"""
|
|
5122
5872
|
_request: typing.Dict[str, typing.Any] = {
|
|
5123
5873
|
"latency": latency,
|
|
@@ -5165,7 +5915,7 @@ class AsyncAgentaApi:
|
|
|
5165
5915
|
from agenta.client import AsyncAgentaApi
|
|
5166
5916
|
|
|
5167
5917
|
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
5168
|
-
await client.get_traces(app_id="
|
|
5918
|
+
await client.get_traces(app_id="string", variant_id="string")
|
|
5169
5919
|
"""
|
|
5170
5920
|
_response = await self._client_wrapper.httpx_client.request(
|
|
5171
5921
|
"GET",
|
|
@@ -5190,6 +5940,11 @@ class AsyncAgentaApi:
|
|
|
5190
5940
|
"""
|
|
5191
5941
|
Parameters:
|
|
5192
5942
|
- trace_id: str.
|
|
5943
|
+
---
|
|
5944
|
+
from agenta.client import AsyncAgentaApi
|
|
5945
|
+
|
|
5946
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
5947
|
+
await client.get_single_trace(trace_id="string")
|
|
5193
5948
|
"""
|
|
5194
5949
|
_response = await self._client_wrapper.httpx_client.request(
|
|
5195
5950
|
"GET",
|
|
@@ -5216,6 +5971,11 @@ class AsyncAgentaApi:
|
|
|
5216
5971
|
- trace_id: str.
|
|
5217
5972
|
|
|
5218
5973
|
- status: str.
|
|
5974
|
+
---
|
|
5975
|
+
from agenta.client import AsyncAgentaApi
|
|
5976
|
+
|
|
5977
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
5978
|
+
await client.update_trace_status(trace_id="string", status="string")
|
|
5219
5979
|
"""
|
|
5220
5980
|
_response = await self._client_wrapper.httpx_client.request(
|
|
5221
5981
|
"PUT",
|
|
@@ -5290,6 +6050,18 @@ class AsyncAgentaApi:
|
|
|
5290
6050
|
- cost: typing.Optional[float].
|
|
5291
6051
|
|
|
5292
6052
|
- tags: typing.Optional[typing.List[str]].
|
|
6053
|
+
---
|
|
6054
|
+
import datetime
|
|
6055
|
+
|
|
6056
|
+
from agenta.client import AsyncAgentaApi
|
|
6057
|
+
|
|
6058
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
6059
|
+
await client.create_span(
|
|
6060
|
+
event_name="string",
|
|
6061
|
+
start_time=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00"),
|
|
6062
|
+
status="string",
|
|
6063
|
+
end_time=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00"),
|
|
6064
|
+
)
|
|
5293
6065
|
"""
|
|
5294
6066
|
_request: typing.Dict[str, typing.Any] = {
|
|
5295
6067
|
"event_name": event_name,
|
|
@@ -5348,7 +6120,7 @@ class AsyncAgentaApi:
|
|
|
5348
6120
|
from agenta.client import AsyncAgentaApi
|
|
5349
6121
|
|
|
5350
6122
|
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
5351
|
-
await client.get_spans_of_trace(trace_id="
|
|
6123
|
+
await client.get_spans_of_trace(trace_id="string")
|
|
5352
6124
|
"""
|
|
5353
6125
|
_response = await self._client_wrapper.httpx_client.request(
|
|
5354
6126
|
"GET",
|
|
@@ -5377,7 +6149,7 @@ class AsyncAgentaApi:
|
|
|
5377
6149
|
from agenta.client import AsyncAgentaApi
|
|
5378
6150
|
|
|
5379
6151
|
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
5380
|
-
await client.get_feedbacks(trace_id="
|
|
6152
|
+
await client.get_feedbacks(trace_id="string")
|
|
5381
6153
|
"""
|
|
5382
6154
|
_response = await self._client_wrapper.httpx_client.request(
|
|
5383
6155
|
"GET",
|
|
@@ -5415,6 +6187,11 @@ class AsyncAgentaApi:
|
|
|
5415
6187
|
- score: typing.Optional[float].
|
|
5416
6188
|
|
|
5417
6189
|
- meta: typing.Optional[typing.Dict[str, typing.Any]].
|
|
6190
|
+
---
|
|
6191
|
+
from agenta.client import AsyncAgentaApi
|
|
6192
|
+
|
|
6193
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
6194
|
+
await client.create_feedback(trace_id="string")
|
|
5418
6195
|
"""
|
|
5419
6196
|
_request: typing.Dict[str, typing.Any] = {}
|
|
5420
6197
|
if feedback is not OMIT:
|
|
@@ -5449,6 +6226,11 @@ class AsyncAgentaApi:
|
|
|
5449
6226
|
- trace_id: str.
|
|
5450
6227
|
|
|
5451
6228
|
- feedback_id: str.
|
|
6229
|
+
---
|
|
6230
|
+
from agenta.client import AsyncAgentaApi
|
|
6231
|
+
|
|
6232
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
6233
|
+
await client.get_feedback(trace_id="string", feedback_id="string")
|
|
5452
6234
|
"""
|
|
5453
6235
|
_response = await self._client_wrapper.httpx_client.request(
|
|
5454
6236
|
"GET",
|
|
@@ -5489,6 +6271,11 @@ class AsyncAgentaApi:
|
|
|
5489
6271
|
- score: typing.Optional[float].
|
|
5490
6272
|
|
|
5491
6273
|
- meta: typing.Optional[typing.Dict[str, typing.Any]].
|
|
6274
|
+
---
|
|
6275
|
+
from agenta.client import AsyncAgentaApi
|
|
6276
|
+
|
|
6277
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
6278
|
+
await client.update_feedback(trace_id="string", feedback_id="string", feedback="string")
|
|
5492
6279
|
"""
|
|
5493
6280
|
_request: typing.Dict[str, typing.Any] = {"feedback": feedback}
|
|
5494
6281
|
if score is not OMIT:
|
|
@@ -5551,6 +6338,12 @@ class AsyncAgentaApi:
|
|
|
5551
6338
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
5552
6339
|
|
|
5553
6340
|
async def get_own_org(self) -> OrganizationOutput:
|
|
6341
|
+
"""
|
|
6342
|
+
from agenta.client import AsyncAgentaApi
|
|
6343
|
+
|
|
6344
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
6345
|
+
await client.get_own_org()
|
|
6346
|
+
"""
|
|
5554
6347
|
_response = await self._client_wrapper.httpx_client.request(
|
|
5555
6348
|
"GET",
|
|
5556
6349
|
urllib.parse.urljoin(
|
|
@@ -5628,6 +6421,11 @@ class AsyncAgentaApi:
|
|
|
5628
6421
|
- config_name: typing.Optional[str].
|
|
5629
6422
|
|
|
5630
6423
|
- environment_name: typing.Optional[str].
|
|
6424
|
+
---
|
|
6425
|
+
from agenta.client import AsyncAgentaApi
|
|
6426
|
+
|
|
6427
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
6428
|
+
await client.get_config(base_id="string")
|
|
5631
6429
|
"""
|
|
5632
6430
|
_response = await self._client_wrapper.httpx_client.request(
|
|
5633
6431
|
"GET",
|
|
@@ -5669,6 +6467,16 @@ class AsyncAgentaApi:
|
|
|
5669
6467
|
- parameters: typing.Dict[str, typing.Any].
|
|
5670
6468
|
|
|
5671
6469
|
- overwrite: bool.
|
|
6470
|
+
---
|
|
6471
|
+
from agenta.client import AsyncAgentaApi
|
|
6472
|
+
|
|
6473
|
+
client = AsyncAgentaApi(api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api")
|
|
6474
|
+
await client.save_config(
|
|
6475
|
+
base_id="string",
|
|
6476
|
+
config_name="string",
|
|
6477
|
+
parameters={"string": {"unknown": "string", "type": "unknown"}},
|
|
6478
|
+
overwrite=True,
|
|
6479
|
+
)
|
|
5672
6480
|
"""
|
|
5673
6481
|
_response = await self._client_wrapper.httpx_client.request(
|
|
5674
6482
|
"POST",
|