@usecortex_ai/node 0.1.1 → 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 (118) 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 -39
  10. package/dist/api/resources/embeddings/client/Client.js +12 -42
  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 +4 -3
  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 -3
  26. package/dist/api/resources/sources/client/Client.js +14 -6
  27. package/dist/api/resources/sources/client/requests/SourcesGetAllRequest.d.ts +2 -0
  28. package/dist/api/resources/sources/client/requests/SourcesGetSubTenantIdsRequest.d.ts +12 -0
  29. package/dist/api/resources/sources/client/requests/SourcesGetSubTenantIdsRequest.js +5 -0
  30. package/dist/api/resources/tenant/client/Client.d.ts +55 -5
  31. package/dist/api/resources/tenant/client/Client.js +173 -8
  32. package/dist/api/resources/tenant/client/requests/TenantDeleteSubTenantRequest.d.ts +14 -0
  33. package/dist/api/resources/tenant/client/requests/TenantDeleteSubTenantRequest.js +5 -0
  34. package/dist/api/resources/tenant/client/requests/TenantGetSubTenantIdsRequest.d.ts +12 -0
  35. package/dist/api/resources/tenant/client/requests/TenantGetSubTenantIdsRequest.js +5 -0
  36. package/dist/api/resources/tenant/client/requests/TenantStatsRequest.d.ts +2 -0
  37. package/dist/api/resources/tenant/client/requests/index.d.ts +2 -0
  38. package/dist/api/resources/upload/client/Client.d.ts +108 -26
  39. package/dist/api/resources/upload/client/Client.js +107 -41
  40. package/dist/api/resources/upload/client/requests/BodyBatchUpdateUploadBatchUpdatePatch.d.ts +17 -1
  41. package/dist/api/resources/upload/client/requests/BodyBatchUploadUploadBatchUploadPost.d.ts +16 -1
  42. package/dist/api/resources/upload/client/requests/BodyUpdateFileUploadUpdateDocumentPatch.d.ts +17 -1
  43. package/dist/api/resources/upload/client/requests/BodyUploadFilesUploadUploadDocumentPost.d.ts +16 -1
  44. package/dist/api/resources/upload/client/requests/EmbeddingsUpdateRequest.d.ts +5 -6
  45. package/dist/api/resources/upload/client/requests/EmbeddingsUploadRequest.d.ts +4 -0
  46. package/dist/api/resources/upload/client/requests/UploadScrapeWebpageRequest.d.ts +4 -0
  47. package/dist/api/resources/upload/client/requests/UploadUpdateMarkdownRequest.d.ts +23 -0
  48. package/dist/api/resources/upload/client/requests/UploadUpdateMarkdownRequest.js +5 -0
  49. package/dist/api/resources/upload/client/requests/UploadUpdateTextRequest.d.ts +23 -0
  50. package/dist/api/resources/upload/client/requests/UploadUpdateTextRequest.js +5 -0
  51. package/dist/api/resources/upload/client/requests/UploadUpdateWebpageRequest.d.ts +4 -0
  52. package/dist/api/resources/upload/client/requests/UploadUploadAppSourcesRequest.d.ts +3 -0
  53. package/dist/api/resources/upload/client/requests/UploadUploadMarkdownRequest.d.ts +20 -0
  54. package/dist/api/resources/upload/client/requests/UploadUploadMarkdownRequest.js +5 -0
  55. package/dist/api/resources/upload/client/requests/UploadUploadTextRequest.d.ts +20 -0
  56. package/dist/api/resources/upload/client/requests/UploadUploadTextRequest.js +5 -0
  57. package/dist/api/resources/upload/client/requests/UploadVerifyProcessingRequest.d.ts +2 -0
  58. package/dist/api/resources/upload/client/requests/index.d.ts +4 -4
  59. package/dist/api/resources/user/client/Client.d.ts +9 -6
  60. package/dist/api/resources/user/client/Client.js +8 -9
  61. package/dist/api/resources/user/client/requests/BodyCreateTenantUserCreateTenantPost.d.ts +1 -0
  62. package/dist/api/resources/userMemory/client/Client.d.ts +89 -21
  63. package/dist/api/resources/userMemory/client/Client.js +183 -33
  64. package/dist/api/resources/userMemory/client/requests/AddUserMemoryRequest.d.ts +18 -0
  65. package/dist/api/resources/userMemory/client/requests/AddUserMemoryRequest.js +5 -0
  66. package/dist/api/resources/userMemory/client/requests/GenerateUserMemoryRequest.d.ts +21 -0
  67. package/dist/api/resources/userMemory/client/requests/GenerateUserMemoryRequest.js +5 -0
  68. package/dist/api/resources/userMemory/client/requests/RetrieveUserMemoryRequest.d.ts +20 -0
  69. package/dist/api/resources/userMemory/client/requests/RetrieveUserMemoryRequest.js +5 -0
  70. package/dist/api/resources/userMemory/client/requests/UserMemoryDeleteUserMemoryRequest.d.ts +5 -3
  71. package/dist/api/resources/userMemory/client/requests/UserMemoryListUserMemoriesRequest.d.ts +4 -3
  72. package/dist/api/resources/userMemory/client/requests/index.d.ts +3 -3
  73. package/dist/api/types/AddUserMemoryResponse.d.ts +14 -0
  74. package/dist/api/types/AddUserMemoryResponse.js +5 -0
  75. package/dist/api/types/AppSourcesUploadData.d.ts +4 -2
  76. package/dist/api/types/AttachmentModel.d.ts +7 -0
  77. package/dist/api/types/BatchUploadData.d.ts +4 -2
  78. package/dist/api/types/BodyScrapeWebpageUploadScrapeWebpagePost.d.ts +0 -1
  79. package/dist/api/types/BodyUpdateScrapeJobUploadUpdateWebpagePatch.d.ts +0 -1
  80. package/dist/api/types/ContentModel.d.ts +6 -0
  81. package/dist/api/types/DeleteMemoryRequest.d.ts +3 -0
  82. package/dist/api/types/DeleteSources.d.ts +7 -0
  83. package/dist/api/types/DeleteSources.js +5 -0
  84. package/dist/api/types/DeleteSubTenantData.d.ts +15 -0
  85. package/dist/api/types/DeleteSubTenantData.js +5 -0
  86. package/dist/api/types/DeleteUserMemoryResponse.d.ts +12 -0
  87. package/dist/api/types/DeleteUserMemoryResponse.js +5 -0
  88. package/dist/api/types/EmbeddingsCreateCollectionData.d.ts +6 -2
  89. package/dist/api/types/EmbeddingsDeleteData.d.ts +6 -2
  90. package/dist/api/types/EmbeddingsGetData.d.ts +6 -2
  91. package/dist/api/types/EmbeddingsSearchData.d.ts +6 -2
  92. package/dist/api/types/ErrorResponse.d.ts +0 -1
  93. package/dist/api/types/FetchContentData.d.ts +6 -3
  94. package/dist/api/types/FileUploadResult.d.ts +2 -0
  95. package/dist/api/types/GenerateUserMemoryResponse.d.ts +13 -0
  96. package/dist/api/types/GenerateUserMemoryResponse.js +5 -0
  97. package/dist/api/types/ListSourcesResponse.d.ts +4 -1
  98. package/dist/api/types/ListUserMemoriesResponse.d.ts +13 -0
  99. package/dist/api/types/ListUserMemoriesResponse.js +5 -0
  100. package/dist/api/types/MarkdownUploadRequest.d.ts +12 -0
  101. package/dist/api/types/ProcessingStatus.d.ts +5 -2
  102. package/dist/api/types/Relations.d.ts +2 -2
  103. package/dist/api/types/RetrieveUserMemoryResponse.d.ts +13 -0
  104. package/dist/api/types/RetrieveUserMemoryResponse.js +5 -0
  105. package/dist/api/types/SearchChunk.d.ts +13 -7
  106. package/dist/api/types/SingleUploadData.d.ts +4 -2
  107. package/dist/api/types/Source.d.ts +9 -9
  108. package/dist/api/types/SourceContent.d.ts +2 -2
  109. package/dist/api/types/SourceModel.d.ts +23 -2
  110. package/dist/api/types/SubTenantIdsData.d.ts +15 -0
  111. package/dist/api/types/SubTenantIdsData.js +5 -0
  112. package/dist/api/types/TenantCreateData.d.ts +6 -2
  113. package/dist/api/types/TenantStats.d.ts +8 -3
  114. package/dist/api/types/UserMemory.d.ts +12 -0
  115. package/dist/api/types/UserMemory.js +5 -0
  116. package/dist/api/types/index.d.ts +9 -1
  117. package/dist/api/types/index.js +9 -1
  118. 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.
