@usecortex_ai/node 0.1.2 → 0.2.0

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 (110) hide show
  1. package/dist/Client.d.ts +5 -11
  2. package/dist/Client.js +12 -63
  3. package/dist/api/resources/document/client/Client.d.ts +59 -0
  4. package/dist/api/resources/document/client/Client.js +128 -0
  5. package/dist/api/resources/document/client/index.d.ts +1 -0
  6. package/dist/api/resources/document/client/index.js +2 -0
  7. package/dist/api/resources/document/index.d.ts +1 -0
  8. package/dist/api/resources/document/index.js +17 -0
  9. package/dist/api/resources/embeddings/client/Client.d.ts +13 -38
  10. package/dist/api/resources/embeddings/client/Client.js +12 -41
  11. package/dist/api/resources/embeddings/client/requests/EmbeddingsCreateCollectionRequest.d.ts +1 -0
  12. package/dist/api/resources/embeddings/client/requests/EmbeddingsDeleteRequest.d.ts +3 -0
  13. package/dist/api/resources/embeddings/client/requests/EmbeddingsSearchRequest.d.ts +3 -0
  14. package/dist/api/resources/embeddings/client/requests/GetEmbeddingsBasedOnChunkIdsRequest.d.ts +3 -0
  15. package/dist/api/resources/fetch/client/Client.d.ts +3 -3
  16. package/dist/api/resources/fetch/client/Client.js +2 -6
  17. package/dist/api/resources/fetch/client/requests/FetchContentRequest.d.ts +5 -0
  18. package/dist/api/resources/index.d.ts +1 -0
  19. package/dist/api/resources/index.js +2 -1
  20. package/dist/api/resources/search/client/Client.d.ts +11 -38
  21. package/dist/api/resources/search/client/Client.js +10 -41
  22. package/dist/api/resources/search/client/requests/FullTextSearchRequest.d.ts +5 -0
  23. package/dist/api/resources/search/client/requests/QnARequest.d.ts +17 -0
  24. package/dist/api/resources/search/client/requests/SearchRequest.d.ts +9 -1
  25. package/dist/api/resources/sources/client/Client.d.ts +15 -35
  26. package/dist/api/resources/sources/client/Client.js +14 -97
  27. package/dist/api/resources/sources/client/requests/SourcesGetAllRequest.d.ts +2 -0
  28. package/dist/api/resources/sources/client/requests/index.d.ts +0 -1
  29. package/dist/api/resources/tenant/client/Client.d.ts +55 -5
  30. package/dist/api/resources/tenant/client/Client.js +173 -8
  31. package/dist/api/resources/tenant/client/requests/TenantDeleteSubTenantRequest.d.ts +14 -0
  32. package/dist/api/resources/tenant/client/requests/TenantDeleteSubTenantRequest.js +5 -0
  33. package/dist/api/resources/tenant/client/requests/TenantGetSubTenantIdsRequest.d.ts +12 -0
  34. package/dist/api/resources/tenant/client/requests/TenantGetSubTenantIdsRequest.js +5 -0
  35. package/dist/api/resources/tenant/client/requests/TenantStatsRequest.d.ts +2 -0
  36. package/dist/api/resources/tenant/client/requests/index.d.ts +2 -0
  37. package/dist/api/resources/upload/client/Client.d.ts +95 -10
  38. package/dist/api/resources/upload/client/Client.js +94 -25
  39. package/dist/api/resources/upload/client/requests/BodyBatchUpdateUploadBatchUpdatePatch.d.ts +17 -1
  40. package/dist/api/resources/upload/client/requests/BodyBatchUploadUploadBatchUploadPost.d.ts +16 -1
  41. package/dist/api/resources/upload/client/requests/BodyUpdateFileUploadUpdateDocumentPatch.d.ts +17 -1
  42. package/dist/api/resources/upload/client/requests/BodyUploadFilesUploadUploadDocumentPost.d.ts +16 -1
  43. package/dist/api/resources/upload/client/requests/EmbeddingsUpdateRequest.d.ts +3 -0
  44. package/dist/api/resources/upload/client/requests/EmbeddingsUploadRequest.d.ts +4 -0
  45. package/dist/api/resources/upload/client/requests/UploadScrapeWebpageRequest.d.ts +4 -0
  46. package/dist/api/resources/upload/client/requests/UploadUpdateMarkdownRequest.d.ts +3 -0
  47. package/dist/api/resources/upload/client/requests/UploadUpdateTextRequest.d.ts +3 -0
  48. package/dist/api/resources/upload/client/requests/UploadUpdateWebpageRequest.d.ts +4 -0
  49. package/dist/api/resources/upload/client/requests/UploadUploadAppSourcesRequest.d.ts +3 -0
  50. package/dist/api/resources/upload/client/requests/UploadUploadMarkdownRequest.d.ts +2 -0
  51. package/dist/api/resources/upload/client/requests/UploadUploadTextRequest.d.ts +2 -0
  52. package/dist/api/resources/upload/client/requests/UploadVerifyProcessingRequest.d.ts +2 -0
  53. package/dist/api/resources/user/client/Client.d.ts +9 -6
  54. package/dist/api/resources/user/client/Client.js +8 -9
  55. package/dist/api/resources/user/client/requests/BodyCreateTenantUserCreateTenantPost.d.ts +1 -0
  56. package/dist/api/resources/userMemory/client/Client.d.ts +89 -21
  57. package/dist/api/resources/userMemory/client/Client.js +183 -33
  58. package/dist/api/resources/userMemory/client/requests/AddUserMemoryRequest.d.ts +18 -0
  59. package/dist/api/resources/userMemory/client/requests/AddUserMemoryRequest.js +5 -0
  60. package/dist/api/resources/userMemory/client/requests/GenerateUserMemoryRequest.d.ts +21 -0
  61. package/dist/api/resources/userMemory/client/requests/GenerateUserMemoryRequest.js +5 -0
  62. package/dist/api/resources/userMemory/client/requests/RetrieveUserMemoryRequest.d.ts +20 -0
  63. package/dist/api/resources/userMemory/client/requests/RetrieveUserMemoryRequest.js +5 -0
  64. package/dist/api/resources/userMemory/client/requests/UserMemoryDeleteUserMemoryRequest.d.ts +5 -3
  65. package/dist/api/resources/userMemory/client/requests/UserMemoryListUserMemoriesRequest.d.ts +4 -3
  66. package/dist/api/resources/userMemory/client/requests/index.d.ts +3 -3
  67. package/dist/api/types/AddUserMemoryResponse.d.ts +14 -0
  68. package/dist/api/types/AddUserMemoryResponse.js +5 -0
  69. package/dist/api/types/AppSourcesUploadData.d.ts +3 -1
  70. package/dist/api/types/AttachmentModel.d.ts +7 -0
  71. package/dist/api/types/BatchUploadData.d.ts +3 -1
  72. package/dist/api/types/BodyScrapeWebpageUploadScrapeWebpagePost.d.ts +0 -1
  73. package/dist/api/types/BodyUpdateScrapeJobUploadUpdateWebpagePatch.d.ts +0 -1
  74. package/dist/api/types/ContentModel.d.ts +6 -0
  75. package/dist/api/types/DeleteMemoryRequest.d.ts +3 -0
  76. package/dist/api/types/DeleteSources.d.ts +7 -0
  77. package/dist/api/types/DeleteSources.js +5 -0
  78. package/dist/api/types/DeleteSubTenantData.d.ts +15 -0
  79. package/dist/api/types/DeleteSubTenantData.js +5 -0
  80. package/dist/api/types/DeleteUserMemoryResponse.d.ts +12 -0
  81. package/dist/api/types/DeleteUserMemoryResponse.js +5 -0
  82. package/dist/api/types/EmbeddingsCreateCollectionData.d.ts +4 -0
  83. package/dist/api/types/EmbeddingsDeleteData.d.ts +4 -0
  84. package/dist/api/types/EmbeddingsGetData.d.ts +4 -0
  85. package/dist/api/types/EmbeddingsSearchData.d.ts +4 -0
  86. package/dist/api/types/ErrorResponse.d.ts +0 -1
  87. package/dist/api/types/FetchContentData.d.ts +4 -1
  88. package/dist/api/types/FileUploadResult.d.ts +2 -0
  89. package/dist/api/types/GenerateUserMemoryResponse.d.ts +13 -0
  90. package/dist/api/types/GenerateUserMemoryResponse.js +5 -0
  91. package/dist/api/types/ListSourcesResponse.d.ts +3 -0
  92. package/dist/api/types/ListUserMemoriesResponse.d.ts +13 -0
  93. package/dist/api/types/ListUserMemoriesResponse.js +5 -0
  94. package/dist/api/types/MarkdownUploadRequest.d.ts +12 -2
  95. package/dist/api/types/ProcessingStatus.d.ts +3 -0
  96. package/dist/api/types/Relations.d.ts +2 -0
  97. package/dist/api/types/RetrieveUserMemoryResponse.d.ts +13 -0
  98. package/dist/api/types/RetrieveUserMemoryResponse.js +5 -0
  99. package/dist/api/types/SearchChunk.d.ts +11 -6
  100. package/dist/api/types/SingleUploadData.d.ts +3 -1
  101. package/dist/api/types/Source.d.ts +7 -8
  102. package/dist/api/types/SourceModel.d.ts +21 -2
  103. package/dist/api/types/SubTenantIdsData.d.ts +6 -1
  104. package/dist/api/types/TenantCreateData.d.ts +4 -0
  105. package/dist/api/types/TenantStats.d.ts +5 -0
  106. package/dist/api/types/UserMemory.d.ts +12 -0
  107. package/dist/api/types/UserMemory.js +5 -0
  108. package/dist/api/types/index.d.ts +8 -1
  109. package/dist/api/types/index.js +8 -1
  110. package/package.json +1 -1
