vellum-ai 1.1.0__py3-none-any.whl → 1.1.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.
Files changed (75) hide show
  1. vellum/client/README.md +0 -55
  2. vellum/client/__init__.py +159 -873
  3. vellum/client/core/__init__.py +3 -0
  4. vellum/client/core/client_wrapper.py +2 -2
  5. vellum/client/core/http_response.py +47 -0
  6. vellum/client/raw_client.py +1561 -0
  7. vellum/client/reference.md +20 -693
  8. vellum/client/resources/ad_hoc/client.py +55 -161
  9. vellum/client/resources/ad_hoc/raw_client.py +278 -0
  10. vellum/client/resources/container_images/client.py +62 -172
  11. vellum/client/resources/container_images/raw_client.py +400 -0
  12. vellum/client/resources/deployments/client.py +112 -437
  13. vellum/client/resources/deployments/raw_client.py +995 -0
  14. vellum/client/resources/document_indexes/client.py +108 -317
  15. vellum/client/resources/document_indexes/raw_client.py +847 -0
  16. vellum/client/resources/documents/client.py +88 -285
  17. vellum/client/resources/documents/raw_client.py +655 -0
  18. vellum/client/resources/folder_entities/client.py +54 -92
  19. vellum/client/resources/folder_entities/raw_client.py +277 -0
  20. vellum/client/resources/metric_definitions/client.py +48 -95
  21. vellum/client/resources/metric_definitions/raw_client.py +225 -0
  22. vellum/client/resources/ml_models/client.py +36 -40
  23. vellum/client/resources/ml_models/raw_client.py +103 -0
  24. vellum/client/resources/organizations/client.py +34 -39
  25. vellum/client/resources/organizations/raw_client.py +96 -0
  26. vellum/client/resources/prompts/client.py +50 -193
  27. vellum/client/resources/prompts/raw_client.py +346 -0
  28. vellum/client/resources/sandboxes/client.py +68 -141
  29. vellum/client/resources/sandboxes/raw_client.py +393 -0
  30. vellum/client/resources/test_suite_runs/client.py +58 -141
  31. vellum/client/resources/test_suite_runs/raw_client.py +355 -0
  32. vellum/client/resources/test_suites/client.py +73 -141
  33. vellum/client/resources/test_suites/raw_client.py +379 -0
  34. vellum/client/resources/workflow_deployments/client.py +118 -362
  35. vellum/client/resources/workflow_deployments/raw_client.py +931 -0
  36. vellum/client/resources/workflow_executions/client.py +36 -40
  37. vellum/client/resources/workflow_executions/raw_client.py +97 -0
  38. vellum/client/resources/workflow_sandboxes/client.py +60 -108
  39. vellum/client/resources/workflow_sandboxes/raw_client.py +300 -0
  40. vellum/client/resources/workflows/client.py +68 -133
  41. vellum/client/resources/workflows/raw_client.py +307 -0
  42. vellum/client/resources/workspace_secrets/client.py +46 -90
  43. vellum/client/resources/workspace_secrets/raw_client.py +220 -0
  44. vellum/client/resources/workspaces/client.py +34 -39
  45. vellum/client/resources/workspaces/raw_client.py +96 -0
  46. vellum/core/http_response.py +3 -0
  47. vellum/raw_client.py +3 -0
  48. vellum/resources/ad_hoc/raw_client.py +3 -0
  49. vellum/resources/container_images/raw_client.py +3 -0
  50. vellum/resources/deployments/raw_client.py +3 -0
  51. vellum/resources/document_indexes/raw_client.py +3 -0
  52. vellum/resources/documents/raw_client.py +3 -0
  53. vellum/resources/folder_entities/raw_client.py +3 -0
  54. vellum/resources/metric_definitions/raw_client.py +3 -0
  55. vellum/resources/ml_models/raw_client.py +3 -0
  56. vellum/resources/organizations/raw_client.py +3 -0
  57. vellum/resources/prompts/raw_client.py +3 -0
  58. vellum/resources/sandboxes/raw_client.py +3 -0
  59. vellum/resources/test_suite_runs/raw_client.py +3 -0
  60. vellum/resources/test_suites/raw_client.py +3 -0
  61. vellum/resources/workflow_deployments/raw_client.py +3 -0
  62. vellum/resources/workflow_executions/raw_client.py +3 -0
  63. vellum/resources/workflow_sandboxes/raw_client.py +3 -0
  64. vellum/resources/workflows/raw_client.py +3 -0
  65. vellum/resources/workspace_secrets/raw_client.py +3 -0
  66. vellum/resources/workspaces/raw_client.py +3 -0
  67. {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.1.dist-info}/METADATA +1 -1
  68. {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.1.dist-info}/RECORD +75 -32
  69. vellum_ee/workflows/display/exceptions.py +7 -0
  70. vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +2 -1
  71. vellum_ee/workflows/display/nodes/vellum/tests/test_code_execution_node.py +53 -2
  72. vellum_ee/workflows/display/workflows/base_workflow_display.py +2 -1
  73. {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.1.dist-info}/LICENSE +0 -0
  74. {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.1.dist-info}/WHEEL +0 -0
  75. {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.1.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,225 @@
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 ...types.metric_definition_input import MetricDefinitionInput
6
+ from ...core.request_options import RequestOptions
7
+ from ...core.http_response import HttpResponse
8
+ from ...types.metric_definition_execution import MetricDefinitionExecution
9
+ from ...core.jsonable_encoder import jsonable_encoder
10
+ from ...core.serialization import convert_and_respect_annotation_metadata
11
+ from ...core.pydantic_utilities import parse_obj_as
12
+ from json.decoder import JSONDecodeError
13
+ from ...core.api_error import ApiError
14
+ from ...types.metric_definition_history_item import MetricDefinitionHistoryItem
15
+ from ...core.client_wrapper import AsyncClientWrapper
16
+ from ...core.http_response import AsyncHttpResponse
17
+
18
+ # this is used as the default value for optional parameters
19
+ OMIT = typing.cast(typing.Any, ...)
20
+
21
+
22
+ class RawMetricDefinitionsClient:
23
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
24
+ self._client_wrapper = client_wrapper
25
+
26
+ def execute_metric_definition(
27
+ self,
28
+ id: str,
29
+ *,
30
+ inputs: typing.Sequence[MetricDefinitionInput],
31
+ release_tag: typing.Optional[str] = OMIT,
32
+ request_options: typing.Optional[RequestOptions] = None,
33
+ ) -> HttpResponse[MetricDefinitionExecution]:
34
+ """
35
+ Parameters
36
+ ----------
37
+ id : str
38
+ Either the Metric Definition's ID or its unique name
39
+
40
+ inputs : typing.Sequence[MetricDefinitionInput]
41
+
42
+ release_tag : typing.Optional[str]
43
+
44
+ request_options : typing.Optional[RequestOptions]
45
+ Request-specific configuration.
46
+
47
+ Returns
48
+ -------
49
+ HttpResponse[MetricDefinitionExecution]
50
+
51
+ """
52
+ _response = self._client_wrapper.httpx_client.request(
53
+ f"v1/metric-definitions/{jsonable_encoder(id)}/execute",
54
+ base_url=self._client_wrapper.get_environment().predict,
55
+ method="POST",
56
+ json={
57
+ "inputs": convert_and_respect_annotation_metadata(
58
+ object_=inputs, annotation=typing.Sequence[MetricDefinitionInput], direction="write"
59
+ ),
60
+ "release_tag": release_tag,
61
+ },
62
+ headers={
63
+ "content-type": "application/json",
64
+ },
65
+ request_options=request_options,
66
+ omit=OMIT,
67
+ )
68
+ try:
69
+ if 200 <= _response.status_code < 300:
70
+ _data = typing.cast(
71
+ MetricDefinitionExecution,
72
+ parse_obj_as(
73
+ type_=MetricDefinitionExecution, # type: ignore
74
+ object_=_response.json(),
75
+ ),
76
+ )
77
+ return HttpResponse(response=_response, data=_data)
78
+ _response_json = _response.json()
79
+ except JSONDecodeError:
80
+ raise ApiError(status_code=_response.status_code, body=_response.text)
81
+ raise ApiError(status_code=_response.status_code, body=_response_json)
82
+
83
+ def metric_definition_history_item_retrieve(
84
+ self, history_id_or_release_tag: str, id: str, *, request_options: typing.Optional[RequestOptions] = None
85
+ ) -> HttpResponse[MetricDefinitionHistoryItem]:
86
+ """
87
+ Parameters
88
+ ----------
89
+ history_id_or_release_tag : str
90
+ Either the UUID of Metric Definition History Item you'd like to retrieve, or the name of a Release Tag that's pointing to the Metric Definition History Item you'd like to retrieve.
91
+
92
+ id : str
93
+ A UUID string identifying this metric definition.
94
+
95
+ request_options : typing.Optional[RequestOptions]
96
+ Request-specific configuration.
97
+
98
+ Returns
99
+ -------
100
+ HttpResponse[MetricDefinitionHistoryItem]
101
+
102
+ """
103
+ _response = self._client_wrapper.httpx_client.request(
104
+ f"v1/metric-definitions/{jsonable_encoder(id)}/history/{jsonable_encoder(history_id_or_release_tag)}",
105
+ base_url=self._client_wrapper.get_environment().default,
106
+ method="GET",
107
+ request_options=request_options,
108
+ )
109
+ try:
110
+ if 200 <= _response.status_code < 300:
111
+ _data = typing.cast(
112
+ MetricDefinitionHistoryItem,
113
+ parse_obj_as(
114
+ type_=MetricDefinitionHistoryItem, # type: ignore
115
+ object_=_response.json(),
116
+ ),
117
+ )
118
+ return HttpResponse(response=_response, data=_data)
119
+ _response_json = _response.json()
120
+ except JSONDecodeError:
121
+ raise ApiError(status_code=_response.status_code, body=_response.text)
122
+ raise ApiError(status_code=_response.status_code, body=_response_json)
123
+
124
+
125
+ class AsyncRawMetricDefinitionsClient:
126
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
127
+ self._client_wrapper = client_wrapper
128
+
129
+ async def execute_metric_definition(
130
+ self,
131
+ id: str,
132
+ *,
133
+ inputs: typing.Sequence[MetricDefinitionInput],
134
+ release_tag: typing.Optional[str] = OMIT,
135
+ request_options: typing.Optional[RequestOptions] = None,
136
+ ) -> AsyncHttpResponse[MetricDefinitionExecution]:
137
+ """
138
+ Parameters
139
+ ----------
140
+ id : str
141
+ Either the Metric Definition's ID or its unique name
142
+
143
+ inputs : typing.Sequence[MetricDefinitionInput]
144
+
145
+ release_tag : typing.Optional[str]
146
+
147
+ request_options : typing.Optional[RequestOptions]
148
+ Request-specific configuration.
149
+
150
+ Returns
151
+ -------
152
+ AsyncHttpResponse[MetricDefinitionExecution]
153
+
154
+ """
155
+ _response = await self._client_wrapper.httpx_client.request(
156
+ f"v1/metric-definitions/{jsonable_encoder(id)}/execute",
157
+ base_url=self._client_wrapper.get_environment().predict,
158
+ method="POST",
159
+ json={
160
+ "inputs": convert_and_respect_annotation_metadata(
161
+ object_=inputs, annotation=typing.Sequence[MetricDefinitionInput], direction="write"
162
+ ),
163
+ "release_tag": release_tag,
164
+ },
165
+ headers={
166
+ "content-type": "application/json",
167
+ },
168
+ request_options=request_options,
169
+ omit=OMIT,
170
+ )
171
+ try:
172
+ if 200 <= _response.status_code < 300:
173
+ _data = typing.cast(
174
+ MetricDefinitionExecution,
175
+ parse_obj_as(
176
+ type_=MetricDefinitionExecution, # type: ignore
177
+ object_=_response.json(),
178
+ ),
179
+ )
180
+ return AsyncHttpResponse(response=_response, data=_data)
181
+ _response_json = _response.json()
182
+ except JSONDecodeError:
183
+ raise ApiError(status_code=_response.status_code, body=_response.text)
184
+ raise ApiError(status_code=_response.status_code, body=_response_json)
185
+
186
+ async def metric_definition_history_item_retrieve(
187
+ self, history_id_or_release_tag: str, id: str, *, request_options: typing.Optional[RequestOptions] = None
188
+ ) -> AsyncHttpResponse[MetricDefinitionHistoryItem]:
189
+ """
190
+ Parameters
191
+ ----------
192
+ history_id_or_release_tag : str
193
+ Either the UUID of Metric Definition History Item you'd like to retrieve, or the name of a Release Tag that's pointing to the Metric Definition History Item you'd like to retrieve.
194
+
195
+ id : str
196
+ A UUID string identifying this metric definition.
197
+
198
+ request_options : typing.Optional[RequestOptions]
199
+ Request-specific configuration.
200
+
201
+ Returns
202
+ -------
203
+ AsyncHttpResponse[MetricDefinitionHistoryItem]
204
+
205
+ """
206
+ _response = await self._client_wrapper.httpx_client.request(
207
+ f"v1/metric-definitions/{jsonable_encoder(id)}/history/{jsonable_encoder(history_id_or_release_tag)}",
208
+ base_url=self._client_wrapper.get_environment().default,
209
+ method="GET",
210
+ request_options=request_options,
211
+ )
212
+ try:
213
+ if 200 <= _response.status_code < 300:
214
+ _data = typing.cast(
215
+ MetricDefinitionHistoryItem,
216
+ parse_obj_as(
217
+ type_=MetricDefinitionHistoryItem, # type: ignore
218
+ object_=_response.json(),
219
+ ),
220
+ )
221
+ return AsyncHttpResponse(response=_response, data=_data)
222
+ _response_json = _response.json()
223
+ except JSONDecodeError:
224
+ raise ApiError(status_code=_response.status_code, body=_response.text)
225
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -1,19 +1,32 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
3
  from ...core.client_wrapper import SyncClientWrapper
4
+ from .raw_client import RawMlModelsClient
4
5
  import typing
5
6
  from ...core.request_options import RequestOptions
6
7
  from ...types.ml_model_read import MlModelRead
7
- from ...core.jsonable_encoder import jsonable_encoder
8
- from ...core.pydantic_utilities import parse_obj_as
9
- from json.decoder import JSONDecodeError
10
- from ...core.api_error import ApiError
11
8
  from ...core.client_wrapper import AsyncClientWrapper
9
+ from .raw_client import AsyncRawMlModelsClient
12
10
 
13
11
 
14
12
  class MlModelsClient:
15
13
  def __init__(self, *, client_wrapper: SyncClientWrapper):
16
- self._client_wrapper = client_wrapper
14
+ self._raw_client = RawMlModelsClient(client_wrapper=client_wrapper)
15
+
16
+ @property
17
+ def _client_wrapper(self) -> SyncClientWrapper:
18
+ return self._raw_client._client_wrapper
19
+
20
+ @property
21
+ def with_raw_response(self) -> RawMlModelsClient:
22
+ """
23
+ Retrieves a raw implementation of this client that returns raw responses.
24
+
25
+ Returns
26
+ -------
27
+ RawMlModelsClient
28
+ """
29
+ return self._raw_client
17
30
 
18
31
  def retrieve(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> MlModelRead:
19
32
  """
@@ -44,30 +57,27 @@ class MlModelsClient:
44
57
  id="id",
45
58
  )
46
59
  """
47
- _response = self._client_wrapper.httpx_client.request(
48
- f"v1/ml-models/{jsonable_encoder(id)}",
49
- base_url=self._client_wrapper.get_environment().default,
50
- method="GET",
60
+ response = self._raw_client.retrieve(
61
+ id,
51
62
  request_options=request_options,
52
63
  )
53
- try:
54
- if 200 <= _response.status_code < 300:
55
- return typing.cast(
56
- MlModelRead,
57
- parse_obj_as(
58
- type_=MlModelRead, # type: ignore
59
- object_=_response.json(),
60
- ),
61
- )
62
- _response_json = _response.json()
63
- except JSONDecodeError:
64
- raise ApiError(status_code=_response.status_code, body=_response.text)
65
- raise ApiError(status_code=_response.status_code, body=_response_json)
64
+ return response.data
66
65
 
67
66
 
68
67
  class AsyncMlModelsClient:
69
68
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
70
- self._client_wrapper = client_wrapper
69
+ self._raw_client = AsyncRawMlModelsClient(client_wrapper=client_wrapper)
70
+
71
+ @property
72
+ def with_raw_response(self) -> AsyncRawMlModelsClient:
73
+ """
74
+ Retrieves a raw implementation of this client that returns raw responses.
75
+
76
+ Returns
77
+ -------
78
+ AsyncRawMlModelsClient
79
+ """
80
+ return self._raw_client
71
81
 
72
82
  async def retrieve(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> MlModelRead:
73
83
  """
@@ -106,22 +116,8 @@ class AsyncMlModelsClient:
106
116
 
107
117
  asyncio.run(main())
108
118
  """
109
- _response = await self._client_wrapper.httpx_client.request(
110
- f"v1/ml-models/{jsonable_encoder(id)}",
111
- base_url=self._client_wrapper.get_environment().default,
112
- method="GET",
119
+ response = await self._raw_client.retrieve(
120
+ id,
113
121
  request_options=request_options,
114
122
  )
115
- try:
116
- if 200 <= _response.status_code < 300:
117
- return typing.cast(
118
- MlModelRead,
119
- parse_obj_as(
120
- type_=MlModelRead, # type: ignore
121
- object_=_response.json(),
122
- ),
123
- )
124
- _response_json = _response.json()
125
- except JSONDecodeError:
126
- raise ApiError(status_code=_response.status_code, body=_response.text)
127
- raise ApiError(status_code=_response.status_code, body=_response_json)
123
+ return response.data
@@ -0,0 +1,103 @@
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 ...core.http_response import HttpResponse
7
+ from ...types.ml_model_read import MlModelRead
8
+ from ...core.jsonable_encoder import jsonable_encoder
9
+ from ...core.pydantic_utilities import parse_obj_as
10
+ from json.decoder import JSONDecodeError
11
+ from ...core.api_error import ApiError
12
+ from ...core.client_wrapper import AsyncClientWrapper
13
+ from ...core.http_response import AsyncHttpResponse
14
+
15
+
16
+ class RawMlModelsClient:
17
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
18
+ self._client_wrapper = client_wrapper
19
+
20
+ def retrieve(
21
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
22
+ ) -> HttpResponse[MlModelRead]:
23
+ """
24
+ Retrieve details about an ML Model
25
+
26
+ Parameters
27
+ ----------
28
+ id : str
29
+ Either the ML Model's ID, its unique name, or its ID in the workspace.
30
+
31
+ request_options : typing.Optional[RequestOptions]
32
+ Request-specific configuration.
33
+
34
+ Returns
35
+ -------
36
+ HttpResponse[MlModelRead]
37
+
38
+ """
39
+ _response = self._client_wrapper.httpx_client.request(
40
+ f"v1/ml-models/{jsonable_encoder(id)}",
41
+ base_url=self._client_wrapper.get_environment().default,
42
+ method="GET",
43
+ request_options=request_options,
44
+ )
45
+ try:
46
+ if 200 <= _response.status_code < 300:
47
+ _data = typing.cast(
48
+ MlModelRead,
49
+ parse_obj_as(
50
+ type_=MlModelRead, # type: ignore
51
+ object_=_response.json(),
52
+ ),
53
+ )
54
+ return HttpResponse(response=_response, data=_data)
55
+ _response_json = _response.json()
56
+ except JSONDecodeError:
57
+ raise ApiError(status_code=_response.status_code, body=_response.text)
58
+ raise ApiError(status_code=_response.status_code, body=_response_json)
59
+
60
+
61
+ class AsyncRawMlModelsClient:
62
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
63
+ self._client_wrapper = client_wrapper
64
+
65
+ async def retrieve(
66
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
67
+ ) -> AsyncHttpResponse[MlModelRead]:
68
+ """
69
+ Retrieve details about an ML Model
70
+
71
+ Parameters
72
+ ----------
73
+ id : str
74
+ Either the ML Model's ID, its unique name, or its ID in the workspace.
75
+
76
+ request_options : typing.Optional[RequestOptions]
77
+ Request-specific configuration.
78
+
79
+ Returns
80
+ -------
81
+ AsyncHttpResponse[MlModelRead]
82
+
83
+ """
84
+ _response = await self._client_wrapper.httpx_client.request(
85
+ f"v1/ml-models/{jsonable_encoder(id)}",
86
+ base_url=self._client_wrapper.get_environment().default,
87
+ method="GET",
88
+ request_options=request_options,
89
+ )
90
+ try:
91
+ if 200 <= _response.status_code < 300:
92
+ _data = typing.cast(
93
+ MlModelRead,
94
+ parse_obj_as(
95
+ type_=MlModelRead, # type: ignore
96
+ object_=_response.json(),
97
+ ),
98
+ )
99
+ return AsyncHttpResponse(response=_response, data=_data)
100
+ _response_json = _response.json()
101
+ except JSONDecodeError:
102
+ raise ApiError(status_code=_response.status_code, body=_response.text)
103
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -1,18 +1,32 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
3
  from ...core.client_wrapper import SyncClientWrapper
4
+ from .raw_client import RawOrganizationsClient
4
5
  import typing
5
6
  from ...core.request_options import RequestOptions
6
7
  from ...types.organization_read import OrganizationRead
7
- from ...core.pydantic_utilities import parse_obj_as
8
- from json.decoder import JSONDecodeError
9
- from ...core.api_error import ApiError
10
8
  from ...core.client_wrapper import AsyncClientWrapper
9
+ from .raw_client import AsyncRawOrganizationsClient
11
10
 
12
11
 
13
12
  class OrganizationsClient:
14
13
  def __init__(self, *, client_wrapper: SyncClientWrapper):
15
- self._client_wrapper = client_wrapper
14
+ self._raw_client = RawOrganizationsClient(client_wrapper=client_wrapper)
15
+
16
+ @property
17
+ def _client_wrapper(self) -> SyncClientWrapper:
18
+ return self._raw_client._client_wrapper
19
+
20
+ @property
21
+ def with_raw_response(self) -> RawOrganizationsClient:
22
+ """
23
+ Retrieves a raw implementation of this client that returns raw responses.
24
+
25
+ Returns
26
+ -------
27
+ RawOrganizationsClient
28
+ """
29
+ return self._raw_client
16
30
 
17
31
  def organization_identity(self, *, request_options: typing.Optional[RequestOptions] = None) -> OrganizationRead:
18
32
  """
@@ -38,30 +52,26 @@ class OrganizationsClient:
38
52
  )
39
53
  client.organizations.organization_identity()
40
54
  """
41
- _response = self._client_wrapper.httpx_client.request(
42
- "v1/organizations/identity",
43
- base_url=self._client_wrapper.get_environment().default,
44
- method="GET",
55
+ response = self._raw_client.organization_identity(
45
56
  request_options=request_options,
46
57
  )
47
- try:
48
- if 200 <= _response.status_code < 300:
49
- return typing.cast(
50
- OrganizationRead,
51
- parse_obj_as(
52
- type_=OrganizationRead, # type: ignore
53
- object_=_response.json(),
54
- ),
55
- )
56
- _response_json = _response.json()
57
- except JSONDecodeError:
58
- raise ApiError(status_code=_response.status_code, body=_response.text)
59
- raise ApiError(status_code=_response.status_code, body=_response_json)
58
+ return response.data
60
59
 
61
60
 
62
61
  class AsyncOrganizationsClient:
63
62
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
64
- self._client_wrapper = client_wrapper
63
+ self._raw_client = AsyncRawOrganizationsClient(client_wrapper=client_wrapper)
64
+
65
+ @property
66
+ def with_raw_response(self) -> AsyncRawOrganizationsClient:
67
+ """
68
+ Retrieves a raw implementation of this client that returns raw responses.
69
+
70
+ Returns
71
+ -------
72
+ AsyncRawOrganizationsClient
73
+ """
74
+ return self._raw_client
65
75
 
66
76
  async def organization_identity(
67
77
  self, *, request_options: typing.Optional[RequestOptions] = None
@@ -97,22 +107,7 @@ class AsyncOrganizationsClient:
97
107
 
98
108
  asyncio.run(main())
99
109
  """
100
- _response = await self._client_wrapper.httpx_client.request(
101
- "v1/organizations/identity",
102
- base_url=self._client_wrapper.get_environment().default,
103
- method="GET",
110
+ response = await self._raw_client.organization_identity(
104
111
  request_options=request_options,
105
112
  )
106
- try:
107
- if 200 <= _response.status_code < 300:
108
- return typing.cast(
109
- OrganizationRead,
110
- parse_obj_as(
111
- type_=OrganizationRead, # type: ignore
112
- object_=_response.json(),
113
- ),
114
- )
115
- _response_json = _response.json()
116
- except JSONDecodeError:
117
- raise ApiError(status_code=_response.status_code, body=_response.text)
118
- raise ApiError(status_code=_response.status_code, body=_response_json)
113
+ return response.data
@@ -0,0 +1,96 @@
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 ...core.http_response import HttpResponse
7
+ from ...types.organization_read import OrganizationRead
8
+ from ...core.pydantic_utilities import parse_obj_as
9
+ from json.decoder import JSONDecodeError
10
+ from ...core.api_error import ApiError
11
+ from ...core.client_wrapper import AsyncClientWrapper
12
+ from ...core.http_response import AsyncHttpResponse
13
+
14
+
15
+ class RawOrganizationsClient:
16
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
17
+ self._client_wrapper = client_wrapper
18
+
19
+ def organization_identity(
20
+ self, *, request_options: typing.Optional[RequestOptions] = None
21
+ ) -> HttpResponse[OrganizationRead]:
22
+ """
23
+ Retrieves information about the active Organization
24
+
25
+ Parameters
26
+ ----------
27
+ request_options : typing.Optional[RequestOptions]
28
+ Request-specific configuration.
29
+
30
+ Returns
31
+ -------
32
+ HttpResponse[OrganizationRead]
33
+
34
+ """
35
+ _response = self._client_wrapper.httpx_client.request(
36
+ "v1/organizations/identity",
37
+ base_url=self._client_wrapper.get_environment().default,
38
+ method="GET",
39
+ request_options=request_options,
40
+ )
41
+ try:
42
+ if 200 <= _response.status_code < 300:
43
+ _data = typing.cast(
44
+ OrganizationRead,
45
+ parse_obj_as(
46
+ type_=OrganizationRead, # type: ignore
47
+ object_=_response.json(),
48
+ ),
49
+ )
50
+ return HttpResponse(response=_response, data=_data)
51
+ _response_json = _response.json()
52
+ except JSONDecodeError:
53
+ raise ApiError(status_code=_response.status_code, body=_response.text)
54
+ raise ApiError(status_code=_response.status_code, body=_response_json)
55
+
56
+
57
+ class AsyncRawOrganizationsClient:
58
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
59
+ self._client_wrapper = client_wrapper
60
+
61
+ async def organization_identity(
62
+ self, *, request_options: typing.Optional[RequestOptions] = None
63
+ ) -> AsyncHttpResponse[OrganizationRead]:
64
+ """
65
+ Retrieves information about the active Organization
66
+
67
+ Parameters
68
+ ----------
69
+ request_options : typing.Optional[RequestOptions]
70
+ Request-specific configuration.
71
+
72
+ Returns
73
+ -------
74
+ AsyncHttpResponse[OrganizationRead]
75
+
76
+ """
77
+ _response = await self._client_wrapper.httpx_client.request(
78
+ "v1/organizations/identity",
79
+ base_url=self._client_wrapper.get_environment().default,
80
+ method="GET",
81
+ request_options=request_options,
82
+ )
83
+ try:
84
+ if 200 <= _response.status_code < 300:
85
+ _data = typing.cast(
86
+ OrganizationRead,
87
+ parse_obj_as(
88
+ type_=OrganizationRead, # type: ignore
89
+ object_=_response.json(),
90
+ ),
91
+ )
92
+ return AsyncHttpResponse(response=_response, data=_data)
93
+ _response_json = _response.json()
94
+ except JSONDecodeError:
95
+ raise ApiError(status_code=_response.status_code, body=_response.text)
96
+ raise ApiError(status_code=_response.status_code, body=_response_json)