@usecortex_ai/node 0.3.4 → 0.3.5

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 (44) hide show
  1. package/dist/api/resources/search/client/Client.d.ts +1 -1
  2. package/dist/api/resources/search/client/requests/SearchRequest.d.ts +7 -0
  3. package/dist/api/resources/sources/client/Client.d.ts +26 -0
  4. package/dist/api/resources/sources/client/Client.js +91 -0
  5. package/dist/api/resources/sources/client/requests/SourcesGetGraphRelationsByIdRequest.d.ts +18 -0
  6. package/dist/api/resources/sources/client/requests/index.d.ts +1 -0
  7. package/dist/api/resources/upload/client/Client.d.ts +83 -0
  8. package/dist/api/resources/upload/client/Client.js +278 -0
  9. package/dist/api/resources/{userMemory/client/requests/GenerateUserMemoryRequest.d.ts → upload/client/requests/UploadBatchScrapeWebpageRequest.d.ts} +7 -7
  10. package/dist/api/resources/upload/client/requests/UploadBatchUploadMarkdownRequest.d.ts +22 -0
  11. package/dist/api/resources/upload/client/requests/UploadBatchUploadMarkdownRequest.js +5 -0
  12. package/dist/api/resources/upload/client/requests/UploadBatchUploadTextRequest.d.ts +22 -0
  13. package/dist/api/resources/upload/client/requests/UploadBatchUploadTextRequest.js +5 -0
  14. package/dist/api/resources/upload/client/requests/index.d.ts +3 -0
  15. package/dist/api/resources/userMemory/client/Client.d.ts +13 -45
  16. package/dist/api/resources/userMemory/client/Client.js +13 -110
  17. package/dist/api/resources/userMemory/client/requests/AddUserMemoryRequest.d.ts +12 -4
  18. package/dist/api/resources/userMemory/client/requests/index.d.ts +0 -1
  19. package/dist/api/types/AddUserMemoryResponse.d.ts +3 -1
  20. package/dist/api/types/Entity.d.ts +15 -0
  21. package/dist/api/types/Entity.js +5 -0
  22. package/dist/api/types/ExtendedContext.d.ts +2 -1
  23. package/dist/api/types/GraphRelationsResponse.d.ts +12 -0
  24. package/dist/api/types/GraphRelationsResponse.js +5 -0
  25. package/dist/api/types/RelationEvidence.d.ts +20 -0
  26. package/dist/api/types/RelationEvidence.js +5 -0
  27. package/dist/api/types/RetrieveMode.d.ts +8 -0
  28. package/dist/api/types/RetrieveMode.js +10 -0
  29. package/dist/api/types/RetrieveResponse.d.ts +12 -0
  30. package/dist/api/types/RetrieveResponse.js +5 -0
  31. package/dist/api/types/RetrieveUserMemoryResponse.d.ts +2 -0
  32. package/dist/api/types/SearchChunk.d.ts +3 -0
  33. package/dist/api/types/TripleWithEvidence.d.ts +15 -0
  34. package/dist/api/types/TripleWithEvidence.js +5 -0
  35. package/dist/api/types/UserAssistantPair.d.ts +9 -0
  36. package/dist/api/types/UserAssistantPair.js +5 -0
  37. package/dist/api/types/WebpageScrapeRequest.d.ts +9 -0
  38. package/dist/api/types/WebpageScrapeRequest.js +5 -0
  39. package/dist/api/types/index.d.ts +8 -1
  40. package/dist/api/types/index.js +8 -1
  41. package/package.json +1 -1
  42. package/dist/api/types/GenerateUserMemoryResponse.d.ts +0 -13
  43. /package/dist/api/resources/{userMemory/client/requests/GenerateUserMemoryRequest.js → sources/client/requests/SourcesGetGraphRelationsByIdRequest.js} +0 -0
  44. /package/dist/api/{types/GenerateUserMemoryResponse.js → resources/upload/client/requests/UploadBatchScrapeWebpageRequest.js} +0 -0