package/dist/Client.d.ts CHANGED
@@ -8,6 +8,7 @@ import { Sources } from "./api/resources/sources/client/Client.js";
8
8
  import { UserMemory } from "./api/resources/userMemory/client/Client.js";
9
9
  import { Fetch } from "./api/resources/fetch/client/Client.js";
10
10
  import { Upload } from "./api/resources/upload/client/Client.js";
11
+ import { Document } from "./api/resources/document/client/Client.js";
11
12
  import { Embeddings } from "./api/resources/embeddings/client/Client.js";
12
13
  import { User } from "./api/resources/user/client/Client.js";
13
14
  import { Tenant } from "./api/resources/tenant/client/Client.js";
@@ -16,7 +17,7 @@ export declare namespace CortexAIClient {
16
17
  environment?: core.Supplier<environments.CortexAIEnvironment | string>;
17
18
  /** Specify a custom URL to connect the client to. */
18
19
  baseUrl?: core.Supplier<string>;
19
- token?: core.Supplier<core.BearerToken | undefined>;
20
+ token: core.Supplier<core.BearerToken>;
20
21
  /** Additional headers to include in requests. */
21
22
  headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
22
23
  }
@@ -40,25 +41,18 @@ export declare class CortexAIClient {
40
41
  protected _userMemory: UserMemory | undefined;
41
42
  protected _fetch: Fetch | undefined;
42
43
  protected _upload: Upload | undefined;
44
+ protected _document: Document | undefined;
43
45
  protected _embeddings: Embeddings | undefined;
44
46
  protected _user: User | undefined;
45
47
  protected _tenant: Tenant | undefined;
46
- constructor(_options?: CortexAIClient.Options);
48
+ constructor(_options: CortexAIClient.Options);
47
49
  get search(): Search;
48
50
  get sources(): Sources;
49
51
  get userMemory(): UserMemory;
50
52
  get fetch(): Fetch;
51
53
  get upload(): Upload;
54
+ get document(): Document;
52
55
  get embeddings(): Embeddings;
53
56
  get user(): User;
54
57
  get tenant(): Tenant;
55
- /**
56
- * @param {CortexAIClient.RequestOptions} requestOptions - Request-specific configuration.
57
- *
58
- * @example
59
- * await client.rootGet()
60
- */
61
- rootGet(requestOptions?: CortexAIClient.RequestOptions): core.HttpResponsePromise<unknown>;
62
- private __rootGet;
63
- protected _getAuthorizationHeader(): Promise<string | undefined>;
64
58
  }
