agenta 0.24.1__py3-none-any.whl → 0.24.2__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 (131) hide show
  1. agenta/cli/variant_commands.py +15 -10
  2. agenta/client/Readme.md +72 -64
  3. agenta/client/api.py +1 -1
  4. agenta/client/backend/__init__.py +14 -9
  5. agenta/client/backend/apps/client.py +1669 -0
  6. agenta/client/backend/bases/client.py +190 -0
  7. agenta/client/backend/client.py +2102 -868
  8. agenta/client/backend/configs/client.py +598 -0
  9. agenta/client/backend/containers/client.py +638 -0
  10. agenta/client/backend/{resources/containers → containers}/types/container_templates_response.py +1 -2
  11. agenta/client/backend/core/__init__.py +29 -0
  12. agenta/client/backend/core/client_wrapper.py +42 -9
  13. agenta/client/backend/core/datetime_utils.py +1 -1
  14. agenta/client/backend/core/file.py +43 -0
  15. agenta/client/backend/core/http_client.py +553 -0
  16. agenta/client/backend/core/jsonable_encoder.py +33 -39
  17. agenta/client/backend/core/pydantic_utilities.py +212 -0
  18. agenta/client/backend/core/query_encoder.py +60 -0
  19. agenta/client/backend/core/remove_none_from_dict.py +2 -2
  20. agenta/client/backend/core/request_options.py +32 -0
  21. agenta/client/backend/core/serialization.py +179 -0
  22. agenta/client/backend/environments/client.py +190 -0
  23. agenta/client/backend/evaluations/client.py +1462 -0
  24. agenta/client/backend/evaluators/client.py +911 -0
  25. agenta/client/backend/observability/client.py +1271 -0
  26. agenta/client/backend/testsets/client.py +1132 -0
  27. agenta/client/backend/types/__init__.py +8 -6
  28. agenta/client/backend/types/aggregated_result.py +14 -29
  29. agenta/client/backend/types/aggregated_result_evaluator_config.py +1 -2
  30. agenta/client/backend/types/app.py +13 -28
  31. agenta/client/backend/types/app_variant_response.py +21 -37
  32. agenta/client/backend/types/app_variant_revision.py +17 -32
  33. agenta/client/backend/types/base_output.py +13 -28
  34. agenta/client/backend/types/body_import_testset.py +16 -31
  35. agenta/client/backend/types/config_db.py +16 -31
  36. agenta/client/backend/types/correct_answer.py +22 -0
  37. agenta/client/backend/types/create_app_output.py +13 -28
  38. agenta/client/backend/types/create_span.py +33 -50
  39. agenta/client/backend/types/create_trace_response.py +16 -31
  40. agenta/client/backend/types/docker_env_vars.py +13 -28
  41. agenta/client/backend/types/environment_output.py +21 -36
  42. agenta/client/backend/types/environment_output_extended.py +21 -36
  43. agenta/client/backend/types/environment_revision.py +18 -33
  44. agenta/client/backend/types/error.py +16 -31
  45. agenta/client/backend/types/evaluation.py +20 -34
  46. agenta/client/backend/types/evaluation_scenario.py +18 -33
  47. agenta/client/backend/types/evaluation_scenario_input.py +16 -31
  48. agenta/client/backend/types/evaluation_scenario_output.py +18 -33
  49. agenta/client/backend/types/evaluation_scenario_result.py +14 -29
  50. agenta/client/backend/types/evaluation_scenario_score_update.py +13 -28
  51. agenta/client/backend/types/evaluation_status_enum.py +11 -33
  52. agenta/client/backend/types/evaluation_type.py +3 -21
  53. agenta/client/backend/types/evaluator.py +18 -32
  54. agenta/client/backend/types/evaluator_config.py +20 -33
  55. agenta/client/backend/types/get_config_response.py +16 -31
  56. agenta/client/backend/types/http_validation_error.py +14 -29
  57. agenta/client/backend/types/human_evaluation.py +17 -32
  58. agenta/client/backend/types/human_evaluation_scenario.py +21 -37
  59. agenta/client/backend/types/human_evaluation_scenario_input.py +13 -28
  60. agenta/client/backend/types/human_evaluation_scenario_output.py +13 -28
  61. agenta/client/backend/types/human_evaluation_scenario_update.py +26 -41
  62. agenta/client/backend/types/human_evaluation_update.py +14 -29
  63. agenta/client/backend/types/image.py +18 -33
  64. agenta/client/backend/types/invite_request.py +13 -28
  65. agenta/client/backend/types/list_api_keys_response.py +18 -33
  66. agenta/client/backend/types/llm_run_rate_limit.py +13 -28
  67. agenta/client/backend/types/llm_tokens.py +16 -31
  68. agenta/client/backend/types/lm_providers_enum.py +21 -0
  69. agenta/client/backend/types/new_human_evaluation.py +13 -28
  70. agenta/client/backend/types/new_testset.py +16 -31
  71. agenta/client/backend/types/organization.py +22 -36
  72. agenta/client/backend/types/organization_output.py +13 -28
  73. agenta/client/backend/types/outputs.py +5 -0
  74. agenta/client/backend/types/permission.py +36 -137
  75. agenta/client/backend/types/result.py +17 -32
  76. agenta/client/backend/types/simple_evaluation_output.py +13 -28
  77. agenta/client/backend/types/span.py +23 -38
  78. agenta/client/backend/types/span_detail.py +26 -40
  79. agenta/client/backend/types/span_status_code.py +1 -25
  80. agenta/client/backend/types/span_variant.py +16 -31
  81. agenta/client/backend/types/template.py +14 -29
  82. agenta/client/backend/types/template_image_info.py +21 -35
  83. agenta/client/backend/types/test_set_output_response.py +16 -32
  84. agenta/client/backend/types/test_set_simple_response.py +13 -28
  85. agenta/client/backend/types/trace_detail.py +26 -40
  86. agenta/client/backend/types/update_app_output.py +22 -0
  87. agenta/client/backend/types/uri.py +13 -28
  88. agenta/client/backend/types/validation_error.py +13 -28
  89. agenta/client/backend/types/variant_action.py +14 -29
  90. agenta/client/backend/types/variant_action_enum.py +1 -19
  91. agenta/client/backend/types/with_pagination.py +14 -30
  92. agenta/client/backend/types/workspace_member_response.py +14 -29
  93. agenta/client/backend/types/workspace_permission.py +18 -33
  94. agenta/client/backend/types/workspace_response.py +20 -35
  95. agenta/client/backend/types/workspace_role.py +11 -37
  96. agenta/client/backend/types/workspace_role_response.py +17 -32
  97. agenta/client/backend/variants/client.py +1447 -0
  98. agenta/client/backend/variants/types/add_variant_from_base_and_config_response.py +8 -0
  99. agenta/sdk/tracing/llm_tracing.py +10 -12
  100. {agenta-0.24.1.dist-info → agenta-0.24.2.dist-info}/METADATA +1 -1
  101. agenta-0.24.2.dist-info/RECORD +175 -0
  102. agenta/client/backend/resources/__init__.py +0 -31
  103. agenta/client/backend/resources/apps/client.py +0 -977
  104. agenta/client/backend/resources/bases/client.py +0 -127
  105. agenta/client/backend/resources/configs/client.py +0 -377
  106. agenta/client/backend/resources/containers/client.py +0 -383
  107. agenta/client/backend/resources/environments/client.py +0 -131
  108. agenta/client/backend/resources/evaluations/client.py +0 -1008
  109. agenta/client/backend/resources/evaluators/client.py +0 -594
  110. agenta/client/backend/resources/observability/client.py +0 -1187
  111. agenta/client/backend/resources/testsets/client.py +0 -689
  112. agenta/client/backend/resources/variants/client.py +0 -796
  113. agenta/client/backend/resources/variants/types/add_variant_from_base_and_config_response.py +0 -7
  114. agenta/client/backend/types/evaluation_webhook.py +0 -36
  115. agenta/client/backend/types/feedback.py +0 -40
  116. agenta/client/backend/types/span_kind.py +0 -49
  117. agenta-0.24.1.dist-info/RECORD +0 -169
  118. /agenta/client/backend/{resources/apps → apps}/__init__.py +0 -0
  119. /agenta/client/backend/{resources/bases → bases}/__init__.py +0 -0
  120. /agenta/client/backend/{resources/configs → configs}/__init__.py +0 -0
  121. /agenta/client/backend/{resources/containers → containers}/__init__.py +0 -0
  122. /agenta/client/backend/{resources/containers → containers}/types/__init__.py +0 -0
  123. /agenta/client/backend/{resources/environments → environments}/__init__.py +0 -0
  124. /agenta/client/backend/{resources/evaluations → evaluations}/__init__.py +0 -0
  125. /agenta/client/backend/{resources/evaluators → evaluators}/__init__.py +0 -0
  126. /agenta/client/backend/{resources/observability → observability}/__init__.py +0 -0
  127. /agenta/client/backend/{resources/testsets → testsets}/__init__.py +0 -0
  128. /agenta/client/backend/{resources/variants → variants}/__init__.py +0 -0
  129. /agenta/client/backend/{resources/variants → variants}/types/__init__.py +0 -0
  130. {agenta-0.24.1.dist-info → agenta-0.24.2.dist-info}/WHEEL +0 -0
  131. {agenta-0.24.1.dist-info → agenta-0.24.2.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,190 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from ..core.client_wrapper import SyncClientWrapper
5
+ from ..core.request_options import RequestOptions
6
+ from ..core.pydantic_utilities import parse_obj_as
7
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
8
+ from ..types.http_validation_error import HttpValidationError
9
+ from json.decoder import JSONDecodeError
10
+ from ..core.api_error import ApiError
11
+ from ..core.client_wrapper import AsyncClientWrapper
12
+
13
+ # this is used as the default value for optional parameters
14
+ OMIT = typing.cast(typing.Any, ...)
15
+
16
+
17
+ class EnvironmentsClient:
18
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
19
+ self._client_wrapper = client_wrapper
20
+
21
+ def deploy_to_environment(
22
+ self,
23
+ *,
24
+ environment_name: str,
25
+ variant_id: str,
26
+ request_options: typing.Optional[RequestOptions] = None,
27
+ ) -> typing.Optional[typing.Any]:
28
+ """
29
+ Deploys a given variant to an environment
30
+
31
+ Args:
32
+ environment_name: Name of the environment to deploy to.
33
+ variant_id: variant id to deploy.
34
+ stoken_session: . Defaults to Depends(verify_session()).
35
+
36
+ Raises:
37
+ HTTPException: If the deployment fails.
38
+
39
+ Parameters
40
+ ----------
41
+ environment_name : str
42
+
43
+ variant_id : str
44
+
45
+ request_options : typing.Optional[RequestOptions]
46
+ Request-specific configuration.
47
+
48
+ Returns
49
+ -------
50
+ typing.Optional[typing.Any]
51
+ Successful Response
52
+
53
+ Examples
54
+ --------
55
+ from agenta import AgentaApi
56
+
57
+ client = AgentaApi(
58
+ api_key="YOUR_API_KEY",
59
+ base_url="https://yourhost.com/path/to/api",
60
+ )
61
+ client.environments.deploy_to_environment(
62
+ environment_name="environment_name",
63
+ variant_id="variant_id",
64
+ )
65
+ """
66
+ _response = self._client_wrapper.httpx_client.request(
67
+ "environments/deploy",
68
+ method="POST",
69
+ json={
70
+ "environment_name": environment_name,
71
+ "variant_id": variant_id,
72
+ },
73
+ request_options=request_options,
74
+ omit=OMIT,
75
+ )
76
+ try:
77
+ if 200 <= _response.status_code < 300:
78
+ return typing.cast(
79
+ typing.Optional[typing.Any],
80
+ parse_obj_as(
81
+ type_=typing.Optional[typing.Any], # type: ignore
82
+ object_=_response.json(),
83
+ ),
84
+ )
85
+ if _response.status_code == 422:
86
+ raise UnprocessableEntityError(
87
+ typing.cast(
88
+ HttpValidationError,
89
+ parse_obj_as(
90
+ type_=HttpValidationError, # type: ignore
91
+ object_=_response.json(),
92
+ ),
93
+ )
94
+ )
95
+ _response_json = _response.json()
96
+ except JSONDecodeError:
97
+ raise ApiError(status_code=_response.status_code, body=_response.text)
98
+ raise ApiError(status_code=_response.status_code, body=_response_json)
99
+
100
+
101
+ class AsyncEnvironmentsClient:
102
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
103
+ self._client_wrapper = client_wrapper
104
+
105
+ async def deploy_to_environment(
106
+ self,
107
+ *,
108
+ environment_name: str,
109
+ variant_id: str,
110
+ request_options: typing.Optional[RequestOptions] = None,
111
+ ) -> typing.Optional[typing.Any]:
112
+ """
113
+ Deploys a given variant to an environment
114
+
115
+ Args:
116
+ environment_name: Name of the environment to deploy to.
117
+ variant_id: variant id to deploy.
118
+ stoken_session: . Defaults to Depends(verify_session()).
119
+
120
+ Raises:
121
+ HTTPException: If the deployment fails.
122
+
123
+ Parameters
124
+ ----------
125
+ environment_name : str
126
+
127
+ variant_id : str
128
+
129
+ request_options : typing.Optional[RequestOptions]
130
+ Request-specific configuration.
131
+
132
+ Returns
133
+ -------
134
+ typing.Optional[typing.Any]
135
+ Successful Response
136
+
137
+ Examples
138
+ --------
139
+ import asyncio
140
+
141
+ from agenta import AsyncAgentaApi
142
+
143
+ client = AsyncAgentaApi(
144
+ api_key="YOUR_API_KEY",
145
+ base_url="https://yourhost.com/path/to/api",
146
+ )
147
+
148
+
149
+ async def main() -> None:
150
+ await client.environments.deploy_to_environment(
151
+ environment_name="environment_name",
152
+ variant_id="variant_id",
153
+ )
154
+
155
+
156
+ asyncio.run(main())
157
+ """
158
+ _response = await self._client_wrapper.httpx_client.request(
159
+ "environments/deploy",
160
+ method="POST",
161
+ json={
162
+ "environment_name": environment_name,
163
+ "variant_id": variant_id,
164
+ },
165
+ request_options=request_options,
166
+ omit=OMIT,
167
+ )
168
+ try:
169
+ if 200 <= _response.status_code < 300:
170
+ return typing.cast(
171
+ typing.Optional[typing.Any],
172
+ parse_obj_as(
173
+ type_=typing.Optional[typing.Any], # type: ignore
174
+ object_=_response.json(),
175
+ ),
176
+ )
177
+ if _response.status_code == 422:
178
+ raise UnprocessableEntityError(
179
+ typing.cast(
180
+ HttpValidationError,
181
+ parse_obj_as(
182
+ type_=HttpValidationError, # type: ignore
183
+ object_=_response.json(),
184
+ ),
185
+ )
186
+ )
187
+ _response_json = _response.json()
188
+ except JSONDecodeError:
189
+ raise ApiError(status_code=_response.status_code, body=_response.text)
190
+ raise ApiError(status_code=_response.status_code, body=_response_json)