@@ -75,7 +75,7 @@ export declare class Search {
75
75
  * tenant_id: "tenant_1234"
76
76
  * })
77
77
  */
78
- retrieve(request: CortexAI.SearchRequest, requestOptions?: Search.RequestOptions): core.HttpResponsePromise<CortexAI.SearchChunk[]>;
78
+ retrieve(request: CortexAI.SearchRequest, requestOptions?: Search.RequestOptions): core.HttpResponsePromise<CortexAI.RetrieveResponse>;
79
79
  private __retrieve;
80
80
  /**
81
81
  * Perform full text search for exact matches within your indexed sources.
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
+ import * as CortexAI from "../../../../index.js";
4
5
  /**
5
6
  * @example
6
7
  * {
@@ -17,12 +18,18 @@ export interface SearchRequest {
17
18
  sub_tenant_id?: string;
18
19
  /** Maximum number of results to return */
19
20
  max_chunks?: number;
21
+ /** Retrieval mode to use ('fast' or 'accurate') */
22
+ mode?: CortexAI.RetrieveMode;
20
23
  /** Search ranking algorithm parameter (0.0-1.0 or 'auto') */
21
24
  alpha?: SearchRequest.Alpha;
22
25
  /** Preference for newer content (0.0 = no bias, 1.0 = strong recency preference) */
23
26
  recency_bias?: number;
24
27
  /** Enable personalized search results based on user preferences */
25
28
  personalise_search?: boolean;
29
+ /** Enable graph context for search results */
30
+ graph_context?: boolean;
31
+ /** Additional context provided by the user to guide retrieval */
32
+ extra_context?: string;
26
33
  }
27
34
  export declare namespace SearchRequest {
28
35
  /**
@@ -81,5 +81,31 @@ export declare class Sources {
81
81
  */
82
82
  getByIds(request: CortexAI.SourceBodyParams, requestOptions?: Sources.RequestOptions): core.HttpResponsePromise<CortexAI.ListSourcesResponse>;
83
83
  private __getByIds;
84
+ /**
85
+ * Retrieve relations for a specific source.
86
+ *
87
+ * Use this endpoint to fetch all relations associated with a specific source. This is useful when you need to understand the relationships between entities within a source.
88
+ *
89
+ * Provide the source ID in the request body along with your tenant information to get the relations for that source.
90
+ *
91
+ * @param {CortexAI.SourcesGetGraphRelationsByIdRequest} request
92
+ * @param {Sources.RequestOptions} requestOptions - Request-specific configuration.
93
+ *
94
+ * @throws {@link CortexAI.BadRequestError}
95
+ * @throws {@link CortexAI.UnauthorizedError}
96
+ * @throws {@link CortexAI.ForbiddenError}
97
+ * @throws {@link CortexAI.NotFoundError}
98
+ * @throws {@link CortexAI.UnprocessableEntityError}
99
+ * @throws {@link CortexAI.InternalServerError}
100
+ * @throws {@link CortexAI.ServiceUnavailableError}
101
+ *
102
+ * @example
103
+ * await client.sources.getGraphRelationsById({
104
+ * source_id: "CortexDoc1234",
105
+ * tenant_id: "tenant_1234"
106
+ * })
107
+ */
108
+ getGraphRelationsById(request: CortexAI.SourcesGetGraphRelationsByIdRequest, requestOptions?: Sources.RequestOptions): core.HttpResponsePromise<CortexAI.GraphRelationsResponse>;
109
+ private __getGraphRelationsById;
84
110
  protected _getAuthorizationHeader(): Promise<string | undefined>;
85
111
  }
@@ -209,6 +209,97 @@ class Sources {
209
209
  });
210
210
  }
211
211
  }