package/dist/Client.js CHANGED
@@ -27,20 +27,19 @@ var __importStar = (this && this.__importStar) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.CortexAIClient = void 0;
30
- const environments = __importStar(require("./environments.js"));
31
30
  const core = __importStar(require("./core/index.js"));
32
31
  const headers_js_1 = require("./core/headers.js");
33
- const errors = __importStar(require("./errors/index.js"));
34
32
  const Client_js_1 = require("./api/resources/search/client/Client.js");
35
33
  const Client_js_2 = require("./api/resources/sources/client/Client.js");
36
34
  const Client_js_3 = require("./api/resources/userMemory/client/Client.js");
37
35
  const Client_js_4 = require("./api/resources/fetch/client/Client.js");
38
36
  const Client_js_5 = require("./api/resources/upload/client/Client.js");
39
- const Client_js_6 = require("./api/resources/embeddings/client/Client.js");
40
- const Client_js_7 = require("./api/resources/user/client/Client.js");
41
- const Client_js_8 = require("./api/resources/tenant/client/Client.js");
37
+ const Client_js_6 = require("./api/resources/document/client/Client.js");
38
+ const Client_js_7 = require("./api/resources/embeddings/client/Client.js");
39
+ const Client_js_8 = require("./api/resources/user/client/Client.js");
40
+ const Client_js_9 = require("./api/resources/tenant/client/Client.js");
42
41
  class CortexAIClient {
43
- constructor(_options = {}) {
42
+ constructor(_options) {
44
43
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
45
44
  "X-Fern-Language": "JavaScript",
46
45
  "X-Fern-Runtime": core.RUNTIME.type,
@@ -67,71 +66,21 @@ class CortexAIClient {
67
66
  var _a;
68
67
  return ((_a = this._upload) !== null && _a !== void 0 ? _a : (this._upload = new Client_js_5.Upload(this._options)));
69
68
  }
69
+ get document() {
70
+ var _a;
71
+ return ((_a = this._document) !== null && _a !== void 0 ? _a : (this._document = new Client_js_6.Document(this._options)));
72
+ }
70
73
  get embeddings() {
71
74
  var _a;
72
- return ((_a = this._embeddings) !== null && _a !== void 0 ? _a : (this._embeddings = new Client_js_6.Embeddings(this._options)));
75
+ return ((_a = this._embeddings) !== null && _a !== void 0 ? _a : (this._embeddings = new Client_js_7.Embeddings(this._options)));
73
76
  }
74
77
  get user() {
75
78
  var _a;
76
- return ((_a = this._user) !== null && _a !== void 0 ? _a : (this._user = new Client_js_7.User(this._options)));
79
+ return ((_a = this._user) !== null && _a !== void 0 ? _a : (this._user = new Client_js_8.User(this._options)));
77
80
  }
78
81
  get tenant() {
79
82
  var _a;
80
- return ((_a = this._tenant) !== null && _a !== void 0 ? _a : (this._tenant = new Client_js_8.Tenant(this._options)));
81
- }
82
- /**
83
- * @param {CortexAIClient.RequestOptions} requestOptions - Request-specific configuration.
84
- *
85
- * @example
86
- * await client.rootGet()
87
- */
88
- rootGet(requestOptions) {
89
- return core.HttpResponsePromise.fromPromise(this.__rootGet(requestOptions));
90
- }
91
- async __rootGet(requestOptions) {
92
- var _a, _b, _c;
93
- 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);
94
- const _response = await core.fetcher({
95
- url: (_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,
96
- method: "GET",
97
- headers: _headers,
98
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
99
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
100
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
101
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
102
- });
103
- if (_response.ok) {
104
- return { data: _response.body, rawResponse: _response.rawResponse };
105
- }
106
- if (_response.error.reason === "status-code") {
107
- throw new errors.CortexAIError({
108
- statusCode: _response.error.statusCode,
109
- body: _response.error.body,
110
- rawResponse: _response.rawResponse,
111
- });
112
- }
113
- switch (_response.error.reason) {
114
- case "non-json":
115
- throw new errors.CortexAIError({
116
- statusCode: _response.error.statusCode,
117
- body: _response.error.rawBody,
118
- rawResponse: _response.rawResponse,
119
- });
120
- case "timeout":
121
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling GET /.");
122
- case "unknown":
123
- throw new errors.CortexAIError({
124
- message: _response.error.errorMessage,
125
- rawResponse: _response.rawResponse,
126
- });
127
- }
128
- }
129
- async _getAuthorizationHeader() {
130
- const bearer = await core.Supplier.get(this._options.token);
131
- if (bearer != null) {
132
- return `Bearer ${bearer}`;
133
- }
134
- return undefined;
83
+ return ((_a = this._tenant) !== null && _a !== void 0 ? _a : (this._tenant = new Client_js_9.Tenant(this._options)));
135
84
  }
136
85
  }
137
86
  exports.CortexAIClient = CortexAIClient;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as environments from "../../../../environments.js";
5
+ import * as core from "../../../../core/index.js";
6
+ import * as CortexAI from "../../../index.js";
7
+ export declare namespace Document {
8
+ interface Options {
9
+ environment?: core.Supplier<environments.CortexAIEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
12
+ token: core.Supplier<core.BearerToken>;
13
+ /** Additional headers to include in requests. */
14
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
15
+ }
16
+ interface RequestOptions {
17
+ /** The maximum time to wait for a response in seconds. */
18
+ timeoutInSeconds?: number;
19
+ /** The number of times to retry the request. Defaults to 2. */
20
+ maxRetries?: number;
21
+ /** A hook to abort the request. */
22
+ abortSignal?: AbortSignal;
23
+ /** Additional query string parameters to include in the request. */
24
+ queryParams?: Record<string, unknown>;
25
+ /** Additional headers to include in the request. */
26
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
27
+ }
28
+ }
29
+ export declare class Document {
30
+ protected readonly _options: Document.Options;
31
+ constructor(_options: Document.Options);
32
+ /**
33
+ * Remove documents and content from your knowledge base.
34
+ *
35
+ * This endpoint permanently deletes the specified sources from your knowledge base. Once deleted, the content will no longer be available for search or retrieval.
36
+ *
37
+ * Use this carefully as the action cannot be undone. The system will confirm successful deletion of each source ID you specify.
38
+ *
39
+ * @param {CortexAI.DeleteMemoryRequest} request
40
+ * @param {Document.RequestOptions} requestOptions - Request-specific configuration.
41
+ *
42
+ * @throws {@link CortexAI.BadRequestError}
43
+ * @throws {@link CortexAI.UnauthorizedError}
44
+ * @throws {@link CortexAI.ForbiddenError}
45
+ * @throws {@link CortexAI.NotFoundError}
46
+ * @throws {@link CortexAI.UnprocessableEntityError}
47
+ * @throws {@link CortexAI.InternalServerError}
48
+ * @throws {@link CortexAI.ServiceUnavailableError}
49
+ *
50
+ * @example
51
+ * await client.document.delete({
52
+ * tenant_id: "tenant_id",
53
+ * source_ids: ["source_ids"]
54
+ * })
55
+ */
56
+ delete(request: CortexAI.DeleteMemoryRequest, requestOptions?: Document.RequestOptions): core.HttpResponsePromise<CortexAI.DeleteSources>;
57
+ private __delete;
58
+ protected _getAuthorizationHeader(): Promise<string>;
59
+ }
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.Document = void 0;
30
+ const environments = __importStar(require("../../../../environments.js"));
31
+ const core = __importStar(require("../../../../core/index.js"));
32
+ const CortexAI = __importStar(require("../../../index.js"));
33
+ const headers_js_1 = require("../../../../core/headers.js");
34
+ const errors = __importStar(require("../../../../errors/index.js"));
35
+ class Document {
36
+ constructor(_options) {
37
+ this._options = _options;
38
+ }
39
+ /**
40
+ * Remove documents and content from your knowledge base.
41
+ *
42
+ * This endpoint permanently deletes the specified sources from your knowledge base. Once deleted, the content will no longer be available for search or retrieval.
43
+ *
44
+ * Use this carefully as the action cannot be undone. The system will confirm successful deletion of each source ID you specify.
45
+ *
46
+ * @param {CortexAI.DeleteMemoryRequest} request
47
+ * @param {Document.RequestOptions} requestOptions - Request-specific configuration.
48
+ *
49
+ * @throws {@link CortexAI.BadRequestError}
50
+ * @throws {@link CortexAI.UnauthorizedError}
51
+ * @throws {@link CortexAI.ForbiddenError}
52
+ * @throws {@link CortexAI.NotFoundError}
53
+ * @throws {@link CortexAI.UnprocessableEntityError}
54
+ * @throws {@link CortexAI.InternalServerError}
55
+ * @throws {@link CortexAI.ServiceUnavailableError}
56
+ *
57
+ * @example
58
+ * await client.document.delete({
59
+ * tenant_id: "tenant_id",
60
+ * source_ids: ["source_ids"]
61
+ * })
62
+ */
63
+ delete(request, requestOptions) {
64
+ return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions));
65
+ }
66
+ async __delete(request, requestOptions) {
67
+ var _a, _b, _c;
68
+ 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);
69
+ const _response = await core.fetcher({
70
+ 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, "document/delete"),
71
+ method: "DELETE",
72
+ headers: _headers,
73
+ contentType: "application/json",
74
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
75
+ requestType: "json",
76
+ body: request,
77
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
78
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
79
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
80
+ });
81
+ if (_response.ok) {
82
+ return { data: _response.body, rawResponse: _response.rawResponse };
83
+ }
84
+ if (_response.error.reason === "status-code") {
85
+ switch (_response.error.statusCode) {
86
+ case 400:
87
+ throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
88
+ case 401:
89
+ throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
90
+ case 403:
91
+ throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
92
+ case 404:
93
+ throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
94
+ case 422:
95
+ throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
96
+ case 500:
97
+ throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
98
+ case 503:
99
+ throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
100
+ default:
101
+ throw new errors.CortexAIError({
102
+ statusCode: _response.error.statusCode,
103
+ body: _response.error.body,
104
+ rawResponse: _response.rawResponse,
105
+ });
106
+ }
107
+ }
108
+ switch (_response.error.reason) {
109
+ case "non-json":
110
+ throw new errors.CortexAIError({
111
+ statusCode: _response.error.statusCode,
112
+ body: _response.error.rawBody,
113
+ rawResponse: _response.rawResponse,
114
+ });
115
+ case "timeout":
116
+ throw new errors.CortexAITimeoutError("Timeout exceeded when calling DELETE /document/delete.");
117
+ case "unknown":
118
+ throw new errors.CortexAIError({
119
+ message: _response.error.errorMessage,
120
+ rawResponse: _response.rawResponse,
121
+ });
122
+ }
123
+ }
124
+ async _getAuthorizationHeader() {
125
+ return `Bearer ${await core.Supplier.get(this._options.token)}`;
126
+ }
127
+ }
128
+ exports.Document = Document;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from "./client/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client/index.js"), exports);
@@ -9,7 +9,7 @@ export declare namespace Embeddings {
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?: core.Supplier<core.BearerToken | undefined>;
12
+ token: core.Supplier<core.BearerToken>;
13
13
  /** Additional headers to include in requests. */
14
14
  headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
15
15
  }
