@usecortex_ai/node 0.2.1 → 0.3.1
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.
- package/README.md +6 -18
- package/dist/Client.d.ts +14 -5
- package/dist/Client.js +68 -12
- package/dist/api/resources/document/client/Client.d.ts +5 -5
- package/dist/api/resources/document/client/Client.js +8 -4
- package/dist/api/resources/embeddings/client/Client.d.ts +9 -9
- package/dist/api/resources/embeddings/client/Client.js +16 -12
- package/dist/api/resources/embeddings/client/requests/EmbeddingsCreateCollectionRequest.d.ts +1 -1
- package/dist/api/resources/embeddings/client/requests/EmbeddingsDeleteRequest.d.ts +3 -3
- package/dist/api/resources/embeddings/client/requests/EmbeddingsSearchRequest.d.ts +2 -2
- package/dist/api/resources/embeddings/client/requests/GetEmbeddingsBasedOnChunkIdsRequest.d.ts +3 -3
- package/dist/api/resources/fetch/client/Client.d.ts +6 -6
- package/dist/api/resources/fetch/client/Client.js +9 -5
- package/dist/api/resources/fetch/client/requests/FetchContentRequest.d.ts +3 -8
- package/dist/api/resources/index.d.ts +1 -1
- package/dist/api/resources/index.js +2 -2
- package/dist/api/resources/search/client/Client.d.ts +11 -11
- package/dist/api/resources/search/client/Client.js +14 -10
- package/dist/api/resources/search/client/requests/FullTextSearchRequest.d.ts +3 -3
- package/dist/api/resources/search/client/requests/QnARequest.d.ts +3 -3
- package/dist/api/resources/search/client/requests/SearchRequest.d.ts +5 -3
- package/dist/api/resources/sources/client/Client.d.ts +7 -6
- package/dist/api/resources/sources/client/Client.js +10 -5
- package/dist/api/resources/sources/client/requests/SourceBodyParams.d.ts +6 -2
- package/dist/api/resources/sources/client/requests/SourcesGetAllRequest.d.ts +3 -2
- package/dist/api/resources/tenant/client/Client.d.ts +8 -7
- package/dist/api/resources/tenant/client/Client.js +11 -6
- package/dist/api/resources/tenant/client/requests/TenantDeleteSubTenantRequest.d.ts +2 -2
- package/dist/api/resources/tenant/client/requests/TenantGetSubTenantIdsRequest.d.ts +1 -1
- package/dist/api/resources/tenant/client/requests/TenantStatsRequest.d.ts +3 -2
- package/dist/api/resources/upload/client/Client.d.ts +47 -32
- package/dist/api/resources/upload/client/Client.js +56 -31
- package/dist/api/resources/upload/client/requests/BodyBatchUpdateUploadBatchUpdatePatch.d.ts +3 -2
- package/dist/api/resources/upload/client/requests/BodyBatchUploadUploadBatchUploadPost.d.ts +5 -2
- package/dist/api/resources/upload/client/requests/BodyUpdateFileUploadUpdateDocumentPatch.d.ts +4 -3
- package/dist/api/resources/upload/client/requests/BodyUploadFilesUploadUploadDocumentPost.d.ts +5 -2
- package/dist/api/resources/upload/client/requests/EmbeddingsUpdateRequest.d.ts +3 -2
- package/dist/api/resources/upload/client/requests/EmbeddingsUploadRequest.d.ts +4 -3
- package/dist/api/resources/upload/client/requests/UploadScrapeWebpageRequest.d.ts +5 -3
- package/dist/api/resources/upload/client/requests/UploadUpdateMarkdownRequest.d.ts +5 -4
- package/dist/api/resources/upload/client/requests/UploadUpdateTextRequest.d.ts +5 -4
- package/dist/api/resources/upload/client/requests/UploadUpdateWebpageRequest.d.ts +5 -4
- package/dist/api/resources/upload/client/requests/UploadUploadAppSourcesRequest.d.ts +3 -2
- package/dist/api/resources/upload/client/requests/UploadUploadMarkdownRequest.d.ts +4 -3
- package/dist/api/resources/upload/client/requests/UploadUploadTextRequest.d.ts +4 -3
- package/dist/api/resources/upload/client/requests/UploadVerifyProcessingRequest.d.ts +2 -1
- package/dist/api/resources/user/client/Client.d.ts +6 -4
- package/dist/api/resources/user/client/Client.js +13 -4
- package/dist/api/resources/user/client/requests/BodyCreateTenantUserCreateTenantPost.d.ts +4 -1
- package/dist/api/resources/userMemory/client/Client.d.ts +19 -13
- package/dist/api/resources/userMemory/client/Client.js +22 -12
- package/dist/api/resources/userMemory/client/requests/AddUserMemoryRequest.d.ts +4 -3
- package/dist/api/resources/userMemory/client/requests/GenerateUserMemoryRequest.d.ts +6 -5
- package/dist/api/resources/userMemory/client/requests/RetrieveUserMemoryRequest.d.ts +7 -3
- package/dist/api/resources/userMemory/client/requests/UserMemoryDeleteUserMemoryRequest.d.ts +4 -3
- package/dist/api/resources/userMemory/client/requests/UserMemoryListUserMemoriesRequest.d.ts +3 -2
- package/dist/api/types/DeleteMemoryRequest.d.ts +1 -1
- package/dist/api/types/MarkdownUploadRequest.d.ts +2 -0
- package/dist/api/types/SubTenantIdsData.d.ts +2 -0
- package/dist/api/types/TenantStats.d.ts +2 -2
- package/package.json +1 -1
- package/dist/api/resources/sources/client/requests/SourcesGetSubTenantIdsRequest.d.ts +0 -12
- package/dist/api/resources/sources/client/requests/SourcesGetSubTenantIdsRequest.js +0 -5
- package/dist/api/resources/upload/client/requests/BodyUpdateMarkdownUploadUpdateMarkdownPatch.d.ts +0 -21
- package/dist/api/resources/upload/client/requests/BodyUpdateMarkdownUploadUpdateMarkdownPatch.js +0 -5
- package/dist/api/resources/upload/client/requests/BodyUpdateMarkdownUploadUpdateTextPatch.d.ts +0 -21
- package/dist/api/resources/upload/client/requests/BodyUpdateMarkdownUploadUpdateTextPatch.js +0 -5
- package/dist/api/resources/upload/client/requests/BodyUploadMarkdownUploadUploadMarkdownPost.d.ts +0 -19
- package/dist/api/resources/upload/client/requests/BodyUploadMarkdownUploadUploadMarkdownPost.js +0 -5
- package/dist/api/resources/upload/client/requests/BodyUploadMarkdownUploadUploadTextPost.d.ts +0 -19
- package/dist/api/resources/upload/client/requests/BodyUploadMarkdownUploadUploadTextPost.js +0 -5
- package/dist/api/resources/userMemory/client/requests/UserMemoryAddUserMemoryRequest.d.ts +0 -16
- package/dist/api/resources/userMemory/client/requests/UserMemoryAddUserMemoryRequest.js +0 -5
- package/dist/api/resources/userMemory/client/requests/UserMemoryGenerateUserMemoryRequest.d.ts +0 -18
- package/dist/api/resources/userMemory/client/requests/UserMemoryGenerateUserMemoryRequest.js +0 -5
- package/dist/api/resources/userMemory/client/requests/UserMemoryRetrieveUserMemoryRequest.d.ts +0 -17
- package/dist/api/resources/userMemory/client/requests/UserMemoryRetrieveUserMemoryRequest.js +0 -5
- package/dist/api/types/SourceContent.d.ts +0 -11
- package/dist/api/types/SourceContent.js +0 -5
|
@@ -44,7 +44,7 @@ const CortexAI = __importStar(require("../../../index.js"));
|
|
|
44
44
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
45
45
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
46
46
|
class Upload {
|
|
47
|
-
constructor(_options) {
|
|
47
|
+
constructor(_options = {}) {
|
|
48
48
|
this._options = _options;
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
@@ -69,7 +69,8 @@ class Upload {
|
|
|
69
69
|
* import { createReadStream } from "fs";
|
|
70
70
|
* await client.upload.batchUpload({
|
|
71
71
|
* files: [fs.createReadStream("/path/to/your/file")],
|
|
72
|
-
* tenant_id: "
|
|
72
|
+
* tenant_id: "tenant_1234",
|
|
73
|
+
* sub_tenant_id: "sub_tenant_4567"
|
|
73
74
|
* })
|
|
74
75
|
*/
|
|
75
76
|
batchUpload(request, requestOptions) {
|
|
@@ -86,6 +87,9 @@ class Upload {
|
|
|
86
87
|
for (const _file of request.files) {
|
|
87
88
|
await _request.appendFile("files", _file);
|
|
88
89
|
}
|
|
90
|
+
if (request.file_ids != null) {
|
|
91
|
+
_request.append("file_ids", request.file_ids);
|
|
92
|
+
}
|
|
89
93
|
if (request.tenant_metadata != null) {
|
|
90
94
|
_request.append("tenant_metadata", request.tenant_metadata);
|
|
91
95
|
}
|
|
@@ -171,7 +175,8 @@ class Upload {
|
|
|
171
175
|
* import { createReadStream } from "fs";
|
|
172
176
|
* await client.upload.batchUpdate({
|
|
173
177
|
* files: [fs.createReadStream("/path/to/your/file")],
|
|
174
|
-
* tenant_id: "
|
|
178
|
+
* tenant_id: "tenant_1234",
|
|
179
|
+
* sub_tenant_id: "sub_tenant_4567"
|
|
175
180
|
* })
|
|
176
181
|
*/
|
|
177
182
|
batchUpdate(request, requestOptions) {
|
|
@@ -278,7 +283,8 @@ class Upload {
|
|
|
278
283
|
* import { createReadStream } from "fs";
|
|
279
284
|
* await client.upload.uploadDocument({
|
|
280
285
|
* file: fs.createReadStream("/path/to/your/file"),
|
|
281
|
-
* tenant_id: "
|
|
286
|
+
* tenant_id: "tenant_1234",
|
|
287
|
+
* sub_tenant_id: "sub_tenant_4567"
|
|
282
288
|
* })
|
|
283
289
|
*/
|
|
284
290
|
uploadDocument(request, requestOptions) {
|
|
@@ -293,6 +299,9 @@ class Upload {
|
|
|
293
299
|
}
|
|
294
300
|
const _request = await core.newFormData();
|
|
295
301
|
await _request.appendFile("file", request.file);
|
|
302
|
+
if (request.file_id != null) {
|
|
303
|
+
_request.append("file_id", request.file_id);
|
|
304
|
+
}
|
|
296
305
|
if (request.tenant_metadata != null) {
|
|
297
306
|
_request.append("tenant_metadata", request.tenant_metadata);
|
|
298
307
|
}
|
|
@@ -378,8 +387,9 @@ class Upload {
|
|
|
378
387
|
* import { createReadStream } from "fs";
|
|
379
388
|
* await client.upload.updateDocument({
|
|
380
389
|
* file: fs.createReadStream("/path/to/your/file"),
|
|
381
|
-
* source_id: "
|
|
382
|
-
* tenant_id: "
|
|
390
|
+
* source_id: "CortexDoc1234",
|
|
391
|
+
* tenant_id: "tenant_1234",
|
|
392
|
+
* sub_tenant_id: "sub_tenant_4567"
|
|
383
393
|
* })
|
|
384
394
|
*/
|
|
385
395
|
updateDocument(request, requestOptions) {
|
|
@@ -478,7 +488,8 @@ class Upload {
|
|
|
478
488
|
*
|
|
479
489
|
* @example
|
|
480
490
|
* await client.upload.uploadAppSources({
|
|
481
|
-
* tenant_id: "
|
|
491
|
+
* tenant_id: "tenant_1234",
|
|
492
|
+
* sub_tenant_id: "sub_tenant_4567",
|
|
482
493
|
* body: [{}]
|
|
483
494
|
* })
|
|
484
495
|
*/
|
|
@@ -569,9 +580,10 @@ class Upload {
|
|
|
569
580
|
*
|
|
570
581
|
* @example
|
|
571
582
|
* await client.upload.uploadMarkdown({
|
|
572
|
-
* tenant_id: "
|
|
583
|
+
* tenant_id: "tenant_1234",
|
|
584
|
+
* sub_tenant_id: "sub_tenant_4567",
|
|
573
585
|
* body: {
|
|
574
|
-
* content: "content"
|
|
586
|
+
* content: "<content>"
|
|
575
587
|
* }
|
|
576
588
|
* })
|
|
577
589
|
*/
|
|
@@ -662,9 +674,10 @@ class Upload {
|
|
|
662
674
|
*
|
|
663
675
|
* @example
|
|
664
676
|
* await client.upload.uploadText({
|
|
665
|
-
* tenant_id: "
|
|
677
|
+
* tenant_id: "tenant_1234",
|
|
678
|
+
* sub_tenant_id: "sub_tenant_4567",
|
|
666
679
|
* body: {
|
|
667
|
-
* content: "content"
|
|
680
|
+
* content: "<content>"
|
|
668
681
|
* }
|
|
669
682
|
* })
|
|
670
683
|
*/
|
|
@@ -755,10 +768,11 @@ class Upload {
|
|
|
755
768
|
*
|
|
756
769
|
* @example
|
|
757
770
|
* await client.upload.updateMarkdown({
|
|
758
|
-
* source_id: "
|
|
759
|
-
* tenant_id: "
|
|
771
|
+
* source_id: "CortexDoc1234",
|
|
772
|
+
* tenant_id: "tenant_1234",
|
|
773
|
+
* sub_tenant_id: "sub_tenant_4567",
|
|
760
774
|
* body: {
|
|
761
|
-
* content: "content"
|
|
775
|
+
* content: "<content>"
|
|
762
776
|
* }
|
|
763
777
|
* })
|
|
764
778
|
*/
|
|
@@ -850,10 +864,11 @@ class Upload {
|
|
|
850
864
|
*
|
|
851
865
|
* @example
|
|
852
866
|
* await client.upload.updateText({
|
|
853
|
-
* source_id: "
|
|
854
|
-
* tenant_id: "
|
|
867
|
+
* source_id: "CortexDoc1234",
|
|
868
|
+
* tenant_id: "tenant_1234",
|
|
869
|
+
* sub_tenant_id: "sub_tenant_4567",
|
|
855
870
|
* body: {
|
|
856
|
-
* content: "content"
|
|
871
|
+
* content: "<content>"
|
|
857
872
|
* }
|
|
858
873
|
* })
|
|
859
874
|
*/
|
|
@@ -945,8 +960,9 @@ class Upload {
|
|
|
945
960
|
*
|
|
946
961
|
* @example
|
|
947
962
|
* await client.upload.uploadEmbeddings({
|
|
948
|
-
* tenant_id: "
|
|
949
|
-
*
|
|
963
|
+
* tenant_id: "tenant_1234",
|
|
964
|
+
* sub_tenant_id: "sub_tenant_4567",
|
|
965
|
+
* embeddings: [[0.123413, 0.655367, 0.987654, 0.123456, 0.789012], [0.123413, 0.655367, 0.987654, 0.123456, 0.789012]]
|
|
950
966
|
* })
|
|
951
967
|
*/
|
|
952
968
|
uploadEmbeddings(request, requestOptions) {
|
|
@@ -1036,7 +1052,8 @@ class Upload {
|
|
|
1036
1052
|
*
|
|
1037
1053
|
* @example
|
|
1038
1054
|
* await client.upload.updateEmbeddings({
|
|
1039
|
-
* tenant_id: "
|
|
1055
|
+
* tenant_id: "tenant_1234",
|
|
1056
|
+
* sub_tenant_id: "sub_tenant_4567"
|
|
1040
1057
|
* })
|
|
1041
1058
|
*/
|
|
1042
1059
|
updateEmbeddings(request, requestOptions) {
|
|
@@ -1126,8 +1143,10 @@ class Upload {
|
|
|
1126
1143
|
*
|
|
1127
1144
|
* @example
|
|
1128
1145
|
* await client.upload.scrapeWebpage({
|
|
1129
|
-
* web_url: "
|
|
1130
|
-
* tenant_id: "
|
|
1146
|
+
* web_url: "https://www.usecortex.ai/",
|
|
1147
|
+
* tenant_id: "tenant_1234",
|
|
1148
|
+
* sub_tenant_id: "sub_tenant_4567",
|
|
1149
|
+
* file_id: "CortexDoc1234",
|
|
1131
1150
|
* body: {}
|
|
1132
1151
|
* })
|
|
1133
1152
|
*/
|
|
@@ -1222,9 +1241,10 @@ class Upload {
|
|
|
1222
1241
|
*
|
|
1223
1242
|
* @example
|
|
1224
1243
|
* await client.upload.updateWebpage({
|
|
1225
|
-
* web_url: "
|
|
1226
|
-
* source_id: "
|
|
1227
|
-
* tenant_id: "
|
|
1244
|
+
* web_url: "https://www.usecortex.ai/",
|
|
1245
|
+
* source_id: "CortexDoc1234",
|
|
1246
|
+
* tenant_id: "tenant_1234",
|
|
1247
|
+
* sub_tenant_id: "sub_tenant_4567",
|
|
1228
1248
|
* body: {}
|
|
1229
1249
|
* })
|
|
1230
1250
|
*/
|
|
@@ -1311,8 +1331,8 @@ class Upload {
|
|
|
1311
1331
|
*
|
|
1312
1332
|
* @example
|
|
1313
1333
|
* await client.upload.deleteSource({
|
|
1314
|
-
* tenant_id: "
|
|
1315
|
-
* source_ids: ["
|
|
1334
|
+
* tenant_id: "tenant_1234",
|
|
1335
|
+
* source_ids: ["CortexDoc1234", "CortexDoc4567"]
|
|
1316
1336
|
* })
|
|
1317
1337
|
*/
|
|
1318
1338
|
deleteSource(request, requestOptions) {
|
|
@@ -1378,8 +1398,8 @@ class Upload {
|
|
|
1378
1398
|
*
|
|
1379
1399
|
* @example
|
|
1380
1400
|
* await client.upload.deleteMemory({
|
|
1381
|
-
* tenant_id: "
|
|
1382
|
-
* source_ids: ["
|
|
1401
|
+
* tenant_id: "tenant_1234",
|
|
1402
|
+
* source_ids: ["CortexDoc1234", "CortexDoc4567"]
|
|
1383
1403
|
* })
|
|
1384
1404
|
*/
|
|
1385
1405
|
deleteMemory(request, requestOptions) {
|
|
@@ -1451,7 +1471,8 @@ class Upload {
|
|
|
1451
1471
|
*
|
|
1452
1472
|
* @example
|
|
1453
1473
|
* await client.upload.verifyProcessing({
|
|
1454
|
-
* file_id: "
|
|
1474
|
+
* file_id: "CortexDoc1234",
|
|
1475
|
+
* tenant_id: "tenant_1234"
|
|
1455
1476
|
* })
|
|
1456
1477
|
*/
|
|
1457
1478
|
verifyProcessing(request, requestOptions) {
|
|
@@ -1519,7 +1540,11 @@ class Upload {
|
|
|
1519
1540
|
}
|
|
1520
1541
|
}
|
|
1521
1542
|
async _getAuthorizationHeader() {
|
|
1522
|
-
|
|
1543
|
+
const bearer = await core.Supplier.get(this._options.token);
|
|
1544
|
+
if (bearer != null) {
|
|
1545
|
+
return `Bearer ${bearer}`;
|
|
1546
|
+
}
|
|
1547
|
+
return undefined;
|
|
1523
1548
|
}
|
|
1524
1549
|
}
|
|
1525
1550
|
exports.Upload = Upload;
|
package/dist/api/resources/upload/client/requests/BodyBatchUpdateUploadBatchUpdatePatch.d.ts
CHANGED
|
@@ -6,13 +6,14 @@ import * as core from "../../../../../core/index.js";
|
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
8
|
* files: [fs.createReadStream("/path/to/your/file")],
|
|
9
|
-
* tenant_id: "
|
|
9
|
+
* tenant_id: "tenant_1234",
|
|
10
|
+
* sub_tenant_id: "sub_tenant_4567"
|
|
10
11
|
* }
|
|
11
12
|
*/
|
|
12
13
|
export interface BodyBatchUpdateUploadBatchUpdatePatch {
|
|
13
14
|
/** Unique identifier for the tenant/organization */
|
|
14
15
|
tenant_id: string;
|
|
15
|
-
/** Optional sub-tenant identifier
|
|
16
|
+
/** Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used. */
|
|
16
17
|
sub_tenant_id?: string;
|
|
17
18
|
/** The document file to upload (e.g., PDF, DOCX, TXT) */
|
|
18
19
|
files: core.file.Uploadable.FileLike[];
|
|
@@ -6,16 +6,19 @@ import * as core from "../../../../../core/index.js";
|
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
8
|
* files: [fs.createReadStream("/path/to/your/file")],
|
|
9
|
-
* tenant_id: "
|
|
9
|
+
* tenant_id: "tenant_1234",
|
|
10
|
+
* sub_tenant_id: "sub_tenant_4567"
|
|
10
11
|
* }
|
|
11
12
|
*/
|
|
12
13
|
export interface BodyBatchUploadUploadBatchUploadPost {
|
|
13
14
|
/** Unique identifier for the tenant/organization */
|
|
14
15
|
tenant_id: string;
|
|
15
|
-
/** Optional sub-tenant identifier
|
|
16
|
+
/** Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used. */
|
|
16
17
|
sub_tenant_id?: string;
|
|
17
18
|
/** The document file to upload (e.g., PDF, DOCX, TXT) */
|
|
18
19
|
files: core.file.Uploadable.FileLike[];
|
|
20
|
+
/** Optional JSON string array of file IDs for the uploaded content. If not provided or empty, will be generated automatically. */
|
|
21
|
+
file_ids?: string;
|
|
19
22
|
/**
|
|
20
23
|
* JSON string containing tenant-level document metadata (e.g., department, compliance_tag)
|
|
21
24
|
*
|
package/dist/api/resources/upload/client/requests/BodyUpdateFileUploadUpdateDocumentPatch.d.ts
CHANGED
|
@@ -6,8 +6,9 @@ import * as core from "../../../../../core/index.js";
|
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
8
|
* file: fs.createReadStream("/path/to/your/file"),
|
|
9
|
-
* source_id: "
|
|
10
|
-
* tenant_id: "
|
|
9
|
+
* source_id: "CortexDoc1234",
|
|
10
|
+
* tenant_id: "tenant_1234",
|
|
11
|
+
* sub_tenant_id: "sub_tenant_4567"
|
|
11
12
|
* }
|
|
12
13
|
*/
|
|
13
14
|
export interface BodyUpdateFileUploadUpdateDocumentPatch {
|
|
@@ -15,7 +16,7 @@ export interface BodyUpdateFileUploadUpdateDocumentPatch {
|
|
|
15
16
|
source_id: string;
|
|
16
17
|
/** Unique identifier for the tenant/organization */
|
|
17
18
|
tenant_id: string;
|
|
18
|
-
/** Optional sub-tenant identifier
|
|
19
|
+
/** Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used. */
|
|
19
20
|
sub_tenant_id?: string;
|
|
20
21
|
/** The document file to upload (e.g., PDF, DOCX, TXT) */
|
|
21
22
|
file: core.file.Uploadable.FileLike;
|
package/dist/api/resources/upload/client/requests/BodyUploadFilesUploadUploadDocumentPost.d.ts
CHANGED
|
@@ -6,16 +6,19 @@ import * as core from "../../../../../core/index.js";
|
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
8
|
* file: fs.createReadStream("/path/to/your/file"),
|
|
9
|
-
* tenant_id: "
|
|
9
|
+
* tenant_id: "tenant_1234",
|
|
10
|
+
* sub_tenant_id: "sub_tenant_4567"
|
|
10
11
|
* }
|
|
11
12
|
*/
|
|
12
13
|
export interface BodyUploadFilesUploadUploadDocumentPost {
|
|
13
14
|
/** Unique identifier for the tenant/organization */
|
|
14
15
|
tenant_id: string;
|
|
15
|
-
/** Optional sub-tenant identifier
|
|
16
|
+
/** Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used. */
|
|
16
17
|
sub_tenant_id?: string;
|
|
17
18
|
/** The document file to upload (e.g., PDF, DOCX, TXT) */
|
|
18
19
|
file: core.file.Uploadable.FileLike;
|
|
20
|
+
/** Optional file ID for the uploaded content. If not provided, will be generated automatically. */
|
|
21
|
+
file_id?: string;
|
|
19
22
|
/**
|
|
20
23
|
* JSON string containing tenant-level document metadata (e.g., department, compliance_tag)
|
|
21
24
|
*
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* @example
|
|
6
6
|
* {
|
|
7
|
-
* tenant_id: "
|
|
7
|
+
* tenant_id: "tenant_1234",
|
|
8
|
+
* sub_tenant_id: "sub_tenant_4567"
|
|
8
9
|
* }
|
|
9
10
|
*/
|
|
10
11
|
export interface EmbeddingsUpdateRequest {
|
|
11
12
|
/** Unique identifier for the tenant/organization */
|
|
12
13
|
tenant_id: string;
|
|
13
|
-
/** Optional sub-tenant identifier
|
|
14
|
+
/** Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used. */
|
|
14
15
|
sub_tenant_id?: string;
|
|
15
16
|
/** The embeddings of source you want to index */
|
|
16
17
|
embeddings?: Record<string, number[]>;
|
|
@@ -4,14 +4,15 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* @example
|
|
6
6
|
* {
|
|
7
|
-
* tenant_id: "
|
|
8
|
-
*
|
|
7
|
+
* tenant_id: "tenant_1234",
|
|
8
|
+
* sub_tenant_id: "sub_tenant_4567",
|
|
9
|
+
* embeddings: [[0.123413, 0.655367, 0.987654, 0.123456, 0.789012], [0.123413, 0.655367, 0.987654, 0.123456, 0.789012]]
|
|
9
10
|
* }
|
|
10
11
|
*/
|
|
11
12
|
export interface EmbeddingsUploadRequest {
|
|
12
13
|
/** Unique identifier for the tenant/organization */
|
|
13
14
|
tenant_id: string;
|
|
14
|
-
/** Optional sub-tenant identifier
|
|
15
|
+
/** Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used. */
|
|
15
16
|
sub_tenant_id?: string;
|
|
16
17
|
/** The embeddings of source you want to index */
|
|
17
18
|
embeddings: number[][];
|
|
@@ -5,8 +5,10 @@ import * as CortexAI from "../../../../index.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
|
-
* web_url: "
|
|
9
|
-
* tenant_id: "
|
|
8
|
+
* web_url: "https://www.usecortex.ai/",
|
|
9
|
+
* tenant_id: "tenant_1234",
|
|
10
|
+
* sub_tenant_id: "sub_tenant_4567",
|
|
11
|
+
* file_id: "CortexDoc1234",
|
|
10
12
|
* body: {}
|
|
11
13
|
* }
|
|
12
14
|
*/
|
|
@@ -15,7 +17,7 @@ export interface UploadScrapeWebpageRequest {
|
|
|
15
17
|
web_url: string;
|
|
16
18
|
/** Unique identifier for the tenant/organization */
|
|
17
19
|
tenant_id: string;
|
|
18
|
-
/** Optional sub-tenant identifier
|
|
20
|
+
/** Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used. */
|
|
19
21
|
sub_tenant_id?: string;
|
|
20
22
|
/** Optional custom file ID for the scraped content. If not provided, a unique ID will be generated */
|
|
21
23
|
file_id?: string;
|
|
@@ -5,10 +5,11 @@ import * as CortexAI from "../../../../index.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
|
-
* source_id: "
|
|
9
|
-
* tenant_id: "
|
|
8
|
+
* source_id: "CortexDoc1234",
|
|
9
|
+
* tenant_id: "tenant_1234",
|
|
10
|
+
* sub_tenant_id: "sub_tenant_4567",
|
|
10
11
|
* body: {
|
|
11
|
-
* content: "content"
|
|
12
|
+
* content: "<content>"
|
|
12
13
|
* }
|
|
13
14
|
* }
|
|
14
15
|
*/
|
|
@@ -17,7 +18,7 @@ export interface UploadUpdateMarkdownRequest {
|
|
|
17
18
|
source_id: string;
|
|
18
19
|
/** Unique identifier for the tenant/organization */
|
|
19
20
|
tenant_id: string;
|
|
20
|
-
/** Optional sub-tenant identifier
|
|
21
|
+
/** Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used. */
|
|
21
22
|
sub_tenant_id?: string;
|
|
22
23
|
body: CortexAI.MarkdownUploadRequest;
|
|
23
24
|
}
|
|
@@ -5,10 +5,11 @@ import * as CortexAI from "../../../../index.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
|
-
* source_id: "
|
|
9
|
-
* tenant_id: "
|
|
8
|
+
* source_id: "CortexDoc1234",
|
|
9
|
+
* tenant_id: "tenant_1234",
|
|
10
|
+
* sub_tenant_id: "sub_tenant_4567",
|
|
10
11
|
* body: {
|
|
11
|
-
* content: "content"
|
|
12
|
+
* content: "<content>"
|
|
12
13
|
* }
|
|
13
14
|
* }
|
|
14
15
|
*/
|
|
@@ -17,7 +18,7 @@ export interface UploadUpdateTextRequest {
|
|
|
17
18
|
source_id: string;
|
|
18
19
|
/** Unique identifier for the tenant/organization */
|
|
19
20
|
tenant_id: string;
|
|
20
|
-
/** Optional sub-tenant identifier
|
|
21
|
+
/** Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used. */
|
|
21
22
|
sub_tenant_id?: string;
|
|
22
23
|
body: CortexAI.MarkdownUploadRequest;
|
|
23
24
|
}
|
|
@@ -5,9 +5,10 @@ import * as CortexAI from "../../../../index.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
|
-
* web_url: "
|
|
9
|
-
* source_id: "
|
|
10
|
-
* tenant_id: "
|
|
8
|
+
* web_url: "https://www.usecortex.ai/",
|
|
9
|
+
* source_id: "CortexDoc1234",
|
|
10
|
+
* tenant_id: "tenant_1234",
|
|
11
|
+
* sub_tenant_id: "sub_tenant_4567",
|
|
11
12
|
* body: {}
|
|
12
13
|
* }
|
|
13
14
|
*/
|
|
@@ -18,7 +19,7 @@ export interface UploadUpdateWebpageRequest {
|
|
|
18
19
|
source_id: string;
|
|
19
20
|
/** Unique identifier for the tenant/organization */
|
|
20
21
|
tenant_id: string;
|
|
21
|
-
/** Optional sub-tenant identifier
|
|
22
|
+
/** Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used. */
|
|
22
23
|
sub_tenant_id?: string;
|
|
23
24
|
body: CortexAI.BodyUpdateScrapeJobUploadUpdateWebpagePatch;
|
|
24
25
|
}
|
|
@@ -5,14 +5,15 @@ import * as CortexAI from "../../../../index.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
|
-
* tenant_id: "
|
|
8
|
+
* tenant_id: "tenant_1234",
|
|
9
|
+
* sub_tenant_id: "sub_tenant_4567",
|
|
9
10
|
* body: [{}]
|
|
10
11
|
* }
|
|
11
12
|
*/
|
|
12
13
|
export interface UploadUploadAppSourcesRequest {
|
|
13
14
|
/** Unique identifier for the tenant/organization */
|
|
14
15
|
tenant_id: string;
|
|
15
|
-
/** Optional sub-tenant identifier
|
|
16
|
+
/** Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used. */
|
|
16
17
|
sub_tenant_id?: string;
|
|
17
18
|
/** List of structured source objects containing app-generated data to be indexed */
|
|
18
19
|
body: CortexAI.SourceModel[];
|
|
@@ -5,16 +5,17 @@ import * as CortexAI from "../../../../index.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
|
-
* tenant_id: "
|
|
8
|
+
* tenant_id: "tenant_1234",
|
|
9
|
+
* sub_tenant_id: "sub_tenant_4567",
|
|
9
10
|
* body: {
|
|
10
|
-
* content: "content"
|
|
11
|
+
* content: "<content>"
|
|
11
12
|
* }
|
|
12
13
|
* }
|
|
13
14
|
*/
|
|
14
15
|
export interface UploadUploadMarkdownRequest {
|
|
15
16
|
/** Unique identifier for the tenant/organization */
|
|
16
17
|
tenant_id: string;
|
|
17
|
-
/** Optional sub-tenant identifier
|
|
18
|
+
/** Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used. */
|
|
18
19
|
sub_tenant_id?: string;
|
|
19
20
|
body: CortexAI.MarkdownUploadRequest;
|
|
20
21
|
}
|
|
@@ -5,16 +5,17 @@ import * as CortexAI from "../../../../index.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
|
-
* tenant_id: "
|
|
8
|
+
* tenant_id: "tenant_1234",
|
|
9
|
+
* sub_tenant_id: "sub_tenant_4567",
|
|
9
10
|
* body: {
|
|
10
|
-
* content: "content"
|
|
11
|
+
* content: "<content>"
|
|
11
12
|
* }
|
|
12
13
|
* }
|
|
13
14
|
*/
|
|
14
15
|
export interface UploadUploadTextRequest {
|
|
15
16
|
/** Unique identifier for the tenant/organization */
|
|
16
17
|
tenant_id: string;
|
|
17
|
-
/** Optional sub-tenant identifier
|
|
18
|
+
/** Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used. */
|
|
18
19
|
sub_tenant_id?: string;
|
|
19
20
|
body: CortexAI.MarkdownUploadRequest;
|
|
20
21
|
}
|
|
@@ -9,7 +9,7 @@ export declare namespace User {
|
|
|
9
9
|
environment?: core.Supplier<environments.CortexAIEnvironment | string>;
|
|
10
10
|
/** Specify a custom URL to connect the client to. */
|
|
11
11
|
baseUrl?: core.Supplier<string>;
|
|
12
|
-
token
|
|
12
|
+
token?: core.Supplier<core.BearerToken | undefined>;
|
|
13
13
|
/** Additional headers to include in requests. */
|
|
14
14
|
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
15
15
|
}
|
|
@@ -28,7 +28,7 @@ export declare namespace User {
|
|
|
28
28
|
}
|
|
29
29
|
export declare class User {
|
|
30
30
|
protected readonly _options: User.Options;
|
|
31
|
-
constructor(_options
|
|
31
|
+
constructor(_options?: User.Options);
|
|
32
32
|
/**
|
|
33
33
|
* Create a tenant for your account.
|
|
34
34
|
*
|
|
@@ -50,9 +50,11 @@ export declare class User {
|
|
|
50
50
|
* @throws {@link CortexAI.ServiceUnavailableError}
|
|
51
51
|
*
|
|
52
52
|
* @example
|
|
53
|
-
* await client.user.createTenant(
|
|
53
|
+
* await client.user.createTenant({
|
|
54
|
+
* note: "<str>"
|
|
55
|
+
* })
|
|
54
56
|
*/
|
|
55
57
|
createTenant(request?: CortexAI.BodyCreateTenantUserCreateTenantPost, requestOptions?: User.RequestOptions): core.HttpResponsePromise<CortexAI.TenantCreateData>;
|
|
56
58
|
private __createTenant;
|
|
57
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
59
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
58
60
|
}
|
|
@@ -44,7 +44,7 @@ const CortexAI = __importStar(require("../../../index.js"));
|
|
|
44
44
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
45
45
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
46
46
|
class User {
|
|
47
|
-
constructor(_options) {
|
|
47
|
+
constructor(_options = {}) {
|
|
48
48
|
this._options = _options;
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
@@ -68,18 +68,23 @@ class User {
|
|
|
68
68
|
* @throws {@link CortexAI.ServiceUnavailableError}
|
|
69
69
|
*
|
|
70
70
|
* @example
|
|
71
|
-
* await client.user.createTenant(
|
|
71
|
+
* await client.user.createTenant({
|
|
72
|
+
* note: "<str>"
|
|
73
|
+
* })
|
|
72
74
|
*/
|
|
73
75
|
createTenant(request = {}, requestOptions) {
|
|
74
76
|
return core.HttpResponsePromise.fromPromise(this.__createTenant(request, requestOptions));
|
|
75
77
|
}
|
|
76
78
|
async __createTenant(request = {}, requestOptions) {
|
|
77
79
|
var _a, _b, _c;
|
|
78
|
-
const { tenant_id: tenantId } = request, _body = __rest(request, ["tenant_id"]);
|
|
80
|
+
const { tenant_id: tenantId, note } = request, _body = __rest(request, ["tenant_id", "note"]);
|
|
79
81
|
const _queryParams = {};
|
|
80
82
|
if (tenantId != null) {
|
|
81
83
|
_queryParams["tenant_id"] = tenantId;
|
|
82
84
|
}
|
|
85
|
+
if (note != null) {
|
|
86
|
+
_queryParams["note"] = note;
|
|
87
|
+
}
|
|
83
88
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: await this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
84
89
|
const _response = await core.fetcher({
|
|
85
90
|
url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "user/create_tenant"),
|
|
@@ -137,7 +142,11 @@ class User {
|
|
|
137
142
|
}
|
|
138
143
|
}
|
|
139
144
|
async _getAuthorizationHeader() {
|
|
140
|
-
|
|
145
|
+
const bearer = await core.Supplier.get(this._options.token);
|
|
146
|
+
if (bearer != null) {
|
|
147
|
+
return `Bearer ${bearer}`;
|
|
148
|
+
}
|
|
149
|
+
return undefined;
|
|
141
150
|
}
|
|
142
151
|
}
|
|
143
152
|
exports.User = User;
|
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* @example
|
|
6
|
-
* {
|
|
6
|
+
* {
|
|
7
|
+
* note: "<str>"
|
|
8
|
+
* }
|
|
7
9
|
*/
|
|
8
10
|
export interface BodyCreateTenantUserCreateTenantPost {
|
|
9
11
|
/** Unique identifier for the tenant/organization */
|
|
10
12
|
tenant_id?: string;
|
|
13
|
+
note?: string;
|
|
11
14
|
tenant_metadata_schema?: Record<string, unknown>[];
|
|
12
15
|
}
|