agenta 0.36.5__py3-none-any.whl → 0.37.1__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 (209) hide show
  1. agenta/__init__.py +1 -2
  2. agenta/client/__init__.py +6 -10
  3. agenta/client/{admin → backend/admin}/client.py +2 -0
  4. agenta/client/backend/api_keys/client.py +531 -0
  5. agenta/client/{apps → backend/apps}/client.py +0 -222
  6. agenta/client/{containers → backend/containers}/client.py +10 -70
  7. agenta/client/{core → backend/core}/http_client.py +6 -6
  8. agenta/client/{core → backend/core}/pydantic_utilities.py +2 -2
  9. agenta/client/{environments → backend/environments}/client.py +0 -2
  10. agenta/client/{human_evaluations → backend/human_evaluations}/client.py +0 -2
  11. agenta/client/{observability → backend/observability}/client.py +98 -0
  12. agenta/client/backend/organization/client.py +839 -0
  13. agenta/client/backend/testsets/__init__.py +1 -0
  14. agenta/client/{types → backend/types}/__init__.py +22 -6
  15. agenta/client/{types → backend/types}/agenta_nodes_response.py +0 -5
  16. agenta/client/{types → backend/types}/agenta_root_dto.py +0 -5
  17. agenta/client/{types → backend/types}/agenta_roots_response.py +0 -5
  18. agenta/client/{types → backend/types}/agenta_tree_dto.py +0 -5
  19. agenta/client/{types → backend/types}/agenta_trees_response.py +0 -5
  20. agenta/client/backend/types/custom_model_settings_dto.py +22 -0
  21. agenta/client/backend/types/custom_provider_dto.py +29 -0
  22. agenta/client/backend/types/custom_provider_kind.py +26 -0
  23. agenta/client/backend/types/custom_provider_settings_dto.py +24 -0
  24. agenta/client/backend/types/data.py +7 -0
  25. agenta/client/{types → backend/types}/organization.py +1 -4
  26. agenta/client/backend/types/organization_details.py +29 -0
  27. agenta/client/{types → backend/types}/organization_membership_request.py +3 -2
  28. agenta/client/{types → backend/types}/permission.py +1 -0
  29. agenta/client/backend/types/provider_key_dto.py +21 -0
  30. agenta/client/backend/types/provider_kind.py +21 -0
  31. agenta/client/backend/types/score.py +3 -0
  32. agenta/client/{types → backend/types}/secret_dto.py +3 -3
  33. agenta/client/backend/types/secret_kind.py +5 -0
  34. agenta/client/backend/types/standard_provider_dto.py +24 -0
  35. agenta/client/backend/types/standard_provider_kind.py +21 -0
  36. agenta/client/backend/types/standard_provider_settings_dto.py +21 -0
  37. agenta/client/backend/types/workspace.py +24 -0
  38. agenta/client/{variants → backend/variants}/client.py +18 -24
  39. agenta/client/backend/vault/__init__.py +1 -0
  40. agenta/client/{vault → backend/vault}/client.py +26 -8
  41. agenta/client/backend/workspace/__init__.py +1 -0
  42. agenta/client/backend/workspace/client.py +405 -0
  43. agenta/client/client.py +46 -46
  44. agenta/client/types/provider_key_dto.py~feat_model-registry +21 -0
  45. agenta/client/types/provider_kind.py~feat_model-registry +21 -0
  46. agenta/sdk/__init__.py +1 -1
  47. agenta/sdk/managers/secrets.py +175 -11
  48. agenta/sdk/managers/shared.py +3 -3
  49. agenta/sdk/middleware/vault.py +29 -37
  50. agenta/sdk/types.py +4 -7
  51. {agenta-0.36.5.dist-info → agenta-0.37.1.dist-info}/METADATA +2 -6
  52. agenta-0.37.1.dist-info/RECORD +255 -0
  53. agenta/client/types/score.py +0 -5
  54. agenta/client/types/secret_kind.py +0 -5
  55. agenta/sdk/client.py +0 -56
  56. agenta-0.36.5.dist-info/RECORD +0 -236
  57. /agenta/client/{access_control → backend/access_control}/__init__.py +0 -0
  58. /agenta/client/{access_control → backend/access_control}/client.py +0 -0
  59. /agenta/client/{admin → backend/admin}/__init__.py +0 -0
  60. /agenta/client/{apps → backend/api_keys}/__init__.py +0 -0
  61. /agenta/client/{bases → backend/apps}/__init__.py +0 -0
  62. /agenta/client/{configs → backend/bases}/__init__.py +0 -0
  63. /agenta/client/{bases → backend/bases}/client.py +0 -0
  64. /agenta/client/{environments → backend/configs}/__init__.py +0 -0
  65. /agenta/client/{configs → backend/configs}/client.py +0 -0
  66. /agenta/client/{containers → backend/containers}/__init__.py +0 -0
  67. /agenta/client/{containers → backend/containers}/types/__init__.py +0 -0
  68. /agenta/client/{containers → backend/containers}/types/container_templates_response.py +0 -0
  69. /agenta/client/{core → backend/core}/__init__.py +0 -0
  70. /agenta/client/{core → backend/core}/api_error.py +0 -0
  71. /agenta/client/{core → backend/core}/client_wrapper.py +0 -0
  72. /agenta/client/{core → backend/core}/datetime_utils.py +0 -0
  73. /agenta/client/{core → backend/core}/file.py +0 -0
  74. /agenta/client/{core → backend/core}/jsonable_encoder.py +0 -0
  75. /agenta/client/{core → backend/core}/query_encoder.py +0 -0
  76. /agenta/client/{core → backend/core}/remove_none_from_dict.py +0 -0
  77. /agenta/client/{core → backend/core}/request_options.py +0 -0
  78. /agenta/client/{core → backend/core}/serialization.py +0 -0
  79. /agenta/client/{evaluations → backend/environments}/__init__.py +0 -0
  80. /agenta/client/{errors → backend/errors}/__init__.py +0 -0
  81. /agenta/client/{errors → backend/errors}/unprocessable_entity_error.py +0 -0
  82. /agenta/client/{evaluators → backend/evaluations}/__init__.py +0 -0
  83. /agenta/client/{evaluations → backend/evaluations}/client.py +0 -0
  84. /agenta/client/{human_evaluations → backend/evaluators}/__init__.py +0 -0
  85. /agenta/client/{evaluators → backend/evaluators}/client.py +0 -0
  86. /agenta/client/{scopes → backend/human_evaluations}/__init__.py +0 -0
  87. /agenta/client/{observability → backend/observability}/__init__.py +0 -0
  88. /agenta/client/{observability → backend/observability}/types/__init__.py +0 -0
  89. /agenta/client/{observability → backend/observability}/types/format.py +0 -0
  90. /agenta/client/{observability → backend/observability}/types/query_analytics_response.py +0 -0
  91. /agenta/client/{observability → backend/observability}/types/query_traces_response.py +0 -0
  92. /agenta/client/{testsets → backend/organization}/__init__.py +0 -0
  93. /agenta/client/{vault → backend/scopes}/__init__.py +0 -0
  94. /agenta/client/{scopes → backend/scopes}/client.py +0 -0
  95. /agenta/client/{testsets → backend/testsets}/client.py +0 -0
  96. /agenta/client/{types → backend/types}/account_response.py +0 -0
  97. /agenta/client/{types → backend/types}/agenta_node_dto.py +0 -0
  98. /agenta/client/{types → backend/types}/agenta_node_dto_nodes_value.py +0 -0
  99. /agenta/client/{types → backend/types}/aggregated_result.py +0 -0
  100. /agenta/client/{types → backend/types}/aggregated_result_evaluator_config.py +0 -0
  101. /agenta/client/{types → backend/types}/analytics_response.py +0 -0
  102. /agenta/client/{types → backend/types}/app.py +0 -0
  103. /agenta/client/{types → backend/types}/app_variant_response.py +0 -0
  104. /agenta/client/{types → backend/types}/app_variant_revision.py +0 -0
  105. /agenta/client/{types → backend/types}/base_output.py +0 -0
  106. /agenta/client/{types → backend/types}/body_import_testset.py +0 -0
  107. /agenta/client/{types → backend/types}/bucket_dto.py +0 -0
  108. /agenta/client/{types → backend/types}/collect_status_response.py +0 -0
  109. /agenta/client/{types → backend/types}/config_db.py +0 -0
  110. /agenta/client/{types → backend/types}/config_dto.py +0 -0
  111. /agenta/client/{types → backend/types}/config_response_model.py +0 -0
  112. /agenta/client/{types → backend/types}/correct_answer.py +0 -0
  113. /agenta/client/{types → backend/types}/create_app_output.py +0 -0
  114. /agenta/client/{types → backend/types}/delete_evaluation.py +0 -0
  115. /agenta/client/{types → backend/types}/docker_env_vars.py +0 -0
  116. /agenta/client/{types → backend/types}/environment_output.py +0 -0
  117. /agenta/client/{types → backend/types}/environment_output_extended.py +0 -0
  118. /agenta/client/{types → backend/types}/environment_revision.py +0 -0
  119. /agenta/client/{types → backend/types}/error.py +0 -0
  120. /agenta/client/{types → backend/types}/evaluation.py +0 -0
  121. /agenta/client/{types → backend/types}/evaluation_scenario.py +0 -0
  122. /agenta/client/{types → backend/types}/evaluation_scenario_input.py +0 -0
  123. /agenta/client/{types → backend/types}/evaluation_scenario_output.py +0 -0
  124. /agenta/client/{types → backend/types}/evaluation_scenario_result.py +0 -0
  125. /agenta/client/{types → backend/types}/evaluation_status_enum.py +0 -0
  126. /agenta/client/{types → backend/types}/evaluation_type.py +0 -0
  127. /agenta/client/{types → backend/types}/evaluator.py +0 -0
  128. /agenta/client/{types → backend/types}/evaluator_config.py +0 -0
  129. /agenta/client/{types → backend/types}/evaluator_mapping_output_interface.py +0 -0
  130. /agenta/client/{types → backend/types}/evaluator_output_interface.py +0 -0
  131. /agenta/client/{types → backend/types}/exception_dto.py +0 -0
  132. /agenta/client/{types → backend/types}/get_config_response.py +0 -0
  133. /agenta/client/{types → backend/types}/header_dto.py +0 -0
  134. /agenta/client/{types → backend/types}/http_validation_error.py +0 -0
  135. /agenta/client/{types → backend/types}/human_evaluation.py +0 -0
  136. /agenta/client/{types → backend/types}/human_evaluation_scenario.py +0 -0
  137. /agenta/client/{types → backend/types}/human_evaluation_scenario_input.py +0 -0
  138. /agenta/client/{types → backend/types}/human_evaluation_scenario_output.py +0 -0
  139. /agenta/client/{types → backend/types}/image.py +0 -0
  140. /agenta/client/{types → backend/types}/invite_request.py +0 -0
  141. /agenta/client/{types → backend/types}/legacy_analytics_response.py +0 -0
  142. /agenta/client/{types → backend/types}/legacy_data_point.py +0 -0
  143. /agenta/client/{types → backend/types}/legacy_scope_request.py +0 -0
  144. /agenta/client/{types → backend/types}/legacy_scopes_response.py +0 -0
  145. /agenta/client/{types → backend/types}/legacy_user_request.py +0 -0
  146. /agenta/client/{types → backend/types}/legacy_user_response.py +0 -0
  147. /agenta/client/{types → backend/types}/lifecycle_dto.py +0 -0
  148. /agenta/client/{types → backend/types}/link_dto.py +0 -0
  149. /agenta/client/{types → backend/types}/list_api_keys_response.py +0 -0
  150. /agenta/client/{types → backend/types}/llm_run_rate_limit.py +0 -0
  151. /agenta/client/{types → backend/types}/metrics_dto.py +0 -0
  152. /agenta/client/{types → backend/types}/new_testset.py +0 -0
  153. /agenta/client/{types → backend/types}/node_dto.py +0 -0
  154. /agenta/client/{types → backend/types}/node_type.py +0 -0
  155. /agenta/client/{types → backend/types}/o_tel_context_dto.py +0 -0
  156. /agenta/client/{types → backend/types}/o_tel_event_dto.py +0 -0
  157. /agenta/client/{types → backend/types}/o_tel_extra_dto.py +0 -0
  158. /agenta/client/{types → backend/types}/o_tel_link_dto.py +0 -0
  159. /agenta/client/{types → backend/types}/o_tel_span_dto.py +0 -0
  160. /agenta/client/{types → backend/types}/o_tel_span_kind.py +0 -0
  161. /agenta/client/{types → backend/types}/o_tel_spans_response.py +0 -0
  162. /agenta/client/{types → backend/types}/o_tel_status_code.py +0 -0
  163. /agenta/client/{types → backend/types}/organization_output.py +0 -0
  164. /agenta/client/{types → backend/types}/organization_request.py +0 -0
  165. /agenta/client/{types → backend/types}/parent_dto.py +0 -0
  166. /agenta/client/{types → backend/types}/project_membership_request.py +0 -0
  167. /agenta/client/{types → backend/types}/project_request.py +0 -0
  168. /agenta/client/{types → backend/types}/project_scope.py +0 -0
  169. /agenta/client/{types → backend/types}/projects_response.py +0 -0
  170. /agenta/client/{types → backend/types}/reference.py +0 -0
  171. /agenta/client/{types → backend/types}/reference_dto.py +0 -0
  172. /agenta/client/{types → backend/types}/reference_request_model.py +0 -0
  173. /agenta/client/{types → backend/types}/result.py +0 -0
  174. /agenta/client/{types → backend/types}/role.py +0 -0
  175. /agenta/client/{types → backend/types}/root_dto.py +0 -0
  176. /agenta/client/{types → backend/types}/scopes_response_model.py +0 -0
  177. /agenta/client/{types → backend/types}/secret_response_dto.py +0 -0
  178. /agenta/client/{types → backend/types}/simple_evaluation_output.py +0 -0
  179. /agenta/client/{types → backend/types}/span_dto.py +0 -0
  180. /agenta/client/{types → backend/types}/span_dto_nodes_value.py +0 -0
  181. /agenta/client/{types → backend/types}/status_code.py +0 -0
  182. /agenta/client/{types → backend/types}/status_dto.py +0 -0
  183. /agenta/client/{types → backend/types}/template.py +0 -0
  184. /agenta/client/{types → backend/types}/template_image_info.py +0 -0
  185. /agenta/client/{types → backend/types}/test_set_output_response.py +0 -0
  186. /agenta/client/{types → backend/types}/test_set_simple_response.py +0 -0
  187. /agenta/client/{types → backend/types}/time_dto.py +0 -0
  188. /agenta/client/{types → backend/types}/tree_dto.py +0 -0
  189. /agenta/client/{types → backend/types}/tree_type.py +0 -0
  190. /agenta/client/{types → backend/types}/update_app_output.py +0 -0
  191. /agenta/client/{types → backend/types}/uri.py +0 -0
  192. /agenta/client/{types → backend/types}/user_request.py +0 -0
  193. /agenta/client/{types → backend/types}/validation_error.py +0 -0
  194. /agenta/client/{types → backend/types}/validation_error_loc_item.py +0 -0
  195. /agenta/client/{types → backend/types}/variant_action.py +0 -0
  196. /agenta/client/{types → backend/types}/variant_action_enum.py +0 -0
  197. /agenta/client/{types → backend/types}/workspace_member_response.py +0 -0
  198. /agenta/client/{types → backend/types}/workspace_membership_request.py +0 -0
  199. /agenta/client/{types → backend/types}/workspace_permission.py +0 -0
  200. /agenta/client/{types → backend/types}/workspace_request.py +0 -0
  201. /agenta/client/{types → backend/types}/workspace_response.py +0 -0
  202. /agenta/client/{types → backend/types}/workspace_role.py +0 -0
  203. /agenta/client/{types → backend/types}/workspace_role_response.py +0 -0
  204. /agenta/client/{variants → backend/variants}/__init__.py +0 -0
  205. /agenta/client/{variants → backend/variants}/types/__init__.py +0 -0
  206. /agenta/client/{variants → backend/variants}/types/add_variant_from_base_and_config_response.py +0 -0
  207. /agenta/client/types/{provider_key_dto.py → provider_key_dto.py~HEAD} +0 -0
  208. /agenta/client/types/{provider_kind.py → provider_kind.py~HEAD} +0 -0
  209. {agenta-0.36.5.dist-info → agenta-0.37.1.dist-info}/WHEEL +0 -0