@@ -28,22 +28,11 @@ export declare namespace Embeddings {
28
28
  }
29
29
  export declare class Embeddings {
30
30
  protected readonly _options: Embeddings.Options;
31
- constructor(_options?: Embeddings.Options);
31
+ constructor(_options: Embeddings.Options);
32
32
  /**
33
- * Delete specific embedding chunks from indexed sources.
33
+ * Delete embedding chunks by chunk ID.
34
34
  *
35
- * This endpoint deletes specified embedding chunks from the Findr backend by sending
36
- * chunk IDs to the backend delete service.
37
- *
38
- * Args:
39
- * request (EmbeddingsDeleteRequest): The delete request containing:
40
- * - chunk_ids (List[str]): List of chunk IDs to delete
41
- * - tenant_id (str): Tenant identifier for multi-tenancy
42
- * - sub_tenant_id (str, optional): Sub-tenant identifier, defaults to tenant_id
43
- * api_details (dict): Authentication details obtained from API key validation
44
- *
45
- * Returns:
46
- * EmbeddingsDeleteData: Success response with deletion details
35
+ * Use this to remove specific chunks from your embeddings index when they are no longer valid or should not appear in results.
47
36
  *
48
37
  * @param {CortexAI.EmbeddingsDeleteRequest} request
49
38
  * @param {Embeddings.RequestOptions} requestOptions - Request-specific configuration.
@@ -65,21 +54,13 @@ export declare class Embeddings {
65
54
  delete(request: CortexAI.EmbeddingsDeleteRequest, requestOptions?: Embeddings.RequestOptions): core.HttpResponsePromise<CortexAI.EmbeddingsDeleteData>;
66
55
  private __delete;
67
56
  /**
68
- * Search for similar embedding chunks using vector similarity.
57
+ * Find similar chunks using an embedding vector.
69
58
  *
70
- * This endpoint performs semantic search by sending an embedding vector to the Findr backend
71
- * and returns a list of the most similar chunk IDs based on vector similarity.
59
+ * Use this to retrieve the most similar chunk IDs to a single query embedding.
72
60
  *
73
- * Args:
74
- * request (EmbeddingsSearchRequest): The search request containing:
75
- * - embeddings (List[float]): Single embedding vector for similarity search
76
- * - tenant_id (str): Tenant identifier for multi-tenancy
77
- * - sub_tenant_id (str, optional): Sub-tenant identifier, defaults to tenant_id
78
- * - max_chunks (int, optional): Maximum number of chunk IDs to return (default: 10)
79
- * api_details (dict): Authentication details obtained from API key validation
80
61
  *
81
- * Returns:
82
- * EmbeddingsSearchData: List of chunk IDs with similarity scores
62
+ * Expected outcome
63
+ * - You receive the closest chunk IDs with optional similarity scores.
83
64
  *
84
65
  * @param {CortexAI.EmbeddingsSearchRequest} request
85
66
  * @param {Embeddings.RequestOptions} requestOptions - Request-specific configuration.
@@ -100,12 +81,9 @@ export declare class Embeddings {
100
81
  search(request: CortexAI.EmbeddingsSearchRequest, requestOptions?: Embeddings.RequestOptions): core.HttpResponsePromise<CortexAI.EmbeddingsSearchData>;
101
82
  private __search;
102
83
  /**
103
- * Get embeddings based on chunk IDs.
84
+ * Retrieve embeddings for specific chunk IDs.
104
85
  *
105
- * This endpoint returns embeddings for a list of chunk IDs.
106
- *
107
- * Returns:
108
- * EmbeddingsGetData: Embeddings data for the requested chunk IDs
86
+ * Use this when you already know the chunk IDs and need their corresponding embeddings.
109
87
  *
110
88
  * @param {CortexAI.GetEmbeddingsBasedOnChunkIdsRequest} request
111
89
  * @param {Embeddings.RequestOptions} requestOptions - Request-specific configuration.
@@ -127,12 +105,9 @@ export declare class Embeddings {
127
105
  getByChunkIds(request: CortexAI.GetEmbeddingsBasedOnChunkIdsRequest, requestOptions?: Embeddings.RequestOptions): core.HttpResponsePromise<CortexAI.EmbeddingsGetData>;
128
106
  private __getByChunkIds;
129
107
  /**
130
- * Create an embeddings collection for the given tenant in Findr.
131
- *
132
- * sub_tenant_id is set to be the same as tenant_id as per requirements.
108
+ * Create an embeddings collection for a tenant.
133
109
  *
134
- * Returns:
135
- * EmbeddingsCreateCollectionData: Success response with collection details
110
+ * Use this to initialize storage so you can index and query embeddings for the tenant.
136
111
  *
137
112
  * @param {CortexAI.EmbeddingsCreateCollectionRequest} request
138
113
  * @param {Embeddings.RequestOptions} requestOptions - Request-specific configuration.
@@ -152,5 +127,5 @@ export declare class Embeddings {
152
127
  */
153
128
  createCollection(request: CortexAI.EmbeddingsCreateCollectionRequest, requestOptions?: Embeddings.RequestOptions): core.HttpResponsePromise<CortexAI.EmbeddingsCreateCollectionData>;
154
129
  private __createCollection;
155
- protected _getAuthorizationHeader(): Promise<string | undefined>;
130
+ protected _getAuthorizationHeader(): Promise<string>;
156
131
  }
