agenta 0.26.0a0__py3-none-any.whl → 0.27.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of agenta might be problematic. Click here for more details.

Files changed (85) hide show
  1. agenta/__init__.py +29 -10
  2. agenta/cli/helper.py +5 -1
  3. agenta/client/backend/__init__.py +14 -0
  4. agenta/client/backend/apps/client.py +28 -20
  5. agenta/client/backend/client.py +47 -16
  6. agenta/client/backend/containers/client.py +5 -1
  7. agenta/client/backend/core/__init__.py +2 -1
  8. agenta/client/backend/core/client_wrapper.py +6 -6
  9. agenta/client/backend/core/file.py +33 -11
  10. agenta/client/backend/core/http_client.py +45 -31
  11. agenta/client/backend/core/pydantic_utilities.py +144 -29
  12. agenta/client/backend/core/request_options.py +3 -0
  13. agenta/client/backend/core/serialization.py +139 -42
  14. agenta/client/backend/evaluations/client.py +7 -2
  15. agenta/client/backend/evaluators/client.py +349 -1
  16. agenta/client/backend/observability/client.py +11 -2
  17. agenta/client/backend/testsets/client.py +10 -10
  18. agenta/client/backend/types/__init__.py +14 -0
  19. agenta/client/backend/types/app.py +1 -0
  20. agenta/client/backend/types/app_variant_response.py +3 -1
  21. agenta/client/backend/types/config_dto.py +32 -0
  22. agenta/client/backend/types/config_response_model.py +32 -0
  23. agenta/client/backend/types/create_span.py +3 -2
  24. agenta/client/backend/types/environment_output.py +1 -0
  25. agenta/client/backend/types/environment_output_extended.py +1 -0
  26. agenta/client/backend/types/evaluation.py +1 -2
  27. agenta/client/backend/types/evaluator.py +2 -0
  28. agenta/client/backend/types/evaluator_config.py +1 -0
  29. agenta/client/backend/types/evaluator_mapping_output_interface.py +21 -0
  30. agenta/client/backend/types/evaluator_output_interface.py +21 -0
  31. agenta/client/backend/types/human_evaluation.py +1 -2
  32. agenta/client/backend/types/lifecycle_dto.py +24 -0
  33. agenta/client/backend/types/llm_tokens.py +2 -2
  34. agenta/client/backend/types/reference_dto.py +23 -0
  35. agenta/client/backend/types/reference_request_model.py +23 -0
  36. agenta/client/backend/types/span.py +1 -0
  37. agenta/client/backend/types/span_detail.py +7 -1
  38. agenta/client/backend/types/test_set_output_response.py +5 -2
  39. agenta/client/backend/types/trace_detail.py +7 -1
  40. agenta/client/backend/types/with_pagination.py +4 -2
  41. agenta/client/backend/variants/client.py +1565 -272
  42. agenta/docker/docker-assets/Dockerfile.cloud.template +1 -1
  43. agenta/sdk/__init__.py +44 -7
  44. agenta/sdk/agenta_init.py +85 -33
  45. agenta/sdk/context/__init__.py +0 -0
  46. agenta/sdk/context/routing.py +26 -0
  47. agenta/sdk/context/tracing.py +3 -0
  48. agenta/sdk/decorators/__init__.py +0 -0
  49. agenta/sdk/decorators/{llm_entrypoint.py → routing.py} +216 -191
  50. agenta/sdk/decorators/tracing.py +218 -99
  51. agenta/sdk/litellm/__init__.py +1 -0
  52. agenta/sdk/litellm/litellm.py +288 -0
  53. agenta/sdk/managers/__init__.py +6 -0
  54. agenta/sdk/managers/config.py +318 -0
  55. agenta/sdk/managers/deployment.py +45 -0
  56. agenta/sdk/managers/shared.py +639 -0
  57. agenta/sdk/managers/variant.py +182 -0
  58. agenta/sdk/router.py +0 -7
  59. agenta/sdk/tracing/__init__.py +1 -0
  60. agenta/sdk/tracing/attributes.py +141 -0
  61. agenta/sdk/tracing/context.py +24 -0
  62. agenta/sdk/tracing/conventions.py +49 -0
  63. agenta/sdk/tracing/exporters.py +65 -0
  64. agenta/sdk/tracing/inline.py +1252 -0
  65. agenta/sdk/tracing/processors.py +117 -0
  66. agenta/sdk/tracing/spans.py +136 -0
  67. agenta/sdk/tracing/tracing.py +233 -0
  68. agenta/sdk/types.py +49 -2
  69. agenta/sdk/utils/{helper/openai_cost.py → costs.py} +3 -0
  70. agenta/sdk/utils/debug.py +5 -5
  71. agenta/sdk/utils/exceptions.py +52 -0
  72. agenta/sdk/utils/globals.py +3 -5
  73. agenta/sdk/{tracing/logger.py → utils/logging.py} +3 -5
  74. agenta/sdk/utils/singleton.py +13 -0
  75. {agenta-0.26.0a0.dist-info → agenta-0.27.0.dist-info}/METADATA +5 -1
  76. {agenta-0.26.0a0.dist-info → agenta-0.27.0.dist-info}/RECORD +78 -57
  77. agenta/sdk/config_manager.py +0 -205
  78. agenta/sdk/context.py +0 -41
  79. agenta/sdk/decorators/base.py +0 -10
  80. agenta/sdk/tracing/callbacks.py +0 -187
  81. agenta/sdk/tracing/llm_tracing.py +0 -617
  82. agenta/sdk/tracing/tasks_manager.py +0 -129
  83. agenta/sdk/tracing/tracing_context.py +0 -27
  84. {agenta-0.26.0a0.dist-info → agenta-0.27.0.dist-info}/WHEEL +0 -0
  85. {agenta-0.26.0a0.dist-info → agenta-0.27.0.dist-info}/entry_points.txt +0 -0
@@ -16,7 +16,12 @@ from ..core.jsonable_encoder import jsonable_encoder
16
16
  from ..types.variant_action import VariantAction
17
17
  from ..types.docker_env_vars import DockerEnvVars
18
18
  from ..types.uri import Uri
19
+ from ..core.serialization import convert_and_respect_annotation_metadata
19
20
  from ..types.app_variant_revision import AppVariantRevision
21
+ from ..types.reference_request_model import ReferenceRequestModel
22
+ from ..types.config_response_model import ConfigResponseModel
23
+ from ..types.config_dto import ConfigDto
24
+ from ..types.reference_dto import ReferenceDto
20
25
  from ..core.client_wrapper import AsyncClientWrapper
21
26
 
22
27
  # this is used as the default value for optional parameters
@@ -237,8 +242,12 @@ class VariantsClient:
237
242
  f"variants/{jsonable_encoder(variant_id)}",
238
243
  method="PUT",
239
244
  json={
240
- "action": action,
241
- "env_vars": env_vars,
245
+ "action": convert_and_respect_annotation_metadata(
246
+ object_=action, annotation=VariantAction, direction="write"
247
+ ),
248
+ "env_vars": convert_and_respect_annotation_metadata(
249
+ object_=env_vars, annotation=DockerEnvVars, direction="write"
250
+ ),
242
251
  },
243
252
  request_options=request_options,
244
253
  omit=OMIT,
@@ -698,83 +707,55 @@ class VariantsClient:
698
707
  raise ApiError(status_code=_response.status_code, body=_response.text)
699
708
  raise ApiError(status_code=_response.status_code, body=_response_json)
700
709
 
701
-
702
- class AsyncVariantsClient:
703
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
704
- self._client_wrapper = client_wrapper
705
-
706
- async def add_variant_from_base_and_config(
710
+ def configs_add(
707
711
  self,
708
712
  *,
709
- base_id: str,
710
- new_variant_name: str,
711
- new_config_name: str,
712
- parameters: typing.Dict[str, typing.Optional[typing.Any]],
713
+ variant_ref: ReferenceRequestModel,
714
+ application_ref: ReferenceRequestModel,
713
715
  request_options: typing.Optional[RequestOptions] = None,
714
- ) -> AddVariantFromBaseAndConfigResponse:
716
+ ) -> ConfigResponseModel:
715
717
  """
716
- Add a new variant based on an existing one.
717
- Same as POST /config
718
-
719
- Args:
720
- payload (AddVariantFromBasePayload): Payload containing base variant ID, new variant name, and parameters.
721
- stoken_session (SessionContainer, optional): Session container. Defaults to result of verify_session().
722
-
723
- Raises:
724
- HTTPException: Raised if the variant could not be added or accessed.
725
-
726
- Returns:
727
- Union[AppVariantResponse, Any]: New variant details or exception.
728
-
729
718
  Parameters
730
719
  ----------
731
- base_id : str
732
-
733
- new_variant_name : str
734
-
735
- new_config_name : str
720
+ variant_ref : ReferenceRequestModel
736
721
 
737
- parameters : typing.Dict[str, typing.Optional[typing.Any]]
722
+ application_ref : ReferenceRequestModel
738
723
 
739
724
  request_options : typing.Optional[RequestOptions]
740
725
  Request-specific configuration.
741
726
 
742
727
  Returns
743
728
  -------
744
- AddVariantFromBaseAndConfigResponse
729
+ ConfigResponseModel
745
730
  Successful Response
746
731
 
747
732
  Examples
748
733
  --------
749
- import asyncio
750
-
751
- from agenta import AsyncAgentaApi
734
+ from agenta import AgentaApi, ReferenceRequestModel
752
735
 
753
- client = AsyncAgentaApi(
736
+ client = AgentaApi(
754
737
  api_key="YOUR_API_KEY",
755
738
  base_url="https://yourhost.com/path/to/api",
756
739
  )
757
-
758
-
759
- async def main() -> None:
760
- await client.variants.add_variant_from_base_and_config(
761
- base_id="base_id",
762
- new_variant_name="new_variant_name",
763
- new_config_name="new_config_name",
764
- parameters={"key": "value"},
765
- )
766
-
767
-
768
- asyncio.run(main())
740
+ client.variants.configs_add(
741
+ variant_ref=ReferenceRequestModel(),
742
+ application_ref=ReferenceRequestModel(),
743
+ )
769
744
  """