@@ -94,19 +75,15 @@ export declare class Embeddings {
94
75
  *
95
76
  * @example
96
77
  * await client.embeddings.search({
97
- * embeddings: [1.1],
98
78
  * tenant_id: "tenant_id"
99
79
  * })
100
80
  */
101
81
  search(request: CortexAI.EmbeddingsSearchRequest, requestOptions?: Embeddings.RequestOptions): core.HttpResponsePromise<CortexAI.EmbeddingsSearchData>;
102
82
  private __search;
103
83
  /**
104
- * Get embeddings based on chunk IDs.
84
+ * Retrieve embeddings for specific chunk IDs.
105
85
  *
106
- * This endpoint returns embeddings for a list of chunk IDs.
107
- *
108
- * Returns:
109
- * EmbeddingsGetData: Embeddings data for the requested chunk IDs
86
+ * Use this when you already know the chunk IDs and need their corresponding embeddings.
110
87
  *
111
88
  * @param {CortexAI.GetEmbeddingsBasedOnChunkIdsRequest} request
112
89
  * @param {Embeddings.RequestOptions} requestOptions - Request-specific configuration.
@@ -128,12 +105,9 @@ export declare class Embeddings {
128
105
  getByChunkIds(request: CortexAI.GetEmbeddingsBasedOnChunkIdsRequest, requestOptions?: Embeddings.RequestOptions): core.HttpResponsePromise<CortexAI.EmbeddingsGetData>;
129
106
  private __getByChunkIds;
130
107
  /**
131
- * Create an embeddings collection for the given tenant in Findr.
132
- *
133
- * sub_tenant_id is set to be the same as tenant_id as per requirements.
108
+ * Create an embeddings collection for a tenant.
134
109
  *
135
- * Returns:
136
- * EmbeddingsCreateCollectionData: Success response with collection details
110
+ * Use this to initialize storage so you can index and query embeddings for the tenant.
137
111
  *
138
112
  * @param {CortexAI.EmbeddingsCreateCollectionRequest} request
139
113
  * @param {Embeddings.RequestOptions} requestOptions - Request-specific configuration.
@@ -153,5 +127,5 @@ export declare class Embeddings {
153
127
  */
154
128
  createCollection(request: CortexAI.EmbeddingsCreateCollectionRequest, requestOptions?: Embeddings.RequestOptions): core.HttpResponsePromise<CortexAI.EmbeddingsCreateCollectionData>;
155
129
  private __createCollection;
156
- protected _getAuthorizationHeader(): Promise<string | undefined>;
130
+ protected _getAuthorizationHeader(): Promise<string>;
157
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.
@@ -160,7 +141,6 @@ class Embeddings {
160
141
  *
161
142
  * @example
162
143
  * await client.embeddings.search({
163
- * embeddings: [1.1],
164
144
  * tenant_id: "tenant_id"
165
145
  * })
166
146
  */
@@ -226,12 +206,9 @@ class Embeddings {
226
206
  }
227
207
  }
228
208
  /**
229
- * Get embeddings based on chunk IDs.
230
- *
231
- * This endpoint returns embeddings for a list of chunk IDs.
209
+ * Retrieve embeddings for specific chunk IDs.
232
210
  *
233
- * Returns:
234
- * EmbeddingsGetData: Embeddings data for the requested chunk IDs
211
+ * Use this when you already know the chunk IDs and need their corresponding embeddings.
235
212
  *
236
213
  * @param {CortexAI.GetEmbeddingsBasedOnChunkIdsRequest} request
237
214
  * @param {Embeddings.RequestOptions} requestOptions - Request-specific configuration.
@@ -312,12 +289,9 @@ class Embeddings {
312
289
  }
313
290
  }
314
291
  /**
315
- * Create an embeddings collection for the given tenant in Findr.
292
+ * Create an embeddings collection for a tenant.
316
293
  *
317
- * sub_tenant_id is set to be the same as tenant_id as per requirements.
318
- *
319
- * Returns:
320
- * EmbeddingsCreateCollectionData: Success response with collection details
294
+ * Use this to initialize storage so you can index and query embeddings for the tenant.
321
295
  *
322
296
  * @param {CortexAI.EmbeddingsCreateCollectionRequest} request
323
297
  * @param {Embeddings.RequestOptions} requestOptions - Request-specific configuration.
@@ -400,11 +374,7 @@ class Embeddings {
400
374
  }
401
375
  }
402
376
  async _getAuthorizationHeader() {
403
- const bearer = await core.Supplier.get(this._options.token);
404
- if (bearer != null) {
405
- return `Bearer ${bearer}`;
406
- }
407
- return undefined;
377
+ return `Bearer ${await core.Supplier.get(this._options.token)}`;
408
378
  }
409
379
  }
410
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
  }
@@ -4,14 +4,15 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * embeddings: [1.1],
8
7
  * tenant_id: "tenant_id"
9
8
  * }
10
9
  */
11
10
  export interface EmbeddingsSearchRequest {
12
- /** Single embedding vector for search */
13
- embeddings: number[];
11
+ /** Unique identifier for the tenant/organization */
14
12
  tenant_id: string;
13
+ /** The embedding vector for search */
14
+ embeddings?: number[];
15
+ /** Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id */
15
16
  sub_tenant_id?: string;
16
17
  max_chunks?: number;
17
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
  }