agenta 0.48.9__py3-none-any.whl → 0.48.10__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 (295) hide show
  1. agenta/__init__.py +3 -2
  2. agenta/client/Readme.md +258 -80
  3. agenta/client/__init__.py +205 -29
  4. agenta/client/backend/__init__.py +461 -0
  5. agenta/client/backend/access_control/__init__.py +2 -0
  6. agenta/client/backend/access_control/client.py +53 -73
  7. agenta/client/backend/access_control/raw_client.py +180 -0
  8. agenta/client/backend/admin/__init__.py +2 -0
  9. agenta/client/backend/admin/client.py +473 -268
  10. agenta/client/backend/admin/raw_client.py +1017 -0
  11. agenta/client/backend/api_keys/__init__.py +2 -0
  12. agenta/client/backend/api_keys/client.py +43 -276
  13. agenta/client/backend/api_keys/raw_client.py +364 -0
  14. agenta/client/backend/apps/__init__.py +2 -0
  15. agenta/client/backend/apps/client.py +132 -895
  16. agenta/client/backend/apps/raw_client.py +1516 -0
  17. agenta/client/backend/bases/__init__.py +2 -0
  18. agenta/client/backend/bases/client.py +33 -73
  19. agenta/client/backend/bases/raw_client.py +179 -0
  20. agenta/client/backend/billing/__init__.py +3 -0
  21. agenta/client/backend/billing/client.py +564 -0
  22. agenta/client/backend/billing/raw_client.py +805 -0
  23. agenta/client/backend/client.py +1268 -0
  24. agenta/client/backend/configs/__init__.py +2 -0
  25. agenta/client/backend/configs/client.py +49 -361
  26. agenta/client/backend/configs/raw_client.py +402 -0
  27. agenta/client/backend/containers/__init__.py +1 -3
  28. agenta/client/backend/containers/client.py +25 -548
  29. agenta/client/backend/containers/raw_client.py +112 -0
  30. agenta/client/backend/core/__init__.py +5 -0
  31. agenta/client/backend/core/api_error.py +12 -6
  32. agenta/client/backend/core/client_wrapper.py +4 -4
  33. agenta/client/backend/core/file.py +1 -3
  34. agenta/client/backend/core/force_multipart.py +16 -0
  35. agenta/client/backend/core/http_client.py +78 -34
  36. agenta/client/backend/core/http_response.py +55 -0
  37. agenta/client/backend/core/jsonable_encoder.py +0 -1
  38. agenta/client/backend/core/pydantic_utilities.py +88 -113
  39. agenta/client/backend/core/serialization.py +9 -3
  40. agenta/client/backend/environment.py +7 -0
  41. agenta/client/backend/environments/__init__.py +2 -0
  42. agenta/client/backend/environments/client.py +43 -79
  43. agenta/client/backend/environments/raw_client.py +193 -0
  44. agenta/client/backend/errors/__init__.py +2 -0
  45. agenta/client/backend/errors/unprocessable_entity_error.py +8 -2
  46. agenta/client/backend/evals/__init__.py +3 -0
  47. agenta/client/backend/evals/client.py +1042 -0
  48. agenta/client/backend/evals/raw_client.py +1549 -0
  49. agenta/client/backend/evaluations/__init__.py +2 -0
  50. agenta/client/backend/evaluations/client.py +106 -590
  51. agenta/client/backend/evaluations/raw_client.py +1344 -0
  52. agenta/client/backend/evaluators/__init__.py +2 -0
  53. agenta/client/backend/evaluators/client.py +99 -516
  54. agenta/client/backend/evaluators/raw_client.py +1182 -0
  55. agenta/client/backend/human_evaluations/__init__.py +2 -0
  56. agenta/client/backend/human_evaluations/client.py +120 -680
  57. agenta/client/backend/human_evaluations/raw_client.py +1577 -0
  58. agenta/client/backend/observability/__init__.py +14 -2
  59. agenta/client/backend/observability/client.py +185 -341
  60. agenta/client/backend/observability/raw_client.py +943 -0
  61. agenta/client/backend/observability/types/__init__.py +10 -2
  62. agenta/client/backend/observability/types/{format.py → fetch_trace_by_id_request_trace_id.py} +1 -1
  63. agenta/client/backend/observability/types/fetch_trace_by_id_response.py +15 -0
  64. agenta/client/backend/observability/types/query_analytics_response.py +2 -1
  65. agenta/client/backend/observability/types/query_traces_response.py +7 -3
  66. agenta/client/backend/organization/__init__.py +2 -0
  67. agenta/client/backend/organization/client.py +105 -361
  68. agenta/client/backend/organization/raw_client.py +774 -0
  69. agenta/client/backend/raw_client.py +1432 -0
  70. agenta/client/backend/scopes/__init__.py +2 -0
  71. agenta/client/backend/scopes/client.py +31 -45
  72. agenta/client/backend/scopes/raw_client.py +105 -0
  73. agenta/client/backend/testsets/__init__.py +14 -0
  74. agenta/client/backend/testsets/client.py +1098 -653
  75. agenta/client/backend/testsets/raw_client.py +2348 -0
  76. agenta/client/backend/testsets/types/__init__.py +17 -0
  77. agenta/client/backend/testsets/types/create_testset_from_file_request_file_type.py +7 -0
  78. agenta/client/backend/testsets/types/fetch_testset_to_file_request_file_type.py +7 -0
  79. agenta/client/backend/testsets/types/update_testset_from_file_request_file_type.py +7 -0
  80. agenta/client/backend/tracing/__init__.py +7 -0
  81. agenta/client/backend/tracing/client.py +782 -0
  82. agenta/client/backend/tracing/raw_client.py +1223 -0
  83. agenta/client/backend/tracing/types/__init__.py +8 -0
  84. agenta/client/backend/{types/variant_action_enum.py → tracing/types/fetch_trace_request_trace_id.py} +1 -1
  85. agenta/client/backend/tracing/types/remove_trace_request_trace_id.py +5 -0
  86. agenta/client/backend/types/__init__.py +153 -26
  87. agenta/client/backend/types/account_request.py +24 -0
  88. agenta/client/backend/types/account_response.py +5 -7
  89. agenta/client/backend/types/agenta_node_dto.py +13 -13
  90. agenta/client/backend/types/agenta_node_dto_nodes_value.py +1 -0
  91. agenta/client/backend/types/agenta_nodes_response.py +14 -8
  92. agenta/client/backend/types/agenta_root_dto.py +16 -8
  93. agenta/client/backend/types/agenta_roots_response.py +16 -8
  94. agenta/client/backend/types/agenta_tree_dto.py +16 -8
  95. agenta/client/backend/types/agenta_trees_response.py +16 -8
  96. agenta/client/backend/types/aggregated_result.py +5 -7
  97. agenta/client/backend/types/aggregated_result_evaluator_config.py +1 -0
  98. agenta/client/backend/types/analytics_response.py +4 -6
  99. agenta/client/backend/types/annotation.py +50 -0
  100. agenta/client/backend/types/annotation_create.py +39 -0
  101. agenta/client/backend/types/annotation_edit.py +31 -0
  102. agenta/client/backend/types/annotation_kind.py +5 -0
  103. agenta/client/backend/types/{uri.py → annotation_link.py} +6 -7
  104. agenta/client/backend/types/{provider_key_dto.py → annotation_link_response.py} +6 -7
  105. agenta/client/backend/types/annotation_query.py +40 -0
  106. agenta/client/backend/types/annotation_query_request.py +20 -0
  107. agenta/client/backend/types/annotation_reference.py +21 -0
  108. agenta/client/backend/types/annotation_references.py +22 -0
  109. agenta/client/backend/types/{docker_env_vars.py → annotation_response.py} +6 -7
  110. agenta/client/backend/types/annotation_source.py +5 -0
  111. agenta/client/backend/types/annotations_response.py +24 -0
  112. agenta/client/backend/types/app.py +3 -5
  113. agenta/client/backend/types/app_variant_response.py +3 -6
  114. agenta/client/backend/types/app_variant_revision.py +5 -6
  115. agenta/client/backend/types/artifact.py +44 -0
  116. agenta/client/backend/types/base_output.py +3 -5
  117. agenta/client/backend/types/body_fetch_workflow_revision.py +21 -0
  118. agenta/client/backend/types/body_import_testset.py +3 -5
  119. agenta/client/backend/types/bucket_dto.py +4 -6
  120. agenta/client/backend/types/collect_status_response.py +3 -5
  121. agenta/client/backend/types/config_db.py +3 -5
  122. agenta/client/backend/types/config_dto.py +5 -7
  123. agenta/client/backend/types/config_response_model.py +5 -7
  124. agenta/client/backend/types/correct_answer.py +3 -5
  125. agenta/client/backend/types/create_app_output.py +3 -5
  126. agenta/client/backend/types/custom_model_settings_dto.py +3 -5
  127. agenta/client/backend/types/custom_provider_dto.py +6 -9
  128. agenta/client/backend/types/custom_provider_kind.py +5 -5
  129. agenta/client/backend/types/custom_provider_settings_dto.py +3 -5
  130. agenta/client/backend/types/data.py +2 -1
  131. agenta/client/backend/types/delete_evaluation.py +3 -5
  132. agenta/client/backend/types/environment_output.py +3 -5
  133. agenta/client/backend/types/environment_output_extended.py +4 -6
  134. agenta/client/backend/types/environment_revision.py +5 -5
  135. agenta/client/backend/types/error.py +3 -5
  136. agenta/client/backend/types/evaluation.py +6 -8
  137. agenta/client/backend/types/evaluation_scenario.py +5 -7
  138. agenta/client/backend/types/evaluation_scenario_input.py +3 -5
  139. agenta/client/backend/types/evaluation_scenario_output.py +4 -6
  140. agenta/client/backend/types/evaluation_scenario_result.py +4 -6
  141. agenta/client/backend/types/evaluator.py +31 -12
  142. agenta/client/backend/types/evaluator_config.py +3 -5
  143. agenta/client/backend/types/evaluator_flags.py +21 -0
  144. agenta/client/backend/types/evaluator_mapping_output_interface.py +3 -5
  145. agenta/client/backend/types/evaluator_output_interface.py +3 -5
  146. agenta/client/backend/types/evaluator_query.py +32 -0
  147. agenta/client/backend/types/evaluator_query_request.py +30 -0
  148. agenta/client/backend/types/evaluator_request.py +20 -0
  149. agenta/client/backend/types/evaluator_response.py +21 -0
  150. agenta/client/backend/types/evaluators_response.py +21 -0
  151. agenta/client/backend/types/exception_dto.py +3 -5
  152. agenta/client/backend/types/{o_tel_spans_response.py → extended_o_tel_tracing_response.py} +5 -7
  153. agenta/client/backend/types/focus.py +5 -0
  154. agenta/client/backend/types/format.py +5 -0
  155. agenta/client/backend/types/full_json_input.py +34 -0
  156. agenta/client/backend/types/full_json_output.py +29 -0
  157. agenta/client/backend/types/get_config_response.py +3 -5
  158. agenta/client/backend/types/{header_dto.py → header.py} +4 -6
  159. agenta/client/backend/types/http_validation_error.py +4 -6
  160. agenta/client/backend/types/human_evaluation.py +3 -5
  161. agenta/client/backend/types/human_evaluation_scenario.py +4 -6
  162. agenta/client/backend/types/human_evaluation_scenario_input.py +3 -5
  163. agenta/client/backend/types/human_evaluation_scenario_output.py +3 -5
  164. agenta/client/backend/types/invite_request.py +4 -6
  165. agenta/client/backend/types/legacy_analytics_response.py +4 -6
  166. agenta/client/backend/types/legacy_data_point.py +3 -5
  167. agenta/client/backend/types/legacy_evaluator.py +26 -0
  168. agenta/client/backend/types/legacy_scope_request.py +4 -6
  169. agenta/client/backend/types/legacy_scopes_response.py +3 -5
  170. agenta/client/backend/types/legacy_subscription_request.py +19 -0
  171. agenta/client/backend/types/legacy_user_request.py +5 -7
  172. agenta/client/backend/types/legacy_user_response.py +3 -5
  173. agenta/client/backend/types/lifecycle_dto.py +3 -5
  174. agenta/client/backend/types/link_dto.py +4 -6
  175. agenta/client/backend/types/list_api_keys_response.py +3 -5
  176. agenta/client/backend/types/llm_run_rate_limit.py +3 -5
  177. agenta/client/backend/types/meta_request.py +30 -0
  178. agenta/client/backend/types/metrics_dto.py +3 -5
  179. agenta/client/backend/types/new_testset.py +3 -5
  180. agenta/client/backend/types/node_dto.py +4 -6
  181. agenta/client/backend/types/o_tel_context_dto.py +3 -5
  182. agenta/client/backend/types/o_tel_event.py +35 -0
  183. agenta/client/backend/types/o_tel_event_dto.py +3 -5
  184. agenta/client/backend/types/o_tel_extra_dto.py +4 -6
  185. agenta/client/backend/types/o_tel_flat_span.py +56 -0
  186. agenta/client/backend/types/o_tel_flat_span_input_end_time.py +6 -0
  187. agenta/client/backend/types/o_tel_flat_span_input_start_time.py +6 -0
  188. agenta/client/backend/types/o_tel_flat_span_output_end_time.py +6 -0
  189. agenta/client/backend/types/o_tel_flat_span_output_start_time.py +6 -0
  190. agenta/client/backend/types/o_tel_link.py +34 -0
  191. agenta/client/backend/types/o_tel_link_dto.py +4 -6
  192. agenta/client/backend/types/o_tel_links_response.py +22 -0
  193. agenta/client/backend/types/o_tel_span.py +58 -0
  194. agenta/client/backend/types/o_tel_span_dto.py +8 -10
  195. agenta/client/backend/types/o_tel_span_input_end_time.py +6 -0
  196. agenta/client/backend/types/o_tel_span_input_spans_value.py +7 -0
  197. agenta/client/backend/types/o_tel_span_input_start_time.py +6 -0
  198. agenta/client/backend/types/o_tel_span_output_end_time.py +6 -0
  199. agenta/client/backend/types/o_tel_span_output_spans_value.py +30 -0
  200. agenta/client/backend/types/o_tel_span_output_start_time.py +6 -0
  201. agenta/client/backend/types/o_tel_spans_tree.py +22 -0
  202. agenta/client/backend/types/o_tel_spans_tree_input_spans_value.py +7 -0
  203. agenta/client/backend/types/o_tel_spans_tree_output_spans_value.py +5 -0
  204. agenta/client/backend/types/o_tel_status_code.py +1 -1
  205. agenta/client/backend/types/o_tel_tracing_data_response.py +22 -0
  206. agenta/client/backend/types/o_tel_tracing_request.py +22 -0
  207. agenta/client/backend/types/o_tel_tracing_response.py +27 -0
  208. agenta/client/backend/types/organization.py +3 -5
  209. agenta/client/backend/types/organization_details.py +3 -5
  210. agenta/client/backend/types/organization_membership_request.py +5 -7
  211. agenta/client/backend/types/organization_output.py +3 -5
  212. agenta/client/backend/types/organization_request.py +3 -5
  213. agenta/client/backend/types/parent_dto.py +3 -5
  214. agenta/client/backend/types/permission.py +11 -0
  215. agenta/client/backend/types/plan.py +14 -0
  216. agenta/client/backend/types/project_membership_request.py +5 -7
  217. agenta/client/backend/types/project_request.py +4 -6
  218. agenta/client/backend/types/project_scope.py +5 -7
  219. agenta/client/backend/types/projects_response.py +3 -5
  220. agenta/client/backend/types/recursive_types.py +23 -0
  221. agenta/client/backend/types/reference.py +18 -5
  222. agenta/client/backend/types/reference_dto.py +4 -5
  223. agenta/client/backend/types/reference_request_model.py +4 -5
  224. agenta/client/backend/types/result.py +4 -6
  225. agenta/client/backend/types/root_dto.py +3 -5
  226. agenta/client/backend/types/scopes_response_model.py +4 -6
  227. agenta/client/backend/types/secret_dto.py +5 -7
  228. agenta/client/backend/types/secret_response_dto.py +11 -11
  229. agenta/client/backend/types/simple_evaluation_output.py +4 -6
  230. agenta/client/backend/types/span_dto.py +18 -14
  231. agenta/client/backend/types/span_dto_nodes_value.py +1 -1
  232. agenta/client/backend/types/standard_provider_dto.py +5 -7
  233. agenta/client/backend/types/standard_provider_settings_dto.py +3 -5
  234. agenta/client/backend/types/status_dto.py +4 -6
  235. agenta/client/backend/types/tags_request.py +30 -0
  236. agenta/client/backend/types/test_set_output_response.py +5 -7
  237. agenta/client/backend/types/test_set_simple_response.py +3 -5
  238. agenta/client/backend/types/testcase_response.py +33 -0
  239. agenta/client/backend/types/testset.py +46 -0
  240. agenta/client/backend/types/testset_request.py +20 -0
  241. agenta/client/backend/types/testset_response.py +21 -0
  242. agenta/client/backend/types/testsets_response.py +21 -0
  243. agenta/client/backend/types/time_dto.py +3 -5
  244. agenta/client/backend/types/timestamp.py +6 -0
  245. agenta/client/backend/types/tree_dto.py +4 -6
  246. agenta/client/backend/types/update_app_output.py +3 -5
  247. agenta/client/backend/types/user_request.py +3 -5
  248. agenta/client/backend/types/validation_error.py +4 -6
  249. agenta/client/backend/types/workflow_artifact.py +45 -0
  250. agenta/client/backend/types/workflow_data.py +20 -0
  251. agenta/client/backend/types/workflow_flags.py +21 -0
  252. agenta/client/backend/types/workflow_request.py +20 -0
  253. agenta/client/backend/types/workflow_response.py +21 -0
  254. agenta/client/backend/types/workflow_revision.py +57 -0
  255. agenta/client/backend/types/workflow_revision_request.py +20 -0
  256. agenta/client/backend/types/workflow_revision_response.py +21 -0
  257. agenta/client/backend/types/workflow_revisions_response.py +21 -0
  258. agenta/client/backend/types/workflow_variant.py +48 -0
  259. agenta/client/backend/types/workflow_variant_request.py +20 -0
  260. agenta/client/backend/types/workflow_variant_response.py +21 -0
  261. agenta/client/backend/types/workflow_variants_response.py +21 -0
  262. agenta/client/backend/types/workflows_response.py +21 -0
  263. agenta/client/backend/types/workspace.py +3 -5
  264. agenta/client/backend/types/workspace_member_response.py +4 -6
  265. agenta/client/backend/types/workspace_membership_request.py +5 -7
  266. agenta/client/backend/types/workspace_permission.py +5 -7
  267. agenta/client/backend/types/workspace_request.py +4 -6
  268. agenta/client/backend/types/workspace_response.py +4 -6
  269. agenta/client/backend/variants/__init__.py +2 -0
  270. agenta/client/backend/variants/client.py +306 -1651
  271. agenta/client/backend/variants/raw_client.py +2482 -0
  272. agenta/client/backend/variants/types/__init__.py +2 -0
  273. agenta/client/backend/variants/types/add_variant_from_base_and_config_response.py +1 -0
  274. agenta/client/backend/vault/__init__.py +2 -0
  275. agenta/client/backend/vault/client.py +69 -323
  276. agenta/client/backend/vault/raw_client.py +616 -0
  277. agenta/client/backend/workflows/__init__.py +3 -0
  278. agenta/client/backend/workflows/client.py +2398 -0
  279. agenta/client/backend/workflows/raw_client.py +3639 -0
  280. agenta/client/backend/workspace/__init__.py +2 -0
  281. agenta/client/backend/workspace/client.py +46 -147
  282. agenta/client/backend/workspace/raw_client.py +376 -0
  283. agenta/client/types.py +4 -0
  284. agenta/sdk/types.py +28 -1
  285. {agenta-0.48.9.dist-info → agenta-0.48.10.dist-info}/METADATA +1 -1
  286. agenta-0.48.10.dist-info/RECORD +362 -0
  287. agenta/client/backend/containers/types/__init__.py +0 -5
  288. agenta/client/backend/containers/types/container_templates_response.py +0 -6
  289. agenta/client/backend/types/image.py +0 -25
  290. agenta/client/backend/types/provider_kind.py +0 -21
  291. agenta/client/backend/types/template.py +0 -23
  292. agenta/client/backend/types/template_image_info.py +0 -29
  293. agenta/client/backend/types/variant_action.py +0 -22
  294. agenta-0.48.9.dist-info/RECORD +0 -255
  295. {agenta-0.48.9.dist-info → agenta-0.48.10.dist-info}/WHEEL +0 -0
