usecortex-ai 0.1.0__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 (89) hide show
  1. cortex_ai/__init__.py +103 -0
  2. cortex_ai/client.py +244 -0
  3. cortex_ai/core/__init__.py +52 -0
  4. cortex_ai/core/api_error.py +23 -0
  5. cortex_ai/core/client_wrapper.py +84 -0
  6. cortex_ai/core/datetime_utils.py +28 -0
  7. cortex_ai/core/file.py +67 -0
  8. cortex_ai/core/force_multipart.py +18 -0
  9. cortex_ai/core/http_client.py +543 -0
  10. cortex_ai/core/http_response.py +55 -0
  11. cortex_ai/core/jsonable_encoder.py +100 -0
  12. cortex_ai/core/pydantic_utilities.py +258 -0
  13. cortex_ai/core/query_encoder.py +58 -0
  14. cortex_ai/core/remove_none_from_dict.py +11 -0
  15. cortex_ai/core/request_options.py +35 -0
  16. cortex_ai/core/serialization.py +276 -0
  17. cortex_ai/embeddings/__init__.py +4 -0
  18. cortex_ai/embeddings/client.py +442 -0
  19. cortex_ai/embeddings/raw_client.py +1153 -0
  20. cortex_ai/environment.py +7 -0
  21. cortex_ai/errors/__init__.py +21 -0
  22. cortex_ai/errors/bad_request_error.py +11 -0
  23. cortex_ai/errors/forbidden_error.py +11 -0
  24. cortex_ai/errors/internal_server_error.py +11 -0
  25. cortex_ai/errors/not_found_error.py +11 -0
  26. cortex_ai/errors/service_unavailable_error.py +11 -0
  27. cortex_ai/errors/unauthorized_error.py +11 -0
  28. cortex_ai/errors/unprocessable_entity_error.py +10 -0
  29. cortex_ai/fetch/__init__.py +4 -0
  30. cortex_ai/fetch/client.py +143 -0
  31. cortex_ai/fetch/raw_client.py +310 -0
  32. cortex_ai/raw_client.py +90 -0
  33. cortex_ai/search/__init__.py +7 -0
  34. cortex_ai/search/client.py +536 -0
  35. cortex_ai/search/raw_client.py +1064 -0
  36. cortex_ai/search/types/__init__.py +7 -0
  37. cortex_ai/search/types/alpha.py +5 -0
  38. cortex_ai/sources/__init__.py +4 -0
  39. cortex_ai/sources/client.py +187 -0
  40. cortex_ai/sources/raw_client.py +532 -0
  41. cortex_ai/tenant/__init__.py +4 -0
  42. cortex_ai/tenant/client.py +120 -0
  43. cortex_ai/tenant/raw_client.py +283 -0
  44. cortex_ai/types/__init__.py +69 -0
  45. cortex_ai/types/actual_error_response.py +20 -0
  46. cortex_ai/types/app_sources_upload_data.py +22 -0
  47. cortex_ai/types/attachment_model.py +26 -0
  48. cortex_ai/types/batch_upload_data.py +22 -0
  49. cortex_ai/types/bm_25_operator_type.py +5 -0
  50. cortex_ai/types/content_model.py +26 -0
  51. cortex_ai/types/delete_memory_request.py +21 -0
  52. cortex_ai/types/embeddings_create_collection_data.py +22 -0
  53. cortex_ai/types/embeddings_delete_data.py +22 -0
  54. cortex_ai/types/embeddings_get_data.py +22 -0
  55. cortex_ai/types/embeddings_search_data.py +22 -0
  56. cortex_ai/types/error_response.py +22 -0
  57. cortex_ai/types/extended_context.py +20 -0
  58. cortex_ai/types/fetch_content_data.py +23 -0
  59. cortex_ai/types/file_upload_result.py +20 -0
  60. cortex_ai/types/full_text_search_data.py +22 -0
  61. cortex_ai/types/http_validation_error.py +20 -0
  62. cortex_ai/types/list_sources_response.py +22 -0
  63. cortex_ai/types/markdown_upload_request.py +21 -0
  64. cortex_ai/types/processing_status.py +22 -0
  65. cortex_ai/types/related_chunk.py +22 -0
  66. cortex_ai/types/search_chunk.py +34 -0
  67. cortex_ai/types/search_data.py +22 -0
  68. cortex_ai/types/single_upload_data.py +21 -0
  69. cortex_ai/types/source.py +32 -0
  70. cortex_ai/types/source_content.py +26 -0
  71. cortex_ai/types/source_model.py +32 -0
  72. cortex_ai/types/tenant_create_data.py +22 -0
  73. cortex_ai/types/tenant_stats.py +23 -0
  74. cortex_ai/types/validation_error.py +22 -0
  75. cortex_ai/types/validation_error_loc_item.py +5 -0
  76. cortex_ai/upload/__init__.py +4 -0
  77. cortex_ai/upload/client.py +1572 -0
  78. cortex_ai/upload/raw_client.py +4202 -0
  79. cortex_ai/user/__init__.py +4 -0
  80. cortex_ai/user/client.py +125 -0
  81. cortex_ai/user/raw_client.py +300 -0
  82. cortex_ai/user_memory/__init__.py +4 -0
  83. cortex_ai/user_memory/client.py +443 -0
  84. cortex_ai/user_memory/raw_client.py +651 -0
  85. usecortex_ai-0.1.0.dist-info/METADATA +136 -0
  86. usecortex_ai-0.1.0.dist-info/RECORD +89 -0
  87. usecortex_ai-0.1.0.dist-info/WHEEL +5 -0
  88. usecortex_ai-0.1.0.dist-info/licenses/LICENSE +22 -0
  89. usecortex_ai-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,7 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import enum
