usecortex-ai 0.2.2__py3-none-any.whl → 0.3.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.
usecortex_ai/client.py CHANGED
@@ -4,10 +4,12 @@ import typing
4
4
 
5
5
  import httpx
6
6
  from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
7
+ from .core.request_options import RequestOptions
7
8
  from .document.client import AsyncDocumentClient, DocumentClient
8
9
  from .embeddings.client import AsyncEmbeddingsClient, EmbeddingsClient
9
10
  from .environment import CortexAIEnvironment
10
11
  from .fetch.client import AsyncFetchClient, FetchClient
12
+ from .raw_client import AsyncRawCortexAI, RawCortexAI
11
13
  from .search.client import AsyncSearchClient, SearchClient
12
14
  from .sources.client import AsyncSourcesClient, SourcesClient
13
15
  from .tenant.client import AsyncTenantClient, TenantClient
@@ -34,7 +36,7 @@ class CortexAI:
34
36
 
35
37
 
36
38
 
37
- token : typing.Union[str, typing.Callable[[], str]]
39
+ token : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
38
40
  headers : typing.Optional[typing.Dict[str, str]]
39
41
  Additional headers to send with every request.
40
42
 
@@ -59,7 +61,7 @@ class CortexAI:
59
61
  *,
60
62
  base_url: typing.Optional[str] = None,
61
63
  environment: CortexAIEnvironment = CortexAIEnvironment.CORTEX_PROD,
62
- token: typing.Union[str, typing.Callable[[], str]],
64
+ token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
63
65
  headers: typing.Optional[typing.Dict[str, str]] = None,
64
66
  timeout: typing.Optional[float] = None,
65
67
  follow_redirects: typing.Optional[bool] = True,
@@ -79,15 +81,49 @@ class CortexAI:
79
81
  else httpx.Client(timeout=_defaulted_timeout),
80
82
  timeout=_defaulted_timeout,
81
83
  )
84
+ self._raw_client = RawCortexAI(client_wrapper=self._client_wrapper)
82
85
  self.search = SearchClient(client_wrapper=self._client_wrapper)
83
86
  self.sources = SourcesClient(client_wrapper=self._client_wrapper)
84
87
  self.user_memory = UserMemoryClient(client_wrapper=self._client_wrapper)
85
88
  self.fetch = FetchClient(client_wrapper=self._client_wrapper)
86
89
  self.upload = UploadClient(client_wrapper=self._client_wrapper)
87
- self.document = DocumentClient(client_wrapper=self._client_wrapper)
88
90
  self.embeddings = EmbeddingsClient(client_wrapper=self._client_wrapper)
89
91
  self.user = UserClient(client_wrapper=self._client_wrapper)
90
92
  self.tenant = TenantClient(client_wrapper=self._client_wrapper)
93
+ self.document = DocumentClient(client_wrapper=self._client_wrapper)
94
+
95
+ @property
96
+ def with_raw_response(self) -> RawCortexAI:
97
+ """
98
+ Retrieves a raw implementation of this client that returns raw responses.
99
+
100
+ Returns
101
+ -------
102
+ RawCortexAI
103
+ """
104
+ return self._raw_client
105
+
106
+ def root_get(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Optional[typing.Any]:
107
+ """
108
+ Parameters
109
+ ----------
110
+ request_options : typing.Optional[RequestOptions]
111
+ Request-specific configuration.
112
+
113
+ Returns
114
+ -------
115
+ typing.Optional[typing.Any]
116
+ Successful Response
117
+
118
+ Examples
119
+ --------
120
+ from usecortex-ai import CortexAI
121
+
122
+ client = CortexAI(token="YOUR_TOKEN", )
123
+ client.root_get()
124
+ """
125
+ _response = self._raw_client.root_get(request_options=request_options)
126
+ return _response.data
91
127
 
92
128
 
93
129
  class AsyncCortexAI:
@@ -108,7 +144,7 @@ class AsyncCortexAI:
108
144
 
109
145
 
110
146
 
111
- token : typing.Union[str, typing.Callable[[], str]]
147
+ token : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
112
148
  headers : typing.Optional[typing.Dict[str, str]]
113
149
  Additional headers to send with every request.
114
150
 
@@ -133,7 +169,7 @@ class AsyncCortexAI:
133
169
  *,
134
170
  base_url: typing.Optional[str] = None,
135
171
  environment: CortexAIEnvironment = CortexAIEnvironment.CORTEX_PROD,
136
- token: typing.Union[str, typing.Callable[[], str]],
172
+ token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
137
173
  headers: typing.Optional[typing.Dict[str, str]] = None,
138
174
  timeout: typing.Optional[float] = None,
139
175
  follow_redirects: typing.Optional[bool] = True,
@@ -153,15 +189,53 @@ class AsyncCortexAI:
153
189
  else httpx.AsyncClient(timeout=_defaulted_timeout),
154
190
  timeout=_defaulted_timeout,
155
191
  )