@@ -1 +1,3 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
@@ -1,21 +1,27 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- from ..core.client_wrapper import SyncClientWrapper
4
3
  import typing
4
+
5
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
5
6
  from ..core.request_options import RequestOptions
6
7
  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
8
+ from .raw_client import AsyncRawWorkspaceClient, RawWorkspaceClient
14
9
 
15
10
 
16
11
  class WorkspaceClient:
17
12
  def __init__(self, *, client_wrapper: SyncClientWrapper):
18
- self._client_wrapper = client_wrapper
13
+ self._raw_client = RawWorkspaceClient(client_wrapper=client_wrapper)
14
+
15
+ @property
16
+ def with_raw_response(self) -> RawWorkspaceClient:
17
+ """
18
+ Retrieves a raw implementation of this client that returns raw responses.
19
+
20
+ Returns
21
+ -------
22
+ RawWorkspaceClient
23
+ """
24
+ return self._raw_client
19
25
 
20
26
  def get_workspace(
21
27
  self, *, request_options: typing.Optional[RequestOptions] = None
@@ -47,28 +53,11 @@ class WorkspaceClient:
47
53
 
48
54
  client = AgentaApi(
49
55
  api_key="YOUR_API_KEY",
50
- base_url="https://yourhost.com/path/to/api",
51
56
  )
52
57
  client.workspace.get_workspace()
53
58
  """
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)
59
+ _response = self._raw_client.get_workspace(request_options=request_options)
60
+ return _response.data
72
61
 
73
62
  def get_all_workspace_roles(
74
63
  self, *, request_options: typing.Optional[RequestOptions] = None
@@ -100,35 +89,20 @@ class WorkspaceClient:
100
89
 
101
90
  client = AgentaApi(
102
91
  api_key="YOUR_API_KEY",
103
- base_url="https://yourhost.com/path/to/api",
104
92
  )
105
93
  client.workspace.get_all_workspace_roles()
106
94
  """
107
- _response = self._client_wrapper.httpx_client.request(
108
- "workspaces/roles",
109
- method="GET",
110
- request_options=request_options,
95
+ _response = self._raw_client.get_all_workspace_roles(
96
+ request_options=request_options
111
97
  )
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)
98
+ return _response.data
125
99
 
126
100
  def remove_user_from_workspace(
127
101
  self,
128
102
  workspace_id: str,
129
103
  *,
130
104
  email: str,
131
- request_options: typing.Optional[RequestOptions] = None,
105
+ request_options: typing.Optional[RequestOptions] = None
132
106
  ) -> typing.Optional[typing.Any]:
133
107
  """
134
108
  Remove a user from a workspace.
@@ -157,49 +131,32 @@ class WorkspaceClient:
157
131
 
158
132
  client = AgentaApi(
159
133
  api_key="YOUR_API_KEY",
160
- base_url="https://yourhost.com/path/to/api",
161
134
  )
162
135
  client.workspace.remove_user_from_workspace(
163
136
  workspace_id="workspace_id",
164
137
  email="email",
165
138
  )
166
139
  """
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,
140
+ _response = self._raw_client.remove_user_from_workspace(
141
+ workspace_id, email=email, request_options=request_options
174
142
  )
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)
143
+ return _response.data
198
144
 