4
+
5
+
6
+ class CortexAIEnvironment(enum.Enum):
7
+ CORTEX_PROD = "https://api.usecortex.ai"
@@ -0,0 +1,21 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ from .bad_request_error import BadRequestError
6
+ from .forbidden_error import ForbiddenError
7
+ from .internal_server_error import InternalServerError
8
+ from .not_found_error import NotFoundError
9
+ from .service_unavailable_error import ServiceUnavailableError
10
+ from .unauthorized_error import UnauthorizedError
11
+ from .unprocessable_entity_error import UnprocessableEntityError
12
+
13
+ __all__ = [
14
+ "BadRequestError",
15
+ "ForbiddenError",
16
+ "InternalServerError",
17
+ "NotFoundError",
18
+ "ServiceUnavailableError",
19
+ "UnauthorizedError",
20
+ "UnprocessableEntityError",
21
+ ]
@@ -0,0 +1,11 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.api_error import ApiError
6
+ from ..types.actual_error_response import ActualErrorResponse
7
+
8
+
9
+ class BadRequestError(ApiError):
10
+ def __init__(self, body: ActualErrorResponse, headers: typing.Optional[typing.Dict[str, str]] = None):
11
+ super().__init__(status_code=400, headers=headers, body=body)
@@ -0,0 +1,11 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.api_error import ApiError
6
+ from ..types.actual_error_response import ActualErrorResponse
7
+
8
+
9
+ class ForbiddenError(ApiError):
10
+ def __init__(self, body: ActualErrorResponse, headers: typing.Optional[typing.Dict[str, str]] = None):
11
+ super().__init__(status_code=403, headers=headers, body=body)
@@ -0,0 +1,11 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.api_error import ApiError
6
+ from ..types.actual_error_response import ActualErrorResponse
7
+
8
+
9
+ class InternalServerError(ApiError):
10
+ def __init__(self, body: ActualErrorResponse, headers: typing.Optional[typing.Dict[str, str]] = None):
11
+ super().__init__(status_code=500, headers=headers, body=body)
@@ -0,0 +1,11 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.api_error import ApiError
6
+ from ..types.actual_error_response import ActualErrorResponse
7
+
8
+
9
+ class NotFoundError(ApiError):
10
+ def __init__(self, body: ActualErrorResponse, headers: typing.Optional[typing.Dict[str, str]] = None):
11
+ super().__init__(status_code=404, headers=headers, body=body)
@@ -0,0 +1,11 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.api_error import ApiError
6
+ from ..types.actual_error_response import ActualErrorResponse
7
+
8
+
9
+ class ServiceUnavailableError(ApiError):
10
+ def __init__(self, body: ActualErrorResponse, headers: typing.Optional[typing.Dict[str, str]] = None):
11
+ super().__init__(status_code=503, headers=headers, body=body)
@@ -0,0 +1,11 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.api_error import ApiError
6
+ from ..types.actual_error_response import ActualErrorResponse
7
+
8
+
9
+ class UnauthorizedError(ApiError):
10
+ def __init__(self, body: ActualErrorResponse, headers: typing.Optional[typing.Dict[str, str]] = None):
11
+ super().__init__(status_code=401, headers=headers, body=body)
@@ -0,0 +1,10 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.api_error import ApiError
6
+
7
+
8
+ class UnprocessableEntityError(ApiError):
9
+ def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
10
+ super().__init__(status_code=422, headers=headers, body=body)
@@ -0,0 +1,4 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
@@ -0,0 +1,143 @@
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.fetch_content_data import FetchContentData
8
+ from .raw_client import AsyncRawFetchClient, RawFetchClient
9
+
10
+ # this is used as the default value for optional parameters
11
+ OMIT = typing.cast(typing.Any, ...)
12
+
13
+
14
+ class FetchClient:
15
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
16
+ self._raw_client = RawFetchClient(client_wrapper=client_wrapper)
17
+
18
+ @property
19
+ def with_raw_response(self) -> RawFetchClient:
20
+ """
21
+ Retrieves a raw implementation of this client that returns raw responses.
22
+
23
+ Returns
24
+ -------
25
+ RawFetchClient
26
+ """
27
+ return self._raw_client
28
+
29
+ def fetch_content(
30
+ self,
31
+ *,
32
+ file_id: str,
33
+ file_type: str,
34
+ tenant_id: str,
35
+ return_content: typing.Optional[bool] = OMIT,
36
+ sub_tenant_id: typing.Optional[str] = OMIT,
37
+ request_options: typing.Optional[RequestOptions] = None,
38
+ ) -> FetchContentData:
39
+ """
40
+ Parameters
41
+ ----------
42
+ file_id : str
43
+
44
+ file_type : str
45
+
46
+ tenant_id : str
47
+
48
+ return_content : typing.Optional[bool]
49
+
50
+ sub_tenant_id : typing.Optional[str]
51
+
52
+ request_options : typing.Optional[RequestOptions]
53
+ Request-specific configuration.
54
+
55
+ Returns
56
+ -------
57
+ FetchContentData
58
+ Successful Response
59
+
60
+ Examples
61
+ --------
62
+ from cortex-ai import CortexAI
63
+
64
+ client = CortexAI(token="YOUR_TOKEN", )
65
+ client.fetch.fetch_content(file_id='file_id', file_type='file_type', tenant_id='tenant_id', )
66
+ """
67
+ _response = self._raw_client.fetch_content(
68
+ file_id=file_id,
69
+ file_type=file_type,
70
+ tenant_id=tenant_id,
71
+ return_content=return_content,
72
+ sub_tenant_id=sub_tenant_id,
73
+ request_options=request_options,
74
+ )
75
+ return _response.data
76
+
77
+
78
+ class AsyncFetchClient:
79
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
80
+ self._raw_client = AsyncRawFetchClient(client_wrapper=client_wrapper)
81
+
82
+ @property
83
+ def with_raw_response(self) -> AsyncRawFetchClient:
84
+ """
85
+ Retrieves a raw implementation of this client that returns raw responses.
86
+
87
+ Returns
88
+ -------
89
+ AsyncRawFetchClient
90
+ """
91
+ return self._raw_client
92
+
93
+ async def fetch_content(
94
+ self,
95
+ *,
96
+ file_id: str,
97
+ file_type: str,
98
+ tenant_id: str,
99
+ return_content: typing.Optional[bool] = OMIT,
100
+ sub_tenant_id: typing.Optional[str] = OMIT,
101
+ request_options: typing.Optional[RequestOptions] = None,
102
+ ) -> FetchContentData:
103
+ """
104
+ Parameters
105
+ ----------
106
+ file_id : str
107
+
108
+ file_type : str
109
+
110
+ tenant_id : str
111
+
112
+ return_content : typing.Optional[bool]
113
+
114
+ sub_tenant_id : typing.Optional[str]
115
+
116
+ request_options : typing.Optional[RequestOptions]
117
+ Request-specific configuration.
118
+
119
+ Returns
120
+ -------
121
+ FetchContentData
122
+ Successful Response
123
+
124
+ Examples
125
+ --------
126
+ import asyncio
127
+
128
+ from cortex-ai import AsyncCortexAI
129
+
130
+ client = AsyncCortexAI(token="YOUR_TOKEN", )
131
+ async def main() -> None:
132
+ await client.fetch.fetch_content(file_id='file_id', file_type='file_type', tenant_id='tenant_id', )
133
+ asyncio.run(main())
134
+ """
135
+ _response = await self._raw_client.fetch_content(
136
+ file_id=file_id,
137
+ file_type=file_type,
138
+ tenant_id=tenant_id,
139
+ return_content=return_content,
140
+ sub_tenant_id=sub_tenant_id,
141
+ request_options=request_options,
142
+ )
143
+ return _response.data
@@ -0,0 +1,310 @@
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 ..errors.bad_request_error import BadRequestError
12
+ from ..errors.forbidden_error import ForbiddenError
13
+ from ..errors.internal_server_error import InternalServerError
14
+ from ..errors.not_found_error import NotFoundError
15
+ from ..errors.service_unavailable_error import ServiceUnavailableError
16
+ from ..errors.unauthorized_error import UnauthorizedError
17
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
18
+ from ..types.actual_error_response import ActualErrorResponse
19
+ from ..types.fetch_content_data import FetchContentData
20
+
21
+ # this is used as the default value for optional parameters
22
+ OMIT = typing.cast(typing.Any, ...)
23
+
24
+
25
+ class RawFetchClient:
26
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
27
+ self._client_wrapper = client_wrapper
28
+
29
+ def fetch_content(
30
+ self,
31
+ *,
32
+ file_id: str,
33
+ file_type: str,
34
+ tenant_id: str,
35
+ return_content: typing.Optional[bool] = OMIT,
36
+ sub_tenant_id: typing.Optional[str] = OMIT,
37
+ request_options: typing.Optional[RequestOptions] = None,
38
+ ) -> HttpResponse[FetchContentData]:
39
+ """
40
+ Parameters
41
+ ----------
42
+ file_id : str
43
+
44
+ file_type : str
45
+
46
+ tenant_id : str
47
+
48
+ return_content : typing.Optional[bool]
49
+
50
+ sub_tenant_id : typing.Optional[str]
51
+
52
+ request_options : typing.Optional[RequestOptions]
53
+ Request-specific configuration.
54
+
55
+ Returns
56
+ -------
57
+ HttpResponse[FetchContentData]
58
+ Successful Response
59
+ """
60
+ _response = self._client_wrapper.httpx_client.request(
61
+ "fetch/fetch_content",
62
+ method="POST",
63
+ json={
64
+ "file_id": file_id,
65
+ "file_type": file_type,
66
+ "tenant_id": tenant_id,
67
+ "return_content": return_content,
68
+ "sub_tenant_id": sub_tenant_id,
69
+ },
70
+ headers={
71
+ "content-type": "application/json",
72
+ },
73
+ request_options=request_options,
74
+ omit=OMIT,
75
+ )
76
+ try:
77
+ if 200 <= _response.status_code < 300:
78
+ _data = typing.cast(
79
+ FetchContentData,
80
+ parse_obj_as(
81
+ type_=FetchContentData, # type: ignore
82
+ object_=_response.json(),
83
+ ),
84
+ )
85
+ return HttpResponse(response=_response, data=_data)
86
+ if _response.status_code == 400:
87
+ raise BadRequestError(
88
+ headers=dict(_response.headers),
89
+ body=typing.cast(
90
+ ActualErrorResponse,
91
+ parse_obj_as(
92
+ type_=ActualErrorResponse, # type: ignore
93
+ object_=_response.json(),
94
+ ),
95
+ ),
96
+ )
97
+ if _response.status_code == 401:
98
+ raise UnauthorizedError(
99
+ headers=dict(_response.headers),
100
+ body=typing.cast(
101
+ ActualErrorResponse,
102
+ parse_obj_as(
103
+ type_=ActualErrorResponse, # type: ignore
104
+ object_=_response.json(),
105
+ ),
106
+ ),
107
+ )
108
+ if _response.status_code == 403:
109
+ raise ForbiddenError(
110
+ headers=dict(_response.headers),
111
+ body=typing.cast(
112
+ ActualErrorResponse,
113
+ parse_obj_as(
114
+ type_=ActualErrorResponse, # type: ignore
115
+ object_=_response.json(),
116
+ ),
117
+ ),
118
+ )
119
+ if _response.status_code == 404:
120
+ raise NotFoundError(
121
+ headers=dict(_response.headers),
122
+ body=typing.cast(
123
+ ActualErrorResponse,
124
+ parse_obj_as(
125
+ type_=ActualErrorResponse, # type: ignore
126
+ object_=_response.json(),
127
+ ),
128
+ ),
129
+ )
130
+ if _response.status_code == 422:
131
+ raise UnprocessableEntityError(
132
+ headers=dict(_response.headers),
133
+ body=typing.cast(
134
+ typing.Optional[typing.Any],
135
+ parse_obj_as(
136
+ type_=typing.Optional[typing.Any], # type: ignore
137
+ object_=_response.json(),
138
+ ),
139
+ ),
140
+ )
141
+ if _response.status_code == 500:
142
+ raise InternalServerError(
143
+ headers=dict(_response.headers),
144
+ body=typing.cast(
145
+ ActualErrorResponse,
146
+ parse_obj_as(
147
+ type_=ActualErrorResponse, # type: ignore
148
+ object_=_response.json(),
149
+ ),
150
+ ),
151
+ )
152
+ if _response.status_code == 503:
153
+ raise ServiceUnavailableError(
154
+ headers=dict(_response.headers),
155
+ body=typing.cast(
156
+ ActualErrorResponse,
157
+ parse_obj_as(
158
+ type_=ActualErrorResponse, # type: ignore
159
+ object_=_response.json(),
160
+ ),
161
+ ),
162
+ )
163
+ _response_json = _response.json()
164
+ except JSONDecodeError:
165
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
166
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
167
+
168
+
169
+ class AsyncRawFetchClient:
170
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
171
+ self._client_wrapper = client_wrapper
172
+
173
+ async def fetch_content(
174
+ self,
175
+ *,
176
+ file_id: str,
177
+ file_type: str,
178
+ tenant_id: str,
179
+ return_content: typing.Optional[bool] = OMIT,
180
+ sub_tenant_id: typing.Optional[str] = OMIT,
181
+ request_options: typing.Optional[RequestOptions] = None,
182
+ ) -> AsyncHttpResponse[FetchContentData]:
183
+ """
184
+ Parameters
185
+ ----------
186
+ file_id : str
187
+
188
+ file_type : str
189
+
190
+ tenant_id : str
191
+
192
+ return_content : typing.Optional[bool]
193
+
194
+ sub_tenant_id : typing.Optional[str]
195
+
196
+ request_options : typing.Optional[RequestOptions]
197
+ Request-specific configuration.
198
+
199
+ Returns
200
+ -------
201
+ AsyncHttpResponse[FetchContentData]
202
+ Successful Response
203
+ """
204
+ _response = await self._client_wrapper.httpx_client.request(
205
+ "fetch/fetch_content",
206
+ method="POST",
207
+ json={
208
+ "file_id": file_id,
209
+ "file_type": file_type,
210
+ "tenant_id": tenant_id,
211
+ "return_content": return_content,
212
+ "sub_tenant_id": sub_tenant_id,
213
+ },
214
+ headers={
215
+ "content-type": "application/json",
216
+ },
217
+ request_options=request_options,
218
+ omit=OMIT,
219
+ )
220
+ try:
221
+ if 200 <= _response.status_code < 300:
222
+ _data = typing.cast(
223
+ FetchContentData,
224
+ parse_obj_as(
225
+ type_=FetchContentData, # type: ignore
226
+ object_=_response.json(),
227
+ ),
228
+ )
229
+ return AsyncHttpResponse(response=_response, data=_data)
230
+ if _response.status_code == 400:
231
+ raise BadRequestError(
232
+ headers=dict(_response.headers),
233
+ body=typing.cast(
234
+ ActualErrorResponse,
235
+ parse_obj_as(
236
+ type_=ActualErrorResponse, # type: ignore
237
+ object_=_response.json(),
238
+ ),
239
+ ),
240
+ )
241
+ if _response.status_code == 401:
242
+ raise UnauthorizedError(
243
+ headers=dict(_response.headers),
244
+ body=typing.cast(
245
+ ActualErrorResponse,
246
+ parse_obj_as(
247
+ type_=ActualErrorResponse, # type: ignore
248
+ object_=_response.json(),
249
+ ),
250
+ ),
251
+ )
252
+ if _response.status_code == 403:
253
+ raise ForbiddenError(
254
+ headers=dict(_response.headers),
255
+ body=typing.cast(
256
+ ActualErrorResponse,
257
+ parse_obj_as(
258
+ type_=ActualErrorResponse, # type: ignore
259
+ object_=_response.json(),
260
+ ),
261
+ ),
262
+ )
263
+ if _response.status_code == 404:
264
+ raise NotFoundError(
265
+ headers=dict(_response.headers),
266
+ body=typing.cast(
267
+ ActualErrorResponse,
268
+ parse_obj_as(
269
+ type_=ActualErrorResponse, # type: ignore
270
+ object_=_response.json(),
271
+ ),
272
+ ),
273
+ )
274
+ if _response.status_code == 422:
275
+ raise UnprocessableEntityError(
276
+ headers=dict(_response.headers),
277
+ body=typing.cast(
278
+ typing.Optional[typing.Any],
279
+ parse_obj_as(
280
+ type_=typing.Optional[typing.Any], # type: ignore
281
+ object_=_response.json(),
282
+ ),
283
+ ),
284
+ )
285
+ if _response.status_code == 500:
286
+ raise InternalServerError(
287
+ headers=dict(_response.headers),
288
+ body=typing.cast(
289
+ ActualErrorResponse,
290
+ parse_obj_as(
291
+ type_=ActualErrorResponse, # type: ignore
292
+ object_=_response.json(),
293
+ ),
294
+ ),
295
+ )
296
+ if _response.status_code == 503:
297
+ raise ServiceUnavailableError(
298
+ headers=dict(_response.headers),
299
+ body=typing.cast(
300
+ ActualErrorResponse,
301
+ parse_obj_as(
302
+ type_=ActualErrorResponse, # type: ignore
303
+ object_=_response.json(),
304
+ ),
305
+ ),
306
+ )
307
+ _response_json = _response.json()
308
+ except JSONDecodeError:
309
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
310
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
@@ -0,0 +1,90 @@
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
+
12
+
13
+ class RawCortexAI:
14
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
15
+ self._client_wrapper = client_wrapper
16
+
17
+ def root_get(
18
+ self, *, request_options: typing.Optional[RequestOptions] = None
19
+ ) -> HttpResponse[typing.Optional[typing.Any]]:
20
+ """
21
+ Parameters
22
+ ----------
23
+ request_options : typing.Optional[RequestOptions]
24
+ Request-specific configuration.
25
+
26
+ Returns
27
+ -------
28
+ HttpResponse[typing.Optional[typing.Any]]
29
+ Successful Response
30
+ """
31
+ _response = self._client_wrapper.httpx_client.request(
32
+ method="GET",
33
+ request_options=request_options,
34
+ )
35
+ try:
36
+ if _response is None or not _response.text.strip():
37
+ return HttpResponse(response=_response, data=None)
38
+ if 200 <= _response.status_code < 300:
39
+ _data = typing.cast(
40
+ typing.Optional[typing.Any],
41
+ parse_obj_as(
42
+ type_=typing.Optional[typing.Any], # type: ignore
43
+ object_=_response.json(),
44
+ ),
45
+ )
46
+ return HttpResponse(response=_response, data=_data)
47
+ _response_json = _response.json()
48
+ except JSONDecodeError:
49
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
50
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
51
+
52
+
53
+ class AsyncRawCortexAI:
54
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
55
+ self._client_wrapper = client_wrapper
56
+
57
+ async def root_get(
58
+ self, *, request_options: typing.Optional[RequestOptions] = None
59
+ ) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
60
+ """
61
+ Parameters
62
+ ----------
63
+ request_options : typing.Optional[RequestOptions]
64
+ Request-specific configuration.
65
+
66
+ Returns
67
+ -------
68
+ AsyncHttpResponse[typing.Optional[typing.Any]]
69
+ Successful Response
70
+ """
71
+ _response = await self._client_wrapper.httpx_client.request(
72
+ method="GET",
73
+ request_options=request_options,
74
+ )
75
+ try:
76
+ if _response is None or not _response.text.strip():
77
+ return AsyncHttpResponse(response=_response, data=None)
78
+ if 200 <= _response.status_code < 300:
79
+ _data = typing.cast(
80
+ typing.Optional[typing.Any],
81
+ parse_obj_as(
82
+ type_=typing.Optional[typing.Any], # type: ignore
83
+ object_=_response.json(),
84
+ ),
85
+ )
86
+ return AsyncHttpResponse(response=_response, data=_data)
87
+ _response_json = _response.json()
88
+ except JSONDecodeError:
89
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
90
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
@@ -0,0 +1,7 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ from .types import Alpha
6
+
7
+ __all__ = ["Alpha"]