770
- _response = await self._client_wrapper.httpx_client.request(
771
- "variants/from-base",
745
+ _response = self._client_wrapper.httpx_client.request(
746
+ "variants/configs/add",
772
747
  method="POST",
773
748
  json={
774
- "base_id": base_id,
775
- "new_variant_name": new_variant_name,
776
- "new_config_name": new_config_name,
777
- "parameters": parameters,
749
+ "variant_ref": convert_and_respect_annotation_metadata(
750
+ object_=variant_ref,
751
+ annotation=ReferenceRequestModel,
752
+ direction="write",
753
+ ),
754
+ "application_ref": convert_and_respect_annotation_metadata(
755
+ object_=application_ref,
756
+ annotation=ReferenceRequestModel,
757
+ direction="write",
758
+ ),
778
759
  },
779
760
  request_options=request_options,
780
761
  omit=OMIT,
@@ -782,9 +763,9 @@ class AsyncVariantsClient:
782
763
  try:
783
764
  if 200 <= _response.status_code < 300:
784
765
  return typing.cast(
785
- AddVariantFromBaseAndConfigResponse,
766
+ ConfigResponseModel,
786
767
  parse_obj_as(
787
- type_=AddVariantFromBaseAndConfigResponse, # type: ignore
768
+ type_=ConfigResponseModel, # type: ignore
788
769
  object_=_response.json(),
789
770
  ),
790
771
  )
@@ -803,56 +784,70 @@ class AsyncVariantsClient:
803
784
  raise ApiError(status_code=_response.status_code, body=_response.text)
804
785
  raise ApiError(status_code=_response.status_code, body=_response_json)
805
786
 
806
- async def get_variant(
787
+ def configs_fetch(
807
788
  self,
808
- variant_id: str,
809
789
  *,
790
+ variant_ref: typing.Optional[ReferenceRequestModel] = OMIT,
791
+ environment_ref: typing.Optional[ReferenceRequestModel] = OMIT,
792
+ application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
810
793
  request_options: typing.Optional[RequestOptions] = None,
811
- ) -> AppVariantResponse:
794
+ ) -> ConfigResponseModel:
812
795
  """
813
796
  Parameters
814
797
  ----------
815
- variant_id : str
798
+ variant_ref : typing.Optional[ReferenceRequestModel]
799
+
800
+ environment_ref : typing.Optional[ReferenceRequestModel]
801
+
802
+ application_ref : typing.Optional[ReferenceRequestModel]
816
803
 
817
804
  request_options : typing.Optional[RequestOptions]
818
805
  Request-specific configuration.
819
806
 
820
807
  Returns
821
808
  -------
822
- AppVariantResponse
809
+ ConfigResponseModel
823
810
  Successful Response
824
811
 
825
812
  Examples
826
813
  --------
827
- import asyncio
828
-
829
- from agenta import AsyncAgentaApi
814
+ from agenta import AgentaApi
830
815
 
831
- client = AsyncAgentaApi(
816
+ client = AgentaApi(
832
817
  api_key="YOUR_API_KEY",
833
818
  base_url="https://yourhost.com/path/to/api",
834
819
  )
835
-
836
-
837
- async def main() -> None:
838
- await client.variants.get_variant(
839
- variant_id="variant_id",
840
- )
841
-
842
-
843
- asyncio.run(main())
820
+ client.variants.configs_fetch()
844
821
  """
845
- _response = await self._client_wrapper.httpx_client.request(
846
- f"variants/{jsonable_encoder(variant_id)}",
847
- method="GET",
822
+ _response = self._client_wrapper.httpx_client.request(
823
+ "variants/configs/fetch",
824
+ method="POST",
825
+ json={
826
+ "variant_ref": convert_and_respect_annotation_metadata(
827
+ object_=variant_ref,
828
+ annotation=ReferenceRequestModel,
829
+ direction="write",
830
+ ),
831
+ "environment_ref": convert_and_respect_annotation_metadata(
832
+ object_=environment_ref,
833
+ annotation=ReferenceRequestModel,
834
+ direction="write",
835
+ ),
836
+ "application_ref": convert_and_respect_annotation_metadata(
837
+ object_=application_ref,
838
+ annotation=ReferenceRequestModel,
839
+ direction="write",
840
+ ),
841
+ },
848
842
  request_options=request_options,
843
+ omit=OMIT,
849
844
  )
850
845
  try:
851
846
  if 200 <= _response.status_code < 300:
852
847
  return typing.cast(
853
- AppVariantResponse,
848
+ ConfigResponseModel,
854
849
  parse_obj_as(
855
- type_=AppVariantResponse, # type: ignore
850
+ type_=ConfigResponseModel, # type: ignore
856
851
  object_=_response.json(),
857
852
  ),
858
853
  )
@@ -871,74 +866,60 @@ class AsyncVariantsClient:
871
866
  raise ApiError(status_code=_response.status_code, body=_response.text)
872
867
  raise ApiError(status_code=_response.status_code, body=_response_json)
873
868
 
874
- async def start_variant(
869
+ def configs_fork(
875
870
  self,
876
- variant_id: str,
877
871
  *,
878
- action: VariantAction,
879
- env_vars: typing.Optional[DockerEnvVars] = OMIT,
872
+ variant_ref: typing.Optional[ReferenceRequestModel] = OMIT,
873
+ environment_ref: typing.Optional[ReferenceRequestModel] = OMIT,
874
+ application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
880
875
  request_options: typing.Optional[RequestOptions] = None,
881
- ) -> Uri:
876
+ ) -> ConfigResponseModel:
882
877
  """
883
- Start a variant of an app.
884
-
885
- Args:
886
- variant_id (str): The ID of the variant to start.
887
- action (VariantAction): The action to perform on the variant (start).
888
- env_vars (Optional[DockerEnvVars], optional): The environment variables to inject to the Docker container. Defaults to None.
889
- stoken_session (SessionContainer, optional): The session container. Defaults to Depends(verify_session()).
890
-
891
- Returns:
892
- URI: The URL of the started variant.
893
-
894
- Raises:
895
- HTTPException: If the app container cannot be started.
896
-
897
878
  Parameters
898
879
  ----------
899
- variant_id : str
880
+ variant_ref : typing.Optional[ReferenceRequestModel]
900
881
 
901
- action : VariantAction
882
+ environment_ref : typing.Optional[ReferenceRequestModel]
902
883
 
903
- env_vars : typing.Optional[DockerEnvVars]
884
+ application_ref : typing.Optional[ReferenceRequestModel]
904
885
 
905
886
  request_options : typing.Optional[RequestOptions]
906
887
  Request-specific configuration.
907
888
 
908
889
  Returns
909
890
  -------
910
- Uri
891
+ ConfigResponseModel
911
892
  Successful Response
912
893
 
913
894
  Examples
914
895
  --------
915
- import asyncio
916
-
917
- from agenta import AsyncAgentaApi, VariantAction
896
+ from agenta import AgentaApi
918
897
 
919
- client = AsyncAgentaApi(
898
+ client = AgentaApi(
920
899
  api_key="YOUR_API_KEY",
921
900
  base_url="https://yourhost.com/path/to/api",
922
901
  )
923
-
924
-
925
- async def main() -> None:
926
- await client.variants.start_variant(
927
- variant_id="variant_id",
928
- action=VariantAction(
929
- action="START",
930
- ),
931
- )
932
-
933
-
934
- asyncio.run(main())
902
+ client.variants.configs_fork()
935
903
  """
936
- _response = await self._client_wrapper.httpx_client.request(
937
- f"variants/{jsonable_encoder(variant_id)}",
938
- method="PUT",
904
+ _response = self._client_wrapper.httpx_client.request(
905
+ "variants/configs/fork",
906
+ method="POST",
939
907
  json={
940
- "action": action,
941
- "env_vars": env_vars,
908
+ "variant_ref": convert_and_respect_annotation_metadata(
909
+ object_=variant_ref,
910
+ annotation=ReferenceRequestModel,
911
+ direction="write",
912
+ ),
913
+ "environment_ref": convert_and_respect_annotation_metadata(
914
+ object_=environment_ref,
915
+ annotation=ReferenceRequestModel,
916
+ direction="write",
917
+ ),
918
+ "application_ref": convert_and_respect_annotation_metadata(
919
+ object_=application_ref,
920
+ annotation=ReferenceRequestModel,
921
+ direction="write",
922
+ ),
942
923
  },
943
924
  request_options=request_options,
944
925
  omit=OMIT,
@@ -946,9 +927,9 @@ class AsyncVariantsClient:
946
927
  try:
947
928
  if 200 <= _response.status_code < 300:
948
929
  return typing.cast(
949
- Uri,
930
+ ConfigResponseModel,
950
931
  parse_obj_as(
951
- type_=Uri, # type: ignore
932
+ type_=ConfigResponseModel, # type: ignore
952
933
  object_=_response.json(),
953
934
  ),
954
935
  )
@@ -967,65 +948,56 @@ class AsyncVariantsClient:
967
948
  raise ApiError(status_code=_response.status_code, body=_response.text)
968
949
  raise ApiError(status_code=_response.status_code, body=_response_json)
969
950
 
970
- async def remove_variant(
951
+ def configs_commit(
971
952
  self,
972
- variant_id: str,
973
953
  *,
954
+ config: ConfigDto,
974
955
  request_options: typing.Optional[RequestOptions] = None,
975
- ) -> typing.Optional[typing.Any]:
956
+ ) -> ConfigResponseModel:
976
957
  """
977
- Remove a variant from the server.
978
- In the case it's the last variant using the image, stop the container and remove the image.
979
-
980
- Arguments:
981
- app_variant -- AppVariant to remove
982
-
983
- Raises:
984
- HTTPException: If there is a problem removing the app variant
985
-
986
958
  Parameters
987
959
  ----------
988
- variant_id : str
960
+ config : ConfigDto
989
961
 
990
962
  request_options : typing.Optional[RequestOptions]
991
963
  Request-specific configuration.
992
964
 
993
965
  Returns
994
966
  -------
995
- typing.Optional[typing.Any]
967
+ ConfigResponseModel
996
968
  Successful Response
997
969
 
998
970
  Examples
999
971
  --------
1000
- import asyncio
1001
-
1002
- from agenta import AsyncAgentaApi
972
+ from agenta import AgentaApi, ConfigDto
1003
973
 
1004
- client = AsyncAgentaApi(
974
+ client = AgentaApi(
1005
975
  api_key="YOUR_API_KEY",
1006
976
  base_url="https://yourhost.com/path/to/api",
1007
977
  )
1008
-
1009
-
1010
- async def main() -> None:
1011
- await client.variants.remove_variant(
1012
- variant_id="variant_id",
1013
- )
1014
-
1015
-
1016
- asyncio.run(main())
978
+ client.variants.configs_commit(
979
+ config=ConfigDto(
980
+ params={"key": "value"},
981
+ ),
982
+ )
1017
983
  """
1018
- _response = await self._client_wrapper.httpx_client.request(
1019
- f"variants/{jsonable_encoder(variant_id)}",
1020
- method="DELETE",
984
+ _response = self._client_wrapper.httpx_client.request(
985
+ "variants/configs/commit",
986
+ method="POST",
987
+ json={
988
+ "config": convert_and_respect_annotation_metadata(
989
+ object_=config, annotation=ConfigDto, direction="write"
990
+ ),
991
+ },
1021
992
  request_options=request_options,
993
+ omit=OMIT,
1022
994
  )
1023
995
  try:
1024
996
  if 200 <= _response.status_code < 300:
1025
997
  return typing.cast(
1026
- typing.Optional[typing.Any],
998
+ ConfigResponseModel,
1027
999
  parse_obj_as(
1028
- type_=typing.Optional[typing.Any], # type: ignore
1000
+ type_=ConfigResponseModel, # type: ignore
1029
1001
  object_=_response.json(),
1030
1002
  ),
1031
1003
  )
@@ -1044,67 +1016,63 @@ class AsyncVariantsClient:
1044
1016
  raise ApiError(status_code=_response.status_code, body=_response.text)
1045
1017
  raise ApiError(status_code=_response.status_code, body=_response_json)
1046
1018
 
1047
- async def update_variant_parameters(
1019
+ def configs_deploy(
1048
1020
  self,
1049
- variant_id: str,
1050
1021
  *,
1051
- parameters: typing.Dict[str, typing.Optional[typing.Any]],
1022
+ variant_ref: ReferenceRequestModel,
1023
+ environment_ref: ReferenceRequestModel,
1024
+ application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
1052
1025
  request_options: typing.Optional[RequestOptions] = None,
1053
- ) -> typing.Optional[typing.Any]:
1026
+ ) -> ConfigResponseModel:
1054
1027
  """
1055
- Updates the parameters for an app variant.
1056
-
1057
- Args:
1058
- variant_id (str): The ID of the app variant to update.
1059
- payload (UpdateVariantParameterPayload): The payload containing the updated parameters.
1060
- stoken_session (SessionContainer, optional): The session container. Defaults to Depends(verify_session()).
1061
-
1062
- Raises:
1063
- HTTPException: If there is an error while trying to update the app variant.
1064
-
1065
- Returns:
1066
- JSONResponse: A JSON response containing the updated app variant parameters.
1067
-
1068
1028
  Parameters
1069
1029
  ----------
1070
- variant_id : str
1030
+ variant_ref : ReferenceRequestModel
1071
1031
 
1072
- parameters : typing.Dict[str, typing.Optional[typing.Any]]
1032
+ environment_ref : ReferenceRequestModel
1033
+
1034
+ application_ref : typing.Optional[ReferenceRequestModel]
1073
1035
 
1074
1036
  request_options : typing.Optional[RequestOptions]
1075
1037
  Request-specific configuration.
1076
1038
 
1077
1039
  Returns
1078
1040
  -------
1079
- typing.Optional[typing.Any]
1041
+ ConfigResponseModel
1080
1042
  Successful Response
1081
1043
 
1082
1044
  Examples
1083
1045
  --------
1084
- import asyncio
1085
-
1086
- from agenta import AsyncAgentaApi
1046
+ from agenta import AgentaApi, ReferenceRequestModel
1087
1047
 
1088
- client = AsyncAgentaApi(
1048
+ client = AgentaApi(
1089
1049
  api_key="YOUR_API_KEY",
1090
1050
  base_url="https://yourhost.com/path/to/api",
1091
1051
  )
1092
-
1093
-
1094
- async def main() -> None:
1095
- await client.variants.update_variant_parameters(
1096
- variant_id="variant_id",
1097
- parameters={"key": "value"},
1098
- )
1099
-
1100
-
1101
- asyncio.run(main())
1052
+ client.variants.configs_deploy(
1053
+ variant_ref=ReferenceRequestModel(),
1054
+ environment_ref=ReferenceRequestModel(),
1055
+ )
1102
1056
  """
1103
- _response = await self._client_wrapper.httpx_client.request(
1104
- f"variants/{jsonable_encoder(variant_id)}/parameters",
1105
- method="PUT",
1057
+ _response = self._client_wrapper.httpx_client.request(
1058
+ "variants/configs/deploy",
1059
+ method="POST",
1106
1060
  json={
1107
- "parameters": parameters,
1061
+ "variant_ref": convert_and_respect_annotation_metadata(
1062
+ object_=variant_ref,
1063
+ annotation=ReferenceRequestModel,
1064
+ direction="write",
1065
+ ),
1066
+ "environment_ref": convert_and_respect_annotation_metadata(
1067
+ object_=environment_ref,
1068
+ annotation=ReferenceRequestModel,
1069
+ direction="write",
1070
+ ),
1071
+ "application_ref": convert_and_respect_annotation_metadata(
1072
+ object_=application_ref,
1073
+ annotation=ReferenceRequestModel,
1074
+ direction="write",
1075
+ ),
1108
1076
  },
1109
1077
  request_options=request_options,
1110
1078
  omit=OMIT,
@@ -1112,9 +1080,9 @@ class AsyncVariantsClient:
1112
1080
  try:
1113
1081
  if 200 <= _response.status_code < 300:
1114
1082
  return typing.cast(
1115
- typing.Optional[typing.Any],
1083
+ ConfigResponseModel,
1116
1084
  parse_obj_as(
1117
- type_=typing.Optional[typing.Any], # type: ignore
1085
+ type_=ConfigResponseModel, # type: ignore
1118
1086
  object_=_response.json(),
1119
1087
  ),
1120
1088
  )
@@ -1133,57 +1101,1261 @@ class AsyncVariantsClient:
1133
1101
  raise ApiError(status_code=_response.status_code, body=_response.text)
1134
1102
  raise ApiError(status_code=_response.status_code, body=_response_json)
1135
1103
 
1136
- async def update_variant_image(
1104
+ def configs_delete(
1137
1105
  self,
1138
- variant_id: str,
1139
1106
  *,
1140
- docker_id: str,
1141
- tags: str,
1142
- type: typing.Optional[str] = OMIT,
1143
- organization_id: typing.Optional[str] = OMIT,
1144
- workspace_id: typing.Optional[str] = OMIT,
1107
+ variant_ref: typing.Optional[ReferenceRequestModel] = OMIT,
1108
+ application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
1145
1109
  request_options: typing.Optional[RequestOptions] = None,
1146
- ) -> typing.Optional[typing.Any]:
1110
+ ) -> int:
1147
1111
  """
1148
- Updates the image used in an app variant.
1112
+ Parameters
1113
+ ----------
1114
+ variant_ref : typing.Optional[ReferenceRequestModel]
1149
1115
 
1150
- Args:
1151
- variant_id (str): The ID of the app variant to update.
1152
- image (Image): The image information to update.
1116
+ application_ref : typing.Optional[ReferenceRequestModel]
1153
1117
 
1154
- Raises:
1155
- HTTPException: If an error occurs while trying to update the app variant.
1118
+ request_options : typing.Optional[RequestOptions]
1119
+ Request-specific configuration.
1156
1120
 
1157
- Returns:
1121
+ Returns
1122
+ -------
1123
+ int
1124
+ Successful Response
1125
+
1126
+ Examples
1127
+ --------
1128
+ from agenta import AgentaApi
1129
+
1130
+ client = AgentaApi(
1131
+ api_key="YOUR_API_KEY",
1132
+ base_url="https://yourhost.com/path/to/api",
1133
+ )
1134
+ client.variants.configs_delete()
1135
+ """
1136
+ _response = self._client_wrapper.httpx_client.request(
1137
+ "variants/configs/delete",
1138
+ method="POST",
1139
+ json={
1140
+ "variant_ref": convert_and_respect_annotation_metadata(
1141
+ object_=variant_ref,
1142
+ annotation=ReferenceRequestModel,
1143
+ direction="write",
1144
+ ),
1145
+ "application_ref": convert_and_respect_annotation_metadata(
1146
+ object_=application_ref,
1147
+ annotation=ReferenceRequestModel,
1148
+ direction="write",
1149
+ ),
1150
+ },
1151
+ request_options=request_options,
1152
+ omit=OMIT,
1153
+ )
1154
+ try:
1155
+ if 200 <= _response.status_code < 300:
1156
+ return typing.cast(
1157
+ int,
1158
+ parse_obj_as(
1159
+ type_=int, # type: ignore
1160
+ object_=_response.json(),
1161
+ ),
1162
+ )
1163
+ if _response.status_code == 422:
1164
+ raise UnprocessableEntityError(
1165
+ typing.cast(
1166
+ HttpValidationError,
1167
+ parse_obj_as(
1168
+ type_=HttpValidationError, # type: ignore
1169
+ object_=_response.json(),
1170
+ ),
1171
+ )
1172
+ )
1173
+ _response_json = _response.json()
1174
+ except JSONDecodeError:
1175
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1176
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1177
+
1178
+ def configs_list(
1179
+ self,
1180
+ *,
1181
+ application_ref: ReferenceDto,
1182
+ request_options: typing.Optional[RequestOptions] = None,
1183
+ ) -> typing.List[ConfigResponseModel]:
1184
+ """
1185
+ Parameters
1186
+ ----------
1187
+ application_ref : ReferenceDto
1188
+
1189
+ request_options : typing.Optional[RequestOptions]
1190
+ Request-specific configuration.
1191
+
1192
+ Returns
1193
+ -------
1194
+ typing.List[ConfigResponseModel]
1195
+ Successful Response
1196
+
1197
+ Examples
1198
+ --------
1199
+ from agenta import AgentaApi, ReferenceDto
1200
+
1201
+ client = AgentaApi(
1202
+ api_key="YOUR_API_KEY",
1203
+ base_url="https://yourhost.com/path/to/api",
1204
+ )
1205
+ client.variants.configs_list(
1206
+ application_ref=ReferenceDto(),
1207
+ )
1208
+ """
1209
+ _response = self._client_wrapper.httpx_client.request(
1210
+ "variants/configs/list",
1211
+ method="POST",
1212
+ json={
1213
+ "application_ref": convert_and_respect_annotation_metadata(
1214
+ object_=application_ref, annotation=ReferenceDto, direction="write"
1215
+ ),
1216
+ },
1217
+ request_options=request_options,
1218
+ omit=OMIT,
1219
+ )
1220
+ try:
1221
+ if 200 <= _response.status_code < 300:
1222
+ return typing.cast(
1223
+ typing.List[ConfigResponseModel],
1224
+ parse_obj_as(
1225
+ type_=typing.List[ConfigResponseModel], # type: ignore
1226
+ object_=_response.json(),
1227
+ ),
1228
+ )
1229
+ if _response.status_code == 422:
1230
+ raise UnprocessableEntityError(
1231
+ typing.cast(
1232
+ HttpValidationError,
1233
+ parse_obj_as(
1234
+ type_=HttpValidationError, # type: ignore
1235
+ object_=_response.json(),
1236
+ ),
1237
+ )
1238
+ )
1239
+ _response_json = _response.json()
1240
+ except JSONDecodeError:
1241
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1242
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1243
+
1244
+ def configs_history(
1245
+ self,
1246
+ *,
1247
+ variant_ref: typing.Optional[ReferenceRequestModel] = OMIT,
1248
+ application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
1249
+ request_options: typing.Optional[RequestOptions] = None,
1250
+ ) -> typing.List[ConfigResponseModel]:
1251
+ """
1252
+ Parameters
1253
+ ----------
1254
+ variant_ref : typing.Optional[ReferenceRequestModel]
1255
+
1256
+ application_ref : typing.Optional[ReferenceRequestModel]
1257
+
1258
+ request_options : typing.Optional[RequestOptions]
1259
+ Request-specific configuration.
1260
+
1261
+ Returns
1262
+ -------
1263
+ typing.List[ConfigResponseModel]
1264
+ Successful Response
1265
+
1266
+ Examples
1267
+ --------
1268
+ from agenta import AgentaApi
1269
+
1270
+ client = AgentaApi(
1271
+ api_key="YOUR_API_KEY",
1272
+ base_url="https://yourhost.com/path/to/api",
1273
+ )
1274
+ client.variants.configs_history()
1275
+ """
1276
+ _response = self._client_wrapper.httpx_client.request(
1277
+ "variants/configs/history",
1278
+ method="POST",
1279
+ json={
1280
+ "variant_ref": convert_and_respect_annotation_metadata(
1281
+ object_=variant_ref,
1282
+ annotation=ReferenceRequestModel,
1283
+ direction="write",
1284
+ ),
1285
+ "application_ref": convert_and_respect_annotation_metadata(
1286
+ object_=application_ref,
1287
+ annotation=ReferenceRequestModel,
1288
+ direction="write",
1289
+ ),
1290
+ },
1291
+ request_options=request_options,
1292
+ omit=OMIT,
1293
+ )
1294
+ try:
1295
+ if 200 <= _response.status_code < 300:
1296
+ return typing.cast(
1297
+ typing.List[ConfigResponseModel],
1298
+ parse_obj_as(
1299
+ type_=typing.List[ConfigResponseModel], # type: ignore
1300
+ object_=_response.json(),
1301
+ ),
1302
+ )
1303
+ if _response.status_code == 422:
1304
+ raise UnprocessableEntityError(
1305
+ typing.cast(
1306
+ HttpValidationError,
1307
+ parse_obj_as(
1308
+ type_=HttpValidationError, # type: ignore
1309
+ object_=_response.json(),
1310
+ ),
1311
+ )
1312
+ )
1313
+ _response_json = _response.json()
1314
+ except JSONDecodeError:
1315
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1316
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1317
+
1318
+
1319
+ class AsyncVariantsClient:
1320
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
1321
+ self._client_wrapper = client_wrapper
1322
+
1323
+ async def add_variant_from_base_and_config(
1324
+ self,
1325
+ *,
1326
+ base_id: str,
1327
+ new_variant_name: str,
1328
+ new_config_name: str,
1329
+ parameters: typing.Dict[str, typing.Optional[typing.Any]],
1330
+ request_options: typing.Optional[RequestOptions] = None,
1331
+ ) -> AddVariantFromBaseAndConfigResponse:
1332
+ """
1333
+ Add a new variant based on an existing one.
1334
+ Same as POST /config
1335
+
1336
+ Args:
1337
+ payload (AddVariantFromBasePayload): Payload containing base variant ID, new variant name, and parameters.
1338
+ stoken_session (SessionContainer, optional): Session container. Defaults to result of verify_session().
1339
+
1340
+ Raises:
1341
+ HTTPException: Raised if the variant could not be added or accessed.
1342
+
1343
+ Returns:
1344
+ Union[AppVariantResponse, Any]: New variant details or exception.
1345
+
1346
+ Parameters
1347
+ ----------
1348
+ base_id : str
1349
+
1350
+ new_variant_name : str
1351
+
1352
+ new_config_name : str
1353
+
1354
+ parameters : typing.Dict[str, typing.Optional[typing.Any]]
1355
+
1356
+ request_options : typing.Optional[RequestOptions]
1357
+ Request-specific configuration.
1358
+
1359
+ Returns
1360
+ -------
1361
+ AddVariantFromBaseAndConfigResponse
1362
+ Successful Response
1363
+
1364
+ Examples
1365
+ --------
1366
+ import asyncio
1367
+
1368
+ from agenta import AsyncAgentaApi
1369
+
1370
+ client = AsyncAgentaApi(
1371
+ api_key="YOUR_API_KEY",
1372
+ base_url="https://yourhost.com/path/to/api",
1373
+ )
1374
+
1375
+
1376
+ async def main() -> None:
1377
+ await client.variants.add_variant_from_base_and_config(
1378
+ base_id="base_id",
1379
+ new_variant_name="new_variant_name",
1380
+ new_config_name="new_config_name",
1381
+ parameters={"key": "value"},
1382
+ )
1383
+
1384
+
1385
+ asyncio.run(main())
1386
+ """
1387
+ _response = await self._client_wrapper.httpx_client.request(
1388
+ "variants/from-base",
1389
+ method="POST",
1390
+ json={
1391
+ "base_id": base_id,
1392
+ "new_variant_name": new_variant_name,
1393
+ "new_config_name": new_config_name,
1394
+ "parameters": parameters,
1395
+ },
1396
+ request_options=request_options,
1397
+ omit=OMIT,
1398
+ )
1399
+ try:
1400
+ if 200 <= _response.status_code < 300:
1401
+ return typing.cast(
1402
+ AddVariantFromBaseAndConfigResponse,
1403
+ parse_obj_as(
1404
+ type_=AddVariantFromBaseAndConfigResponse, # type: ignore
1405
+ object_=_response.json(),
1406
+ ),
1407
+ )
1408
+ if _response.status_code == 422:
1409
+ raise UnprocessableEntityError(
1410
+ typing.cast(
1411
+ HttpValidationError,
1412
+ parse_obj_as(
1413
+ type_=HttpValidationError, # type: ignore
1414
+ object_=_response.json(),
1415
+ ),
1416
+ )
1417
+ )
1418
+ _response_json = _response.json()
1419
+ except JSONDecodeError:
1420
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1421
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1422
+
1423
+ async def get_variant(
1424
+ self,
1425
+ variant_id: str,
1426
+ *,
1427
+ request_options: typing.Optional[RequestOptions] = None,
1428
+ ) -> AppVariantResponse:
1429
+ """
1430
+ Parameters
1431
+ ----------
1432
+ variant_id : str
1433
+
1434
+ request_options : typing.Optional[RequestOptions]
1435
+ Request-specific configuration.
1436
+
1437
+ Returns
1438
+ -------
1439
+ AppVariantResponse
1440
+ Successful Response
1441
+
1442
+ Examples
1443
+ --------
1444
+ import asyncio
1445
+
1446
+ from agenta import AsyncAgentaApi
1447
+
1448
+ client = AsyncAgentaApi(
1449
+ api_key="YOUR_API_KEY",
1450
+ base_url="https://yourhost.com/path/to/api",
1451
+ )
1452
+
1453
+
1454
+ async def main() -> None:
1455
+ await client.variants.get_variant(
1456
+ variant_id="variant_id",
1457
+ )
1458
+
1459
+
1460
+ asyncio.run(main())
1461
+ """
1462
+ _response = await self._client_wrapper.httpx_client.request(
1463
+ f"variants/{jsonable_encoder(variant_id)}",
1464
+ method="GET",
1465
+ request_options=request_options,
1466
+ )
1467
+ try:
1468
+ if 200 <= _response.status_code < 300:
1469
+ return typing.cast(
1470
+ AppVariantResponse,
1471
+ parse_obj_as(
1472
+ type_=AppVariantResponse, # type: ignore
1473
+ object_=_response.json(),
1474
+ ),
1475
+ )
1476
+ if _response.status_code == 422:
1477
+ raise UnprocessableEntityError(
1478
+ typing.cast(
1479
+ HttpValidationError,
1480
+ parse_obj_as(
1481
+ type_=HttpValidationError, # type: ignore
1482
+ object_=_response.json(),
1483
+ ),
1484
+ )
1485
+ )
1486
+ _response_json = _response.json()
1487
+ except JSONDecodeError:
1488
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1489
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1490
+
1491
+ async def start_variant(
1492
+ self,
1493
+ variant_id: str,
1494
+ *,
1495
+ action: VariantAction,
1496
+ env_vars: typing.Optional[DockerEnvVars] = OMIT,
1497
+ request_options: typing.Optional[RequestOptions] = None,
1498
+ ) -> Uri:
1499
+ """
1500
+ Start a variant of an app.
1501
+
1502
+ Args:
1503
+ variant_id (str): The ID of the variant to start.
1504
+ action (VariantAction): The action to perform on the variant (start).
1505
+ env_vars (Optional[DockerEnvVars], optional): The environment variables to inject to the Docker container. Defaults to None.
1506
+ stoken_session (SessionContainer, optional): The session container. Defaults to Depends(verify_session()).
1507
+
1508
+ Returns:
1509
+ URI: The URL of the started variant.
1510
+
1511
+ Raises:
1512
+ HTTPException: If the app container cannot be started.
1513
+
1514
+ Parameters
1515
+ ----------
1516
+ variant_id : str
1517
+
1518
+ action : VariantAction
1519
+
1520
+ env_vars : typing.Optional[DockerEnvVars]
1521
+
1522
+ request_options : typing.Optional[RequestOptions]
1523
+ Request-specific configuration.
1524
+
1525
+ Returns
1526
+ -------
1527
+ Uri
1528
+ Successful Response
1529
+
1530
+ Examples
1531
+ --------
1532
+ import asyncio
1533
+
1534
+ from agenta import AsyncAgentaApi, VariantAction
1535
+
1536
+ client = AsyncAgentaApi(
1537
+ api_key="YOUR_API_KEY",
1538
+ base_url="https://yourhost.com/path/to/api",
1539
+ )
1540
+
1541
+
1542
+ async def main() -> None:
1543
+ await client.variants.start_variant(
1544
+ variant_id="variant_id",
1545
+ action=VariantAction(
1546
+ action="START",
1547
+ ),
1548
+ )
1549
+
1550
+
1551
+ asyncio.run(main())
1552
+ """
1553
+ _response = await self._client_wrapper.httpx_client.request(
1554
+ f"variants/{jsonable_encoder(variant_id)}",
1555
+ method="PUT",
1556
+ json={
1557
+ "action": convert_and_respect_annotation_metadata(
1558
+ object_=action, annotation=VariantAction, direction="write"
1559
+ ),
1560
+ "env_vars": convert_and_respect_annotation_metadata(
1561
+ object_=env_vars, annotation=DockerEnvVars, direction="write"
1562
+ ),
1563
+ },
1564
+ request_options=request_options,
1565
+ omit=OMIT,
1566
+ )
1567
+ try:
1568
+ if 200 <= _response.status_code < 300:
1569
+ return typing.cast(
1570
+ Uri,
1571
+ parse_obj_as(
1572
+ type_=Uri, # type: ignore
1573
+ object_=_response.json(),
1574
+ ),
1575
+ )
1576
+ if _response.status_code == 422:
1577
+ raise UnprocessableEntityError(
1578
+ typing.cast(
1579
+ HttpValidationError,
1580
+ parse_obj_as(
1581
+ type_=HttpValidationError, # type: ignore
1582
+ object_=_response.json(),
1583
+ ),
1584
+ )
1585
+ )
1586
+ _response_json = _response.json()
1587
+ except JSONDecodeError:
1588
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1589
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1590
+
1591
+ async def remove_variant(
1592
+ self,
1593
+ variant_id: str,
1594
+ *,
1595
+ request_options: typing.Optional[RequestOptions] = None,
1596
+ ) -> typing.Optional[typing.Any]:
1597
+ """
1598
+ Remove a variant from the server.
1599
+ In the case it's the last variant using the image, stop the container and remove the image.
1600
+
1601
+ Arguments:
1602
+ app_variant -- AppVariant to remove
1603
+
1604
+ Raises:
1605
+ HTTPException: If there is a problem removing the app variant
1606
+
1607
+ Parameters
1608
+ ----------
1609
+ variant_id : str
1610
+
1611
+ request_options : typing.Optional[RequestOptions]
1612
+ Request-specific configuration.
1613
+
1614
+ Returns
1615
+ -------
1616
+ typing.Optional[typing.Any]
1617
+ Successful Response
1618
+
1619
+ Examples
1620
+ --------
1621
+ import asyncio
1622
+
1623
+ from agenta import AsyncAgentaApi
1624
+
1625
+ client = AsyncAgentaApi(
1626
+ api_key="YOUR_API_KEY",
1627
+ base_url="https://yourhost.com/path/to/api",
1628
+ )
1629
+
1630
+
1631
+ async def main() -> None:
1632
+ await client.variants.remove_variant(
1633
+ variant_id="variant_id",
1634
+ )
1635
+
1636
+
1637
+ asyncio.run(main())
1638
+ """
1639
+ _response = await self._client_wrapper.httpx_client.request(
1640
+ f"variants/{jsonable_encoder(variant_id)}",
1641
+ method="DELETE",
1642
+ request_options=request_options,
1643
+ )
1644
+ try:
1645
+ if 200 <= _response.status_code < 300:
1646
+ return typing.cast(
1647
+ typing.Optional[typing.Any],
1648
+ parse_obj_as(
1649
+ type_=typing.Optional[typing.Any], # type: ignore
1650
+ object_=_response.json(),
1651
+ ),
1652
+ )
1653
+ if _response.status_code == 422:
1654
+ raise UnprocessableEntityError(
1655
+ typing.cast(
1656
+ HttpValidationError,
1657
+ parse_obj_as(
1658
+ type_=HttpValidationError, # type: ignore
1659
+ object_=_response.json(),
1660
+ ),
1661
+ )
1662
+ )
1663
+ _response_json = _response.json()
1664
+ except JSONDecodeError:
1665
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1666
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1667
+
1668
+ async def update_variant_parameters(
1669
+ self,
1670
+ variant_id: str,
1671
+ *,
1672
+ parameters: typing.Dict[str, typing.Optional[typing.Any]],
1673
+ request_options: typing.Optional[RequestOptions] = None,
1674
+ ) -> typing.Optional[typing.Any]:
1675
+ """
1676
+ Updates the parameters for an app variant.
1677
+
1678
+ Args:
1679
+ variant_id (str): The ID of the app variant to update.
1680
+ payload (UpdateVariantParameterPayload): The payload containing the updated parameters.
1681
+ stoken_session (SessionContainer, optional): The session container. Defaults to Depends(verify_session()).
1682
+
1683
+ Raises:
1684
+ HTTPException: If there is an error while trying to update the app variant.
1685
+
1686
+ Returns:
1687
+ JSONResponse: A JSON response containing the updated app variant parameters.
1688
+
1689
+ Parameters
1690
+ ----------
1691
+ variant_id : str
1692
+
1693
+ parameters : typing.Dict[str, typing.Optional[typing.Any]]
1694
+
1695
+ request_options : typing.Optional[RequestOptions]
1696
+ Request-specific configuration.
1697
+
1698
+ Returns
1699
+ -------
1700
+ typing.Optional[typing.Any]
1701
+ Successful Response
1702
+
1703
+ Examples
1704
+ --------
1705
+ import asyncio
1706
+
1707
+ from agenta import AsyncAgentaApi
1708
+
1709
+ client = AsyncAgentaApi(
1710
+ api_key="YOUR_API_KEY",
1711
+ base_url="https://yourhost.com/path/to/api",
1712
+ )
1713
+
1714
+
1715
+ async def main() -> None:
1716
+ await client.variants.update_variant_parameters(
1717
+ variant_id="variant_id",
1718
+ parameters={"key": "value"},
1719
+ )
1720
+
1721
+
1722
+ asyncio.run(main())
1723
+ """
1724
+ _response = await self._client_wrapper.httpx_client.request(
1725
+ f"variants/{jsonable_encoder(variant_id)}/parameters",
1726
+ method="PUT",
1727
+ json={
1728
+ "parameters": parameters,
1729
+ },
1730
+ request_options=request_options,
1731
+ omit=OMIT,
1732
+ )
1733
+ try:
1734
+ if 200 <= _response.status_code < 300:
1735
+ return typing.cast(
1736
+ typing.Optional[typing.Any],
1737
+ parse_obj_as(
1738
+ type_=typing.Optional[typing.Any], # type: ignore
1739
+ object_=_response.json(),
1740
+ ),
1741
+ )
1742
+ if _response.status_code == 422:
1743
+ raise UnprocessableEntityError(
1744
+ typing.cast(
1745
+ HttpValidationError,
1746
+ parse_obj_as(
1747
+ type_=HttpValidationError, # type: ignore
1748
+ object_=_response.json(),
1749
+ ),
1750
+ )
1751
+ )
1752
+ _response_json = _response.json()
1753
+ except JSONDecodeError:
1754
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1755
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1756
+
1757
+ async def update_variant_image(
1758
+ self,
1759
+ variant_id: str,
1760
+ *,
1761
+ docker_id: str,
1762
+ tags: str,
1763
+ type: typing.Optional[str] = OMIT,
1764
+ organization_id: typing.Optional[str] = OMIT,
1765
+ workspace_id: typing.Optional[str] = OMIT,
1766
+ request_options: typing.Optional[RequestOptions] = None,
1767
+ ) -> typing.Optional[typing.Any]:
1768
+ """
1769
+ Updates the image used in an app variant.
1770
+
1771
+ Args:
1772
+ variant_id (str): The ID of the app variant to update.
1773
+ image (Image): The image information to update.
1774
+
1775
+ Raises:
1776
+ HTTPException: If an error occurs while trying to update the app variant.
1777
+
1778
+ Returns:
1158
1779
  JSONResponse: A JSON response indicating whether the update was successful or not.
1159
1780
 
1160
1781
  Parameters
1161
1782
  ----------
1162
- variant_id : str
1783
+ variant_id : str
1784
+
1785
+ docker_id : str
1786
+
1787
+ tags : str
1788
+
1789
+ type : typing.Optional[str]
1790
+
1791
+ organization_id : typing.Optional[str]
1792
+
1793
+ workspace_id : typing.Optional[str]
1794
+
1795
+ request_options : typing.Optional[RequestOptions]
1796
+ Request-specific configuration.
1797
+
1798
+ Returns
1799
+ -------
1800
+ typing.Optional[typing.Any]
1801
+ Successful Response
1802
+
1803
+ Examples
1804
+ --------
1805
+ import asyncio
1806
+
1807
+ from agenta import AsyncAgentaApi
1808
+
1809
+ client = AsyncAgentaApi(
1810
+ api_key="YOUR_API_KEY",
1811
+ base_url="https://yourhost.com/path/to/api",
1812
+ )
1813
+
1814
+
1815
+ async def main() -> None:
1816
+ await client.variants.update_variant_image(
1817
+ variant_id="variant_id",
1818
+ docker_id="docker_id",
1819
+ tags="tags",
1820
+ )
1821
+
1822
+
1823
+ asyncio.run(main())
1824
+ """
1825
+ _response = await self._client_wrapper.httpx_client.request(
1826
+ f"variants/{jsonable_encoder(variant_id)}/image",
1827
+ method="PUT",
1828
+ json={
1829
+ "type": type,
1830
+ "docker_id": docker_id,
1831
+ "tags": tags,
1832
+ "organization_id": organization_id,
1833
+ "workspace_id": workspace_id,
1834
+ },
1835
+ request_options=request_options,
1836
+ omit=OMIT,
1837
+ )
1838
+ try:
1839
+ if 200 <= _response.status_code < 300:
1840
+ return typing.cast(
1841
+ typing.Optional[typing.Any],
1842
+ parse_obj_as(
1843
+ type_=typing.Optional[typing.Any], # type: ignore
1844
+ object_=_response.json(),
1845
+ ),
1846
+ )
1847
+ if _response.status_code == 422:
1848
+ raise UnprocessableEntityError(
1849
+ typing.cast(
1850
+ HttpValidationError,
1851
+ parse_obj_as(
1852
+ type_=HttpValidationError, # type: ignore
1853
+ object_=_response.json(),
1854
+ ),
1855
+ )
1856
+ )
1857
+ _response_json = _response.json()
1858
+ except JSONDecodeError:
1859
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1860
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1861
+
1862
+ async def retrieve_variant_logs(
1863
+ self,
1864
+ variant_id: str,
1865
+ *,
1866
+ request_options: typing.Optional[RequestOptions] = None,
1867
+ ) -> typing.Optional[typing.Any]:
1868
+ """
1869
+ Parameters
1870
+ ----------
1871
+ variant_id : str
1872
+
1873
+ request_options : typing.Optional[RequestOptions]
1874
+ Request-specific configuration.
1875
+
1876
+ Returns
1877
+ -------
1878
+ typing.Optional[typing.Any]
1879
+ Successful Response
1880
+
1881
+ Examples
1882
+ --------
1883
+ import asyncio
1884
+
1885
+ from agenta import AsyncAgentaApi
1886
+
1887
+ client = AsyncAgentaApi(
1888
+ api_key="YOUR_API_KEY",
1889
+ base_url="https://yourhost.com/path/to/api",
1890
+ )
1891
+
1892
+
1893
+ async def main() -> None:
1894
+ await client.variants.retrieve_variant_logs(
1895
+ variant_id="variant_id",
1896
+ )
1897
+
1898
+
1899
+ asyncio.run(main())
1900
+ """
1901
+ _response = await self._client_wrapper.httpx_client.request(
1902
+ f"variants/{jsonable_encoder(variant_id)}/logs",
1903
+ method="GET",
1904
+ request_options=request_options,
1905
+ )
1906
+ try:
1907
+ if 200 <= _response.status_code < 300:
1908
+ return typing.cast(
1909
+ typing.Optional[typing.Any],
1910
+ parse_obj_as(
1911
+ type_=typing.Optional[typing.Any], # type: ignore
1912
+ object_=_response.json(),
1913
+ ),
1914
+ )
1915
+ if _response.status_code == 422:
1916
+ raise UnprocessableEntityError(
1917
+ typing.cast(
1918
+ HttpValidationError,
1919
+ parse_obj_as(
1920
+ type_=HttpValidationError, # type: ignore
1921
+ object_=_response.json(),
1922
+ ),
1923
+ )
1924
+ )
1925
+ _response_json = _response.json()
1926
+ except JSONDecodeError:
1927
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1928
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1929
+
1930
+ async def get_variant_revisions(
1931
+ self,
1932
+ variant_id: str,
1933
+ *,
1934
+ request_options: typing.Optional[RequestOptions] = None,
1935
+ ) -> typing.List[AppVariantRevision]:
1936
+ """
1937
+ Parameters
1938
+ ----------
1939
+ variant_id : str
1940
+
1941
+ request_options : typing.Optional[RequestOptions]
1942
+ Request-specific configuration.
1943
+
1944
+ Returns
1945
+ -------
1946
+ typing.List[AppVariantRevision]
1947
+ Successful Response
1948
+
1949
+ Examples
1950
+ --------
1951
+ import asyncio
1952
+
1953
+ from agenta import AsyncAgentaApi
1954
+
1955
+ client = AsyncAgentaApi(
1956
+ api_key="YOUR_API_KEY",
1957
+ base_url="https://yourhost.com/path/to/api",
1958
+ )
1959
+
1960
+
1961
+ async def main() -> None:
1962
+ await client.variants.get_variant_revisions(
1963
+ variant_id="variant_id",
1964
+ )
1965
+
1966
+
1967
+ asyncio.run(main())
1968
+ """
1969
+ _response = await self._client_wrapper.httpx_client.request(
1970
+ f"variants/{jsonable_encoder(variant_id)}/revisions",
1971
+ method="GET",
1972
+ request_options=request_options,
1973
+ )
1974
+ try:
1975
+ if 200 <= _response.status_code < 300:
1976
+ return typing.cast(
1977
+ typing.List[AppVariantRevision],
1978
+ parse_obj_as(
1979
+ type_=typing.List[AppVariantRevision], # type: ignore
1980
+ object_=_response.json(),
1981
+ ),
1982
+ )
1983
+ if _response.status_code == 422:
1984
+ raise UnprocessableEntityError(
1985
+ typing.cast(
1986
+ HttpValidationError,
1987
+ parse_obj_as(
1988
+ type_=HttpValidationError, # type: ignore
1989
+ object_=_response.json(),
1990
+ ),
1991
+ )
1992
+ )
1993
+ _response_json = _response.json()
1994
+ except JSONDecodeError:
1995
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1996
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1997
+
1998
+ async def get_variant_revision(
1999
+ self,
2000
+ variant_id: str,
2001
+ revision_number: int,
2002
+ *,
2003
+ request_options: typing.Optional[RequestOptions] = None,
2004
+ ) -> AppVariantRevision:
2005
+ """
2006
+ Parameters
2007
+ ----------
2008
+ variant_id : str
2009
+
2010
+ revision_number : int
2011
+
2012
+ request_options : typing.Optional[RequestOptions]
2013
+ Request-specific configuration.
2014
+
2015
+ Returns
2016
+ -------
2017
+ AppVariantRevision
2018
+ Successful Response
2019
+
2020
+ Examples
2021
+ --------
2022
+ import asyncio
2023
+
2024
+ from agenta import AsyncAgentaApi
2025
+
2026
+ client = AsyncAgentaApi(
2027
+ api_key="YOUR_API_KEY",
2028
+ base_url="https://yourhost.com/path/to/api",
2029
+ )
2030
+
2031
+
2032
+ async def main() -> None:
2033
+ await client.variants.get_variant_revision(
2034
+ variant_id="variant_id",
2035
+ revision_number=1,
2036
+ )
2037
+
2038
+
2039
+ asyncio.run(main())
2040
+ """
2041
+ _response = await self._client_wrapper.httpx_client.request(
2042
+ f"variants/{jsonable_encoder(variant_id)}/revisions/{jsonable_encoder(revision_number)}",
2043
+ method="GET",
2044
+ request_options=request_options,
2045
+ )
2046
+ try:
2047
+ if 200 <= _response.status_code < 300:
2048
+ return typing.cast(
2049
+ AppVariantRevision,
2050
+ parse_obj_as(
2051
+ type_=AppVariantRevision, # type: ignore
2052
+ object_=_response.json(),
2053
+ ),
2054
+ )
2055
+ if _response.status_code == 422:
2056
+ raise UnprocessableEntityError(
2057
+ typing.cast(
2058
+ HttpValidationError,
2059
+ parse_obj_as(
2060
+ type_=HttpValidationError, # type: ignore
2061
+ object_=_response.json(),
2062
+ ),
2063
+ )
2064
+ )
2065
+ _response_json = _response.json()
2066
+ except JSONDecodeError:
2067
+ raise ApiError(status_code=_response.status_code, body=_response.text)
2068
+ raise ApiError(status_code=_response.status_code, body=_response_json)
2069
+
2070
+ async def configs_add(
2071
+ self,
2072
+ *,
2073
+ variant_ref: ReferenceRequestModel,
2074
+ application_ref: ReferenceRequestModel,
2075
+ request_options: typing.Optional[RequestOptions] = None,
2076
+ ) -> ConfigResponseModel:
2077
+ """
2078
+ Parameters
2079
+ ----------
2080
+ variant_ref : ReferenceRequestModel
2081
+
2082
+ application_ref : ReferenceRequestModel
2083
+
2084
+ request_options : typing.Optional[RequestOptions]
2085
+ Request-specific configuration.
2086
+
2087
+ Returns
2088
+ -------
2089
+ ConfigResponseModel
2090
+ Successful Response
2091
+
2092
+ Examples
2093
+ --------
2094
+ import asyncio
2095
+
2096
+ from agenta import AsyncAgentaApi, ReferenceRequestModel
2097
+
2098
+ client = AsyncAgentaApi(
2099
+ api_key="YOUR_API_KEY",
2100
+ base_url="https://yourhost.com/path/to/api",
2101
+ )
2102
+
2103
+
2104
+ async def main() -> None:
2105
+ await client.variants.configs_add(
2106
+ variant_ref=ReferenceRequestModel(),
2107
+ application_ref=ReferenceRequestModel(),
2108
+ )
2109
+
2110
+
2111
+ asyncio.run(main())
2112
+ """
2113
+ _response = await self._client_wrapper.httpx_client.request(
2114
+ "variants/configs/add",
2115
+ method="POST",
2116
+ json={
2117
+ "variant_ref": convert_and_respect_annotation_metadata(
2118
+ object_=variant_ref,
2119
+ annotation=ReferenceRequestModel,
2120
+ direction="write",
2121
+ ),
2122
+ "application_ref": convert_and_respect_annotation_metadata(
2123
+ object_=application_ref,
2124
+ annotation=ReferenceRequestModel,
2125
+ direction="write",
2126
+ ),
2127
+ },
2128
+ request_options=request_options,
2129
+ omit=OMIT,
2130
+ )
2131
+ try:
2132
+ if 200 <= _response.status_code < 300:
2133
+ return typing.cast(
2134
+ ConfigResponseModel,
2135
+ parse_obj_as(
2136
+ type_=ConfigResponseModel, # type: ignore
2137
+ object_=_response.json(),
2138
+ ),
2139
+ )
2140
+ if _response.status_code == 422:
2141
+ raise UnprocessableEntityError(
2142
+ typing.cast(
2143
+ HttpValidationError,
2144
+ parse_obj_as(
2145
+ type_=HttpValidationError, # type: ignore
2146
+ object_=_response.json(),
2147
+ ),
2148
+ )
2149
+ )
2150
+ _response_json = _response.json()
2151
+ except JSONDecodeError:
2152
+ raise ApiError(status_code=_response.status_code, body=_response.text)
2153
+ raise ApiError(status_code=_response.status_code, body=_response_json)
2154
+
2155
+ async def configs_fetch(
2156
+ self,
2157
+ *,
2158
+ variant_ref: typing.Optional[ReferenceRequestModel] = OMIT,
2159
+ environment_ref: typing.Optional[ReferenceRequestModel] = OMIT,
2160
+ application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
2161
+ request_options: typing.Optional[RequestOptions] = None,
2162
+ ) -> ConfigResponseModel:
2163
+ """
2164
+ Parameters
2165
+ ----------
2166
+ variant_ref : typing.Optional[ReferenceRequestModel]
2167
+
2168
+ environment_ref : typing.Optional[ReferenceRequestModel]
2169
+
2170
+ application_ref : typing.Optional[ReferenceRequestModel]
2171
+
2172
+ request_options : typing.Optional[RequestOptions]
2173
+ Request-specific configuration.
2174
+
2175
+ Returns
2176
+ -------
2177
+ ConfigResponseModel
2178
+ Successful Response
2179
+
2180
+ Examples
2181
+ --------
2182
+ import asyncio
2183
+
2184
+ from agenta import AsyncAgentaApi
2185
+
2186
+ client = AsyncAgentaApi(
2187
+ api_key="YOUR_API_KEY",
2188
+ base_url="https://yourhost.com/path/to/api",
2189
+ )
2190
+
2191
+
2192
+ async def main() -> None:
2193
+ await client.variants.configs_fetch()
2194
+
2195
+
2196
+ asyncio.run(main())
2197
+ """
2198
+ _response = await self._client_wrapper.httpx_client.request(
2199
+ "variants/configs/fetch",
2200
+ method="POST",
2201
+ json={
2202
+ "variant_ref": convert_and_respect_annotation_metadata(
2203
+ object_=variant_ref,
2204
+ annotation=ReferenceRequestModel,
2205
+ direction="write",
2206
+ ),
2207
+ "environment_ref": convert_and_respect_annotation_metadata(
2208
+ object_=environment_ref,
2209
+ annotation=ReferenceRequestModel,
2210
+ direction="write",
2211
+ ),
2212
+ "application_ref": convert_and_respect_annotation_metadata(
2213
+ object_=application_ref,
2214
+ annotation=ReferenceRequestModel,
2215
+ direction="write",
2216
+ ),
2217
+ },
2218
+ request_options=request_options,
2219
+ omit=OMIT,
2220
+ )
2221
+ try:
2222
+ if 200 <= _response.status_code < 300:
2223
+ return typing.cast(
2224
+ ConfigResponseModel,
2225
+ parse_obj_as(
2226
+ type_=ConfigResponseModel, # type: ignore
2227
+ object_=_response.json(),
2228
+ ),
2229
+ )
2230
+ if _response.status_code == 422:
2231
+ raise UnprocessableEntityError(
2232
+ typing.cast(
2233
+ HttpValidationError,
2234
+ parse_obj_as(
2235
+ type_=HttpValidationError, # type: ignore
2236
+ object_=_response.json(),
2237
+ ),
2238
+ )
2239
+ )
2240
+ _response_json = _response.json()
2241
+ except JSONDecodeError:
2242
+ raise ApiError(status_code=_response.status_code, body=_response.text)
2243
+ raise ApiError(status_code=_response.status_code, body=_response_json)
2244
+
2245
+ async def configs_fork(
2246
+ self,
2247
+ *,
2248
+ variant_ref: typing.Optional[ReferenceRequestModel] = OMIT,
2249
+ environment_ref: typing.Optional[ReferenceRequestModel] = OMIT,
2250
+ application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
2251
+ request_options: typing.Optional[RequestOptions] = None,
2252
+ ) -> ConfigResponseModel:
2253
+ """
2254
+ Parameters
2255
+ ----------
2256
+ variant_ref : typing.Optional[ReferenceRequestModel]
1163
2257
 
1164
- docker_id : str
2258
+ environment_ref : typing.Optional[ReferenceRequestModel]
1165
2259
 
1166
- tags : str
2260
+ application_ref : typing.Optional[ReferenceRequestModel]
1167
2261
 
1168
- type : typing.Optional[str]
2262
+ request_options : typing.Optional[RequestOptions]
2263
+ Request-specific configuration.
1169
2264
 
1170
- organization_id : typing.Optional[str]
2265
+ Returns
2266
+ -------
2267
+ ConfigResponseModel
2268
+ Successful Response
1171
2269
 
1172
- workspace_id : typing.Optional[str]
2270
+ Examples
2271
+ --------
2272
+ import asyncio
2273
+
2274
+ from agenta import AsyncAgentaApi
2275
+
2276
+ client = AsyncAgentaApi(
2277
+ api_key="YOUR_API_KEY",
2278
+ base_url="https://yourhost.com/path/to/api",
2279
+ )
2280
+
2281
+
2282
+ async def main() -> None:
2283
+ await client.variants.configs_fork()
2284
+
2285
+
2286
+ asyncio.run(main())
2287
+ """
2288
+ _response = await self._client_wrapper.httpx_client.request(
2289
+ "variants/configs/fork",
2290
+ method="POST",
2291
+ json={
2292
+ "variant_ref": convert_and_respect_annotation_metadata(
2293
+ object_=variant_ref,
2294
+ annotation=ReferenceRequestModel,
2295
+ direction="write",
2296
+ ),
2297
+ "environment_ref": convert_and_respect_annotation_metadata(
2298
+ object_=environment_ref,
2299
+ annotation=ReferenceRequestModel,
2300
+ direction="write",
2301
+ ),
2302
+ "application_ref": convert_and_respect_annotation_metadata(
2303
+ object_=application_ref,
2304
+ annotation=ReferenceRequestModel,
2305
+ direction="write",
2306
+ ),
2307
+ },
2308
+ request_options=request_options,
2309
+ omit=OMIT,
2310
+ )
2311
+ try:
2312
+ if 200 <= _response.status_code < 300:
2313
+ return typing.cast(
2314
+ ConfigResponseModel,
2315
+ parse_obj_as(
2316
+ type_=ConfigResponseModel, # type: ignore
2317
+ object_=_response.json(),
2318
+ ),
2319
+ )
2320
+ if _response.status_code == 422:
2321
+ raise UnprocessableEntityError(
2322
+ typing.cast(
2323
+ HttpValidationError,
2324
+ parse_obj_as(
2325
+ type_=HttpValidationError, # type: ignore
2326
+ object_=_response.json(),
2327
+ ),
2328
+ )
2329
+ )
2330
+ _response_json = _response.json()
2331
+ except JSONDecodeError:
2332
+ raise ApiError(status_code=_response.status_code, body=_response.text)
2333
+ raise ApiError(status_code=_response.status_code, body=_response_json)
2334
+
2335
+ async def configs_commit(
2336
+ self,
2337
+ *,
2338
+ config: ConfigDto,
2339
+ request_options: typing.Optional[RequestOptions] = None,
2340
+ ) -> ConfigResponseModel:
2341
+ """
2342
+ Parameters
2343
+ ----------
2344
+ config : ConfigDto
1173
2345
 
1174
2346
  request_options : typing.Optional[RequestOptions]
1175
2347
  Request-specific configuration.
1176
2348
 
1177
2349
  Returns
1178
2350
  -------
1179
- typing.Optional[typing.Any]
2351
+ ConfigResponseModel
1180
2352
  Successful Response
1181
2353
 
1182
2354
  Examples
1183
2355
  --------
1184
2356
  import asyncio
1185
2357
 
1186
- from agenta import AsyncAgentaApi
2358
+ from agenta import AsyncAgentaApi, ConfigDto
1187
2359
 
1188
2360
  client = AsyncAgentaApi(
1189
2361
  api_key="YOUR_API_KEY",
@@ -1192,24 +2364,22 @@ class AsyncVariantsClient:
1192
2364
 
1193
2365
 
1194
2366
  async def main() -> None:
1195
- await client.variants.update_variant_image(
1196
- variant_id="variant_id",
1197
- docker_id="docker_id",
1198
- tags="tags",
2367
+ await client.variants.configs_commit(
2368
+ config=ConfigDto(
2369
+ params={"key": "value"},
2370
+ ),
1199
2371
  )
1200
2372
 
1201
2373
 
1202
2374
  asyncio.run(main())
1203
2375
  """
1204
2376
  _response = await self._client_wrapper.httpx_client.request(
1205
- f"variants/{jsonable_encoder(variant_id)}/image",
1206
- method="PUT",
2377
+ "variants/configs/commit",
2378
+ method="POST",
1207
2379
  json={
1208
- "type": type,
1209
- "docker_id": docker_id,
1210
- "tags": tags,
1211
- "organization_id": organization_id,
1212
- "workspace_id": workspace_id,
2380
+ "config": convert_and_respect_annotation_metadata(
2381
+ object_=config, annotation=ConfigDto, direction="write"
2382
+ ),
1213
2383
  },
1214
2384
  request_options=request_options,
1215
2385
  omit=OMIT,
@@ -1217,9 +2387,9 @@ class AsyncVariantsClient:
1217
2387
  try:
1218
2388
  if 200 <= _response.status_code < 300:
1219
2389
  return typing.cast(
1220
- typing.Optional[typing.Any],
2390
+ ConfigResponseModel,
1221
2391
  parse_obj_as(
1222
- type_=typing.Optional[typing.Any], # type: ignore
2392
+ type_=ConfigResponseModel, # type: ignore
1223
2393
  object_=_response.json(),
1224
2394
  ),
1225
2395
  )
@@ -1238,30 +2408,36 @@ class AsyncVariantsClient:
1238
2408
  raise ApiError(status_code=_response.status_code, body=_response.text)
1239
2409
  raise ApiError(status_code=_response.status_code, body=_response_json)
1240
2410
 
1241
- async def retrieve_variant_logs(
2411
+ async def configs_deploy(
1242
2412
  self,
1243
- variant_id: str,
1244
2413
  *,
2414
+ variant_ref: ReferenceRequestModel,
2415
+ environment_ref: ReferenceRequestModel,
2416
+ application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
1245
2417
  request_options: typing.Optional[RequestOptions] = None,
1246
- ) -> typing.Optional[typing.Any]:
2418
+ ) -> ConfigResponseModel:
1247
2419
  """
1248
2420
  Parameters
1249
2421
  ----------
1250
- variant_id : str
2422
+ variant_ref : ReferenceRequestModel
2423
+
2424
+ environment_ref : ReferenceRequestModel
2425
+
2426
+ application_ref : typing.Optional[ReferenceRequestModel]
1251
2427
 
1252
2428
  request_options : typing.Optional[RequestOptions]
1253
2429
  Request-specific configuration.
1254
2430
 
1255
2431
  Returns
1256
2432
  -------
1257
- typing.Optional[typing.Any]
2433
+ ConfigResponseModel
1258
2434
  Successful Response
1259
2435
 
1260
2436
  Examples
1261
2437
  --------
1262
2438
  import asyncio
1263
2439
 
1264
- from agenta import AsyncAgentaApi
2440
+ from agenta import AsyncAgentaApi, ReferenceRequestModel
1265
2441
 
1266
2442
  client = AsyncAgentaApi(
1267
2443
  api_key="YOUR_API_KEY",
@@ -1270,24 +2446,43 @@ class AsyncVariantsClient:
1270
2446
 
1271
2447
 
1272
2448
  async def main() -> None:
1273
- await client.variants.retrieve_variant_logs(
1274
- variant_id="variant_id",
2449
+ await client.variants.configs_deploy(
2450
+ variant_ref=ReferenceRequestModel(),
2451
+ environment_ref=ReferenceRequestModel(),
1275
2452
  )
1276
2453
 
1277
2454
 
1278
2455
  asyncio.run(main())
1279
2456
  """
1280
2457
  _response = await self._client_wrapper.httpx_client.request(
1281
- f"variants/{jsonable_encoder(variant_id)}/logs",
1282
- method="GET",
2458
+ "variants/configs/deploy",
2459
+ method="POST",
2460
+ json={
2461
+ "variant_ref": convert_and_respect_annotation_metadata(
2462
+ object_=variant_ref,
2463
+ annotation=ReferenceRequestModel,
2464
+ direction="write",
2465
+ ),
2466
+ "environment_ref": convert_and_respect_annotation_metadata(
2467
+ object_=environment_ref,
2468
+ annotation=ReferenceRequestModel,
2469
+ direction="write",
2470
+ ),
2471
+ "application_ref": convert_and_respect_annotation_metadata(
2472
+ object_=application_ref,
2473
+ annotation=ReferenceRequestModel,
2474
+ direction="write",
2475
+ ),
2476
+ },
1283
2477
  request_options=request_options,
2478
+ omit=OMIT,
1284
2479
  )
1285
2480
  try:
1286
2481
  if 200 <= _response.status_code < 300:
1287
2482
  return typing.cast(
1288
- typing.Optional[typing.Any],
2483
+ ConfigResponseModel,
1289
2484
  parse_obj_as(
1290
- type_=typing.Optional[typing.Any], # type: ignore
2485
+ type_=ConfigResponseModel, # type: ignore
1291
2486
  object_=_response.json(),
1292
2487
  ),
1293
2488
  )
@@ -1306,23 +2501,26 @@ class AsyncVariantsClient:
1306
2501
  raise ApiError(status_code=_response.status_code, body=_response.text)
1307
2502
  raise ApiError(status_code=_response.status_code, body=_response_json)
1308
2503
 
1309
- async def get_variant_revisions(
2504
+ async def configs_delete(
1310
2505
  self,
1311
- variant_id: str,
1312
2506
  *,
2507
+ variant_ref: typing.Optional[ReferenceRequestModel] = OMIT,
2508
+ application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
1313
2509
  request_options: typing.Optional[RequestOptions] = None,
1314
- ) -> typing.List[AppVariantRevision]:
2510
+ ) -> int:
1315
2511
  """
1316
2512
  Parameters
1317
2513
  ----------
1318
- variant_id : str
2514
+ variant_ref : typing.Optional[ReferenceRequestModel]
2515
+
2516
+ application_ref : typing.Optional[ReferenceRequestModel]
1319
2517
 
1320
2518
  request_options : typing.Optional[RequestOptions]
1321
2519
  Request-specific configuration.
1322
2520
 
1323
2521
  Returns
1324
2522
  -------
1325
- typing.List[AppVariantRevision]
2523
+ int
1326
2524
  Successful Response
1327
2525
 
1328
2526
  Examples
@@ -1338,24 +2536,109 @@ class AsyncVariantsClient:
1338
2536
 
1339
2537
 
1340
2538
  async def main() -> None:
1341
- await client.variants.get_variant_revisions(
1342
- variant_id="variant_id",
2539
+ await client.variants.configs_delete()
2540
+
2541
+
2542
+ asyncio.run(main())
2543
+ """
2544
+ _response = await self._client_wrapper.httpx_client.request(
2545
+ "variants/configs/delete",
2546
+ method="POST",
2547
+ json={
2548
+ "variant_ref": convert_and_respect_annotation_metadata(
2549
+ object_=variant_ref,
2550
+ annotation=ReferenceRequestModel,
2551
+ direction="write",
2552
+ ),
2553
+ "application_ref": convert_and_respect_annotation_metadata(
2554
+ object_=application_ref,
2555
+ annotation=ReferenceRequestModel,
2556
+ direction="write",
2557
+ ),
2558
+ },
2559
+ request_options=request_options,
2560
+ omit=OMIT,
2561
+ )
2562
+ try:
2563
+ if 200 <= _response.status_code < 300:
2564
+ return typing.cast(
2565
+ int,
2566
+ parse_obj_as(
2567
+ type_=int, # type: ignore
2568
+ object_=_response.json(),
2569
+ ),
2570
+ )
2571
+ if _response.status_code == 422:
2572
+ raise UnprocessableEntityError(
2573
+ typing.cast(
2574
+ HttpValidationError,
2575
+ parse_obj_as(
2576
+ type_=HttpValidationError, # type: ignore
2577
+ object_=_response.json(),
2578
+ ),
2579
+ )
2580
+ )
2581
+ _response_json = _response.json()
2582
+ except JSONDecodeError:
2583
+ raise ApiError(status_code=_response.status_code, body=_response.text)
2584
+ raise ApiError(status_code=_response.status_code, body=_response_json)
2585
+
2586
+ async def configs_list(
2587
+ self,
2588
+ *,
2589
+ application_ref: ReferenceDto,
2590
+ request_options: typing.Optional[RequestOptions] = None,
2591
+ ) -> typing.List[ConfigResponseModel]:
2592
+ """
2593
+ Parameters
2594
+ ----------
2595
+ application_ref : ReferenceDto
2596
+
2597
+ request_options : typing.Optional[RequestOptions]
2598
+ Request-specific configuration.
2599
+
2600
+ Returns
2601
+ -------
2602
+ typing.List[ConfigResponseModel]
2603
+ Successful Response
2604
+
2605
+ Examples
2606
+ --------
2607
+ import asyncio
2608
+
2609
+ from agenta import AsyncAgentaApi, ReferenceDto
2610
+
2611
+ client = AsyncAgentaApi(
2612
+ api_key="YOUR_API_KEY",
2613
+ base_url="https://yourhost.com/path/to/api",
2614
+ )
2615
+
2616
+
2617
+ async def main() -> None:
2618
+ await client.variants.configs_list(
2619
+ application_ref=ReferenceDto(),
1343
2620
  )
1344
2621
 
1345
2622
 
1346
2623
  asyncio.run(main())
1347
2624
  """
1348
2625
  _response = await self._client_wrapper.httpx_client.request(
1349
- f"variants/{jsonable_encoder(variant_id)}/revisions",
1350
- method="GET",
2626
+ "variants/configs/list",
2627
+ method="POST",
2628
+ json={
2629
+ "application_ref": convert_and_respect_annotation_metadata(
2630
+ object_=application_ref, annotation=ReferenceDto, direction="write"
2631
+ ),
2632
+ },
1351
2633
  request_options=request_options,
2634
+ omit=OMIT,
1352
2635
  )
1353
2636
  try:
1354
2637
  if 200 <= _response.status_code < 300:
1355
2638
  return typing.cast(
1356
- typing.List[AppVariantRevision],
2639
+ typing.List[ConfigResponseModel],
1357
2640
  parse_obj_as(
1358
- type_=typing.List[AppVariantRevision], # type: ignore
2641
+ type_=typing.List[ConfigResponseModel], # type: ignore
1359
2642
  object_=_response.json(),
1360
2643
  ),
1361
2644
  )
@@ -1374,26 +2657,26 @@ class AsyncVariantsClient:
1374
2657
  raise ApiError(status_code=_response.status_code, body=_response.text)
1375
2658
  raise ApiError(status_code=_response.status_code, body=_response_json)
1376
2659
 
1377
- async def get_variant_revision(
2660
+ async def configs_history(
1378
2661
  self,
1379
- variant_id: str,
1380
- revision_number: int,
1381
2662
  *,
2663
+ variant_ref: typing.Optional[ReferenceRequestModel] = OMIT,
2664
+ application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
1382
2665
  request_options: typing.Optional[RequestOptions] = None,
1383
- ) -> AppVariantRevision:
2666
+ ) -> typing.List[ConfigResponseModel]:
1384
2667
  """
1385
2668
  Parameters
1386
2669
  ----------
1387
- variant_id : str
2670
+ variant_ref : typing.Optional[ReferenceRequestModel]
1388
2671
 
1389
- revision_number : int
2672
+ application_ref : typing.Optional[ReferenceRequestModel]
1390
2673
 
1391
2674
  request_options : typing.Optional[RequestOptions]
1392
2675
  Request-specific configuration.
1393
2676
 
1394
2677
  Returns
1395
2678
  -------
1396
- AppVariantRevision
2679
+ typing.List[ConfigResponseModel]
1397
2680
  Successful Response
1398
2681
 
1399
2682
  Examples
@@ -1409,25 +2692,35 @@ class AsyncVariantsClient:
1409
2692
 
1410
2693
 
1411
2694
  async def main() -> None:
1412
- await client.variants.get_variant_revision(
1413
- variant_id="variant_id",
1414
- revision_number=1,
1415
- )
2695
+ await client.variants.configs_history()
1416
2696
 
1417
2697
 
1418
2698
  asyncio.run(main())
1419
2699
  """
1420
2700
  _response = await self._client_wrapper.httpx_client.request(
1421
- f"variants/{jsonable_encoder(variant_id)}/revisions/{jsonable_encoder(revision_number)}",
1422
- method="GET",
2701
+ "variants/configs/history",
2702
+ method="POST",
2703
+ json={
2704
+ "variant_ref": convert_and_respect_annotation_metadata(
2705
+ object_=variant_ref,
2706
+ annotation=ReferenceRequestModel,
2707
+ direction="write",
2708
+ ),
2709
+ "application_ref": convert_and_respect_annotation_metadata(
2710
+ object_=application_ref,
2711
+ annotation=ReferenceRequestModel,
2712
+ direction="write",
2713
+ ),
2714
+ },
1423
2715
  request_options=request_options,
2716
+ omit=OMIT,
1424
2717
  )
1425
2718
  try:
1426
2719
  if 200 <= _response.status_code < 300:
1427
2720
  return typing.cast(
1428
- AppVariantRevision,
2721
+ typing.List[ConfigResponseModel],
1429
2722
  parse_obj_as(
1430
- type_=AppVariantRevision, # type: ignore
2723
+ type_=typing.List[ConfigResponseModel], # type: ignore
1431
2724
  object_=_response.json(),
1432
2725
  ),
1433
2726
  )