@@ -33,24 +33,13 @@ const CortexAI = __importStar(require("../../../index.js"));
33
33
  const headers_js_1 = require("../../../../core/headers.js");
34
34
  const errors = __importStar(require("../../../../errors/index.js"));
35
35
  class Embeddings {
36
- constructor(_options = {}) {
36
+ constructor(_options) {
37
37
  this._options = _options;
38
38
  }
39
39
  /**
40
- * Delete specific embedding chunks from indexed sources.
40
+ * Delete embedding chunks by chunk ID.
41
41
  *
42
- * This endpoint deletes specified embedding chunks from the Findr backend by sending
43
- * chunk IDs to the backend delete service.
44
- *
45
- * Args:
46
- * request (EmbeddingsDeleteRequest): The delete request containing:
47
- * - chunk_ids (List[str]): List of chunk IDs to delete
48
- * - tenant_id (str): Tenant identifier for multi-tenancy
49
- * - sub_tenant_id (str, optional): Sub-tenant identifier, defaults to tenant_id
50
- * api_details (dict): Authentication details obtained from API key validation
51
- *
52
- * Returns:
53
- * EmbeddingsDeleteData: Success response with deletion details
42
+ * Use this to remove specific chunks from your embeddings index when they are no longer valid or should not appear in results.
54
43
  *
55
44
  * @param {CortexAI.EmbeddingsDeleteRequest} request
56
45
  * @param {Embeddings.RequestOptions} requestOptions - Request-specific configuration.
@@ -131,21 +120,13 @@ class Embeddings {
131
120
  }
132
121
  }
133
122
  /**
134
- * Search for similar embedding chunks using vector similarity.
123
+ * Find similar chunks using an embedding vector.
135
124
  *
136
- * This endpoint performs semantic search by sending an embedding vector to the Findr backend
137
- * and returns a list of the most similar chunk IDs based on vector similarity.
125
+ * Use this to retrieve the most similar chunk IDs to a single query embedding.
138
126
  *
139
- * Args:
140
- * request (EmbeddingsSearchRequest): The search request containing:
141
- * - embeddings (List[float]): Single embedding vector for similarity search
142
- * - tenant_id (str): Tenant identifier for multi-tenancy
143
- * - sub_tenant_id (str, optional): Sub-tenant identifier, defaults to tenant_id
144
- * - max_chunks (int, optional): Maximum number of chunk IDs to return (default: 10)
145
- * api_details (dict): Authentication details obtained from API key validation
146
127
  *
147
- * Returns:
148
- * EmbeddingsSearchData: List of chunk IDs with similarity scores
128
+ * Expected outcome
129
+ * - You receive the closest chunk IDs with optional similarity scores.
149
130
  *
150
131
  * @param {CortexAI.EmbeddingsSearchRequest} request
151
132
  * @param {Embeddings.RequestOptions} requestOptions - Request-specific configuration.
@@ -225,12 +206,9 @@ class Embeddings {
225
206
  }
226
207
  }
227
208
  /**
228
- * Get embeddings based on chunk IDs.
229
- *
230
- * This endpoint returns embeddings for a list of chunk IDs.
209
+ * Retrieve embeddings for specific chunk IDs.
231
210
  *
232
- * Returns:
233
- * EmbeddingsGetData: Embeddings data for the requested chunk IDs
211
+ * Use this when you already know the chunk IDs and need their corresponding embeddings.
234
212
  *
235
213
  * @param {CortexAI.GetEmbeddingsBasedOnChunkIdsRequest} request
236
214
  * @param {Embeddings.RequestOptions} requestOptions - Request-specific configuration.
@@ -311,12 +289,9 @@ class Embeddings {
311
289
  }
312
290
  }
313
291
  /**
314
- * Create an embeddings collection for the given tenant in Findr.
292
+ * Create an embeddings collection for a tenant.
315
293
  *
316
- * sub_tenant_id is set to be the same as tenant_id as per requirements.
317
- *
318
- * Returns:
319
- * EmbeddingsCreateCollectionData: Success response with collection details
294
+ * Use this to initialize storage so you can index and query embeddings for the tenant.
320
295
  *
321
296
  * @param {CortexAI.EmbeddingsCreateCollectionRequest} request
322
297
  * @param {Embeddings.RequestOptions} requestOptions - Request-specific configuration.
@@ -399,11 +374,7 @@ class Embeddings {
399
374
  }
400
375
  }
401
376
  async _getAuthorizationHeader() {
402
- const bearer = await core.Supplier.get(this._options.token);
403
- if (bearer != null) {
404
- return `Bearer ${bearer}`;
405
- }
406
- return undefined;
377
+ return `Bearer ${await core.Supplier.get(this._options.token)}`;
407
378
  }
408
379
  }
409
380
  exports.Embeddings = Embeddings;
@@ -8,5 +8,6 @@
8
8
  * }
9
9
  */
10
10
  export interface EmbeddingsCreateCollectionRequest {
11
+ /** Unique identifier for the tenant/organization */
11
12
  tenant_id: string;
12
13
  }
@@ -9,7 +9,10 @@
9
9
  * }
10
10
  */
11
11
  export interface EmbeddingsDeleteRequest {
12
+ /** The chunk IDs of the source you want to delete */
12
13
  chunk_ids: string[];
14
+ /** Unique identifier for the tenant/organization */
13
15
  tenant_id: string;
16
+ /** Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id */
14
17
  sub_tenant_id?: string;
15
18
  }
@@ -8,8 +8,11 @@
8
8
  * }
