athena-intelligence 0.1.204__py3-none-any.whl → 0.1.206__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 athena-intelligence might be problematic. Click here for more details.

athena/__init__.py CHANGED
@@ -3,6 +3,9 @@
3
3
  # isort: skip_file
4
4
 
5
5
  from .types import (
6
+ AopAsyncExecuteResponseOut,
7
+ AopExecuteRequestIn,
8
+ AopExecuteResponseOut,
6
9
  AssetContentRequestOut,
7
10
  AssetNode,
8
11
  AssetNotFoundError,
@@ -40,7 +43,6 @@ from .types import (
40
43
  InputMessageContentItem_ImageUrl,
41
44
  InputMessageContentItem_Text,
42
45
  PaginatedAssetsOut,
43
- ParentFolderError,
44
46
  PromptMessage,
45
47
  PublicAssetOut,
46
48
  ResearchAgentResponse,
@@ -60,7 +62,7 @@ from .errors import (
60
62
  UnprocessableEntityError,
61
63
  UnsupportedMediaTypeError,
62
64
  )
63
- from . import agents, assets, query, tools
65
+ from . import agents, aop, assets, query, tools
64
66
  from .client import AsyncAthena, Athena
65
67
  from .environment import AthenaEnvironment
66
68
  from .query import QueryExecuteRequestDatabaseAssetIds
@@ -68,6 +70,9 @@ from .tools import ToolsDataFrameRequestColumnsItem
68
70
  from .version import __version__
69
71
 
70
72
  __all__ = [
73
+ "AopAsyncExecuteResponseOut",
74
+ "AopExecuteRequestIn",
75
+ "AopExecuteResponseOut",
71
76
  "AssetContentRequestOut",
72
77
  "AssetNode",
73
78
  "AssetNotFoundError",
@@ -112,7 +117,6 @@ __all__ = [
112
117
  "InternalServerError",
113
118
  "NotFoundError",
114
119
  "PaginatedAssetsOut",
115
- "ParentFolderError",
116
120
  "PromptMessage",
117
121
  "PublicAssetOut",
118
122
  "QueryExecuteRequestDatabaseAssetIds",
@@ -129,6 +133,7 @@ __all__ = [
129
133
  "UnsupportedMediaTypeError",
130
134
  "__version__",
131
135
  "agents",
136
+ "aop",
132
137
  "assets",
133
138
  "query",
134
139
  "tools",
athena/aop/__init__.py ADDED
@@ -0,0 +1,4 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
athena/aop/client.py ADDED
@@ -0,0 +1,201 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
+ from ..core.request_options import RequestOptions
7
+ from ..types.aop_async_execute_response_out import AopAsyncExecuteResponseOut
8
+ from ..types.aop_execute_request_in import AopExecuteRequestIn
9
+ from ..types.aop_execute_response_out import AopExecuteResponseOut
10
+ from .raw_client import AsyncRawAopClient, RawAopClient
11
+
12
+ # this is used as the default value for optional parameters
13
+ OMIT = typing.cast(typing.Any, ...)
14
+
15
+
16
+ class AopClient:
17
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
18
+ self._raw_client = RawAopClient(client_wrapper=client_wrapper)
19
+
20
+ @property
21
+ def with_raw_response(self) -> RawAopClient:
22
+ """
23
+ Retrieves a raw implementation of this client that returns raw responses.
24
+
25
+ Returns
26
+ -------
27
+ RawAopClient
28
+ """
29
+ return self._raw_client
30
+
31
+ def execute(
32
+ self, *, request: AopExecuteRequestIn, request_options: typing.Optional[RequestOptions] = None
33
+ ) -> AopExecuteResponseOut:
34
+ """
35
+ Execute an existing Agent Operating Procedure (AOP) asset with optional user inputs. AOPs are pre-configured AI workflows that can perform complex tasks like research, analysis, and content generation.
36
+
37
+ Parameters
38
+ ----------
39
+ request : AopExecuteRequestIn
40
+
41
+ request_options : typing.Optional[RequestOptions]
42
+ Request-specific configuration.
43
+
44
+ Returns
45
+ -------
46
+ AopExecuteResponseOut
47
+ AOP execution started successfully
48
+
49
+ Examples
50
+ --------
51
+ from athena import AopExecuteRequestIn, Athena
52
+
53
+ client = Athena(
54
+ api_key="YOUR_API_KEY",
55
+ )
56
+ client.aop.execute(
57
+ request=AopExecuteRequestIn(
58
+ asset_id="asset_9249292-d118-42d3-95b4-00eccfe0754f",
59
+ user_inputs={"company": "Acme Corp", "quarter": "Q1 2024"},
60
+ ),
61
+ )
62
+ """
63
+ _response = self._raw_client.execute(request=request, request_options=request_options)
64
+ return _response.data
65
+
66
+ def execute_async(
67
+ self, *, request: AopExecuteRequestIn, request_options: typing.Optional[RequestOptions] = None
68
+ ) -> AopAsyncExecuteResponseOut:
69
+ """
70
+ Start execution of an Agent Operating Procedure (AOP) asset asynchronously. Returns immediately with a thread_id for tracking execution progress without waiting for completion.
71
+
72
+ Parameters
73
+ ----------
74
+ request : AopExecuteRequestIn
75
+
76
+ request_options : typing.Optional[RequestOptions]
77
+ Request-specific configuration.
78
+
79
+ Returns
80
+ -------
81
+ AopAsyncExecuteResponseOut
82
+ AOP execution started successfully
83
+
84
+ Examples
85
+ --------
86
+ from athena import AopExecuteRequestIn, Athena
87
+
88
+ client = Athena(
89
+ api_key="YOUR_API_KEY",
90
+ )
91
+ client.aop.execute_async(
92
+ request=AopExecuteRequestIn(
93
+ asset_id="asset_9249292-d118-42d3-95b4-00eccfe0754f",
94
+ user_inputs={"company": "Acme Corp", "quarter": "Q1 2024"},
95
+ ),
96
+ )
97
+ """
98
+ _response = self._raw_client.execute_async(request=request, request_options=request_options)
99
+ return _response.data
100
+
101
+
102
+ class AsyncAopClient:
103
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
104
+ self._raw_client = AsyncRawAopClient(client_wrapper=client_wrapper)
105
+
106
+ @property
107
+ def with_raw_response(self) -> AsyncRawAopClient:
108
+ """
109
+ Retrieves a raw implementation of this client that returns raw responses.
110
+
111
+ Returns
112
+ -------
113
+ AsyncRawAopClient
114
+ """
115
+ return self._raw_client
116
+
117
+ async def execute(
118
+ self, *, request: AopExecuteRequestIn, request_options: typing.Optional[RequestOptions] = None
119
+ ) -> AopExecuteResponseOut:
120
+ """
121
+ Execute an existing Agent Operating Procedure (AOP) asset with optional user inputs. AOPs are pre-configured AI workflows that can perform complex tasks like research, analysis, and content generation.
122
+
123
+ Parameters
124
+ ----------
125
+ request : AopExecuteRequestIn
126
+
127
+ request_options : typing.Optional[RequestOptions]
128
+ Request-specific configuration.
129
+
130
+ Returns
131
+ -------
132
+ AopExecuteResponseOut
133
+ AOP execution started successfully
134
+
135
+ Examples
136
+ --------
137
+ import asyncio
138
+
139
+ from athena import AopExecuteRequestIn, AsyncAthena
140
+
141
+ client = AsyncAthena(
142
+ api_key="YOUR_API_KEY",
143
+ )
144
+
145
+
146
+ async def main() -> None:
147
+ await client.aop.execute(
148
+ request=AopExecuteRequestIn(
149
+ asset_id="asset_9249292-d118-42d3-95b4-00eccfe0754f",
150
+ user_inputs={"company": "Acme Corp", "quarter": "Q1 2024"},
151
+ ),
152
+ )
153
+
154
+
155
+ asyncio.run(main())
156
+ """
157
+ _response = await self._raw_client.execute(request=request, request_options=request_options)
158
+ return _response.data
159
+
160
+ async def execute_async(
161
+ self, *, request: AopExecuteRequestIn, request_options: typing.Optional[RequestOptions] = None
162
+ ) -> AopAsyncExecuteResponseOut:
163
+ """
164
+ Start execution of an Agent Operating Procedure (AOP) asset asynchronously. Returns immediately with a thread_id for tracking execution progress without waiting for completion.
165
+
166
+ Parameters
167
+ ----------
168
+ request : AopExecuteRequestIn
169
+
170
+ request_options : typing.Optional[RequestOptions]
171
+ Request-specific configuration.
172
+
173
+ Returns
174
+ -------
175
+ AopAsyncExecuteResponseOut
176
+ AOP execution started successfully
177
+
178
+ Examples
179
+ --------
180
+ import asyncio
181
+
182
+ from athena import AopExecuteRequestIn, AsyncAthena
183
+
184
+ client = AsyncAthena(
185
+ api_key="YOUR_API_KEY",
186
+ )
187
+
188
+
189
+ async def main() -> None:
190
+ await client.aop.execute_async(
191
+ request=AopExecuteRequestIn(
192
+ asset_id="asset_9249292-d118-42d3-95b4-00eccfe0754f",
193
+ user_inputs={"company": "Acme Corp", "quarter": "Q1 2024"},
194
+ ),
195
+ )
196
+
197
+
198
+ asyncio.run(main())
199
+ """
200
+ _response = await self._raw_client.execute_async(request=request, request_options=request_options)
201
+ return _response.data
@@ -0,0 +1,433 @@
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.pydantic_utilities import parse_obj_as
10
+ from ..core.request_options import RequestOptions
11
+ from ..core.serialization import convert_and_respect_annotation_metadata
12
+ from ..errors.bad_request_error import BadRequestError
13
+ from ..errors.internal_server_error import InternalServerError
14
+ from ..errors.not_found_error import NotFoundError
15
+ from ..errors.unauthorized_error import UnauthorizedError
16
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
17
+ from ..types.aop_async_execute_response_out import AopAsyncExecuteResponseOut
18
+ from ..types.aop_execute_request_in import AopExecuteRequestIn
19
+ from ..types.aop_execute_response_out import AopExecuteResponseOut
20
+ from ..types.asset_not_found_error import AssetNotFoundError
21
+
22
+ # this is used as the default value for optional parameters
23
+ OMIT = typing.cast(typing.Any, ...)
24
+
25
+
26
+ class RawAopClient:
27
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
28
+ self._client_wrapper = client_wrapper
29
+
30
+ def execute(
31
+ self, *, request: AopExecuteRequestIn, request_options: typing.Optional[RequestOptions] = None
32
+ ) -> HttpResponse[AopExecuteResponseOut]:
33
+ """
34
+ Execute an existing Agent Operating Procedure (AOP) asset with optional user inputs. AOPs are pre-configured AI workflows that can perform complex tasks like research, analysis, and content generation.
35
+
36
+ Parameters
37
+ ----------
38
+ request : AopExecuteRequestIn
39
+
40
+ request_options : typing.Optional[RequestOptions]
41
+ Request-specific configuration.
42
+
43
+ Returns
44
+ -------
45
+ HttpResponse[AopExecuteResponseOut]
46
+ AOP execution started successfully
47
+ """
48
+ _response = self._client_wrapper.httpx_client.request(
49
+ "api/v0/aop/execute",
50
+ method="POST",
51
+ json=convert_and_respect_annotation_metadata(
52
+ object_=request, annotation=AopExecuteRequestIn, direction="write"
53
+ ),
54
+ headers={
55
+ "content-type": "application/json",
56
+ },
57
+ request_options=request_options,
58
+ omit=OMIT,
59
+ )
60
+ try:
61
+ if 200 <= _response.status_code < 300:
62
+ _data = typing.cast(
63
+ AopExecuteResponseOut,
64
+ parse_obj_as(
65
+ type_=AopExecuteResponseOut, # type: ignore
66
+ object_=_response.json(),
67
+ ),
68
+ )
69
+ return HttpResponse(response=_response, data=_data)
70
+ if _response.status_code == 400:
71
+ raise BadRequestError(
72
+ headers=dict(_response.headers),
73
+ body=typing.cast(
74
+ typing.Optional[typing.Any],
75
+ parse_obj_as(
76
+ type_=typing.Optional[typing.Any], # type: ignore
77
+ object_=_response.json(),
78
+ ),
79
+ ),
80
+ )
81
+ if _response.status_code == 401:
82
+ raise UnauthorizedError(
83
+ headers=dict(_response.headers),
84
+ body=typing.cast(
85
+ typing.Optional[typing.Any],
86
+ parse_obj_as(
87
+ type_=typing.Optional[typing.Any], # type: ignore
88
+ object_=_response.json(),
89
+ ),
90
+ ),
91
+ )
92
+ if _response.status_code == 404:
93
+ raise NotFoundError(
94
+ headers=dict(_response.headers),
95
+ body=typing.cast(
96
+ AssetNotFoundError,
97
+ parse_obj_as(
98
+ type_=AssetNotFoundError, # type: ignore
99
+ object_=_response.json(),
100
+ ),
101
+ ),
102
+ )
103
+ if _response.status_code == 422:
104
+ raise UnprocessableEntityError(
105
+ headers=dict(_response.headers),
106
+ body=typing.cast(
107
+ typing.Optional[typing.Any],
108
+ parse_obj_as(
109
+ type_=typing.Optional[typing.Any], # type: ignore
110
+ object_=_response.json(),
111
+ ),
112
+ ),
113
+ )
114
+ if _response.status_code == 500:
115
+ raise InternalServerError(
116
+ headers=dict(_response.headers),
117
+ body=typing.cast(
118
+ typing.Optional[typing.Any],
119
+ parse_obj_as(
120
+ type_=typing.Optional[typing.Any], # type: ignore
121
+ object_=_response.json(),
122
+ ),
123
+ ),
124
+ )
125
+ _response_json = _response.json()
126
+ except JSONDecodeError:
127
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
128
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
129
+
130
+ def execute_async(
131
+ self, *, request: AopExecuteRequestIn, request_options: typing.Optional[RequestOptions] = None
132
+ ) -> HttpResponse[AopAsyncExecuteResponseOut]:
133
+ """
134
+ Start execution of an Agent Operating Procedure (AOP) asset asynchronously. Returns immediately with a thread_id for tracking execution progress without waiting for completion.
135
+
136
+ Parameters
137
+ ----------
138
+ request : AopExecuteRequestIn
139
+
140
+ request_options : typing.Optional[RequestOptions]
141
+ Request-specific configuration.
142
+
143
+ Returns
144
+ -------
145
+ HttpResponse[AopAsyncExecuteResponseOut]
146
+ AOP execution started successfully
147
+ """
148
+ _response = self._client_wrapper.httpx_client.request(
149
+ "api/v0/aop/execute-async",
150
+ method="POST",
151
+ json=convert_and_respect_annotation_metadata(
152
+ object_=request, annotation=AopExecuteRequestIn, direction="write"
153
+ ),
154
+ headers={
155
+ "content-type": "application/json",
156
+ },
157
+ request_options=request_options,
158
+ omit=OMIT,
159
+ )
160
+ try:
161
+ if 200 <= _response.status_code < 300:
162
+ _data = typing.cast(
163
+ AopAsyncExecuteResponseOut,
164
+ parse_obj_as(
165
+ type_=AopAsyncExecuteResponseOut, # type: ignore
166
+ object_=_response.json(),
167
+ ),
168
+ )
169
+ return HttpResponse(response=_response, data=_data)
170
+ if _response.status_code == 400:
171
+ raise BadRequestError(
172
+ headers=dict(_response.headers),
173
+ body=typing.cast(
174
+ typing.Optional[typing.Any],
175
+ parse_obj_as(
176
+ type_=typing.Optional[typing.Any], # type: ignore
177
+ object_=_response.json(),
178
+ ),
179
+ ),
180
+ )
181
+ if _response.status_code == 401:
182
+ raise UnauthorizedError(
183
+ headers=dict(_response.headers),
184
+ body=typing.cast(
185
+ typing.Optional[typing.Any],
186
+ parse_obj_as(
187
+ type_=typing.Optional[typing.Any], # type: ignore
188
+ object_=_response.json(),
189
+ ),
190
+ ),
191
+ )
192
+ if _response.status_code == 404:
193
+ raise NotFoundError(
194
+ headers=dict(_response.headers),
195
+ body=typing.cast(
196
+ AssetNotFoundError,
197
+ parse_obj_as(
198
+ type_=AssetNotFoundError, # type: ignore
199
+ object_=_response.json(),
200
+ ),
201
+ ),
202
+ )
203
+ if _response.status_code == 422:
204
+ raise UnprocessableEntityError(
205
+ headers=dict(_response.headers),
206
+ body=typing.cast(
207
+ typing.Optional[typing.Any],
208
+ parse_obj_as(
209
+ type_=typing.Optional[typing.Any], # type: ignore
210
+ object_=_response.json(),
211
+ ),
212
+ ),
213
+ )
214
+ if _response.status_code == 500:
215
+ raise InternalServerError(
216
+ headers=dict(_response.headers),
217
+ body=typing.cast(
218
+ typing.Optional[typing.Any],
219
+ parse_obj_as(
220
+ type_=typing.Optional[typing.Any], # type: ignore
221
+ object_=_response.json(),
222
+ ),
223
+ ),
224
+ )
225
+ _response_json = _response.json()
226
+ except JSONDecodeError:
227
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
228
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
229
+
230
+
231
+ class AsyncRawAopClient:
232
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
233
+ self._client_wrapper = client_wrapper
234
+
235
+ async def execute(
236
+ self, *, request: AopExecuteRequestIn, request_options: typing.Optional[RequestOptions] = None
237
+ ) -> AsyncHttpResponse[AopExecuteResponseOut]:
238
+ """
239
+ Execute an existing Agent Operating Procedure (AOP) asset with optional user inputs. AOPs are pre-configured AI workflows that can perform complex tasks like research, analysis, and content generation.
240
+
241
+ Parameters
242
+ ----------
243
+ request : AopExecuteRequestIn
244
+
245
+ request_options : typing.Optional[RequestOptions]
246
+ Request-specific configuration.
247
+
248
+ Returns
249
+ -------
250
+ AsyncHttpResponse[AopExecuteResponseOut]
251
+ AOP execution started successfully
252
+ """
253
+ _response = await self._client_wrapper.httpx_client.request(
254
+ "api/v0/aop/execute",
255
+ method="POST",
256
+ json=convert_and_respect_annotation_metadata(
257
+ object_=request, annotation=AopExecuteRequestIn, direction="write"
258
+ ),
259
+ headers={
260
+ "content-type": "application/json",
261
+ },
262
+ request_options=request_options,
263
+ omit=OMIT,
264
+ )
265
+ try:
266
+ if 200 <= _response.status_code < 300:
267
+ _data = typing.cast(
268
+ AopExecuteResponseOut,
269
+ parse_obj_as(
270
+ type_=AopExecuteResponseOut, # type: ignore
271
+ object_=_response.json(),
272
+ ),
273
+ )
274
+ return AsyncHttpResponse(response=_response, data=_data)
275
+ if _response.status_code == 400:
276
+ raise BadRequestError(
277
+ headers=dict(_response.headers),
278
+ body=typing.cast(
279
+ typing.Optional[typing.Any],
280
+ parse_obj_as(
281
+ type_=typing.Optional[typing.Any], # type: ignore
282
+ object_=_response.json(),
283
+ ),
284
+ ),
285
+ )
286
+ if _response.status_code == 401:
287
+ raise UnauthorizedError(
288
+ headers=dict(_response.headers),
289
+ body=typing.cast(
290
+ typing.Optional[typing.Any],
291
+ parse_obj_as(
292
+ type_=typing.Optional[typing.Any], # type: ignore
293
+ object_=_response.json(),
294
+ ),
295
+ ),
296
+ )
297
+ if _response.status_code == 404:
298
+ raise NotFoundError(
299
+ headers=dict(_response.headers),
300
+ body=typing.cast(
301
+ AssetNotFoundError,
302
+ parse_obj_as(
303
+ type_=AssetNotFoundError, # type: ignore
304
+ object_=_response.json(),
305
+ ),
306
+ ),
307
+ )
308
+ if _response.status_code == 422:
309
+ raise UnprocessableEntityError(
310
+ headers=dict(_response.headers),
311
+ body=typing.cast(
312
+ typing.Optional[typing.Any],
313
+ parse_obj_as(
314
+ type_=typing.Optional[typing.Any], # type: ignore
315
+ object_=_response.json(),
316
+ ),
317
+ ),
318
+ )
319
+ if _response.status_code == 500:
320
+ raise InternalServerError(
321
+ headers=dict(_response.headers),
322
+ body=typing.cast(
323
+ typing.Optional[typing.Any],
324
+ parse_obj_as(
325
+ type_=typing.Optional[typing.Any], # type: ignore
326
+ object_=_response.json(),
327
+ ),
328
+ ),
329
+ )
330
+ _response_json = _response.json()
331
+ except JSONDecodeError:
332
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
333
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
334
+
335
+ async def execute_async(
336
+ self, *, request: AopExecuteRequestIn, request_options: typing.Optional[RequestOptions] = None
337
+ ) -> AsyncHttpResponse[AopAsyncExecuteResponseOut]:
338
+ """
339
+ Start execution of an Agent Operating Procedure (AOP) asset asynchronously. Returns immediately with a thread_id for tracking execution progress without waiting for completion.
340
+
341
+ Parameters
342
+ ----------
343
+ request : AopExecuteRequestIn
344
+
345
+ request_options : typing.Optional[RequestOptions]
346
+ Request-specific configuration.
347
+
348
+ Returns
349
+ -------
350
+ AsyncHttpResponse[AopAsyncExecuteResponseOut]
351
+ AOP execution started successfully
352
+ """
353
+ _response = await self._client_wrapper.httpx_client.request(
354
+ "api/v0/aop/execute-async",
355
+ method="POST",
356
+ json=convert_and_respect_annotation_metadata(
357
+ object_=request, annotation=AopExecuteRequestIn, direction="write"
358
+ ),
359
+ headers={
360
+ "content-type": "application/json",
361
+ },
362
+ request_options=request_options,
363
+ omit=OMIT,
364
+ )
365
+ try:
366
+ if 200 <= _response.status_code < 300:
367
+ _data = typing.cast(
368
+ AopAsyncExecuteResponseOut,
369
+ parse_obj_as(
370
+ type_=AopAsyncExecuteResponseOut, # type: ignore
371
+ object_=_response.json(),
372
+ ),
373
+ )
374
+ return AsyncHttpResponse(response=_response, data=_data)
375
+ if _response.status_code == 400:
376
+ raise BadRequestError(
377
+ headers=dict(_response.headers),
378
+ body=typing.cast(
379
+ typing.Optional[typing.Any],
380
+ parse_obj_as(
381
+ type_=typing.Optional[typing.Any], # type: ignore
382
+ object_=_response.json(),
383
+ ),
384
+ ),
385
+ )
386
+ if _response.status_code == 401:
387
+ raise UnauthorizedError(
388
+ headers=dict(_response.headers),
389
+ body=typing.cast(
390
+ typing.Optional[typing.Any],
391
+ parse_obj_as(
392
+ type_=typing.Optional[typing.Any], # type: ignore
393
+ object_=_response.json(),
394
+ ),
395
+ ),
396
+ )
397
+ if _response.status_code == 404:
398
+ raise NotFoundError(
399
+ headers=dict(_response.headers),
400
+ body=typing.cast(
401
+ AssetNotFoundError,
402
+ parse_obj_as(
403
+ type_=AssetNotFoundError, # type: ignore
404
+ object_=_response.json(),
405
+ ),
406
+ ),
407
+ )
408
+ if _response.status_code == 422:
409
+ raise UnprocessableEntityError(
410
+ headers=dict(_response.headers),
411
+ body=typing.cast(
412
+ typing.Optional[typing.Any],
413
+ parse_obj_as(
414
+ type_=typing.Optional[typing.Any], # type: ignore
415
+ object_=_response.json(),
416
+ ),
417
+ ),
418
+ )
419
+ if _response.status_code == 500:
420
+ raise InternalServerError(
421
+ headers=dict(_response.headers),
422
+ body=typing.cast(
423
+ typing.Optional[typing.Any],
424
+ parse_obj_as(
425
+ type_=typing.Optional[typing.Any], # type: ignore
426
+ object_=_response.json(),
427
+ ),
428
+ ),
429
+ )
430
+ _response_json = _response.json()
431
+ except JSONDecodeError:
432
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
433
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)