199
145
 
200
146
  class AsyncWorkspaceClient:
201
147
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
202
- self._client_wrapper = client_wrapper
148
+ self._raw_client = AsyncRawWorkspaceClient(client_wrapper=client_wrapper)
149
+
150
+ @property
151
+ def with_raw_response(self) -> AsyncRawWorkspaceClient:
152
+ """
153
+ Retrieves a raw implementation of this client that returns raw responses.
154
+
155
+ Returns
156
+ -------
157
+ AsyncRawWorkspaceClient
158
+ """
159
+ return self._raw_client
203
160
 
204
161
  async def get_workspace(
205
162
  self, *, request_options: typing.Optional[RequestOptions] = None
@@ -233,7 +190,6 @@ class AsyncWorkspaceClient:
233
190
 
234
191
  client = AsyncAgentaApi(
235
192
  api_key="YOUR_API_KEY",
236
- base_url="https://yourhost.com/path/to/api",
237
193
  )
238
194
 
239
195
 
@@ -243,24 +199,10 @@ class AsyncWorkspaceClient:
243
199
 
244
200
  asyncio.run(main())
245
201
  """
246
- _response = await self._client_wrapper.httpx_client.request(
247
- "workspaces",
248
- method="GET",
249
- request_options=request_options,
202
+ _response = await self._raw_client.get_workspace(
203
+ request_options=request_options
250
204
  )
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)
205
+ return _response.data
264
206
 
265
207
  async def get_all_workspace_roles(
266
208
  self, *, request_options: typing.Optional[RequestOptions] = None
@@ -294,7 +236,6 @@ class AsyncWorkspaceClient:
294
236
 
295
237
  client = AsyncAgentaApi(
296
238
  api_key="YOUR_API_KEY",
297
- base_url="https://yourhost.com/path/to/api",
298
239
  )
299
240
 
300
241
 
@@ -304,31 +245,17 @@ class AsyncWorkspaceClient:
304
245
 
305
246
  asyncio.run(main())
306
247
  """
307
- _response = await self._client_wrapper.httpx_client.request(
308
- "workspaces/roles",
309
- method="GET",
310
- request_options=request_options,
248
+ _response = await self._raw_client.get_all_workspace_roles(
249
+ request_options=request_options
311
250
  )
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)
251
+ return _response.data
325
252
 
326
253
  async def remove_user_from_workspace(
327
254
  self,
328
255
  workspace_id: str,
329
256
  *,
330
257
  email: str,
331
- request_options: typing.Optional[RequestOptions] = None,
258
+ request_options: typing.Optional[RequestOptions] = None
332
259
  ) -> typing.Optional[typing.Any]:
333
260
  """
334
261
  Remove a user from a workspace.
@@ -359,7 +286,6 @@ class AsyncWorkspaceClient:
359
286
 
360
287
  client = AsyncAgentaApi(
361
288
  api_key="YOUR_API_KEY",
362
- base_url="https://yourhost.com/path/to/api",
363
289
  )
364
290
 
365
291
 
@@ -372,34 +298,7 @@ class AsyncWorkspaceClient:
372
298
 
373
299
  asyncio.run(main())
374
300
  """
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,
301
+ _response = await self._raw_client.remove_user_from_workspace(
302
+ workspace_id, email=email, request_options=request_options
382
303
  )
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)
304
+ return _response.data
@@ -0,0 +1,376 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.jsonable_encoder import jsonable_encoder
10
+ from ..core.pydantic_utilities import parse_obj_as
11
+ from ..core.request_options import RequestOptions
12
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
13
+ from ..types.http_validation_error import HttpValidationError
14
+ from ..types.workspace import Workspace
15
+
16
+
17
+ class RawWorkspaceClient:
18
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
19
+ self._client_wrapper = client_wrapper
20
+
21
+ def get_workspace(
22
+ self, *, request_options: typing.Optional[RequestOptions] = None
23
+ ) -> HttpResponse[typing.List[Workspace]]:
24
+ """
25
+ Get workspace details.
26
+
27
+ Returns details about the workspace associated with the user's session.
28
+
29
+ Returns:
30
+ Workspace: The details of the workspace.
31
+
32
+ Raises:
33
+ HTTPException: If the user does not have permission to perform this action.
34
+
35
+ Parameters
36
+ ----------
37
+ request_options : typing.Optional[RequestOptions]
38
+ Request-specific configuration.
39
+
40
+ Returns
41
+ -------
42
+ HttpResponse[typing.List[Workspace]]
43
+ Successful Response
44
+ """
45
+ _response = self._client_wrapper.httpx_client.request(
46
+ "workspaces",
47
+ method="GET",
48
+ request_options=request_options,
49
+ )
50
+ try:
51
+ if 200 <= _response.status_code < 300:
52
+ _data = typing.cast(
53
+ typing.List[Workspace],
54
+ parse_obj_as(
55
+ type_=typing.List[Workspace], # type: ignore
56
+ object_=_response.json(),
57
+ ),
58
+ )
59
+ return HttpResponse(response=_response, data=_data)
60
+ _response_json = _response.json()
61
+ except JSONDecodeError:
62
+ raise ApiError(
63
+ status_code=_response.status_code,
64
+ headers=dict(_response.headers),
65
+ body=_response.text,
66
+ )
67
+ raise ApiError(
68
+ status_code=_response.status_code,
69
+ headers=dict(_response.headers),
70
+ body=_response_json,
71
+ )
72
+
73
+ def get_all_workspace_roles(
74
+ self, *, request_options: typing.Optional[RequestOptions] = None
75
+ ) -> HttpResponse[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
+ HttpResponse[typing.List[typing.Dict[str, str]]]
95
+ Successful Response
96
+ """
97
+ _response = self._client_wrapper.httpx_client.request(
98
+ "workspaces/roles",
99
+ method="GET",
100
+ request_options=request_options,
101
+ )
102
+ try:
103
+ if 200 <= _response.status_code < 300:
104
+ _data = typing.cast(
105
+ typing.List[typing.Dict[str, str]],
106
+ parse_obj_as(
107
+ type_=typing.List[typing.Dict[str, str]], # type: ignore
108
+ object_=_response.json(),
109
+ ),
110
+ )
111
+ return HttpResponse(response=_response, data=_data)
112
+ _response_json = _response.json()
113
+ except JSONDecodeError:
114
+ raise ApiError(
115
+ status_code=_response.status_code,
116
+ headers=dict(_response.headers),
117
+ body=_response.text,
118
+ )
119
+ raise ApiError(
120
+ status_code=_response.status_code,
121
+ headers=dict(_response.headers),
122
+ body=_response_json,
123
+ )
124
+
125
+ def remove_user_from_workspace(
126
+ self,
127
+ workspace_id: str,
128
+ *,
129
+ email: str,
130
+ request_options: typing.Optional[RequestOptions] = None,
131
+ ) -> HttpResponse[typing.Optional[typing.Any]]:
132
+ """
133
+ Remove a user from a workspace.
134
+
135
+ Args:
136
+ email (str): The email address of the user to be removed
137
+ workspace_id (str): The ID of the workspace.
138
+
139
+ Parameters
140
+ ----------
141
+ workspace_id : str
142
+
143
+ email : str
144
+
145
+ request_options : typing.Optional[RequestOptions]
146
+ Request-specific configuration.
147
+
148
+ Returns
149
+ -------
150
+ HttpResponse[typing.Optional[typing.Any]]
151
+ Successful Response
152
+ """
153
+ _response = self._client_wrapper.httpx_client.request(
154
+ f"workspaces/{jsonable_encoder(workspace_id)}/users",
155
+ method="DELETE",
156
+ params={
157
+ "email": email,
158
+ },
159
+ request_options=request_options,
160
+ )
161
+ try:
162
+ if _response is None or not _response.text.strip():
163
+ return HttpResponse(response=_response, data=None)
164
+ if 200 <= _response.status_code < 300:
165
+ _data = typing.cast(
166
+ typing.Optional[typing.Any],
167
+ parse_obj_as(
168
+ type_=typing.Optional[typing.Any], # type: ignore
169
+ object_=_response.json(),
170
+ ),
171
+ )
172
+ return HttpResponse(response=_response, data=_data)
173
+ if _response.status_code == 422:
174
+ raise UnprocessableEntityError(
175
+ headers=dict(_response.headers),
176
+ body=typing.cast(
177
+ HttpValidationError,
178
+ parse_obj_as(
179
+ type_=HttpValidationError, # type: ignore
180
+ object_=_response.json(),
181
+ ),
182
+ ),
183
+ )
184
+ _response_json = _response.json()
185
+ except JSONDecodeError:
186
+ raise ApiError(
187
+ status_code=_response.status_code,
188
+ headers=dict(_response.headers),
189
+ body=_response.text,
190
+ )
191
+ raise ApiError(
192
+ status_code=_response.status_code,
193
+ headers=dict(_response.headers),
194
+ body=_response_json,
195
+ )
196
+
197
+
198
+ class AsyncRawWorkspaceClient:
199
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
200
+ self._client_wrapper = client_wrapper
201
+
202
+ async def get_workspace(
203
+ self, *, request_options: typing.Optional[RequestOptions] = None
204
+ ) -> AsyncHttpResponse[typing.List[Workspace]]:
205
+ """
206
+ Get workspace details.
207
+
208
+ Returns details about the workspace associated with the user's session.
209
+
210
+ Returns:
211
+ Workspace: The details of the workspace.
212
+
213
+ Raises:
214
+ HTTPException: If the user does not have permission to perform this action.
215
+
216
+ Parameters
217
+ ----------
218
+ request_options : typing.Optional[RequestOptions]
219
+ Request-specific configuration.
220
+
221
+ Returns
222
+ -------
223
+ AsyncHttpResponse[typing.List[Workspace]]
224
+ Successful Response
225
+ """
226
+ _response = await self._client_wrapper.httpx_client.request(
227
+ "workspaces",
228
+ method="GET",
229
+ request_options=request_options,
230
+ )
231
+ try:
232
+ if 200 <= _response.status_code < 300:
233
+ _data = typing.cast(
234
+ typing.List[Workspace],
235
+ parse_obj_as(
236
+ type_=typing.List[Workspace], # type: ignore
237
+ object_=_response.json(),
238
+ ),
239
+ )
240
+ return AsyncHttpResponse(response=_response, data=_data)
241
+ _response_json = _response.json()
242
+ except JSONDecodeError:
243
+ raise ApiError(
244
+ status_code=_response.status_code,
245
+ headers=dict(_response.headers),
246
+ body=_response.text,
247
+ )
248
+ raise ApiError(
249
+ status_code=_response.status_code,
250
+ headers=dict(_response.headers),
251
+ body=_response_json,
252
+ )
253
+
254
+ async def get_all_workspace_roles(
255
+ self, *, request_options: typing.Optional[RequestOptions] = None
256
+ ) -> AsyncHttpResponse[typing.List[typing.Dict[str, str]]]:
257
+ """
258
+ Get all workspace roles.
259
+
260
+ Returns a list of all available workspace roles.
261
+
262
+ Returns:
263
+ List[WorkspaceRoleResponse]: A list of WorkspaceRole objects representing the available workspace roles.
264
+
265
+ Raises:
266
+ HTTPException: If an error occurs while retrieving the workspace roles.
267
+
268
+ Parameters
269
+ ----------
270
+ request_options : typing.Optional[RequestOptions]
271
+ Request-specific configuration.
272
+
273
+ Returns
274
+ -------
275
+ AsyncHttpResponse[typing.List[typing.Dict[str, str]]]
276
+ Successful Response
277
+ """
278
+ _response = await self._client_wrapper.httpx_client.request(
279
+ "workspaces/roles",
280
+ method="GET",
281
+ request_options=request_options,
282
+ )
283
+ try:
284
+ if 200 <= _response.status_code < 300:
285
+ _data = typing.cast(
286
+ typing.List[typing.Dict[str, str]],
287
+ parse_obj_as(
288
+ type_=typing.List[typing.Dict[str, str]], # type: ignore
289
+ object_=_response.json(),
290
+ ),
291
+ )
292
+ return AsyncHttpResponse(response=_response, data=_data)
293
+ _response_json = _response.json()
294
+ except JSONDecodeError:
295
+ raise ApiError(
296
+ status_code=_response.status_code,
297
+ headers=dict(_response.headers),
298
+ body=_response.text,
299
+ )
300
+ raise ApiError(
301
+ status_code=_response.status_code,
302
+ headers=dict(_response.headers),
303
+ body=_response_json,
304
+ )
305
+
306
+ async def remove_user_from_workspace(
307
+ self,
308
+ workspace_id: str,
309
+ *,
310
+ email: str,
311
+ request_options: typing.Optional[RequestOptions] = None,
312
+ ) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
313
+ """
314
+ Remove a user from a workspace.
315
+
316
+ Args:
317
+ email (str): The email address of the user to be removed
318
+ workspace_id (str): The ID of the workspace.
319
+
320
+ Parameters
321
+ ----------
322
+ workspace_id : str
323
+
324
+ email : str
325
+
326
+ request_options : typing.Optional[RequestOptions]
327
+ Request-specific configuration.
328
+
329
+ Returns
330
+ -------
331
+ AsyncHttpResponse[typing.Optional[typing.Any]]
332
+ Successful Response
333
+ """
334
+ _response = await self._client_wrapper.httpx_client.request(
335
+ f"workspaces/{jsonable_encoder(workspace_id)}/users",
336
+ method="DELETE",
337
+ params={
338
+ "email": email,
339
+ },
340
+ request_options=request_options,
341
+ )
342
+ try:
343
+ if _response is None or not _response.text.strip():
344
+ return AsyncHttpResponse(response=_response, data=None)
345
+ if 200 <= _response.status_code < 300:
346
+ _data = typing.cast(
347
+ typing.Optional[typing.Any],
348
+ parse_obj_as(
349
+ type_=typing.Optional[typing.Any], # type: ignore
350
+ object_=_response.json(),
351
+ ),
352
+ )
353
+ return AsyncHttpResponse(response=_response, data=_data)
354
+ if _response.status_code == 422:
355
+ raise UnprocessableEntityError(
356
+ headers=dict(_response.headers),
357
+ body=typing.cast(
358
+ HttpValidationError,
359
+ parse_obj_as(
360
+ type_=HttpValidationError, # type: ignore
361
+ object_=_response.json(),
362
+ ),
363
+ ),
364
+ )
365
+ _response_json = _response.json()
366
+ except JSONDecodeError:
367
+ raise ApiError(
368
+ status_code=_response.status_code,
369
+ headers=dict(_response.headers),
370
+ body=_response.text,
371
+ )
372
+ raise ApiError(
373
+ status_code=_response.status_code,
374
+ headers=dict(_response.headers),
375
+ body=_response_json,
376
+ )
agenta/client/types.py ADDED
@@ -0,0 +1,4 @@
1
+ # Compatibility layer to maintain backward compatibility
2
+ # Re-exports all types from backend.types
3
+
4
+ from .backend.types import *