agenta 0.36.4__py3-none-any.whl → 0.37.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/__init__.py +1 -2
- agenta/client/__init__.py +6 -10
- agenta/client/{admin → backend/admin}/client.py +2 -0
- agenta/client/backend/api_keys/client.py +531 -0
- agenta/client/{apps → backend/apps}/client.py +0 -222
- agenta/client/{containers → backend/containers}/client.py +10 -70
- agenta/client/{core → backend/core}/http_client.py +6 -6
- agenta/client/{core → backend/core}/pydantic_utilities.py +2 -2
- agenta/client/{environments → backend/environments}/client.py +0 -2
- agenta/client/{human_evaluations → backend/human_evaluations}/client.py +0 -2
- agenta/client/{observability → backend/observability}/client.py +98 -0
- agenta/client/backend/organization/client.py +839 -0
- agenta/client/backend/testsets/__init__.py +1 -0
- agenta/client/{types → backend/types}/__init__.py +22 -6
- agenta/client/{types → backend/types}/agenta_nodes_response.py +0 -5
- agenta/client/{types → backend/types}/agenta_root_dto.py +0 -5
- agenta/client/{types → backend/types}/agenta_roots_response.py +0 -5
- agenta/client/{types → backend/types}/agenta_tree_dto.py +0 -5
- agenta/client/{types → backend/types}/agenta_trees_response.py +0 -5
- agenta/client/backend/types/custom_model_settings_dto.py +22 -0
- agenta/client/backend/types/custom_provider_dto.py +29 -0
- agenta/client/backend/types/custom_provider_kind.py +26 -0
- agenta/client/backend/types/custom_provider_settings_dto.py +24 -0
- agenta/client/backend/types/data.py +7 -0
- agenta/client/{types → backend/types}/organization.py +1 -4
- agenta/client/backend/types/organization_details.py +29 -0
- agenta/client/{types → backend/types}/organization_membership_request.py +3 -2
- agenta/client/{types → backend/types}/permission.py +1 -0
- agenta/client/backend/types/provider_key_dto.py +21 -0
- agenta/client/backend/types/provider_kind.py +21 -0
- agenta/client/backend/types/score.py +3 -0
- agenta/client/{types → backend/types}/secret_dto.py +3 -3
- agenta/client/backend/types/secret_kind.py +5 -0
- agenta/client/backend/types/standard_provider_dto.py +24 -0
- agenta/client/backend/types/standard_provider_kind.py +21 -0
- agenta/client/backend/types/standard_provider_settings_dto.py +21 -0
- agenta/client/backend/types/workspace.py +24 -0
- agenta/client/{variants → backend/variants}/client.py +18 -24
- agenta/client/backend/vault/__init__.py +1 -0
- agenta/client/{vault → backend/vault}/client.py +26 -8
- agenta/client/backend/workspace/__init__.py +1 -0
- agenta/client/backend/workspace/client.py +405 -0
- agenta/client/client.py +46 -46
- agenta/client/types/provider_key_dto.py~feat_model-registry +21 -0
- agenta/client/types/provider_kind.py~feat_model-registry +21 -0
- agenta/sdk/__init__.py +1 -1
- agenta/sdk/managers/secrets.py +175 -11
- agenta/sdk/managers/shared.py +3 -3
- agenta/sdk/middleware/vault.py +29 -37
- agenta/sdk/types.py +4 -7
- {agenta-0.36.4.dist-info → agenta-0.37.0.dist-info}/METADATA +2 -6
- agenta-0.37.0.dist-info/RECORD +255 -0
- agenta/client/types/score.py +0 -5
- agenta/client/types/secret_kind.py +0 -5
- agenta/sdk/client.py +0 -56
- agenta-0.36.4.dist-info/RECORD +0 -236
- /agenta/client/{access_control → backend/access_control}/__init__.py +0 -0
- /agenta/client/{access_control → backend/access_control}/client.py +0 -0
- /agenta/client/{admin → backend/admin}/__init__.py +0 -0
- /agenta/client/{apps → backend/api_keys}/__init__.py +0 -0
- /agenta/client/{bases → backend/apps}/__init__.py +0 -0
- /agenta/client/{configs → backend/bases}/__init__.py +0 -0
- /agenta/client/{bases → backend/bases}/client.py +0 -0
- /agenta/client/{environments → backend/configs}/__init__.py +0 -0
- /agenta/client/{configs → backend/configs}/client.py +0 -0
- /agenta/client/{containers → backend/containers}/__init__.py +0 -0
- /agenta/client/{containers → backend/containers}/types/__init__.py +0 -0
- /agenta/client/{containers → backend/containers}/types/container_templates_response.py +0 -0
- /agenta/client/{core → backend/core}/__init__.py +0 -0
- /agenta/client/{core → backend/core}/api_error.py +0 -0
- /agenta/client/{core → backend/core}/client_wrapper.py +0 -0
- /agenta/client/{core → backend/core}/datetime_utils.py +0 -0
- /agenta/client/{core → backend/core}/file.py +0 -0
- /agenta/client/{core → backend/core}/jsonable_encoder.py +0 -0
- /agenta/client/{core → backend/core}/query_encoder.py +0 -0
- /agenta/client/{core → backend/core}/remove_none_from_dict.py +0 -0
- /agenta/client/{core → backend/core}/request_options.py +0 -0
- /agenta/client/{core → backend/core}/serialization.py +0 -0
- /agenta/client/{evaluations → backend/environments}/__init__.py +0 -0
- /agenta/client/{errors → backend/errors}/__init__.py +0 -0
- /agenta/client/{errors → backend/errors}/unprocessable_entity_error.py +0 -0
- /agenta/client/{evaluators → backend/evaluations}/__init__.py +0 -0
- /agenta/client/{evaluations → backend/evaluations}/client.py +0 -0
- /agenta/client/{human_evaluations → backend/evaluators}/__init__.py +0 -0
- /agenta/client/{evaluators → backend/evaluators}/client.py +0 -0
- /agenta/client/{scopes → backend/human_evaluations}/__init__.py +0 -0
- /agenta/client/{observability → backend/observability}/__init__.py +0 -0
- /agenta/client/{observability → backend/observability}/types/__init__.py +0 -0
- /agenta/client/{observability → backend/observability}/types/format.py +0 -0
- /agenta/client/{observability → backend/observability}/types/query_analytics_response.py +0 -0
- /agenta/client/{observability → backend/observability}/types/query_traces_response.py +0 -0
- /agenta/client/{testsets → backend/organization}/__init__.py +0 -0
- /agenta/client/{vault → backend/scopes}/__init__.py +0 -0
- /agenta/client/{scopes → backend/scopes}/client.py +0 -0
- /agenta/client/{testsets → backend/testsets}/client.py +0 -0
- /agenta/client/{types → backend/types}/account_response.py +0 -0
- /agenta/client/{types → backend/types}/agenta_node_dto.py +0 -0
- /agenta/client/{types → backend/types}/agenta_node_dto_nodes_value.py +0 -0
- /agenta/client/{types → backend/types}/aggregated_result.py +0 -0
- /agenta/client/{types → backend/types}/aggregated_result_evaluator_config.py +0 -0
- /agenta/client/{types → backend/types}/analytics_response.py +0 -0
- /agenta/client/{types → backend/types}/app.py +0 -0
- /agenta/client/{types → backend/types}/app_variant_response.py +0 -0
- /agenta/client/{types → backend/types}/app_variant_revision.py +0 -0
- /agenta/client/{types → backend/types}/base_output.py +0 -0
- /agenta/client/{types → backend/types}/body_import_testset.py +0 -0
- /agenta/client/{types → backend/types}/bucket_dto.py +0 -0
- /agenta/client/{types → backend/types}/collect_status_response.py +0 -0
- /agenta/client/{types → backend/types}/config_db.py +0 -0
- /agenta/client/{types → backend/types}/config_dto.py +0 -0
- /agenta/client/{types → backend/types}/config_response_model.py +0 -0
- /agenta/client/{types → backend/types}/correct_answer.py +0 -0
- /agenta/client/{types → backend/types}/create_app_output.py +0 -0
- /agenta/client/{types → backend/types}/delete_evaluation.py +0 -0
- /agenta/client/{types → backend/types}/docker_env_vars.py +0 -0
- /agenta/client/{types → backend/types}/environment_output.py +0 -0
- /agenta/client/{types → backend/types}/environment_output_extended.py +0 -0
- /agenta/client/{types → backend/types}/environment_revision.py +0 -0
- /agenta/client/{types → backend/types}/error.py +0 -0
- /agenta/client/{types → backend/types}/evaluation.py +0 -0
- /agenta/client/{types → backend/types}/evaluation_scenario.py +0 -0
- /agenta/client/{types → backend/types}/evaluation_scenario_input.py +0 -0
- /agenta/client/{types → backend/types}/evaluation_scenario_output.py +0 -0
- /agenta/client/{types → backend/types}/evaluation_scenario_result.py +0 -0
- /agenta/client/{types → backend/types}/evaluation_status_enum.py +0 -0
- /agenta/client/{types → backend/types}/evaluation_type.py +0 -0
- /agenta/client/{types → backend/types}/evaluator.py +0 -0
- /agenta/client/{types → backend/types}/evaluator_config.py +0 -0
- /agenta/client/{types → backend/types}/evaluator_mapping_output_interface.py +0 -0
- /agenta/client/{types → backend/types}/evaluator_output_interface.py +0 -0
- /agenta/client/{types → backend/types}/exception_dto.py +0 -0
- /agenta/client/{types → backend/types}/get_config_response.py +0 -0
- /agenta/client/{types → backend/types}/header_dto.py +0 -0
- /agenta/client/{types → backend/types}/http_validation_error.py +0 -0
- /agenta/client/{types → backend/types}/human_evaluation.py +0 -0
- /agenta/client/{types → backend/types}/human_evaluation_scenario.py +0 -0
- /agenta/client/{types → backend/types}/human_evaluation_scenario_input.py +0 -0
- /agenta/client/{types → backend/types}/human_evaluation_scenario_output.py +0 -0
- /agenta/client/{types → backend/types}/image.py +0 -0
- /agenta/client/{types → backend/types}/invite_request.py +0 -0
- /agenta/client/{types → backend/types}/legacy_analytics_response.py +0 -0
- /agenta/client/{types → backend/types}/legacy_data_point.py +0 -0
- /agenta/client/{types → backend/types}/legacy_scope_request.py +0 -0
- /agenta/client/{types → backend/types}/legacy_scopes_response.py +0 -0
- /agenta/client/{types → backend/types}/legacy_user_request.py +0 -0
- /agenta/client/{types → backend/types}/legacy_user_response.py +0 -0
- /agenta/client/{types → backend/types}/lifecycle_dto.py +0 -0
- /agenta/client/{types → backend/types}/link_dto.py +0 -0
- /agenta/client/{types → backend/types}/list_api_keys_response.py +0 -0
- /agenta/client/{types → backend/types}/llm_run_rate_limit.py +0 -0
- /agenta/client/{types → backend/types}/metrics_dto.py +0 -0
- /agenta/client/{types → backend/types}/new_testset.py +0 -0
- /agenta/client/{types → backend/types}/node_dto.py +0 -0
- /agenta/client/{types → backend/types}/node_type.py +0 -0
- /agenta/client/{types → backend/types}/o_tel_context_dto.py +0 -0
- /agenta/client/{types → backend/types}/o_tel_event_dto.py +0 -0
- /agenta/client/{types → backend/types}/o_tel_extra_dto.py +0 -0
- /agenta/client/{types → backend/types}/o_tel_link_dto.py +0 -0
- /agenta/client/{types → backend/types}/o_tel_span_dto.py +0 -0
- /agenta/client/{types → backend/types}/o_tel_span_kind.py +0 -0
- /agenta/client/{types → backend/types}/o_tel_spans_response.py +0 -0
- /agenta/client/{types → backend/types}/o_tel_status_code.py +0 -0
- /agenta/client/{types → backend/types}/organization_output.py +0 -0
- /agenta/client/{types → backend/types}/organization_request.py +0 -0
- /agenta/client/{types → backend/types}/parent_dto.py +0 -0
- /agenta/client/{types → backend/types}/project_membership_request.py +0 -0
- /agenta/client/{types → backend/types}/project_request.py +0 -0
- /agenta/client/{types → backend/types}/project_scope.py +0 -0
- /agenta/client/{types → backend/types}/projects_response.py +0 -0
- /agenta/client/{types → backend/types}/reference.py +0 -0
- /agenta/client/{types → backend/types}/reference_dto.py +0 -0
- /agenta/client/{types → backend/types}/reference_request_model.py +0 -0
- /agenta/client/{types → backend/types}/result.py +0 -0
- /agenta/client/{types → backend/types}/role.py +0 -0
- /agenta/client/{types → backend/types}/root_dto.py +0 -0
- /agenta/client/{types → backend/types}/scopes_response_model.py +0 -0
- /agenta/client/{types → backend/types}/secret_response_dto.py +0 -0
- /agenta/client/{types → backend/types}/simple_evaluation_output.py +0 -0
- /agenta/client/{types → backend/types}/span_dto.py +0 -0
- /agenta/client/{types → backend/types}/span_dto_nodes_value.py +0 -0
- /agenta/client/{types → backend/types}/status_code.py +0 -0
- /agenta/client/{types → backend/types}/status_dto.py +0 -0
- /agenta/client/{types → backend/types}/template.py +0 -0
- /agenta/client/{types → backend/types}/template_image_info.py +0 -0
- /agenta/client/{types → backend/types}/test_set_output_response.py +0 -0
- /agenta/client/{types → backend/types}/test_set_simple_response.py +0 -0
- /agenta/client/{types → backend/types}/time_dto.py +0 -0
- /agenta/client/{types → backend/types}/tree_dto.py +0 -0
- /agenta/client/{types → backend/types}/tree_type.py +0 -0
- /agenta/client/{types → backend/types}/update_app_output.py +0 -0
- /agenta/client/{types → backend/types}/uri.py +0 -0
- /agenta/client/{types → backend/types}/user_request.py +0 -0
- /agenta/client/{types → backend/types}/validation_error.py +0 -0
- /agenta/client/{types → backend/types}/validation_error_loc_item.py +0 -0
- /agenta/client/{types → backend/types}/variant_action.py +0 -0
- /agenta/client/{types → backend/types}/variant_action_enum.py +0 -0
- /agenta/client/{types → backend/types}/workspace_member_response.py +0 -0
- /agenta/client/{types → backend/types}/workspace_membership_request.py +0 -0
- /agenta/client/{types → backend/types}/workspace_permission.py +0 -0
- /agenta/client/{types → backend/types}/workspace_request.py +0 -0
- /agenta/client/{types → backend/types}/workspace_response.py +0 -0
- /agenta/client/{types → backend/types}/workspace_role.py +0 -0
- /agenta/client/{types → backend/types}/workspace_role_response.py +0 -0
- /agenta/client/{variants → backend/variants}/__init__.py +0 -0
- /agenta/client/{variants → backend/variants}/types/__init__.py +0 -0
- /agenta/client/{variants → backend/variants}/types/add_variant_from_base_and_config_response.py +0 -0
- /agenta/client/types/{provider_key_dto.py → provider_key_dto.py~HEAD} +0 -0
- /agenta/client/types/{provider_kind.py → provider_kind.py~HEAD} +0 -0
- {agenta-0.36.4.dist-info → agenta-0.37.0.dist-info}/WHEEL +0 -0
|
@@ -33,7 +33,6 @@ class AppsClient:
|
|
|
33
33
|
|
|
34
34
|
Args:
|
|
35
35
|
app_id (str): The ID of the app to retrieve variants for.
|
|
36
|
-
stoken_session (SessionContainer, optional): The session container to verify the user's session. Defaults to Depends(verify_session()).
|
|
37
36
|
|
|
38
37
|
Returns:
|
|
39
38
|
List[AppVariantResponse]: A list of app variants for the given app ID.
|
|
@@ -104,7 +103,6 @@ class AppsClient:
|
|
|
104
103
|
Args:
|
|
105
104
|
app_id (str): The ID of the app to retrieve the variant for.
|
|
106
105
|
environment (str): The environment of the app variant to retrieve.
|
|
107
|
-
stoken_session (SessionContainer, optional): The session token container. Defaults to Depends(verify_session()).
|
|
108
106
|
|
|
109
107
|
Raises:
|
|
110
108
|
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).
|
|
@@ -183,7 +181,6 @@ class AppsClient:
|
|
|
183
181
|
|
|
184
182
|
Args:
|
|
185
183
|
app_name (Optional[str]): The name of the app to filter by.
|
|
186
|
-
stoken_session (SessionContainer): The session container.
|
|
187
184
|
|
|
188
185
|
Returns:
|
|
189
186
|
List[App]: A list of apps filtered by app_name.
|
|
@@ -260,7 +257,6 @@ class AppsClient:
|
|
|
260
257
|
|
|
261
258
|
Args:
|
|
262
259
|
payload (CreateApp): The payload containing the app name and organization ID (optional).
|
|
263
|
-
stoken_session (SessionContainer): The session container containing the user's session token.
|
|
264
260
|
|
|
265
261
|
Returns:
|
|
266
262
|
CreateAppOutput: The output containing the newly created app's ID and name.
|
|
@@ -415,7 +411,6 @@ class AppsClient:
|
|
|
415
411
|
Args:
|
|
416
412
|
app_id (str): The ID of the app.
|
|
417
413
|
payload (UpdateApp): The payload containing the app name.
|
|
418
|
-
stoken_session (SessionContainer): The session container containing the user's session token.
|
|
419
414
|
|
|
420
415
|
Returns:
|
|
421
416
|
UpdateAppOuput: The output containing the newly created app's ID and name.
|
|
@@ -767,107 +762,6 @@ class AppsClient:
|
|
|
767
762
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
768
763
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
769
764
|
|
|
770
|
-
def create_app_and_variant_from_template(
|
|
771
|
-
self,
|
|
772
|
-
*,
|
|
773
|
-
app_name: str,
|
|
774
|
-
template_id: str,
|
|
775
|
-
env_vars: typing.Dict[str, str],
|
|
776
|
-
project_id: typing.Optional[str] = OMIT,
|
|
777
|
-
workspace_id: typing.Optional[str] = OMIT,
|
|
778
|
-
organization_id: typing.Optional[str] = OMIT,
|
|
779
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
780
|
-
) -> AppVariantResponse:
|
|
781
|
-
"""
|
|
782
|
-
Create an app and variant from a template.
|
|
783
|
-
|
|
784
|
-
Args:
|
|
785
|
-
payload (CreateAppVariant): The payload containing the app and variant information.
|
|
786
|
-
stoken_session (SessionContainer, optional): The session container. Defaults to Depends(verify_session()).
|
|
787
|
-
|
|
788
|
-
Raises:
|
|
789
|
-
HTTPException: If the user has reached the app limit or if an app with the same name already exists.
|
|
790
|
-
|
|
791
|
-
Returns:
|
|
792
|
-
AppVariantResponse: The output of the created app variant.
|
|
793
|
-
|
|
794
|
-
Parameters
|
|
795
|
-
----------
|
|
796
|
-
app_name : str
|
|
797
|
-
|
|
798
|
-
template_id : str
|
|
799
|
-
|
|
800
|
-
env_vars : typing.Dict[str, str]
|
|
801
|
-
|
|
802
|
-
project_id : typing.Optional[str]
|
|
803
|
-
|
|
804
|
-
workspace_id : typing.Optional[str]
|
|
805
|
-
|
|
806
|
-
organization_id : typing.Optional[str]
|
|
807
|
-
|
|
808
|
-
request_options : typing.Optional[RequestOptions]
|
|
809
|
-
Request-specific configuration.
|
|
810
|
-
|
|
811
|
-
Returns
|
|
812
|
-
-------
|
|
813
|
-
AppVariantResponse
|
|
814
|
-
Successful Response
|
|
815
|
-
|
|
816
|
-
Examples
|
|
817
|
-
--------
|
|
818
|
-
from agenta import AgentaApi
|
|
819
|
-
|
|
820
|
-
client = AgentaApi(
|
|
821
|
-
api_key="YOUR_API_KEY",
|
|
822
|
-
base_url="https://yourhost.com/path/to/api",
|
|
823
|
-
)
|
|
824
|
-
client.apps.create_app_and_variant_from_template(
|
|
825
|
-
app_name="app_name",
|
|
826
|
-
template_id="template_id",
|
|
827
|
-
env_vars={"key": "value"},
|
|
828
|
-
)
|
|
829
|
-
"""
|
|
830
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
831
|
-
"apps/app_and_variant_from_template",
|
|
832
|
-
method="POST",
|
|
833
|
-
json={
|
|
834
|
-
"app_name": app_name,
|
|
835
|
-
"template_id": template_id,
|
|
836
|
-
"project_id": project_id,
|
|
837
|
-
"workspace_id": workspace_id,
|
|
838
|
-
"env_vars": env_vars,
|
|
839
|
-
"organization_id": organization_id,
|
|
840
|
-
},
|
|
841
|
-
headers={
|
|
842
|
-
"content-type": "application/json",
|
|
843
|
-
},
|
|
844
|
-
request_options=request_options,
|
|
845
|
-
omit=OMIT,
|
|
846
|
-
)
|
|
847
|
-
try:
|
|
848
|
-
if 200 <= _response.status_code < 300:
|
|
849
|
-
return typing.cast(
|
|
850
|
-
AppVariantResponse,
|
|
851
|
-
parse_obj_as(
|
|
852
|
-
type_=AppVariantResponse, # type: ignore
|
|
853
|
-
object_=_response.json(),
|
|
854
|
-
),
|
|
855
|
-
)
|
|
856
|
-
if _response.status_code == 422:
|
|
857
|
-
raise UnprocessableEntityError(
|
|
858
|
-
typing.cast(
|
|
859
|
-
HttpValidationError,
|
|
860
|
-
parse_obj_as(
|
|
861
|
-
type_=HttpValidationError, # type: ignore
|
|
862
|
-
object_=_response.json(),
|
|
863
|
-
),
|
|
864
|
-
)
|
|
865
|
-
)
|
|
866
|
-
_response_json = _response.json()
|
|
867
|
-
except JSONDecodeError:
|
|
868
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
869
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
870
|
-
|
|
871
765
|
def list_environments(
|
|
872
766
|
self, app_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
873
767
|
) -> typing.List[EnvironmentOutput]:
|
|
@@ -876,7 +770,6 @@ class AppsClient:
|
|
|
876
770
|
|
|
877
771
|
Args:
|
|
878
772
|
app_id (str): The ID of the app to retrieve environments for.
|
|
879
|
-
stoken_session (SessionContainer, optional): The session container. Defaults to Depends(verify_session()).
|
|
880
773
|
|
|
881
774
|
Returns:
|
|
882
775
|
List[EnvironmentOutput]: A list of environment objects.
|
|
@@ -1011,7 +904,6 @@ class AsyncAppsClient:
|
|
|
1011
904
|
|
|
1012
905
|
Args:
|
|
1013
906
|
app_id (str): The ID of the app to retrieve variants for.
|
|
1014
|
-
stoken_session (SessionContainer, optional): The session container to verify the user's session. Defaults to Depends(verify_session()).
|
|
1015
907
|
|
|
1016
908
|
Returns:
|
|
1017
909
|
List[AppVariantResponse]: A list of app variants for the given app ID.
|
|
@@ -1090,7 +982,6 @@ class AsyncAppsClient:
|
|
|
1090
982
|
Args:
|
|
1091
983
|
app_id (str): The ID of the app to retrieve the variant for.
|
|
1092
984
|
environment (str): The environment of the app variant to retrieve.
|
|
1093
|
-
stoken_session (SessionContainer, optional): The session token container. Defaults to Depends(verify_session()).
|
|
1094
985
|
|
|
1095
986
|
Raises:
|
|
1096
987
|
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).
|
|
@@ -1177,7 +1068,6 @@ class AsyncAppsClient:
|
|
|
1177
1068
|
|
|
1178
1069
|
Args:
|
|
1179
1070
|
app_name (Optional[str]): The name of the app to filter by.
|
|
1180
|
-
stoken_session (SessionContainer): The session container.
|
|
1181
1071
|
|
|
1182
1072
|
Returns:
|
|
1183
1073
|
List[App]: A list of apps filtered by app_name.
|
|
@@ -1262,7 +1152,6 @@ class AsyncAppsClient:
|
|
|
1262
1152
|
|
|
1263
1153
|
Args:
|
|
1264
1154
|
payload (CreateApp): The payload containing the app name and organization ID (optional).
|
|
1265
|
-
stoken_session (SessionContainer): The session container containing the user's session token.
|
|
1266
1155
|
|
|
1267
1156
|
Returns:
|
|
1268
1157
|
CreateAppOutput: The output containing the newly created app's ID and name.
|
|
@@ -1433,7 +1322,6 @@ class AsyncAppsClient:
|
|
|
1433
1322
|
Args:
|
|
1434
1323
|
app_id (str): The ID of the app.
|
|
1435
1324
|
payload (UpdateApp): The payload containing the app name.
|
|
1436
|
-
stoken_session (SessionContainer): The session container containing the user's session token.
|
|
1437
1325
|
|
|
1438
1326
|
Returns:
|
|
1439
1327
|
UpdateAppOuput: The output containing the newly created app's ID and name.
|
|
@@ -1817,115 +1705,6 @@ class AsyncAppsClient:
|
|
|
1817
1705
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1818
1706
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1819
1707
|
|
|
1820
|
-
async def create_app_and_variant_from_template(
|
|
1821
|
-
self,
|
|
1822
|
-
*,
|
|
1823
|
-
app_name: str,
|
|
1824
|
-
template_id: str,
|
|
1825
|
-
env_vars: typing.Dict[str, str],
|
|
1826
|
-
project_id: typing.Optional[str] = OMIT,
|
|
1827
|
-
workspace_id: typing.Optional[str] = OMIT,
|
|
1828
|
-
organization_id: typing.Optional[str] = OMIT,
|
|
1829
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1830
|
-
) -> AppVariantResponse:
|
|
1831
|
-
"""
|
|
1832
|
-
Create an app and variant from a template.
|
|
1833
|
-
|
|
1834
|
-
Args:
|
|
1835
|
-
payload (CreateAppVariant): The payload containing the app and variant information.
|
|
1836
|
-
stoken_session (SessionContainer, optional): The session container. Defaults to Depends(verify_session()).
|
|
1837
|
-
|
|
1838
|
-
Raises:
|
|
1839
|
-
HTTPException: If the user has reached the app limit or if an app with the same name already exists.
|
|
1840
|
-
|
|
1841
|
-
Returns:
|
|
1842
|
-
AppVariantResponse: The output of the created app variant.
|
|
1843
|
-
|
|
1844
|
-
Parameters
|
|
1845
|
-
----------
|
|
1846
|
-
app_name : str
|
|
1847
|
-
|
|
1848
|
-
template_id : str
|
|
1849
|
-
|
|
1850
|
-
env_vars : typing.Dict[str, str]
|
|
1851
|
-
|
|
1852
|
-
project_id : typing.Optional[str]
|
|
1853
|
-
|
|
1854
|
-
workspace_id : typing.Optional[str]
|
|
1855
|
-
|
|
1856
|
-
organization_id : typing.Optional[str]
|
|
1857
|
-
|
|
1858
|
-
request_options : typing.Optional[RequestOptions]
|
|
1859
|
-
Request-specific configuration.
|
|
1860
|
-
|
|
1861
|
-
Returns
|
|
1862
|
-
-------
|
|
1863
|
-
AppVariantResponse
|
|
1864
|
-
Successful Response
|
|
1865
|
-
|
|
1866
|
-
Examples
|
|
1867
|
-
--------
|
|
1868
|
-
import asyncio
|
|
1869
|
-
|
|
1870
|
-
from agenta import AsyncAgentaApi
|
|
1871
|
-
|
|
1872
|
-
client = AsyncAgentaApi(
|
|
1873
|
-
api_key="YOUR_API_KEY",
|
|
1874
|
-
base_url="https://yourhost.com/path/to/api",
|
|
1875
|
-
)
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
async def main() -> None:
|
|
1879
|
-
await client.apps.create_app_and_variant_from_template(
|
|
1880
|
-
app_name="app_name",
|
|
1881
|
-
template_id="template_id",
|
|
1882
|
-
env_vars={"key": "value"},
|
|
1883
|
-
)
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
asyncio.run(main())
|
|
1887
|
-
"""
|
|
1888
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
1889
|
-
"apps/app_and_variant_from_template",
|
|
1890
|
-
method="POST",
|
|
1891
|
-
json={
|
|
1892
|
-
"app_name": app_name,
|
|
1893
|
-
"template_id": template_id,
|
|
1894
|
-
"project_id": project_id,
|
|
1895
|
-
"workspace_id": workspace_id,
|
|
1896
|
-
"env_vars": env_vars,
|
|
1897
|
-
"organization_id": organization_id,
|
|
1898
|
-
},
|
|
1899
|
-
headers={
|
|
1900
|
-
"content-type": "application/json",
|
|
1901
|
-
},
|
|
1902
|
-
request_options=request_options,
|
|
1903
|
-
omit=OMIT,
|
|
1904
|
-
)
|
|
1905
|
-
try:
|
|
1906
|
-
if 200 <= _response.status_code < 300:
|
|
1907
|
-
return typing.cast(
|
|
1908
|
-
AppVariantResponse,
|
|
1909
|
-
parse_obj_as(
|
|
1910
|
-
type_=AppVariantResponse, # type: ignore
|
|
1911
|
-
object_=_response.json(),
|
|
1912
|
-
),
|
|
1913
|
-
)
|
|
1914
|
-
if _response.status_code == 422:
|
|
1915
|
-
raise UnprocessableEntityError(
|
|
1916
|
-
typing.cast(
|
|
1917
|
-
HttpValidationError,
|
|
1918
|
-
parse_obj_as(
|
|
1919
|
-
type_=HttpValidationError, # type: ignore
|
|
1920
|
-
object_=_response.json(),
|
|
1921
|
-
),
|
|
1922
|
-
)
|
|
1923
|
-
)
|
|
1924
|
-
_response_json = _response.json()
|
|
1925
|
-
except JSONDecodeError:
|
|
1926
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1927
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1928
|
-
|
|
1929
1708
|
async def list_environments(
|
|
1930
1709
|
self, app_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1931
1710
|
) -> typing.List[EnvironmentOutput]:
|
|
@@ -1934,7 +1713,6 @@ class AsyncAppsClient:
|
|
|
1934
1713
|
|
|
1935
1714
|
Args:
|
|
1936
1715
|
app_id (str): The ID of the app to retrieve environments for.
|
|
1937
|
-
stoken_session (SessionContainer, optional): The session container. Defaults to Depends(verify_session()).
|
|
1938
1716
|
|
|
1939
1717
|
Returns:
|
|
1940
1718
|
List[EnvironmentOutput]: A list of environment objects.
|
|
@@ -37,7 +37,6 @@ class ContainersClient:
|
|
|
37
37
|
app_id (str): The ID of the application to build the image for.
|
|
38
38
|
base_name (str): The base name of the image to build.
|
|
39
39
|
tar_file (UploadFile): The tar file containing the application code.
|
|
40
|
-
stoken_session (SessionContainer): The session container for the user making the request.
|
|
41
40
|
|
|
42
41
|
Returns:
|
|
43
42
|
Image: The Docker image that was built.
|
|
@@ -83,11 +82,7 @@ class ContainersClient:
|
|
|
83
82
|
files={
|
|
84
83
|
"tar_file": tar_file,
|
|
85
84
|
},
|
|
86
|
-
request_options=
|
|
87
|
-
{**request_options, "timeout_in_seconds": 600}
|
|
88
|
-
if request_options
|
|
89
|
-
else {"timeout_in_seconds": 600}
|
|
90
|
-
),
|
|
85
|
+
request_options=request_options,
|
|
91
86
|
omit=OMIT,
|
|
92
87
|
)
|
|
93
88
|
try:
|
|
@@ -159,11 +154,7 @@ class ContainersClient:
|
|
|
159
154
|
headers={
|
|
160
155
|
"content-type": "application/json",
|
|
161
156
|
},
|
|
162
|
-
request_options=
|
|
163
|
-
{**request_options, "timeout_in_seconds": 600}
|
|
164
|
-
if request_options
|
|
165
|
-
else {"timeout_in_seconds": 600}
|
|
166
|
-
),
|
|
157
|
+
request_options=request_options,
|
|
167
158
|
omit=OMIT,
|
|
168
159
|
)
|
|
169
160
|
try:
|
|
@@ -196,12 +187,8 @@ class ContainersClient:
|
|
|
196
187
|
"""
|
|
197
188
|
Returns a list of templates available for creating new containers.
|
|
198
189
|
|
|
199
|
-
Parameters:
|
|
200
|
-
stoken_session (SessionContainer): The session container for the user.
|
|
201
|
-
|
|
202
190
|
Returns:
|
|
203
|
-
|
|
204
|
-
Union[List[Template], str]: A list of templates or an error message.
|
|
191
|
+
Union[List[Template], str]: A list of templates or an error message.
|
|
205
192
|
|
|
206
193
|
Parameters
|
|
207
194
|
----------
|
|
@@ -226,11 +213,7 @@ class ContainersClient:
|
|
|
226
213
|
_response = self._client_wrapper.httpx_client.request(
|
|
227
214
|
"containers/templates",
|
|
228
215
|
method="GET",
|
|
229
|
-
request_options=
|
|
230
|
-
{**request_options, "timeout_in_seconds": 600}
|
|
231
|
-
if request_options
|
|
232
|
-
else {"timeout_in_seconds": 600}
|
|
233
|
-
),
|
|
216
|
+
request_options=request_options,
|
|
234
217
|
)
|
|
235
218
|
try:
|
|
236
219
|
if 200 <= _response.status_code < 300:
|
|
@@ -257,23 +240,14 @@ class ContainersClient:
|
|
|
257
240
|
Constructs the URL for an app container based on the provided base_id or variant_id.
|
|
258
241
|
|
|
259
242
|
Args:
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
243
|
base_id (Optional[str]): The ID of the base to use for the app container.
|
|
264
244
|
variant_id (Optional[str]): The ID of the variant to use for the app container.
|
|
265
245
|
request (Request): The request object.
|
|
266
246
|
|
|
267
247
|
Returns:
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
248
|
URI: The URI for the app container.
|
|
272
249
|
|
|
273
250
|
Raises:
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
251
|
HTTPException: If the base or variant cannot be found or the user does not have access.
|
|
278
252
|
|
|
279
253
|
Parameters
|
|
@@ -307,11 +281,7 @@ class ContainersClient:
|
|
|
307
281
|
"base_id": base_id,
|
|
308
282
|
"variant_id": variant_id,
|
|
309
283
|
},
|
|
310
|
-
request_options=
|
|
311
|
-
{**request_options, "timeout_in_seconds": 600}
|
|
312
|
-
if request_options
|
|
313
|
-
else {"timeout_in_seconds": 600}
|
|
314
|
-
),
|
|
284
|
+
request_options=request_options,
|
|
315
285
|
)
|
|
316
286
|
try:
|
|
317
287
|
if 200 <= _response.status_code < 300:
|
|
@@ -357,7 +327,6 @@ class AsyncContainersClient:
|
|
|
357
327
|
app_id (str): The ID of the application to build the image for.
|
|
358
328
|
base_name (str): The base name of the image to build.
|
|
359
329
|
tar_file (UploadFile): The tar file containing the application code.
|
|
360
|
-
stoken_session (SessionContainer): The session container for the user making the request.
|
|
361
330
|
|
|
362
331
|
Returns:
|
|
363
332
|
Image: The Docker image that was built.
|
|
@@ -411,11 +380,7 @@ class AsyncContainersClient:
|
|
|
411
380
|
files={
|
|
412
381
|
"tar_file": tar_file,
|
|
413
382
|
},
|
|
414
|
-
request_options=
|
|
415
|
-
{**request_options, "timeout_in_seconds": 600}
|
|
416
|
-
if request_options
|
|
417
|
-
else {"timeout_in_seconds": 600}
|
|
418
|
-
),
|
|
383
|
+
request_options=request_options,
|
|
419
384
|
omit=OMIT,
|
|
420
385
|
)
|
|
421
386
|
try:
|
|
@@ -495,11 +460,7 @@ class AsyncContainersClient:
|
|
|
495
460
|
headers={
|
|
496
461
|
"content-type": "application/json",
|
|
497
462
|
},
|
|
498
|
-
request_options=
|
|
499
|
-
{**request_options, "timeout_in_seconds": 600}
|
|
500
|
-
if request_options
|
|
501
|
-
else {"timeout_in_seconds": 600}
|
|
502
|
-
),
|
|
463
|
+
request_options=request_options,
|
|
503
464
|
omit=OMIT,
|
|
504
465
|
)
|
|
505
466
|
try:
|
|
@@ -532,12 +493,8 @@ class AsyncContainersClient:
|
|
|
532
493
|
"""
|
|
533
494
|
Returns a list of templates available for creating new containers.
|
|
534
495
|
|
|
535
|
-
Parameters:
|
|
536
|
-
stoken_session (SessionContainer): The session container for the user.
|
|
537
|
-
|
|
538
496
|
Returns:
|
|
539
|
-
|
|
540
|
-
Union[List[Template], str]: A list of templates or an error message.
|
|
497
|
+
Union[List[Template], str]: A list of templates or an error message.
|
|
541
498
|
|
|
542
499
|
Parameters
|
|
543
500
|
----------
|
|
@@ -570,11 +527,7 @@ class AsyncContainersClient:
|
|
|
570
527
|
_response = await self._client_wrapper.httpx_client.request(
|
|
571
528
|
"containers/templates",
|
|
572
529
|
method="GET",
|
|
573
|
-
request_options=
|
|
574
|
-
{**request_options, "timeout_in_seconds": 600}
|
|
575
|
-
if request_options
|
|
576
|
-
else {"timeout_in_seconds": 600}
|
|
577
|
-
),
|
|
530
|
+
request_options=request_options,
|
|
578
531
|
)
|
|
579
532
|
try:
|
|
580
533
|
if 200 <= _response.status_code < 300:
|
|
@@ -601,23 +554,14 @@ class AsyncContainersClient:
|
|
|
601
554
|
Constructs the URL for an app container based on the provided base_id or variant_id.
|
|
602
555
|
|
|
603
556
|
Args:
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
557
|
base_id (Optional[str]): The ID of the base to use for the app container.
|
|
608
558
|
variant_id (Optional[str]): The ID of the variant to use for the app container.
|
|
609
559
|
request (Request): The request object.
|
|
610
560
|
|
|
611
561
|
Returns:
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
562
|
URI: The URI for the app container.
|
|
616
563
|
|
|
617
564
|
Raises:
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
565
|
HTTPException: If the base or variant cannot be found or the user does not have access.
|
|
622
566
|
|
|
623
567
|
Parameters
|
|
@@ -659,11 +603,7 @@ class AsyncContainersClient:
|
|
|
659
603
|
"base_id": base_id,
|
|
660
604
|
"variant_id": variant_id,
|
|
661
605
|
},
|
|
662
|
-
request_options=
|
|
663
|
-
{**request_options, "timeout_in_seconds": 600}
|
|
664
|
-
if request_options
|
|
665
|
-
else {"timeout_in_seconds": 600}
|
|
666
|
-
),
|
|
606
|
+
request_options=request_options,
|
|
667
607
|
)
|
|
668
608
|
try:
|
|
669
609
|
if 200 <= _response.status_code < 300:
|
|
@@ -87,8 +87,8 @@ def _retry_timeout(response: httpx.Response, retries: int) -> float:
|
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
def _should_retry(response: httpx.Response) -> bool:
|
|
90
|
-
|
|
91
|
-
return response.status_code >= 500 or response.status_code in
|
|
90
|
+
retryable_400s = [429, 408, 409]
|
|
91
|
+
return response.status_code >= 500 or response.status_code in retryable_400s
|
|
92
92
|
|
|
93
93
|
|
|
94
94
|
def remove_omit_from_dict(
|
|
@@ -195,7 +195,7 @@ class HttpClient:
|
|
|
195
195
|
] = None,
|
|
196
196
|
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
|
197
197
|
request_options: typing.Optional[RequestOptions] = None,
|
|
198
|
-
retries: int =
|
|
198
|
+
retries: int = 2,
|
|
199
199
|
omit: typing.Optional[typing.Any] = None,
|
|
200
200
|
) -> httpx.Response:
|
|
201
201
|
base_url = self.get_base_url(base_url)
|
|
@@ -299,7 +299,7 @@ class HttpClient:
|
|
|
299
299
|
] = None,
|
|
300
300
|
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
|
301
301
|
request_options: typing.Optional[RequestOptions] = None,
|
|
302
|
-
retries: int =
|
|
302
|
+
retries: int = 2,
|
|
303
303
|
omit: typing.Optional[typing.Any] = None,
|
|
304
304
|
) -> typing.Iterator[httpx.Response]:
|
|
305
305
|
base_url = self.get_base_url(base_url)
|
|
@@ -406,7 +406,7 @@ class AsyncHttpClient:
|
|
|
406
406
|
] = None,
|
|
407
407
|
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
|
408
408
|
request_options: typing.Optional[RequestOptions] = None,
|
|
409
|
-
retries: int =
|
|
409
|
+
retries: int = 2,
|
|
410
410
|
omit: typing.Optional[typing.Any] = None,
|
|
411
411
|
) -> httpx.Response:
|
|
412
412
|
base_url = self.get_base_url(base_url)
|
|
@@ -510,7 +510,7 @@ class AsyncHttpClient:
|
|
|
510
510
|
] = None,
|
|
511
511
|
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
|
512
512
|
request_options: typing.Optional[RequestOptions] = None,
|
|
513
|
-
retries: int =
|
|
513
|
+
retries: int = 2,
|
|
514
514
|
omit: typing.Optional[typing.Any] = None,
|
|
515
515
|
) -> typing.AsyncIterator[httpx.Response]:
|
|
516
516
|
base_url = self.get_base_url(base_url)
|
|
@@ -81,7 +81,7 @@ def to_jsonable_with_fallback(
|
|
|
81
81
|
class UniversalBaseModel(pydantic.BaseModel):
|
|
82
82
|
if IS_PYDANTIC_V2:
|
|
83
83
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
|
|
84
|
-
# Allow fields
|
|
84
|
+
# Allow fields beginning with `model_` to be used in the model
|
|
85
85
|
protected_namespaces=(),
|
|
86
86
|
) # type: ignore # Pydantic v2
|
|
87
87
|
|
|
@@ -143,7 +143,7 @@ class UniversalBaseModel(pydantic.BaseModel):
|
|
|
143
143
|
Override the default dict method to `exclude_unset` by default. This function patches
|
|
144
144
|
`exclude_unset` to work include fields within non-None default values.
|
|
145
145
|
"""
|
|
146
|
-
# Note: the logic here is
|
|
146
|
+
# Note: the logic here is multiplexed given the levers exposed in Pydantic V1 vs V2
|
|
147
147
|
# Pydantic V1's .dict can be extremely slow, so we do not want to call it twice.
|
|
148
148
|
#
|
|
149
149
|
# We'd ideally do the same for Pydantic V2, but it shells out to a library to serialize models
|
|
@@ -31,7 +31,6 @@ class EnvironmentsClient:
|
|
|
31
31
|
Args:
|
|
32
32
|
environment_name: Name of the environment to deploy to.
|
|
33
33
|
variant_id: variant id to deploy.
|
|
34
|
-
stoken_session: . Defaults to Depends(verify_session()).
|
|
35
34
|
|
|
36
35
|
Raises:
|
|
37
36
|
HTTPException: If the deployment fails.
|
|
@@ -118,7 +117,6 @@ class AsyncEnvironmentsClient:
|
|
|
118
117
|
Args:
|
|
119
118
|
environment_name: Name of the environment to deploy to.
|
|
120
119
|
variant_id: variant id to deploy.
|
|
121
|
-
stoken_session: . Defaults to Depends(verify_session()).
|
|
122
120
|
|
|
123
121
|
Raises:
|
|
124
122
|
HTTPException: If the deployment fails.
|
|
@@ -612,7 +612,6 @@ class HumanEvaluationsClient:
|
|
|
612
612
|
|
|
613
613
|
Args:
|
|
614
614
|
evaluation_scenario_id: The ID of the evaluation scenario to fetch.
|
|
615
|
-
stoken_session: Session data, verified by `verify_session`.
|
|
616
615
|
|
|
617
616
|
Returns:
|
|
618
617
|
Dictionary containing the scenario ID and its score.
|
|
@@ -1462,7 +1461,6 @@ class AsyncHumanEvaluationsClient:
|
|
|
1462
1461
|
|
|
1463
1462
|
Args:
|
|
1464
1463
|
evaluation_scenario_id: The ID of the evaluation scenario to fetch.
|
|
1465
|
-
stoken_session: Session data, verified by `verify_session`.
|
|
1466
1464
|
|
|
1467
1465
|
Returns:
|
|
1468
1466
|
Dictionary containing the scenario ID and its score.
|