@@ -90,7 +90,13 @@ class VaultClient:
90
90
 
91
91
  Examples
92
92
  --------
93
- from agenta import AgentaApi, HeaderDto, ProviderKeyDto, SecretDto
93
+ from agenta import (
94
+ AgentaApi,
95
+ HeaderDto,
96
+ SecretDto,
97
+ StandardProviderDto,
98
+ StandardProviderSettingsDto,
99
+ )
94
100
 
95
101
  client = AgentaApi(
96
102
  api_key="YOUR_API_KEY",
@@ -99,9 +105,12 @@ class VaultClient:
99
105
  client.vault.create_secret(
100
106
  header=HeaderDto(),
101
107
  secret=SecretDto(
102
- data=ProviderKeyDto(
103
- provider="openai",
104
- key="key",
108
+ kind="provider_key",
109
+ data=StandardProviderDto(
110
+ kind="openai",
111
+ provider=StandardProviderSettingsDto(
112
+ key="key",
113
+ ),
105
114
  ),
106
115
  ),
107
116
  )
@@ -414,7 +423,13 @@ class AsyncVaultClient:
414
423
  --------
415
424
  import asyncio
416
425
 
417
- from agenta import AsyncAgentaApi, HeaderDto, ProviderKeyDto, SecretDto
426
+ from agenta import (
427
+ AsyncAgentaApi,
428
+ HeaderDto,
429
+ SecretDto,
430
+ StandardProviderDto,
431
+ StandardProviderSettingsDto,
432
+ )
418
433
 
419
434
  client = AsyncAgentaApi(
420
435
  api_key="YOUR_API_KEY",
@@ -426,9 +441,12 @@ class AsyncVaultClient:
426
441
  await client.vault.create_secret(
427
442
  header=HeaderDto(),
428
443
  secret=SecretDto(
429
- data=ProviderKeyDto(
430
- provider="openai",
431
- key="key",
444
+ kind="provider_key",
445
+ data=StandardProviderDto(
446
+ kind="openai",
447
+ provider=StandardProviderSettingsDto(
448
+ key="key",
449
+ ),
432
450
  ),
433
451
  ),
434
452
  )
@@ -0,0 +1 @@
1
+ # This file was auto-generated by Fern from our API Definition.
@@ -0,0 +1,405 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.client_wrapper import SyncClientWrapper
4
+ import typing
5
+ from ..core.request_options import RequestOptions
6
+ from ..types.workspace import Workspace
7
+ from ..core.pydantic_utilities import parse_obj_as
8
+ from json.decoder import JSONDecodeError
9
+ from ..core.api_error import ApiError
10
+ from ..core.jsonable_encoder import jsonable_encoder
11
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
12
+ from ..types.http_validation_error import HttpValidationError
13
+ from ..core.client_wrapper import AsyncClientWrapper
14
+
15
+
16
+ class WorkspaceClient:
17
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
18
+ self._client_wrapper = client_wrapper
19
+
20
+ def get_workspace(
21
+ self, *, request_options: typing.Optional[RequestOptions] = None
22
+ ) -> typing.List[Workspace]:
23
+ """
24
+ Get workspace details.
25
+
26
+ Returns details about the workspace associated with the user's session.
27
+
28
+ Returns:
29
+ Workspace: The details of the workspace.
30
+
31
+ Raises:
32
+ HTTPException: If the user does not have permission to perform this action.
33
+
34
+ Parameters
35
+ ----------
36
+ request_options : typing.Optional[RequestOptions]
37
+ Request-specific configuration.
38
+
39
+ Returns
40
+ -------
41
+ typing.List[Workspace]
42
+ Successful Response
43
+
44
+ Examples
45
+ --------
46
+ from agenta import AgentaApi
47
+
48
+ client = AgentaApi(
49
+ api_key="YOUR_API_KEY",
50
+ base_url="https://yourhost.com/path/to/api",
51
+ )
52
+ client.workspace.get_workspace()
53
+ """
54
+ _response = self._client_wrapper.httpx_client.request(
55
+ "workspaces",
56
+ method="GET",
57
+ request_options=request_options,
58
+ )
59
+ try:
60
+ if 200 <= _response.status_code < 300:
61
+ return typing.cast(
62
+ typing.List[Workspace],
63
+ parse_obj_as(
64
+ type_=typing.List[Workspace], # type: ignore
65
+ object_=_response.json(),
66
+ ),
67
+ )
68
+ _response_json = _response.json()
69
+ except JSONDecodeError:
70
+ raise ApiError(status_code=_response.status_code, body=_response.text)
71
+ raise ApiError(status_code=_response.status_code, body=_response_json)
72
+
73
+ def get_all_workspace_roles(
74
+ self, *, request_options: typing.Optional[RequestOptions] = None
75
+ ) -> typing.List[typing.Dict[str, str]]:
76
+ """
77
+ Get all workspace roles.
78
+
79
+ Returns a list of all available workspace roles.
80
+
81
+ Returns:
82
+ List[WorkspaceRoleResponse]: A list of WorkspaceRole objects representing the available workspace roles.
83
+
84
+ Raises:
85
+ HTTPException: If an error occurs while retrieving the workspace roles.
86
+
87
+ Parameters
88
+ ----------
89
+ request_options : typing.Optional[RequestOptions]
90
+ Request-specific configuration.
91
+
92
+ Returns
93
+ -------
94
+ typing.List[typing.Dict[str, str]]
95
+ Successful Response
96
+
97
+ Examples
98
+ --------
99
+ from agenta import AgentaApi
100
+
101
+ client = AgentaApi(
102
+ api_key="YOUR_API_KEY",
103
+ base_url="https://yourhost.com/path/to/api",
104
+ )
105
+ client.workspace.get_all_workspace_roles()
106
+ """
107
+ _response = self._client_wrapper.httpx_client.request(
108
+ "workspaces/roles",
109
+ method="GET",
110
+ request_options=request_options,
111
+ )
112
+ try:
113
+ if 200 <= _response.status_code < 300:
114
+ return typing.cast(
115
+ typing.List[typing.Dict[str, str]],
116
+ parse_obj_as(
117
+ type_=typing.List[typing.Dict[str, str]], # type: ignore
118
+ object_=_response.json(),
119
+ ),
120
+ )
121
+ _response_json = _response.json()
122
+ except JSONDecodeError:
123
+ raise ApiError(status_code=_response.status_code, body=_response.text)
124
+ raise ApiError(status_code=_response.status_code, body=_response_json)
125
+
126
+ def remove_user_from_workspace(
127
+ self,
128
+ workspace_id: str,
129
+ *,
130
+ email: str,
131
+ request_options: typing.Optional[RequestOptions] = None,
132
+ ) -> typing.Optional[typing.Any]:
133
+ """
134
+ Remove a user from a workspace.
135
+
136
+ Args:
137
+ email (str): The email address of the user to be removed
138
+ workspace_id (str): The ID of the workspace.
139
+
140
+ Parameters
141
+ ----------
142
+ workspace_id : str
143
+
144
+ email : str
145
+
146
+ request_options : typing.Optional[RequestOptions]
147
+ Request-specific configuration.
148
+
149
+ Returns
150
+ -------
151
+ typing.Optional[typing.Any]
152
+ Successful Response
153
+
154
+ Examples
155
+ --------
156
+ from agenta import AgentaApi
157
+
158
+ client = AgentaApi(
159
+ api_key="YOUR_API_KEY",
160
+ base_url="https://yourhost.com/path/to/api",
161
+ )
162
+ client.workspace.remove_user_from_workspace(
163
+ workspace_id="workspace_id",
164
+ email="email",
165
+ )
166
+ """
167
+ _response = self._client_wrapper.httpx_client.request(
168
+ f"workspaces/{jsonable_encoder(workspace_id)}/users",
169
+ method="DELETE",
170
+ params={
171
+ "email": email,
172
+ },
173
+ request_options=request_options,
174
+ )
175
+ try:
176
+ if 200 <= _response.status_code < 300:
177
+ return typing.cast(
178
+ typing.Optional[typing.Any],
179
+ parse_obj_as(
180
+ type_=typing.Optional[typing.Any], # type: ignore
181
+ object_=_response.json(),
182
+ ),
183
+ )
184
+ if _response.status_code == 422:
185
+ raise UnprocessableEntityError(
186
+ typing.cast(
187
+ HttpValidationError,
188
+ parse_obj_as(
189
+ type_=HttpValidationError, # type: ignore
190
+ object_=_response.json(),
191
+ ),
192
+ )
193
+ )
194
+ _response_json = _response.json()
195
+ except JSONDecodeError:
196
+ raise ApiError(status_code=_response.status_code, body=_response.text)
197
+ raise ApiError(status_code=_response.status_code, body=_response_json)
198
+
199
+
200
+ class AsyncWorkspaceClient:
201
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
202
+ self._client_wrapper = client_wrapper
203
+
204
+ async def get_workspace(
205
+ self, *, request_options: typing.Optional[RequestOptions] = None
206
+ ) -> typing.List[Workspace]:
207
+ """
208
+ Get workspace details.
209
+
210
+ Returns details about the workspace associated with the user's session.
211
+
212
+ Returns:
213
+ Workspace: The details of the workspace.
214
+
215
+ Raises:
216
+ HTTPException: If the user does not have permission to perform this action.
217
+
218
+ Parameters
219
+ ----------
220
+ request_options : typing.Optional[RequestOptions]
221
+ Request-specific configuration.
222
+
223
+ Returns
224
+ -------
225
+ typing.List[Workspace]
226
+ Successful Response
227
+
228
+ Examples
229
+ --------
230
+ import asyncio
231
+
232
+ from agenta import AsyncAgentaApi
233
+
234
+ client = AsyncAgentaApi(
235
+ api_key="YOUR_API_KEY",
236
+ base_url="https://yourhost.com/path/to/api",
237
+ )
238
+
239
+
240
+ async def main() -> None:
241
+ await client.workspace.get_workspace()
242
+
243
+
244
+ asyncio.run(main())
245
+ """
246
+ _response = await self._client_wrapper.httpx_client.request(
247
+ "workspaces",
248
+ method="GET",
249
+ request_options=request_options,
250
+ )
251
+ try:
252
+ if 200 <= _response.status_code < 300:
253
+ return typing.cast(
254
+ typing.List[Workspace],
255
+ parse_obj_as(
256
+ type_=typing.List[Workspace], # type: ignore
257
+ object_=_response.json(),
258
+ ),
259
+ )
260
+ _response_json = _response.json()
261
+ except JSONDecodeError:
262
+ raise ApiError(status_code=_response.status_code, body=_response.text)
263
+ raise ApiError(status_code=_response.status_code, body=_response_json)
264
+
265
+ async def get_all_workspace_roles(
266
+ self, *, request_options: typing.Optional[RequestOptions] = None
267
+ ) -> typing.List[typing.Dict[str, str]]:
268
+ """
269
+ Get all workspace roles.
270
+
271
+ Returns a list of all available workspace roles.
272
+
273
+ Returns:
274
+ List[WorkspaceRoleResponse]: A list of WorkspaceRole objects representing the available workspace roles.
275
+
276
+ Raises:
277
+ HTTPException: If an error occurs while retrieving the workspace roles.
278
+
279
+ Parameters
280
+ ----------
281
+ request_options : typing.Optional[RequestOptions]
282
+ Request-specific configuration.
283
+
284
+ Returns
285
+ -------
286
+ typing.List[typing.Dict[str, str]]
287
+ Successful Response
288
+
289
+ Examples
290
+ --------
291
+ import asyncio
292
+
293
+ from agenta import AsyncAgentaApi
294
+
295
+ client = AsyncAgentaApi(
296
+ api_key="YOUR_API_KEY",
297
+ base_url="https://yourhost.com/path/to/api",
298
+ )
299
+
300
+
301
+ async def main() -> None:
302
+ await client.workspace.get_all_workspace_roles()
303
+
304
+
305
+ asyncio.run(main())
306
+ """
307
+ _response = await self._client_wrapper.httpx_client.request(
308
+ "workspaces/roles",
309
+ method="GET",
310
+ request_options=request_options,
311
+ )
312
+ try:
313
+ if 200 <= _response.status_code < 300:
314
+ return typing.cast(
315
+ typing.List[typing.Dict[str, str]],
316
+ parse_obj_as(
317
+ type_=typing.List[typing.Dict[str, str]], # type: ignore
318
+ object_=_response.json(),
319
+ ),
320
+ )
321
+ _response_json = _response.json()
322
+ except JSONDecodeError:
323
+ raise ApiError(status_code=_response.status_code, body=_response.text)
324
+ raise ApiError(status_code=_response.status_code, body=_response_json)
325
+
326
+ async def remove_user_from_workspace(
327
+ self,
328
+ workspace_id: str,
329
+ *,
330
+ email: str,
331
+ request_options: typing.Optional[RequestOptions] = None,
332
+ ) -> typing.Optional[typing.Any]:
333
+ """
334
+ Remove a user from a workspace.
335
+
336
+ Args:
337
+ email (str): The email address of the user to be removed
338
+ workspace_id (str): The ID of the workspace.
339
+
340
+ Parameters
341
+ ----------
342
+ workspace_id : str
343
+
344
+ email : str
345
+
346
+ request_options : typing.Optional[RequestOptions]
347
+ Request-specific configuration.
348
+
349
+ Returns
350
+ -------
351
+ typing.Optional[typing.Any]
352
+ Successful Response
353
+
354
+ Examples
355
+ --------
356
+ import asyncio
357
+
358
+ from agenta import AsyncAgentaApi
359
+
360
+ client = AsyncAgentaApi(
361
+ api_key="YOUR_API_KEY",
362
+ base_url="https://yourhost.com/path/to/api",
363
+ )
364
+
365
+
366
+ async def main() -> None:
367
+ await client.workspace.remove_user_from_workspace(
368
+ workspace_id="workspace_id",
369
+ email="email",
370
+ )
371
+
372
+
373
+ asyncio.run(main())
374
+ """
375
+ _response = await self._client_wrapper.httpx_client.request(
376
+ f"workspaces/{jsonable_encoder(workspace_id)}/users",
377
+ method="DELETE",
378
+ params={
379
+ "email": email,
380
+ },
381
+ request_options=request_options,
382
+ )
383
+ try:
384
+ if 200 <= _response.status_code < 300:
385
+ return typing.cast(
386
+ typing.Optional[typing.Any],
387
+ parse_obj_as(
388
+ type_=typing.Optional[typing.Any], # type: ignore
389
+ object_=_response.json(),
390
+ ),
391
+ )
392
+ if _response.status_code == 422:
393
+ raise UnprocessableEntityError(
394
+ typing.cast(
395
+ HttpValidationError,
396
+ parse_obj_as(
397
+ type_=HttpValidationError, # type: ignore
398
+ object_=_response.json(),
399
+ ),
400
+ )
401
+ )
402
+ _response_json = _response.json()
403
+ except JSONDecodeError:
404
+ raise ApiError(status_code=_response.status_code, body=_response.text)
405
+ raise ApiError(status_code=_response.status_code, body=_response_json)
agenta/client/client.py CHANGED
@@ -2,54 +2,54 @@
2
2
 
3
3
  import typing
4
4
  import httpx
5
- from .core.client_wrapper import SyncClientWrapper
6
- from .admin.client import AdminClient
7
- from .vault.client import VaultClient
8
- from .access_control.client import AccessControlClient
9
- from .scopes.client import ScopesClient
10
- from .apps.client import AppsClient
11
- from .variants.client import VariantsClient
12
- from .evaluations.client import EvaluationsClient
13
- from .human_evaluations.client import HumanEvaluationsClient
14
- from .evaluators.client import EvaluatorsClient
15
- from .testsets.client import TestsetsClient
16
- from .containers.client import ContainersClient
17
- from .environments.client import EnvironmentsClient
18
- from .bases.client import BasesClient
19
- from .configs.client import ConfigsClient
20
- from .observability.client import ObservabilityClient
21
- from .core.request_options import RequestOptions
22
- from .types.list_api_keys_response import ListApiKeysResponse
23
- from .core.pydantic_utilities import parse_obj_as
5
+ from .backend.core.client_wrapper import SyncClientWrapper
6
+ from .backend.admin.client import AdminClient
7
+ from .backend.vault.client import VaultClient
8
+ from .backend.access_control.client import AccessControlClient
9
+ from .backend.scopes.client import ScopesClient
10
+ from .backend.apps.client import AppsClient
11
+ from .backend.variants.client import VariantsClient
12
+ from .backend.evaluations.client import EvaluationsClient
13
+ from .backend.human_evaluations.client import HumanEvaluationsClient
14
+ from .backend.evaluators.client import EvaluatorsClient
15
+ from .backend.testsets.client import TestsetsClient
16
+ from .backend.containers.client import ContainersClient
17
+ from .backend.environments.client import EnvironmentsClient
18
+ from .backend.bases.client import BasesClient
19
+ from .backend.configs.client import ConfigsClient
20
+ from .backend.observability.client import ObservabilityClient
21
+ from .backend.core.request_options import RequestOptions
22
+ from .backend.types.list_api_keys_response import ListApiKeysResponse
23
+ from .backend.core.pydantic_utilities import parse_obj_as
24
24
  from json.decoder import JSONDecodeError
25
- from .core.api_error import ApiError
26
- from .core.jsonable_encoder import jsonable_encoder
27
- from .errors.unprocessable_entity_error import UnprocessableEntityError
28
- from .types.http_validation_error import HttpValidationError
29
- from .types.organization import Organization
30
- from .types.organization_output import OrganizationOutput
31
- from .types.invite_request import InviteRequest
32
- from .core.serialization import convert_and_respect_annotation_metadata
33
- from .types.workspace_response import WorkspaceResponse
25
+ from .backend.core.api_error import ApiError
26
+ from .backend.core.jsonable_encoder import jsonable_encoder
27
+ from .backend.errors.unprocessable_entity_error import UnprocessableEntityError
28
+ from .backend.types.http_validation_error import HttpValidationError
29
+ from .backend.types.organization import Organization
30
+ from .backend.types.organization_output import OrganizationOutput
31
+ from .backend.types.invite_request import InviteRequest
32
+ from .backend.core.serialization import convert_and_respect_annotation_metadata
33
+ from .backend.types.workspace_response import WorkspaceResponse
34
34
  import datetime as dt
35
- from .types.workspace_role_response import WorkspaceRoleResponse
36
- from .types.permission import Permission
37
- from .core.client_wrapper import AsyncClientWrapper
38
- from .admin.client import AsyncAdminClient
39
- from .vault.client import AsyncVaultClient
40
- from .access_control.client import AsyncAccessControlClient
41
- from .scopes.client import AsyncScopesClient
42
- from .apps.client import AsyncAppsClient
43
- from .variants.client import AsyncVariantsClient
44
- from .evaluations.client import AsyncEvaluationsClient
45
- from .human_evaluations.client import AsyncHumanEvaluationsClient
46
- from .evaluators.client import AsyncEvaluatorsClient
47
- from .testsets.client import AsyncTestsetsClient
48
- from .containers.client import AsyncContainersClient
49
- from .environments.client import AsyncEnvironmentsClient
50
- from .bases.client import AsyncBasesClient
51
- from .configs.client import AsyncConfigsClient
52
- from .observability.client import AsyncObservabilityClient
35
+ from .backend.types.workspace_role_response import WorkspaceRoleResponse
36
+ from .backend.types.permission import Permission
37
+ from .backend.core.client_wrapper import AsyncClientWrapper
38
+ from .backend.admin.client import AsyncAdminClient
39
+ from .backend.vault.client import AsyncVaultClient
40
+ from .backend.access_control.client import AsyncAccessControlClient
41
+ from .backend.scopes.client import AsyncScopesClient
42
+ from .backend.apps.client import AsyncAppsClient
43
+ from .backend.variants.client import AsyncVariantsClient
44
+ from .backend.evaluations.client import AsyncEvaluationsClient
45
+ from .backend.human_evaluations.client import AsyncHumanEvaluationsClient
46
+ from .backend.evaluators.client import AsyncEvaluatorsClient
47
+ from .backend.testsets.client import AsyncTestsetsClient
48
+ from .backend.containers.client import AsyncContainersClient
49
+ from .backend.environments.client import AsyncEnvironmentsClient
50
+ from .backend.bases.client import AsyncBasesClient
51
+ from .backend.configs.client import AsyncConfigsClient
52
+ from .backend.observability.client import AsyncObservabilityClient
53
53
 
54
54
  # this is used as the default value for optional parameters
55
55
  OMIT = typing.cast(typing.Any, ...)
@@ -0,0 +1,21 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
5
+ import typing
6
+ import pydantic
7
+
8
+
9
+ class StandardProviderSettingsDto(UniversalBaseModel):
10
+ key: str
11
+
12
+ if IS_PYDANTIC_V2:
13
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
14
+ extra="allow", frozen=True
15
+ ) # type: ignore # Pydantic v2
16
+ else:
17
+
18
+ class Config:
19
+ frozen = True
20
+ smart_union = True
21
+ extra = pydantic.Extra.allow
@@ -0,0 +1,21 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ StandardProviderKind = typing.Union[
6
+ typing.Literal[
7
+ "openai",
8
+ "cohere",
9
+ "anyscale",
10
+ "deepinfra",
11
+ "alephalpha",
12
+ "groq",
13
+ "mistralai",
14
+ "anthropic",
15
+ "perplexityai",
16
+ "togetherai",
17
+ "openrouter",
18
+ "gemini",
19
+ ],
20
+ typing.Any,
21
+ ]
agenta/sdk/__init__.py CHANGED
@@ -2,7 +2,7 @@ from typing import Optional, Callable, Any
2
2
 
3
3
  from .utils.preinit import PreInitObject # always the first import!
4
4
 
5
- import agenta.client.types as client_types # pylint: disable=wrong-import-order
5
+ import agenta.client.backend.types as client_types # pylint: disable=wrong-import-order
6
6
 
7
7
  from .types import (
8
8
  DictInput,