192
+ self._raw_client = AsyncRawCortexAI(client_wrapper=self._client_wrapper)
156
193
  self.search = AsyncSearchClient(client_wrapper=self._client_wrapper)
157
194
  self.sources = AsyncSourcesClient(client_wrapper=self._client_wrapper)
158
195
  self.user_memory = AsyncUserMemoryClient(client_wrapper=self._client_wrapper)
159
196
  self.fetch = AsyncFetchClient(client_wrapper=self._client_wrapper)
160
197
  self.upload = AsyncUploadClient(client_wrapper=self._client_wrapper)
161
- self.document = AsyncDocumentClient(client_wrapper=self._client_wrapper)
162
198
  self.embeddings = AsyncEmbeddingsClient(client_wrapper=self._client_wrapper)
163
199
  self.user = AsyncUserClient(client_wrapper=self._client_wrapper)
164
200
  self.tenant = AsyncTenantClient(client_wrapper=self._client_wrapper)
201
+ self.document = AsyncDocumentClient(client_wrapper=self._client_wrapper)
202
+
203
+ @property
204
+ def with_raw_response(self) -> AsyncRawCortexAI:
205
+ """
206
+ Retrieves a raw implementation of this client that returns raw responses.
207
+
208
+ Returns
209
+ -------
210
+ AsyncRawCortexAI
211
+ """
212
+ return self._raw_client
213
+
214
+ async def root_get(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Optional[typing.Any]:
215
+ """
216
+ Parameters
217
+ ----------
218
+ request_options : typing.Optional[RequestOptions]
219
+ Request-specific configuration.
220
+
221
+ Returns
222
+ -------
223
+ typing.Optional[typing.Any]
224
+ Successful Response
225
+
226
+ Examples
227
+ --------
228
+ import asyncio
229
+
230
+ from usecortex-ai import AsyncCortexAI
231
+
232
+ client = AsyncCortexAI(token="YOUR_TOKEN", )
233
+ async def main() -> None:
234
+ await client.root_get()
235
+ asyncio.run(main())
236
+ """
237
+ _response = await self._raw_client.root_get(request_options=request_options)
238
+ return _response.data
165
239
 
166
240
 
167
241
  def _get_base_url(*, base_url: typing.Optional[str] = None, environment: CortexAIEnvironment) -> str:
@@ -10,7 +10,7 @@ class BaseClientWrapper:
10
10
  def __init__(
11
11
  self,
12
12
  *,
13
- token: typing.Union[str, typing.Callable[[], str]],
13
+ token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
14
14
  headers: typing.Optional[typing.Dict[str, str]] = None,
15
15
  base_url: str,
16
16
  timeout: typing.Optional[float] = None,
@@ -25,11 +25,13 @@ class BaseClientWrapper:
25
25
  "X-Fern-Language": "Python",
26
26
  **(self.get_custom_headers() or {}),
27
27
  }
28
- headers["Authorization"] = f"Bearer {self._get_token()}"
28
+ token = self._get_token()
29
+ if token is not None:
30
+ headers["Authorization"] = f"Bearer {token}"
29
31
  return headers
30
32
 
31
- def _get_token(self) -> str:
32
- if isinstance(self._token, str):
33
+ def _get_token(self) -> typing.Optional[str]:
34
+ if isinstance(self._token, str) or self._token is None:
33
35
  return self._token
34
36
  else:
35
37
  return self._token()
@@ -48,7 +50,7 @@ class SyncClientWrapper(BaseClientWrapper):
48
50
  def __init__(
49
51
  self,
50
52
  *,
51
- token: typing.Union[str, typing.Callable[[], str]],
53
+ token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
52
54
  headers: typing.Optional[typing.Dict[str, str]] = None,
53
55
  base_url: str,
54
56
  timeout: typing.Optional[float] = None,
@@ -67,7 +69,7 @@ class AsyncClientWrapper(BaseClientWrapper):
67
69
  def __init__(
68
70
  self,
69
71
  *,
70
- token: typing.Union[str, typing.Callable[[], str]],
72
+ token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
71
73
  headers: typing.Optional[typing.Dict[str, str]] = None,
72
74
  base_url: str,
73
75
  timeout: typing.Optional[float] = None,
@@ -50,7 +50,7 @@ class DocumentClient:
50
50
  List of source IDs to delete
51
51
 
52
52
  sub_tenant_id : typing.Optional[str]
53
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
53
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
54
54
 
55
55
  request_options : typing.Optional[RequestOptions]
56
56
  Request-specific configuration.
@@ -65,7 +65,7 @@ class DocumentClient:
65
65
  from usecortex-ai import CortexAI
66
66
 
67
67
  client = CortexAI(token="YOUR_TOKEN", )
68
- client.document.delete(tenant_id='tenant_id', source_ids=['source_ids'], )
68
+ client.document.delete(tenant_id='tenant_1234', source_ids=['CortexDoc1234', 'CortexDoc4567'], )
69
69
  """
70
70
  _response = self._raw_client.delete(
71
71
  tenant_id=tenant_id, source_ids=source_ids, sub_tenant_id=sub_tenant_id, request_options=request_options
@@ -112,7 +112,7 @@ class AsyncDocumentClient:
112
112
  List of source IDs to delete
113
113
 
114
114
  sub_tenant_id : typing.Optional[str]
115
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
115
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
116
116
 
117
117
  request_options : typing.Optional[RequestOptions]
118
118
  Request-specific configuration.
@@ -130,7 +130,7 @@ class AsyncDocumentClient:
130
130
 
131
131
  client = AsyncCortexAI(token="YOUR_TOKEN", )
132
132
  async def main() -> None:
133
- await client.document.delete(tenant_id='tenant_id', source_ids=['source_ids'], )
133
+ await client.document.delete(tenant_id='tenant_1234', source_ids=['CortexDoc1234', 'CortexDoc4567'], )
134
134
  asyncio.run(main())
135
135
  """
136
136
  _response = await self._raw_client.delete(
@@ -50,7 +50,7 @@ class RawDocumentClient:
50
50
  List of source IDs to delete
51
51
 
52
52
  sub_tenant_id : typing.Optional[str]
53
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
53
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
54
54
 
55
55
  request_options : typing.Optional[RequestOptions]
56
56
  Request-specific configuration.
@@ -195,7 +195,7 @@ class AsyncRawDocumentClient:
195
195
  List of source IDs to delete
196
196
 
197
197
  sub_tenant_id : typing.Optional[str]
198
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
198
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
199
199
 
200
200
  request_options : typing.Optional[RequestOptions]
201
201
  Request-specific configuration.
@@ -51,7 +51,7 @@ class EmbeddingsClient:
51
51
  Unique identifier for the tenant/organization
52
52
 
53
53
  sub_tenant_id : typing.Optional[str]
54
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
54
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
55
55
 
56
56
  request_options : typing.Optional[RequestOptions]
57
57
  Request-specific configuration.
@@ -66,7 +66,7 @@ class EmbeddingsClient:
66
66
  from usecortex-ai import CortexAI
67
67
 
68
68
  client = CortexAI(token="YOUR_TOKEN", )
69
- client.embeddings.delete(chunk_ids=['chunk_ids'], tenant_id='tenant_id', )
69
+ client.embeddings.delete(chunk_ids=['CortexEmbeddings123_0', 'CortexEmbeddings123_1'], tenant_id='tenant_1234', )
70
70
  """
71
71
  _response = self._raw_client.delete(
72
72
  chunk_ids=chunk_ids, tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
@@ -100,7 +100,7 @@ class EmbeddingsClient:
100
100
  The embedding vector for search
101
101
 
102
102
  sub_tenant_id : typing.Optional[str]
103
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
103
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
104
104
 
105
105
  max_chunks : typing.Optional[int]
106
106
 
@@ -117,7 +117,7 @@ class EmbeddingsClient:
117
117
  from usecortex-ai import CortexAI
118
118
 
119
119
  client = CortexAI(token="YOUR_TOKEN", )
120
- client.embeddings.search(tenant_id='tenant_id', )
120
+ client.embeddings.search(tenant_id='tenant_1234', )
121
121
  """
122
122
  _response = self._raw_client.search(
123
123
  tenant_id=tenant_id,
@@ -150,7 +150,7 @@ class EmbeddingsClient:
150
150
  Unique identifier for the tenant/organization
151
151
 
152
152
  sub_tenant_id : typing.Optional[str]
153
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
153
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
154
154
 
155
155
  request_options : typing.Optional[RequestOptions]
156
156
  Request-specific configuration.
@@ -165,7 +165,7 @@ class EmbeddingsClient:
165
165
  from usecortex-ai import CortexAI
166
166
 
167
167
  client = CortexAI(token="YOUR_TOKEN", )
168
- client.embeddings.get_by_chunk_ids(chunk_ids=['chunk_ids'], tenant_id='tenant_id', )
168
+ client.embeddings.get_by_chunk_ids(chunk_ids=['CortexEmbeddings123_0', 'CortexEmbeddings123_1'], tenant_id='tenant_1234', )
169
169
  """
170
170
  _response = self._raw_client.get_by_chunk_ids(
171
171
  chunk_ids=chunk_ids, tenant_id=tenant_id, sub_tenant_id=sub_tenant_id, request_options=request_options
@@ -198,7 +198,7 @@ class EmbeddingsClient:
198
198
  from usecortex-ai import CortexAI
199
199
 
200
200
  client = CortexAI(token="YOUR_TOKEN", )
201
- client.embeddings.create_collection(tenant_id='tenant_id', )
201
+ client.embeddings.create_collection(tenant_id='tenant_1234', )
202
202
  """
203
203
  _response = self._raw_client.create_collection(tenant_id=tenant_id, request_options=request_options)
204
204
  return _response.data
@@ -241,7 +241,7 @@ class AsyncEmbeddingsClient:
241
241
  Unique identifier for the tenant/organization
242
242
 
243
243
  sub_tenant_id : typing.Optional[str]
244
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
244
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
245
245
 
246
246
  request_options : typing.Optional[RequestOptions]
247
247
  Request-specific configuration.
@@ -259,7 +259,7 @@ class AsyncEmbeddingsClient:
259
259
 
260
260
  client = AsyncCortexAI(token="YOUR_TOKEN", )
261
261
  async def main() -> None:
262
- await client.embeddings.delete(chunk_ids=['chunk_ids'], tenant_id='tenant_id', )
262
+ await client.embeddings.delete(chunk_ids=['CortexEmbeddings123_0', 'CortexEmbeddings123_1'], tenant_id='tenant_1234', )
263
263
  asyncio.run(main())
264
264
  """
265
265
  _response = await self._raw_client.delete(
@@ -294,7 +294,7 @@ class AsyncEmbeddingsClient:
294
294
  The embedding vector for search
295
295
 
296
296
  sub_tenant_id : typing.Optional[str]
297
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
297
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
298
298
 
299
299
  max_chunks : typing.Optional[int]
300
300
 
@@ -314,7 +314,7 @@ class AsyncEmbeddingsClient:
314
314
 
315
315
  client = AsyncCortexAI(token="YOUR_TOKEN", )
316
316
  async def main() -> None:
317
- await client.embeddings.search(tenant_id='tenant_id', )
317
+ await client.embeddings.search(tenant_id='tenant_1234', )
318
318
  asyncio.run(main())
319
319
  """
320
320
  _response = await self._raw_client.search(
@@ -348,7 +348,7 @@ class AsyncEmbeddingsClient:
348
348
  Unique identifier for the tenant/organization
349
349
 
350
350
  sub_tenant_id : typing.Optional[str]
351
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
351
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
352
352
 
353
353
  request_options : typing.Optional[RequestOptions]
354
354
  Request-specific configuration.
@@ -366,7 +366,7 @@ class AsyncEmbeddingsClient:
366
366
 
367
367
  client = AsyncCortexAI(token="YOUR_TOKEN", )
368
368
  async def main() -> None:
369
- await client.embeddings.get_by_chunk_ids(chunk_ids=['chunk_ids'], tenant_id='tenant_id', )
369
+ await client.embeddings.get_by_chunk_ids(chunk_ids=['CortexEmbeddings123_0', 'CortexEmbeddings123_1'], tenant_id='tenant_1234', )
370
370
  asyncio.run(main())
371
371
  """
372
372
  _response = await self._raw_client.get_by_chunk_ids(
@@ -403,7 +403,7 @@ class AsyncEmbeddingsClient:
403
403
 
404
404
  client = AsyncCortexAI(token="YOUR_TOKEN", )
405
405
  async def main() -> None:
406
- await client.embeddings.create_collection(tenant_id='tenant_id', )
406
+ await client.embeddings.create_collection(tenant_id='tenant_1234', )
407
407
  asyncio.run(main())
408
408
  """
409
409
  _response = await self._raw_client.create_collection(tenant_id=tenant_id, request_options=request_options)
@@ -51,7 +51,7 @@ class RawEmbeddingsClient:
51
51
  Unique identifier for the tenant/organization
52
52
 
53
53
  sub_tenant_id : typing.Optional[str]
54
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
54
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
55
55
 
56
56
  request_options : typing.Optional[RequestOptions]
57
57
  Request-specific configuration.
@@ -194,7 +194,7 @@ class RawEmbeddingsClient:
194
194
  The embedding vector for search
195
195
 
196
196
  sub_tenant_id : typing.Optional[str]
197
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
197
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
198
198
 
199
199
  max_chunks : typing.Optional[int]
200
200
 
@@ -335,7 +335,7 @@ class RawEmbeddingsClient:
335
335
  Unique identifier for the tenant/organization
336
336
 
337
337
  sub_tenant_id : typing.Optional[str]
338
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
338
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
339
339
 
340
340
  request_options : typing.Optional[RequestOptions]
341
341
  Request-specific configuration.
@@ -346,7 +346,7 @@ class RawEmbeddingsClient:
346
346
  Successful Response
347
347
  """
348
348
  _response = self._client_wrapper.httpx_client.request(
349
- "embeddings/by-chunk-ids",
349
+ "embeddings/retrieve_by_ids",
350
350
  method="POST",
351
351
  json={
352
352
  "chunk_ids": chunk_ids,
@@ -473,7 +473,7 @@ class RawEmbeddingsClient:
473
473
  Successful Response
474
474
  """
475
475
  _response = self._client_wrapper.httpx_client.request(
476
- "embeddings/create_embeddings_tenant",
476
+ "embeddings/create_tenant",
477
477
  method="POST",
478
478
  params={
479
479
  "tenant_id": tenant_id,
@@ -599,7 +599,7 @@ class AsyncRawEmbeddingsClient:
599
599
  Unique identifier for the tenant/organization
600
600
 
601
601
  sub_tenant_id : typing.Optional[str]
602
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
602
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
603
603
 
604
604
  request_options : typing.Optional[RequestOptions]
605
605
  Request-specific configuration.
@@ -742,7 +742,7 @@ class AsyncRawEmbeddingsClient:
742
742
  The embedding vector for search
743
743
 
744
744
  sub_tenant_id : typing.Optional[str]
745
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
745
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
746
746
 
747
747
  max_chunks : typing.Optional[int]
748
748
 
@@ -883,7 +883,7 @@ class AsyncRawEmbeddingsClient:
883
883
  Unique identifier for the tenant/organization
884
884
 
885
885
  sub_tenant_id : typing.Optional[str]
886
- Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id
886
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
887
887
 
888
888
  request_options : typing.Optional[RequestOptions]
889
889
  Request-specific configuration.
@@ -894,7 +894,7 @@ class AsyncRawEmbeddingsClient:
894
894
  Successful Response
895
895
  """
896
896
  _response = await self._client_wrapper.httpx_client.request(
897
- "embeddings/by-chunk-ids",
897
+ "embeddings/retrieve_by_ids",
898
898
  method="POST",
899
899
  json={
900
900
  "chunk_ids": chunk_ids,
@@ -1021,7 +1021,7 @@ class AsyncRawEmbeddingsClient:
1021
1021
  Successful Response
1022
1022
  """
1023
1023
  _response = await self._client_wrapper.httpx_client.request(
1024
- "embeddings/create_embeddings_tenant",
1024
+ "embeddings/create_tenant",
1025
1025
  method="POST",
1026
1026
  params={
1027
1027
  "tenant_id": tenant_id,
@@ -40,19 +40,14 @@ class FetchClient:
40
40
  Parameters
41
41
  ----------
42
42
  file_id : str
43
- Unique identifier for the file to fetch
44
43
 
45
44
  file_type : str
46
- Type of file (e.g., 'app', 'file', or other)
47
45
 
48
46
  tenant_id : str
49
- Tenant identifier for multi-tenancy
50
47
 
51
48
  return_content : typing.Optional[bool]
52
- Whether to return the file content along with the URL
53
49
 
54
50
  sub_tenant_id : typing.Optional[str]
55
- Sub-tenant identifier, defaults to tenant_id if not provided
56
51
 
57
52
  request_options : typing.Optional[RequestOptions]
58
53
  Request-specific configuration.
@@ -67,7 +62,7 @@ class FetchClient:
67
62
  from usecortex-ai import CortexAI
68
63
 
69
64
  client = CortexAI(token="YOUR_TOKEN", )
70
- client.fetch.fetch_content(file_id='file_id', file_type='file_type', tenant_id='tenant_id', )
65
+ client.fetch.fetch_content(file_id='CortexDoc1234', file_type='<file_type>', tenant_id='tenant_1234', )
71
66
  """
72
67
  _response = self._raw_client.fetch_content(
73
68
  file_id=file_id,
@@ -109,19 +104,14 @@ class AsyncFetchClient:
109
104
  Parameters
110
105
  ----------
111
106
  file_id : str
112
- Unique identifier for the file to fetch
113
107
 
114
108
  file_type : str
115
- Type of file (e.g., 'app', 'file', or other)
116
109
 
117
110
  tenant_id : str
118
- Tenant identifier for multi-tenancy
119
111
 
120
112
  return_content : typing.Optional[bool]
121
- Whether to return the file content along with the URL
122
113
 
123
114
  sub_tenant_id : typing.Optional[str]
124
- Sub-tenant identifier, defaults to tenant_id if not provided
125
115
 
126
116
  request_options : typing.Optional[RequestOptions]
127
117
  Request-specific configuration.
@@ -139,7 +129,7 @@ class AsyncFetchClient:
139
129
 
140
130
  client = AsyncCortexAI(token="YOUR_TOKEN", )
141
131
  async def main() -> None:
142
- await client.fetch.fetch_content(file_id='file_id', file_type='file_type', tenant_id='tenant_id', )
132
+ await client.fetch.fetch_content(file_id='CortexDoc1234', file_type='<file_type>', tenant_id='tenant_1234', )
143
133
  asyncio.run(main())
144
134
  """
145
135
  _response = await self._raw_client.fetch_content(
@@ -40,19 +40,14 @@ class RawFetchClient:
40
40
  Parameters
41
41
  ----------
42
42
  file_id : str
43
- Unique identifier for the file to fetch
44
43
 
45
44
  file_type : str
46
- Type of file (e.g., 'app', 'file', or other)
47
45
 
48
46
  tenant_id : str
49
- Tenant identifier for multi-tenancy
50
47
 
51
48
  return_content : typing.Optional[bool]
52
- Whether to return the file content along with the URL
53
49
 
54
50
  sub_tenant_id : typing.Optional[str]
55
- Sub-tenant identifier, defaults to tenant_id if not provided
56
51
 
57
52
  request_options : typing.Optional[RequestOptions]
58
53
  Request-specific configuration.
@@ -189,19 +184,14 @@ class AsyncRawFetchClient:
189
184
  Parameters
190
185
  ----------
191
186
  file_id : str
192
- Unique identifier for the file to fetch
193
187
 
194
188
  file_type : str
195
- Type of file (e.g., 'app', 'file', or other)
196
189
 
197
190
  tenant_id : str
198
- Tenant identifier for multi-tenancy
199
191
 
200
192
  return_content : typing.Optional[bool]
201
- Whether to return the file content along with the URL
202
193
 
203
194
  sub_tenant_id : typing.Optional[str]
204
- Sub-tenant identifier, defaults to tenant_id if not provided
205
195
 
206
196
  request_options : typing.Optional[RequestOptions]
207
197
  Request-specific configuration.
@@ -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)