212
+ /**
213
+ * Retrieve relations for a specific source.
214
+ *
215
+ * Use this endpoint to fetch all relations associated with a specific source. This is useful when you need to understand the relationships between entities within a source.
216
+ *
217
+ * Provide the source ID in the request body along with your tenant information to get the relations for that source.
218
+ *
219
+ * @param {CortexAI.SourcesGetGraphRelationsByIdRequest} request
220
+ * @param {Sources.RequestOptions} requestOptions - Request-specific configuration.
221
+ *
222
+ * @throws {@link CortexAI.BadRequestError}
223
+ * @throws {@link CortexAI.UnauthorizedError}
224
+ * @throws {@link CortexAI.ForbiddenError}
225
+ * @throws {@link CortexAI.NotFoundError}
226
+ * @throws {@link CortexAI.UnprocessableEntityError}
227
+ * @throws {@link CortexAI.InternalServerError}
228
+ * @throws {@link CortexAI.ServiceUnavailableError}
229
+ *
230
+ * @example
231
+ * await client.sources.getGraphRelationsById({
232
+ * source_id: "CortexDoc1234",
233
+ * tenant_id: "tenant_1234"
234
+ * })
235
+ */
236
+ getGraphRelationsById(request, requestOptions) {
237
+ return core.HttpResponsePromise.fromPromise(this.__getGraphRelationsById(request, requestOptions));
238
+ }
239
+ async __getGraphRelationsById(request, requestOptions) {
240
+ var _a, _b, _c;
241
+ const { source_id: sourceId, tenant_id: tenantId, sub_tenant_id: subTenantId } = request;
242
+ const _queryParams = {};
243
+ _queryParams["source_id"] = sourceId;
244
+ if (tenantId != null) {
245
+ _queryParams["tenant_id"] = tenantId;
246
+ }
247
+ if (subTenantId != null) {
248
+ _queryParams["sub_tenant_id"] = subTenantId;
249
+ }
250
+ 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);
251
+ const _response = await core.fetcher({
252
+ 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, "list/graph_relations_by_id"),
253
+ method: "GET",
254
+ headers: _headers,
255
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
256
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
257
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
258
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
259
+ });
260
+ if (_response.ok) {
261
+ return { data: _response.body, rawResponse: _response.rawResponse };
262
+ }
263
+ if (_response.error.reason === "status-code") {
264
+ switch (_response.error.statusCode) {
265
+ case 400:
266
+ throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
267
+ case 401:
268
+ throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
269
+ case 403:
270
+ throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
271
+ case 404:
272
+ throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
273
+ case 422:
274
+ throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
275
+ case 500:
276
+ throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
277
+ case 503:
278
+ throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
279
+ default:
280
+ throw new errors.CortexAIError({
281
+ statusCode: _response.error.statusCode,
282
+ body: _response.error.body,
283
+ rawResponse: _response.rawResponse,
284
+ });
285
+ }
286
+ }
287
+ switch (_response.error.reason) {
288
+ case "non-json":
289
+ throw new errors.CortexAIError({
290
+ statusCode: _response.error.statusCode,
291
+ body: _response.error.rawBody,
292
+ rawResponse: _response.rawResponse,
293
+ });
294
+ case "timeout":
295
+ throw new errors.CortexAITimeoutError("Timeout exceeded when calling GET /list/graph_relations_by_id.");
296
+ case "unknown":
297
+ throw new errors.CortexAIError({
298
+ message: _response.error.errorMessage,
299
+ rawResponse: _response.rawResponse,
300
+ });
301
+ }
302
+ }
212
303
  async _getAuthorizationHeader() {
213
304
  const bearer = await core.Supplier.get(this._options.token);
214
305
  if (bearer != null) {
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * source_id: "CortexDoc1234",
8
+ * tenant_id: "tenant_1234"
9
+ * }
10
+ */
11
+ export interface SourcesGetGraphRelationsByIdRequest {
12
+ /** The source ID to fetch relations for */
13
+ source_id: string;
14
+ /** Unique identifier for the tenant/organization */
15
+ tenant_id?: string;
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. */
17
+ sub_tenant_id?: string;
18
+ }
@@ -1,2 +1,3 @@
1
1
  export { type SourcesGetAllRequest } from "./SourcesGetAllRequest.js";
2
2
  export { type SourceBodyParams } from "./SourceBodyParams.js";
3
+ export { type SourcesGetGraphRelationsByIdRequest } from "./SourcesGetGraphRelationsByIdRequest.js";
@@ -287,6 +287,60 @@ export declare class Upload {
287
287
  */
288
288
  updateText(request: CortexAI.UploadUpdateTextRequest, requestOptions?: Upload.RequestOptions): core.HttpResponsePromise<CortexAI.SingleUploadData>;
289
289
  private __updateText;
290
+ /**
291
+ * Upload multiple markdown/text documents simultaneously for efficient bulk processing.
292
+ *
293
+ * This endpoint allows you to upload several markdown or text contents at once. Each content item gets processed asynchronously, and you can track the progress using their returned file IDs.
294
+ *
295
+ * @param {CortexAI.UploadBatchUploadMarkdownRequest} request
296
+ * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
297
+ *
298
+ * @throws {@link CortexAI.BadRequestError}
299
+ * @throws {@link CortexAI.UnauthorizedError}
300
+ * @throws {@link CortexAI.ForbiddenError}
301
+ * @throws {@link CortexAI.NotFoundError}
302
+ * @throws {@link CortexAI.UnprocessableEntityError}
303
+ * @throws {@link CortexAI.InternalServerError}
304
+ * @throws {@link CortexAI.ServiceUnavailableError}
305
+ *
306
+ * @example
307
+ * await client.upload.batchUploadMarkdown({
308
+ * tenant_id: "tenant_1234",
309
+ * sub_tenant_id: "sub_tenant_4567",
310
+ * body: [{
311
+ * content: "<content>"
312
+ * }]
313
+ * })
314
+ */
315
+ batchUploadMarkdown(request: CortexAI.UploadBatchUploadMarkdownRequest, requestOptions?: Upload.RequestOptions): core.HttpResponsePromise<CortexAI.BatchUploadData>;
316
+ private __batchUploadMarkdown;
317
+ /**
318
+ * Upload multiple markdown/text documents simultaneously for efficient bulk processing.
319
+ *
320
+ * This endpoint allows you to upload several markdown or text contents at once. Each content item gets processed asynchronously, and you can track the progress using their returned file IDs.
321
+ *
322
+ * @param {CortexAI.UploadBatchUploadTextRequest} request
323
+ * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
324
+ *
325
+ * @throws {@link CortexAI.BadRequestError}
326
+ * @throws {@link CortexAI.UnauthorizedError}
327
+ * @throws {@link CortexAI.ForbiddenError}
328
+ * @throws {@link CortexAI.NotFoundError}
329
+ * @throws {@link CortexAI.UnprocessableEntityError}
330
+ * @throws {@link CortexAI.InternalServerError}
331
+ * @throws {@link CortexAI.ServiceUnavailableError}
332
+ *
333
+ * @example
334
+ * await client.upload.batchUploadText({
335
+ * tenant_id: "tenant_1234",
336
+ * sub_tenant_id: "sub_tenant_4567",
337
+ * body: [{
338
+ * content: "<content>"
339
+ * }]
340
+ * })
341
+ */
342
+ batchUploadText(request: CortexAI.UploadBatchUploadTextRequest, requestOptions?: Upload.RequestOptions): core.HttpResponsePromise<CortexAI.BatchUploadData>;
343
+ private __batchUploadText;
290
344
  /**
291
345
  * Upload pre-computed embeddings for advanced similarity search.
292
346
  *
@@ -398,6 +452,35 @@ export declare class Upload {
398
452
  */
399
453
  updateWebpage(request: CortexAI.UploadUpdateWebpageRequest, requestOptions?: Upload.RequestOptions): core.HttpResponsePromise<CortexAI.SingleUploadData>;
400
454
  private __updateWebpage;
455
+ /**
456
+ * Extract and index content from multiple web pages simultaneously.
457
+ *
458
+ * This endpoint initiates web scraping for multiple URLs at once, extracting the main content, text, and structure from each webpage. It's perfect for capturing multiple articles, documentation pages, or any web content you want to include in your knowledge base.
459
+ *
460
+ * The system processes all webpage content asynchronously, cleaning and structuring the information for optimal search and retrieval.
461
+ *
462
+ * @param {CortexAI.UploadBatchScrapeWebpageRequest} request
463
+ * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
464
+ *
465
+ * @throws {@link CortexAI.BadRequestError}
466
+ * @throws {@link CortexAI.UnauthorizedError}
467
+ * @throws {@link CortexAI.ForbiddenError}
468
+ * @throws {@link CortexAI.NotFoundError}
469
+ * @throws {@link CortexAI.UnprocessableEntityError}
470
+ * @throws {@link CortexAI.InternalServerError}
471
+ * @throws {@link CortexAI.ServiceUnavailableError}
472
+ *
473
+ * @example
474
+ * await client.upload.batchScrapeWebpage({
475
+ * tenant_id: "tenant_1234",
476
+ * sub_tenant_id: "sub_tenant_4567",
477
+ * body: [{
478
+ * web_url: "https://www.usecortex.ai/"
479
+ * }]
480
+ * })
481
+ */
482
+ batchScrapeWebpage(request: CortexAI.UploadBatchScrapeWebpageRequest, requestOptions?: Upload.RequestOptions): core.HttpResponsePromise<CortexAI.BatchUploadData>;
483
+ private __batchScrapeWebpage;
401
484
  /**
402
485
  * Remove documents and content from your knowledge base.
403
486
  *
@@ -940,6 +940,190 @@ class Upload {
940
940
  });
941
941
  }
942
942
  }
943
+ /**
944
+ * Upload multiple markdown/text documents simultaneously for efficient bulk processing.
945
+ *
946
+ * This endpoint allows you to upload several markdown or text contents at once. Each content item gets processed asynchronously, and you can track the progress using their returned file IDs.
947
+ *
948
+ * @param {CortexAI.UploadBatchUploadMarkdownRequest} request
949
+ * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
950
+ *
951
+ * @throws {@link CortexAI.BadRequestError}
952
+ * @throws {@link CortexAI.UnauthorizedError}
953
+ * @throws {@link CortexAI.ForbiddenError}
954
+ * @throws {@link CortexAI.NotFoundError}
955
+ * @throws {@link CortexAI.UnprocessableEntityError}
956
+ * @throws {@link CortexAI.InternalServerError}
957
+ * @throws {@link CortexAI.ServiceUnavailableError}
958
+ *
959
+ * @example
960
+ * await client.upload.batchUploadMarkdown({
961
+ * tenant_id: "tenant_1234",
962
+ * sub_tenant_id: "sub_tenant_4567",
963
+ * body: [{
964
+ * content: "<content>"
965
+ * }]
966
+ * })
967
+ */
968
+ batchUploadMarkdown(request, requestOptions) {
969
+ return core.HttpResponsePromise.fromPromise(this.__batchUploadMarkdown(request, requestOptions));
970
+ }
971
+ async __batchUploadMarkdown(request, requestOptions) {
972
+ var _a, _b, _c;
973
+ const { tenant_id: tenantId, sub_tenant_id: subTenantId, body: _body } = request;
974
+ const _queryParams = {};
975
+ _queryParams["tenant_id"] = tenantId;
976
+ if (subTenantId != null) {
977
+ _queryParams["sub_tenant_id"] = subTenantId;
978
+ }
979
+ 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);
980
+ const _response = await core.fetcher({
981
+ 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, "upload/batch_upload_markdown"),
982
+ method: "POST",
983
+ headers: _headers,
984
+ contentType: "application/json",
985
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
986
+ requestType: "json",
987
+ body: _body,
988
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
989
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
990
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
991
+ });
992
+ if (_response.ok) {
993
+ return { data: _response.body, rawResponse: _response.rawResponse };
994
+ }
995
+ if (_response.error.reason === "status-code") {
996
+ switch (_response.error.statusCode) {
997
+ case 400:
998
+ throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
999
+ case 401:
1000
+ throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
1001
+ case 403:
1002
+ throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
1003
+ case 404:
1004
+ throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
1005
+ case 422:
1006
+ throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
1007
+ case 500:
1008
+ throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
1009
+ case 503:
1010
+ throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
1011
+ default:
1012
+ throw new errors.CortexAIError({
1013
+ statusCode: _response.error.statusCode,
1014
+ body: _response.error.body,
1015
+ rawResponse: _response.rawResponse,
1016
+ });
1017
+ }
1018
+ }
1019
+ switch (_response.error.reason) {
1020
+ case "non-json":
1021
+ throw new errors.CortexAIError({
1022
+ statusCode: _response.error.statusCode,
1023
+ body: _response.error.rawBody,
1024
+ rawResponse: _response.rawResponse,
1025
+ });
1026
+ case "timeout":
1027
+ throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /upload/batch_upload_markdown.");
1028
+ case "unknown":
1029
+ throw new errors.CortexAIError({
1030
+ message: _response.error.errorMessage,
1031
+ rawResponse: _response.rawResponse,
1032
+ });
1033
+ }
1034
+ }
1035
+ /**
1036
+ * Upload multiple markdown/text documents simultaneously for efficient bulk processing.
1037
+ *
1038
+ * This endpoint allows you to upload several markdown or text contents at once. Each content item gets processed asynchronously, and you can track the progress using their returned file IDs.
1039
+ *
1040
+ * @param {CortexAI.UploadBatchUploadTextRequest} request
1041
+ * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
1042
+ *
1043
+ * @throws {@link CortexAI.BadRequestError}
1044
+ * @throws {@link CortexAI.UnauthorizedError}
1045
+ * @throws {@link CortexAI.ForbiddenError}
1046
+ * @throws {@link CortexAI.NotFoundError}
1047
+ * @throws {@link CortexAI.UnprocessableEntityError}
1048
+ * @throws {@link CortexAI.InternalServerError}
1049
+ * @throws {@link CortexAI.ServiceUnavailableError}
1050
+ *
1051
+ * @example
1052
+ * await client.upload.batchUploadText({
1053
+ * tenant_id: "tenant_1234",
1054
+ * sub_tenant_id: "sub_tenant_4567",
1055
+ * body: [{
1056
+ * content: "<content>"
1057
+ * }]
1058
+ * })
1059
+ */
1060
+ batchUploadText(request, requestOptions) {
1061
+ return core.HttpResponsePromise.fromPromise(this.__batchUploadText(request, requestOptions));
1062
+ }
1063
+ async __batchUploadText(request, requestOptions) {
1064
+ var _a, _b, _c;
1065
+ const { tenant_id: tenantId, sub_tenant_id: subTenantId, body: _body } = request;
1066
+ const _queryParams = {};
1067
+ _queryParams["tenant_id"] = tenantId;
1068
+ if (subTenantId != null) {
1069
+ _queryParams["sub_tenant_id"] = subTenantId;
1070
+ }
1071
+ 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);
1072
+ const _response = await core.fetcher({
1073
+ 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, "upload/batch_upload_text"),
1074
+ method: "POST",
1075
+ headers: _headers,
1076
+ contentType: "application/json",
1077
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
1078
+ requestType: "json",
1079
+ body: _body,
1080
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
1081
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
1082
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1083
+ });
1084
+ if (_response.ok) {
1085
+ return { data: _response.body, rawResponse: _response.rawResponse };
1086
+ }
1087
+ if (_response.error.reason === "status-code") {
1088
+ switch (_response.error.statusCode) {
1089
+ case 400:
1090
+ throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
1091
+ case 401:
1092
+ throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
1093
+ case 403:
1094
+ throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
1095
+ case 404:
1096
+ throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
1097
+ case 422:
1098
+ throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
1099
+ case 500:
1100
+ throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
1101
+ case 503:
1102
+ throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
1103
+ default:
1104
+ throw new errors.CortexAIError({
1105
+ statusCode: _response.error.statusCode,
1106
+ body: _response.error.body,
1107
+ rawResponse: _response.rawResponse,
1108
+ });
1109
+ }
1110
+ }
1111
+ switch (_response.error.reason) {
1112
+ case "non-json":
1113
+ throw new errors.CortexAIError({
1114
+ statusCode: _response.error.statusCode,
1115
+ body: _response.error.rawBody,
1116
+ rawResponse: _response.rawResponse,
1117
+ });
1118
+ case "timeout":
1119
+ throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /upload/batch_upload_text.");
1120
+ case "unknown":
1121
+ throw new errors.CortexAIError({
1122
+ message: _response.error.errorMessage,
1123
+ rawResponse: _response.rawResponse,
1124
+ });
1125
+ }
1126
+ }
943
1127
  /**
944
1128
  * Upload pre-computed embeddings for advanced similarity search.
945
1129
  *
@@ -1317,6 +1501,100 @@ class Upload {
1317
1501
  });
1318
1502
  }
1319
1503
  }
1504
+ /**
1505
+ * Extract and index content from multiple web pages simultaneously.
1506
+ *
1507
+ * This endpoint initiates web scraping for multiple URLs at once, extracting the main content, text, and structure from each webpage. It's perfect for capturing multiple articles, documentation pages, or any web content you want to include in your knowledge base.
1508
+ *
1509
+ * The system processes all webpage content asynchronously, cleaning and structuring the information for optimal search and retrieval.
1510
+ *
1511
+ * @param {CortexAI.UploadBatchScrapeWebpageRequest} request
1512
+ * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
1513
+ *
1514
+ * @throws {@link CortexAI.BadRequestError}
1515
+ * @throws {@link CortexAI.UnauthorizedError}
1516
+ * @throws {@link CortexAI.ForbiddenError}
1517
+ * @throws {@link CortexAI.NotFoundError}
1518
+ * @throws {@link CortexAI.UnprocessableEntityError}
1519
+ * @throws {@link CortexAI.InternalServerError}
1520
+ * @throws {@link CortexAI.ServiceUnavailableError}
1521
+ *
1522
+ * @example
1523
+ * await client.upload.batchScrapeWebpage({
1524
+ * tenant_id: "tenant_1234",
1525
+ * sub_tenant_id: "sub_tenant_4567",
1526
+ * body: [{
1527
+ * web_url: "https://www.usecortex.ai/"
1528
+ * }]
1529
+ * })
1530
+ */
1531
+ batchScrapeWebpage(request, requestOptions) {
1532
+ return core.HttpResponsePromise.fromPromise(this.__batchScrapeWebpage(request, requestOptions));
1533
+ }
1534
+ async __batchScrapeWebpage(request, requestOptions) {
1535
+ var _a, _b, _c;
1536
+ const { tenant_id: tenantId, sub_tenant_id: subTenantId, body: _body } = request;
1537
+ const _queryParams = {};
1538
+ _queryParams["tenant_id"] = tenantId;
1539
+ if (subTenantId != null) {
1540
+ _queryParams["sub_tenant_id"] = subTenantId;
1541
+ }
1542
+ 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);
1543
+ const _response = await core.fetcher({
1544
+ 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, "upload/batch_scrape_webpage"),
1545
+ method: "POST",
1546
+ headers: _headers,
1547
+ contentType: "application/json",
1548
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
1549
+ requestType: "json",
1550
+ body: _body,
1551
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
1552
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
1553
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1554
+ });
1555
+ if (_response.ok) {
1556
+ return { data: _response.body, rawResponse: _response.rawResponse };
1557
+ }
1558
+ if (_response.error.reason === "status-code") {
1559
+ switch (_response.error.statusCode) {
1560
+ case 400:
1561
+ throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
1562
+ case 401:
1563
+ throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
1564
+ case 403:
1565
+ throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
1566
+ case 404:
1567
+ throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
1568
+ case 422:
1569
+ throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
1570
+ case 500:
1571
+ throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
1572
+ case 503:
1573
+ throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
1574
+ default:
1575
+ throw new errors.CortexAIError({
1576
+ statusCode: _response.error.statusCode,
1577
+ body: _response.error.body,
1578
+ rawResponse: _response.rawResponse,
1579
+ });
1580
+ }
1581
+ }
1582
+ switch (_response.error.reason) {
1583
+ case "non-json":
1584
+ throw new errors.CortexAIError({
1585
+ statusCode: _response.error.statusCode,
1586
+ body: _response.error.rawBody,
1587
+ rawResponse: _response.rawResponse,
1588
+ });
1589
+ case "timeout":
1590
+ throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /upload/batch_scrape_webpage.");
1591
+ case "unknown":
1592
+ throw new errors.CortexAIError({
1593
+ message: _response.error.errorMessage,
1594
+ rawResponse: _response.rawResponse,
1595
+ });
1596
+ }
1597
+ }
1320
1598
  /**
1321
1599
  * Remove documents and content from your knowledge base.
1322
1600
  *
@@ -1,22 +1,22 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
+ import * as CortexAI from "../../../../index.js";
4
5
  /**
5
6
  * @example
6
7
  * {
7
8
  * tenant_id: "tenant_1234",
8
9
  * sub_tenant_id: "sub_tenant_4567",
9
- * user_message: "I prefer detailed technical explanations and works in the Pacific timezone",
10
- * user_name: "John Doe"
10
+ * body: [{
11
+ * web_url: "https://www.usecortex.ai/"
12
+ * }]
11
13
  * }
12
14
  */