9
9
  */
10
10
  export interface EmbeddingsSearchRequest {
11
+ /** Unique identifier for the tenant/organization */
11
12
  tenant_id: string;
13
+ /** The embedding vector for search */
12
14
  embeddings?: number[];
15
+ /** Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id */
13
16
  sub_tenant_id?: string;
14
17
  max_chunks?: number;
15
18
  }
@@ -9,7 +9,10 @@
9
9
  * }
10
10
  */
11
11
  export interface GetEmbeddingsBasedOnChunkIdsRequest {
12
+ /** The chunk IDs of the source you want to get embeddings for */
12
13
  chunk_ids: string[];
14
+ /** Unique identifier for the tenant/organization */
13
15
  tenant_id: string;
16
+ /** Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id */
14
17
  sub_tenant_id?: string;
15
18
  }
@@ -9,7 +9,7 @@ export declare namespace Fetch {
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?: core.Supplier<core.BearerToken | undefined>;
12
+ token: core.Supplier<core.BearerToken>;
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 Fetch {
28
28
  }
29
29
  export declare class Fetch {
30
30
  protected readonly _options: Fetch.Options;
31
- constructor(_options?: Fetch.Options);
31
+ constructor(_options: Fetch.Options);
32
32
  /**
33
33
  * @param {CortexAI.FetchContentRequest} request
34
34
  * @param {Fetch.RequestOptions} requestOptions - Request-specific configuration.
@@ -50,5 +50,5 @@ export declare class Fetch {
50
50
  */
51
51
  fetchContent(request: CortexAI.FetchContentRequest, requestOptions?: Fetch.RequestOptions): core.HttpResponsePromise<CortexAI.FetchContentData>;
52
52
  private __fetchContent;
53
- protected _getAuthorizationHeader(): Promise<string | undefined>;
53
+ protected _getAuthorizationHeader(): Promise<string>;
54
54
  }
@@ -33,7 +33,7 @@ const CortexAI = __importStar(require("../../../index.js"));
33
33
  const headers_js_1 = require("../../../../core/headers.js");
34
34
  const errors = __importStar(require("../../../../errors/index.js"));
35
35
  class Fetch {
36
- constructor(_options = {}) {
36
+ constructor(_options) {
37
37
  this._options = _options;
38
38
  }
39
39
  /**
@@ -117,11 +117,7 @@ class Fetch {
117
117
  }
118
118
  }
119
119
  async _getAuthorizationHeader() {
120
- const bearer = await core.Supplier.get(this._options.token);
121
- if (bearer != null) {
122
- return `Bearer ${bearer}`;
123
- }
124
- return undefined;
120
+ return `Bearer ${await core.Supplier.get(this._options.token)}`;
125
121
  }
126
122
  }
127
123
  exports.Fetch = Fetch;