@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
@@ -25,6 +25,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  __setModuleDefault(result, mod);
26
26
  return result;
27
27
  };
28
+ var __rest = (this && this.__rest) || function (s, e) {
29
+ var t = {};
30
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
31
+ t[p] = s[p];
32
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
33
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
34
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
35
+ t[p[i]] = s[p[i]];
36
+ }
37
+ return t;
38
+ };
28
39
  Object.defineProperty(exports, "__esModule", { value: true });
29
40
  exports.UserMemory = void 0;
30
41
  const environments = __importStar(require("../../../../environments.js"));
@@ -33,19 +44,32 @@ const CortexAI = __importStar(require("../../../index.js"));
33
44
  const headers_js_1 = require("../../../../core/headers.js");
34
45
  const errors = __importStar(require("../../../../errors/index.js"));
35
46
  class UserMemory {
36
- constructor(_options = {}) {
47
+ constructor(_options) {
37
48
  this._options = _options;
38
49
  }
39
50
  /**
51
+ * Retrieve all stored user memories for your tenant.
52
+ *
53
+ * This endpoint returns a comprehensive list of all user memories that have been stored,
54
+ * whether they were added manually or generated through AI. User memories help personalize
55
+ * your experience by storing context, preferences, and important information.
56
+ *
57
+ * You can optionally specify a sub-tenant to filter memories within that specific scope.
58
+ *
40
59
  * @param {CortexAI.UserMemoryListUserMemoriesRequest} request
41
60
  * @param {UserMemory.RequestOptions} requestOptions - Request-specific configuration.
42
61
  *
62
+ * @throws {@link CortexAI.BadRequestError}
63
+ * @throws {@link CortexAI.UnauthorizedError}
64
+ * @throws {@link CortexAI.ForbiddenError}
65
+ * @throws {@link CortexAI.NotFoundError}
43
66
  * @throws {@link CortexAI.UnprocessableEntityError}
67
+ * @throws {@link CortexAI.InternalServerError}
68
+ * @throws {@link CortexAI.ServiceUnavailableError}
44
69
  *
45
70
  * @example
46
71
  * await client.userMemory.listUserMemories({
47
- * tenant_id: "tenant_id",
48
- * sub_tenant_id: "sub_tenant_id"
72
+ * tenant_id: "tenant_id"
49
73
  * })
50
74
  */
51
75
  listUserMemories(request, requestOptions) {
@@ -56,7 +80,9 @@ class UserMemory {
56
80
  const { tenant_id: tenantId, sub_tenant_id: subTenantId } = request;
57
81
  const _queryParams = {};
58
82
  _queryParams["tenant_id"] = tenantId;
59
- _queryParams["sub_tenant_id"] = subTenantId;
83
+ if (subTenantId != null) {
84
+ _queryParams["sub_tenant_id"] = subTenantId;
85
+ }
60
86
  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);
61
87
  const _response = await core.fetcher({
62
88
  url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "user_memory/list_user_memories"),
@@ -72,8 +98,20 @@ class UserMemory {
72
98
  }
73
99
  if (_response.error.reason === "status-code") {
74
100
  switch (_response.error.statusCode) {
101
+ case 400:
102
+ throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
103
+ case 401:
104
+ throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
105
+ case 403:
106
+ throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
107
+ case 404:
108
+ throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
75
109
  case 422:
76
110
  throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
111
+ case 500:
112
+ throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
113
+ case 503:
114
+ throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
77
115
  default:
78
116
  throw new errors.CortexAIError({
79
117
  statusCode: _response.error.statusCode,
@@ -99,16 +137,29 @@ class UserMemory {
99
137
  }
100
138
  }
101
139
  /**
140
+ * Permanently remove a specific user memory from storage.
141
+ *
142
+ * This endpoint allows you to delete a user memory by its unique identifier.
143
+ * Once deleted, the memory cannot be recovered, so use this operation carefully.
144
+ *
145
+ * The memory will be removed from your tenant's storage and will no longer
146
+ * appear in search results or memory listings.
147
+ *
102
148
  * @param {CortexAI.UserMemoryDeleteUserMemoryRequest} request
103
149
  * @param {UserMemory.RequestOptions} requestOptions - Request-specific configuration.
104
150
  *
151
+ * @throws {@link CortexAI.BadRequestError}
152
+ * @throws {@link CortexAI.UnauthorizedError}
153
+ * @throws {@link CortexAI.ForbiddenError}
154
+ * @throws {@link CortexAI.NotFoundError}
105
155
  * @throws {@link CortexAI.UnprocessableEntityError}
156
+ * @throws {@link CortexAI.InternalServerError}
157
+ * @throws {@link CortexAI.ServiceUnavailableError}
106
158
  *
107
159
  * @example
108
160
  * await client.userMemory.deleteUserMemory({
109
161
  * tenant_id: "tenant_id",
110
- * memory_id: "memory_id",
111
- * sub_tenant_id: "sub_tenant_id"
162
+ * memory_id: "memory_id"
112
163
  * })
113
164
  */
114
165
  deleteUserMemory(request, requestOptions) {
@@ -120,7 +171,9 @@ class UserMemory {
120
171
  const _queryParams = {};
121
172
  _queryParams["tenant_id"] = tenantId;
122
173
  _queryParams["memory_id"] = memoryId;
123
- _queryParams["sub_tenant_id"] = subTenantId;
174
+ if (subTenantId != null) {
175
+ _queryParams["sub_tenant_id"] = subTenantId;
176
+ }
124
177
  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);
125
178
  const _response = await core.fetcher({
126
179
  url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "user_memory/delete_user_memory"),
@@ -136,8 +189,20 @@ class UserMemory {
136
189
  }
137
190
  if (_response.error.reason === "status-code") {
138
191
  switch (_response.error.statusCode) {
192
+ case 400:
193
+ throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
194
+ case 401:
195
+ throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
196
+ case 403:
197
+ throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
198
+ case 404:
199
+ throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
139
200
  case 422:
140
201
  throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
202
+ case 500:
203
+ throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
204
+ case 503:
205
+ throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
141
206
  default:
142
207
  throw new errors.CortexAIError({
143
208
  statusCode: _response.error.statusCode,
@@ -163,16 +228,30 @@ class UserMemory {
163
228
  }
164
229
  }
165
230
  /**
166
- * @param {CortexAI.UserMemoryRetrieveUserMemoryRequest} request
231
+ * Find relevant user memories using semantic search.
232
+ *
233
+ * This endpoint performs a semantic search across all your stored user memories
234
+ * to find the most relevant ones based on your query. The results are ranked by
235
+ * similarity score, with the most relevant memories returned first.
236
+ *
237
+ * Use this to recall past preferences, context, or information that might be
238
+ * relevant to your current task or query.
239
+ *
240
+ * @param {CortexAI.RetrieveUserMemoryRequest} request
167
241
  * @param {UserMemory.RequestOptions} requestOptions - Request-specific configuration.
168
242
  *
243
+ * @throws {@link CortexAI.BadRequestError}
244
+ * @throws {@link CortexAI.UnauthorizedError}
245
+ * @throws {@link CortexAI.ForbiddenError}
246
+ * @throws {@link CortexAI.NotFoundError}
169
247
  * @throws {@link CortexAI.UnprocessableEntityError}
248
+ * @throws {@link CortexAI.InternalServerError}
249
+ * @throws {@link CortexAI.ServiceUnavailableError}
170
250
  *
171
251
  * @example
172
252
  * await client.userMemory.retrieveUserMemory({
173
253
  * tenant_id: "tenant_id",
174
- * query: "query",
175
- * sub_tenant_id: "sub_tenant_id"
254
+ * query: "query"
176
255
  * })
177
256
  */
178
257
  retrieveUserMemory(request, requestOptions) {
@@ -180,20 +259,24 @@ class UserMemory {
180
259
  }
181
260
  async __retrieveUserMemory(request, requestOptions) {
182
261
  var _a, _b, _c;
183
- const { tenant_id: tenantId, query, sub_tenant_id: subTenantId, max_count: maxCount } = request;
262
+ const { tenant_id: tenantId, sub_tenant_id: subTenantId, max_count: maxCount } = request, _body = __rest(request, ["tenant_id", "sub_tenant_id", "max_count"]);
184
263
  const _queryParams = {};
185
264
  _queryParams["tenant_id"] = tenantId;
186
- _queryParams["query"] = query;
187
- _queryParams["sub_tenant_id"] = subTenantId;
265
+ if (subTenantId != null) {
266
+ _queryParams["sub_tenant_id"] = subTenantId;
267
+ }
188
268
  if (maxCount != null) {
189
269
  _queryParams["max_count"] = maxCount.toString();
190
270
  }
191
271
  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);
192
272
  const _response = await core.fetcher({
193
273
  url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "user_memory/retrieve_user_memory"),
194
- method: "GET",
274
+ method: "POST",
195
275
  headers: _headers,
276
+ contentType: "application/json",
196
277
  queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
278
+ requestType: "json",
279
+ body: _body,
197
280
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
198
281
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
199
282
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -203,8 +286,20 @@ class UserMemory {
203
286
  }
204
287
  if (_response.error.reason === "status-code") {
205
288
  switch (_response.error.statusCode) {
289
+ case 400:
290
+ throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
291
+ case 401:
292
+ throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
293
+ case 403:
294
+ throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
295
+ case 404:
296
+ throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
206
297
  case 422:
207
298
  throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
299
+ case 500:
300
+ throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
301
+ case 503:
302
+ throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
208
303
  default:
209
304
  throw new errors.CortexAIError({
210
305
  statusCode: _response.error.statusCode,
@@ -221,7 +316,7 @@ class UserMemory {
221
316
  rawResponse: _response.rawResponse,
222
317
  });
223
318
  case "timeout":
224
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling GET /user_memory/retrieve_user_memory.");
319
+ throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /user_memory/retrieve_user_memory.");
225
320
  case "unknown":
226
321
  throw new errors.CortexAIError({
227
322
  message: _response.error.errorMessage,
@@ -230,17 +325,31 @@ class UserMemory {
230
325
  }
231
326
  }
232
327
  /**
233
- * @param {CortexAI.UserMemoryGenerateUserMemoryRequest} request
328
+ * Generate AI-powered user memories from your query and context.
329
+ *
330
+ * This endpoint uses artificial intelligence to create personalized memories
331
+ * based on your query and user context. The AI analyzes your input and generates
332
+ * relevant, contextual memories that can help improve future interactions.
333
+ *
334
+ * Generated memories are automatically stored and can be retrieved through
335
+ * the standard memory search endpoints.
336
+ *
337
+ * @param {CortexAI.GenerateUserMemoryRequest} request
234
338
  * @param {UserMemory.RequestOptions} requestOptions - Request-specific configuration.
235
339
  *
340
+ * @throws {@link CortexAI.BadRequestError}
341
+ * @throws {@link CortexAI.UnauthorizedError}
342
+ * @throws {@link CortexAI.ForbiddenError}
343
+ * @throws {@link CortexAI.NotFoundError}
236
344
  * @throws {@link CortexAI.UnprocessableEntityError}
345
+ * @throws {@link CortexAI.InternalServerError}
346
+ * @throws {@link CortexAI.ServiceUnavailableError}
237
347
  *
238
348
  * @example
239
349
  * await client.userMemory.generateUserMemory({
240
350
  * tenant_id: "tenant_id",
241
351
  * user_query: "user_query",
242
- * user_name: "user_name",
243
- * sub_tenant_id: "sub_tenant_id"
352
+ * user_name: "user_name"
244
353
  * })
245
354
  */
246
355
  generateUserMemory(request, requestOptions) {
@@ -248,18 +357,21 @@ class UserMemory {
248
357
  }
249
358
  async __generateUserMemory(request, requestOptions) {
250
359
  var _a, _b, _c;
251
- const { tenant_id: tenantId, user_query: userQuery, user_name: userName, sub_tenant_id: subTenantId } = request;
360
+ const { tenant_id: tenantId, sub_tenant_id: subTenantId } = request, _body = __rest(request, ["tenant_id", "sub_tenant_id"]);
252
361
  const _queryParams = {};
253
362
  _queryParams["tenant_id"] = tenantId;
254
- _queryParams["user_query"] = userQuery;
255
- _queryParams["user_name"] = userName;
256
- _queryParams["sub_tenant_id"] = subTenantId;
363
+ if (subTenantId != null) {
364
+ _queryParams["sub_tenant_id"] = subTenantId;
365
+ }
257
366
  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);
258
367
  const _response = await core.fetcher({
259
368
  url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "user_memory/generate_user_memory"),
260
369
  method: "POST",
261
370
  headers: _headers,
371
+ contentType: "application/json",
262
372
  queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
373
+ requestType: "json",
374
+ body: _body,
263
375
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
264
376
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
265
377
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -269,8 +381,20 @@ class UserMemory {
269
381
  }
270
382
  if (_response.error.reason === "status-code") {
271
383
  switch (_response.error.statusCode) {
384
+ case 400:
385
+ throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
386
+ case 401:
387
+ throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
388
+ case 403:
389
+ throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
390
+ case 404:
391
+ throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
272
392
  case 422:
273
393
  throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
394
+ case 500:
395
+ throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
396
+ case 503:
397
+ throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
274
398
  default:
275
399
  throw new errors.CortexAIError({
276
400
  statusCode: _response.error.statusCode,
@@ -296,16 +420,30 @@ class UserMemory {
296
420
  }
297
421
  }
298
422
  /**
299
- * @param {CortexAI.UserMemoryAddUserMemoryRequest} request
423
+ * Store a new user memory for future reference.
424
+ *
425
+ * This endpoint allows you to manually add a memory that will be stored and
426
+ * can be retrieved later through memory search. Use this to save important
427
+ * preferences, context, or information that you want the system to remember.
428
+ *
429
+ * The stored memory will be indexed and available for semantic search, making
430
+ * it accessible when relevant to future queries or interactions.
431
+ *
432
+ * @param {CortexAI.AddUserMemoryRequest} request
300
433
  * @param {UserMemory.RequestOptions} requestOptions - Request-specific configuration.
301
434
  *
435
+ * @throws {@link CortexAI.BadRequestError}
436
+ * @throws {@link CortexAI.UnauthorizedError}
437
+ * @throws {@link CortexAI.ForbiddenError}
438
+ * @throws {@link CortexAI.NotFoundError}
302
439
  * @throws {@link CortexAI.UnprocessableEntityError}
440
+ * @throws {@link CortexAI.InternalServerError}
441
+ * @throws {@link CortexAI.ServiceUnavailableError}
303
442
  *
304
443
  * @example
305
444
  * await client.userMemory.addUserMemory({
306
445
  * tenant_id: "tenant_id",
307
- * user_memory: "user_memory",
308
- * sub_tenant_id: "sub_tenant_id"
446
+ * user_memory: "user_memory"
309
447
  * })
310
448
  */
311
449
  addUserMemory(request, requestOptions) {
@@ -313,17 +451,21 @@ class UserMemory {
313
451
  }
314
452
  async __addUserMemory(request, requestOptions) {
315
453
  var _a, _b, _c;
316
- const { tenant_id: tenantId, user_memory: userMemory, sub_tenant_id: subTenantId } = request;
454
+ const { tenant_id: tenantId, sub_tenant_id: subTenantId } = request, _body = __rest(request, ["tenant_id", "sub_tenant_id"]);
317
455
  const _queryParams = {};
318
456
  _queryParams["tenant_id"] = tenantId;
319
- _queryParams["user_memory"] = userMemory;
320
- _queryParams["sub_tenant_id"] = subTenantId;
457
+ if (subTenantId != null) {
458
+ _queryParams["sub_tenant_id"] = subTenantId;
459
+ }
321
460
  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);
322
461
  const _response = await core.fetcher({
323
462
  url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "user_memory/add_user_memory"),
324
463
  method: "POST",
325
464
  headers: _headers,
465
+ contentType: "application/json",
326
466
  queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
467
+ requestType: "json",
468
+ body: _body,
327
469
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
328
470
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
329
471
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -333,8 +475,20 @@ class UserMemory {
333
475
  }
334
476
  if (_response.error.reason === "status-code") {
335
477
  switch (_response.error.statusCode) {
478
+ case 400:
479
+ throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
480
+ case 401:
481
+ throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
482
+ case 403:
483
+ throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
484
+ case 404:
485
+ throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
336
486
  case 422:
337
487
  throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
488
+ case 500:
489
+ throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
490
+ case 503:
491
+ throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
338
492
  default:
339
493
  throw new errors.CortexAIError({
340
494
  statusCode: _response.error.statusCode,
@@ -360,11 +514,7 @@ class UserMemory {
360
514
  }
361
515
  }
362
516
  async _getAuthorizationHeader() {
363
- const bearer = await core.Supplier.get(this._options.token);
364
- if (bearer != null) {
365
- return `Bearer ${bearer}`;
366
- }
367
- return undefined;
517
+ return `Bearer ${await core.Supplier.get(this._options.token)}`;
368
518
  }
369
519
  }
370
520
  exports.UserMemory = UserMemory;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * tenant_id: "tenant_id",
8
+ * user_memory: "user_memory"
9
+ * }
10
+ */
11
+ export interface AddUserMemoryRequest {
12
+ /** Unique identifier for the tenant/organization */
13
+ tenant_id: string;
14
+ /** Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id */
15
+ sub_tenant_id?: string;
16
+ /** The memory content to store for future reference */
17
+ user_memory: string;
18
+ }
@@ -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,21 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * tenant_id: "tenant_id",
8
+ * user_query: "user_query",
9
+ * user_name: "user_name"
10
+ * }
11
+ */
12
+ export interface GenerateUserMemoryRequest {
13
+ /** Unique identifier for the tenant/organization */
14
+ tenant_id: string;
15
+ /** Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id */
16
+ sub_tenant_id?: string;
17
+ /** Your query or context for AI memory generation */
18
+ user_query: string;
19
+ /** Your name to personalize the generated memories */
20
+ user_name: string;
21
+ }
@@ -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,20 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * tenant_id: "tenant_id",
8
+ * query: "query"
9
+ * }
10
+ */
11
+ export interface RetrieveUserMemoryRequest {
12
+ /** Unique identifier for the tenant/organization */
13
+ tenant_id: string;
14
+ /** Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id */
15
+ sub_tenant_id?: string;
16
+ /** Maximum number of memories to return (default: 5) */
17
+ max_count?: number;
18
+ /** Search query to find relevant user memories */
19
+ query: string;
20
+ }
@@ -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 });
@@ -5,12 +5,14 @@
5
5
  * @example
6
6
  * {
7
7
  * tenant_id: "tenant_id",
8
- * memory_id: "memory_id",
9
- * sub_tenant_id: "sub_tenant_id"
8
+ * memory_id: "memory_id"
10
9
  * }
11
10
  */
12
11
  export interface UserMemoryDeleteUserMemoryRequest {
12
+ /** Unique identifier for the tenant/organization */
13
13
  tenant_id: string;
14
+ /** Unique identifier of the memory to delete */
14
15
  memory_id: string;
15
- sub_tenant_id: string;
16
+ /** Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id */
17
+ sub_tenant_id?: string;
16
18
  }
@@ -4,11 +4,12 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * tenant_id: "tenant_id",
8
- * sub_tenant_id: "sub_tenant_id"
7
+ * tenant_id: "tenant_id"
9
8
  * }
10
9
  */
11
10
  export interface UserMemoryListUserMemoriesRequest {
11
+ /** Unique identifier for the tenant/organization */
12
12
  tenant_id: string;
13
- sub_tenant_id: string;
13
+ /** Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id */
14
+ sub_tenant_id?: string;
14
15
  }
@@ -1,5 +1,5 @@
1
1
  export { type UserMemoryListUserMemoriesRequest } from "./UserMemoryListUserMemoriesRequest.js";
2
2
  export { type UserMemoryDeleteUserMemoryRequest } from "./UserMemoryDeleteUserMemoryRequest.js";
3
- export { type UserMemoryRetrieveUserMemoryRequest } from "./UserMemoryRetrieveUserMemoryRequest.js";
4
- export { type UserMemoryGenerateUserMemoryRequest } from "./UserMemoryGenerateUserMemoryRequest.js";
5
- export { type UserMemoryAddUserMemoryRequest } from "./UserMemoryAddUserMemoryRequest.js";
3
+ export { type RetrieveUserMemoryRequest } from "./RetrieveUserMemoryRequest.js";
4
+ export { type GenerateUserMemoryRequest } from "./GenerateUserMemoryRequest.js";
5
+ export { type AddUserMemoryRequest } from "./AddUserMemoryRequest.js";
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Response model for adding a new user memory.
6
+ */
7
+ export interface AddUserMemoryResponse {
8
+ /** Indicates whether the memory addition operation was successful */
9
+ success: boolean;
10
+ /** Confirms whether the memory was successfully stored in the system */
11
+ user_memory_added: boolean;
12
+ /** Unique identifier assigned to the newly created memory */
13
+ memory_id?: string;
14
+ }
@@ -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 });
@@ -3,7 +3,9 @@
3
3
  */
4
4
  import * as CortexAI from "../index.js";
5
5
  export interface AppSourcesUploadData {
6
- success?: boolean;
7
- message?: string;
6
+ /** List of successfully uploaded app source for indexing */
8
7
  uploaded: CortexAI.FileUploadResult[];
8
+ /** Status message indicating app sources upload scheduled */
9
+ message: string;
10
+ success?: boolean;
9
11
  }
@@ -3,11 +3,18 @@
3
3
  */
4
4
  import * as CortexAI from "../index.js";
5
5
  export interface AttachmentModel {
6
+ /** Unique identifier for the attachment. */
6
7
  id?: string;
8
+ /** Public or internal URL referencing the attachment resource. */
7
9
  url?: string;
10
+ /** Human-readable title or filename of the attachment. */
8
11
  title?: string;
12
+ /** MIME type of the attachment (e.g., application/pdf). */
9
13
  content_type?: string;
14
+ /** Direct URL for content retrieval when different from the reference URL. */
10
15
  content_url?: string;
16
+ /** Additional attachment attributes defined by the tenant (free-form). */
11
17
  misc?: Record<string, unknown>;
18
+ /** Structured content payload for the attachment when available. */
12
19
  content?: CortexAI.ContentModel;
13
20
  }
@@ -3,7 +3,9 @@
3
3
  */
4
4
  import * as CortexAI from "../index.js";
5
5
  export interface BatchUploadData {
6
- success?: boolean;
7
- message?: string;
6
+ /** List of successfully uploaded files for processing */
8
7
  uploaded: CortexAI.FileUploadResult[];
8
+ /** Status message indicating batch document parsing scheduled */
9
+ message: string;
10
+ success?: boolean;
9
11
  }
@@ -2,5 +2,4 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  export interface BodyScrapeWebpageUploadScrapeWebpagePost {
5
- relations?: string;
6
5
  }
@@ -2,5 +2,4 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  export interface BodyUpdateScrapeJobUploadUpdateWebpagePatch {
5
- relations?: string;
6
5
  }
@@ -2,10 +2,16 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  export interface ContentModel {
5
+ /** Plain text content extracted or provided for indexing. */
5
6
  text?: string;
7
+ /** Base64-encoded HTML content preserving structure and formatting. */
6
8
  html_base64?: string;
9
+ /** Base64-encoded CSV data for tabular content ingestion. */
7
10
  csv_base64?: string;
11
+ /** Raw Markdown content to be indexed as rich text. */
8
12
  markdown?: string;
13
+ /** List of file descriptors associated with the source (e.g., filenames, sizes). */
9
14
  files?: Record<string, unknown>[];
15
+ /** Optional layout metadata such as sections or blocks to guide chunking. */
10
16
  layout?: Record<string, unknown>[];
11
17
  }
@@ -2,7 +2,10 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  export interface DeleteMemoryRequest {
5
+ /** Unique identifier for the tenant/organization */
5
6
  tenant_id: string;
7
+ /** List of source IDs to delete */
6
8
  source_ids: string[];
9
+ /** Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id */
7
10
  sub_tenant_id?: string;
8
11
  }