13
- export interface GenerateUserMemoryRequest {
15
+ export interface UploadBatchScrapeWebpageRequest {
14
16
  /** Unique identifier for the tenant/organization */
15
17
  tenant_id: string;
16
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. */
17
19
  sub_tenant_id?: string;
18
- /** Your query or context for AI memory generation */
19
- user_message: string;
20
- /** Your name to personalize the generated memories */
21
- user_name: string;
20
+ /** List of webpages to scrape and index */
21
+ body: CortexAI.WebpageScrapeRequest[];
22
22
  }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as CortexAI from "../../../../index.js";
5
+ /**
6
+ * @example
7
+ * {
8
+ * tenant_id: "tenant_1234",
9
+ * sub_tenant_id: "sub_tenant_4567",
10
+ * body: [{
11
+ * content: "<content>"
12
+ * }]
13
+ * }
14
+ */
15
+ export interface UploadBatchUploadMarkdownRequest {
16
+ /** Unique identifier for the tenant/organization */
17
+ tenant_id: string;
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. */
19
+ sub_tenant_id?: string;
20
+ /** List of markdown/text content to upload */
21
+ body: CortexAI.MarkdownUploadRequest[];
22
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,22 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as CortexAI from "../../../../index.js";
5
+ /**
6
+ * @example
7
+ * {
8
+ * tenant_id: "tenant_1234",
9
+ * sub_tenant_id: "sub_tenant_4567",
10
+ * body: [{
11
+ * content: "<content>"
12
+ * }]
13
+ * }
14
+ */
15
+ export interface UploadBatchUploadTextRequest {
16
+ /** Unique identifier for the tenant/organization */
17
+ tenant_id: string;
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. */
19
+ sub_tenant_id?: string;
20
+ /** List of markdown/text content to upload */
21
+ body: CortexAI.MarkdownUploadRequest[];
22
+ }