@usecortex_ai/node 0.3.5 → 0.4.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 (249) hide show
  1. package/dist/Client.d.ts +20 -24
  2. package/dist/Client.js +26 -34
  3. package/dist/api/errors/BadRequestError.d.ts +1 -2
  4. package/dist/api/errors/ForbiddenError.d.ts +1 -2
  5. package/dist/api/errors/InternalServerError.d.ts +1 -2
  6. package/dist/api/errors/NotFoundError.d.ts +1 -2
  7. package/dist/api/errors/ServiceUnavailableError.d.ts +1 -2
  8. package/dist/api/errors/TooManyRequestsError.d.ts +9 -0
  9. package/dist/api/errors/TooManyRequestsError.js +42 -0
  10. package/dist/api/errors/UnauthorizedError.d.ts +1 -2
  11. package/dist/api/errors/index.d.ts +1 -0
  12. package/dist/api/errors/index.js +1 -0
  13. package/dist/api/resources/dashboard/client/Client.d.ts +136 -0
  14. package/dist/api/resources/{userMemory → dashboard}/client/Client.js +191 -138
  15. package/dist/api/resources/dashboard/client/requests/CreateUserDashboardUserCreateUserPostRequest.d.ts +12 -0
  16. package/dist/api/resources/dashboard/client/requests/ListSourcesDashboardSourcesGetRequest.d.ts +16 -0
  17. package/dist/api/resources/dashboard/client/requests/index.d.ts +2 -0
  18. package/dist/api/resources/embeddings/client/Client.d.ts +40 -27
  19. package/dist/api/resources/embeddings/client/Client.js +68 -44
  20. package/dist/api/resources/embeddings/client/requests/BodyFilterRawEmbeddingsEndpointEmbeddingsFilterRawEmbeddingsPost.d.ts +24 -0
  21. package/dist/api/resources/embeddings/client/requests/BodyInsertRawEmbeddingsEndpointEmbeddingsInsertRawEmbeddingsPost.d.ts +27 -0
  22. package/dist/api/resources/embeddings/client/requests/BodySearchRawEmbeddingsEndpointEmbeddingsSearchRawEmbeddingsPost.d.ts +25 -0
  23. package/dist/api/resources/embeddings/client/requests/EmbeddingsDeleteRequest.d.ts +6 -5
  24. package/dist/api/resources/embeddings/client/requests/index.d.ts +3 -3
  25. package/dist/api/resources/fetch/client/Client.d.ts +96 -7
  26. package/dist/api/resources/fetch/client/Client.js +288 -10
  27. package/dist/api/resources/{sources/client/requests/SourcesGetGraphRelationsByIdRequest.d.ts → fetch/client/requests/FetchGraphRelationsBySourceIdRequest.d.ts} +2 -3
  28. package/dist/api/resources/{sources/client/requests/SourcesGetAllRequest.d.ts → fetch/client/requests/FetchSourcesRequest.d.ts} +2 -3
  29. package/dist/api/resources/fetch/client/requests/ListSourcesByIdRequest.d.ts +18 -0
  30. package/dist/api/resources/{upload/client/requests/UploadUpdateTextRequest.d.ts → fetch/client/requests/SourceFetchRequest.d.ts} +9 -10
  31. package/dist/api/resources/fetch/client/requests/index.d.ts +4 -1
  32. package/dist/api/resources/index.d.ts +10 -13
  33. package/dist/api/resources/index.js +11 -14
  34. package/dist/api/resources/search/client/Client.d.ts +50 -26
  35. package/dist/api/resources/search/client/Client.js +65 -35
  36. package/dist/api/resources/search/client/requests/FullTextSearchRequest.d.ts +6 -4
  37. package/dist/api/resources/search/client/requests/{SearchRequest.d.ts → HybridSearchRequest.d.ts} +13 -9
  38. package/dist/api/resources/search/client/requests/QnASearchRequest.d.ts +39 -0
  39. package/dist/api/resources/search/client/requests/index.d.ts +2 -2
  40. package/dist/api/resources/sources/client/Client.d.ts +11 -61
  41. package/dist/api/resources/sources/client/Client.js +14 -191
  42. package/dist/api/resources/sources/client/requests/SourceDeleteRequest.d.ts +17 -0
  43. package/dist/api/resources/sources/client/requests/index.d.ts +1 -3
  44. package/dist/api/resources/tenant/client/Client.d.ts +54 -38
  45. package/dist/api/resources/tenant/client/Client.js +67 -114
  46. package/dist/api/resources/tenant/client/requests/TenantCreateRequest.d.ts +20 -0
  47. package/dist/api/resources/tenant/client/requests/TenantStatsRequest.d.ts +1 -4
  48. package/dist/api/resources/tenant/client/requests/index.d.ts +1 -2
  49. package/dist/api/resources/upload/client/Client.d.ts +54 -428
  50. package/dist/api/resources/upload/client/Client.js +97 -1417
  51. package/dist/api/resources/upload/client/requests/{UploadUploadMarkdownRequest.d.ts → BodyAddMemoryMemoriesAddMemoryPost.d.ts} +7 -7
  52. package/dist/api/resources/upload/client/requests/BodyUploadAppIngestionUploadAppPost.d.ts +31 -0
  53. package/dist/api/resources/upload/client/requests/BodyUploadDocumentIngestionUploadDocumentPost.d.ts +22 -0
  54. package/dist/api/resources/upload/client/requests/UploadDeleteMemoryRequest.d.ts +18 -0
  55. package/dist/api/resources/upload/client/requests/UploadVerifyProcessingRequest.d.ts +1 -2
  56. package/dist/api/resources/upload/client/requests/index.d.ts +4 -16
  57. package/dist/api/types/AddMemoryResponse.d.ts +17 -0
  58. package/dist/api/types/ApiKeyInfo.d.ts +17 -0
  59. package/dist/api/types/AppSourcesUploadData.d.ts +10 -4
  60. package/dist/api/types/CollectionStats.d.ts +9 -0
  61. package/dist/api/types/CustomPropertyDefinition.d.ts +38 -0
  62. package/dist/api/types/DashboardApisResponse.d.ts +12 -0
  63. package/dist/api/types/DashboardSourcesResponse.d.ts +12 -0
  64. package/dist/api/types/DashboardTenantsResponse.d.ts +12 -0
  65. package/dist/api/types/DeleteResult.d.ts +14 -0
  66. package/dist/api/types/DeleteUserMemoryResponse.d.ts +1 -1
  67. package/dist/api/types/Entity.d.ts +2 -2
  68. package/dist/api/types/FetchMode.d.ts +12 -0
  69. package/dist/api/types/FetchMode.js +11 -0
  70. package/dist/api/types/GraphContext.d.ts +12 -0
  71. package/dist/api/types/Infra.d.ts +8 -0
  72. package/dist/api/types/InsertResult.d.ts +16 -0
  73. package/dist/api/types/MemoryItem.d.ts +41 -0
  74. package/dist/api/types/MemoryResultItem.d.ts +19 -0
  75. package/dist/api/types/MilvusDataType.d.ts +21 -0
  76. package/dist/api/types/MilvusDataType.js +20 -0
  77. package/dist/api/types/PathTriplet.d.ts +9 -0
  78. package/dist/api/types/ProcessingStatus.d.ts +16 -2
  79. package/dist/api/types/ProcessingStatus.js +12 -0
  80. package/dist/api/types/QnASearchResponse.d.ts +20 -0
  81. package/dist/api/types/RawEmbeddingDocument.d.ts +15 -0
  82. package/dist/api/types/RawEmbeddingSearchResult.d.ts +19 -0
  83. package/dist/api/types/RawEmbeddingVector.d.ts +12 -0
  84. package/dist/api/types/RelationEvidence.d.ts +8 -0
  85. package/dist/api/types/RetrievalResult.d.ts +11 -0
  86. package/dist/api/types/ScoredPathResponse.d.ts +11 -0
  87. package/dist/api/types/SearchMode.d.ts +11 -0
  88. package/dist/api/types/SearchMode.js +10 -0
  89. package/dist/api/types/SourceDeleteResponse.d.ts +14 -0
  90. package/dist/api/types/SourceDeleteResultItem.d.ts +14 -0
  91. package/dist/api/types/SourceFetchResponse.d.ts +26 -0
  92. package/dist/api/types/{GraphRelationsResponse.d.ts → SourceGraphRelationsResponse.d.ts} +2 -2
  93. package/dist/api/types/SourceListResponse.d.ts +11 -0
  94. package/dist/api/types/SourceModel.d.ts +5 -1
  95. package/dist/api/types/SourceStatus.d.ts +10 -0
  96. package/dist/api/types/SourceStatus.js +12 -0
  97. package/dist/api/types/SourceUploadResponse.d.ts +14 -0
  98. package/dist/api/types/SourceUploadResultItem.d.ts +14 -0
  99. package/dist/api/types/SupportedLlmProviders.d.ts +11 -0
  100. package/dist/api/types/SupportedLlmProviders.js +13 -0
  101. package/dist/api/types/TenantCreateResponse.d.ts +14 -0
  102. package/dist/api/types/TenantInfo.d.ts +11 -0
  103. package/dist/api/types/TenantMetadataSchemaInfo.d.ts +14 -0
  104. package/dist/api/types/TenantStatsResponse.d.ts +14 -0
  105. package/dist/api/types/{TripleWithEvidence.d.ts → TripletWithEvidence.d.ts} +1 -1
  106. package/dist/api/types/UserAssistantPair.d.ts +3 -0
  107. package/dist/api/types/{SearchChunk.d.ts → VectorStoreChunk.d.ts} +3 -6
  108. package/dist/api/types/index.d.ts +38 -31
  109. package/dist/api/types/index.js +38 -31
  110. package/package.json +30 -33
  111. package/dist/api/resources/document/client/Client.d.ts +0 -59
  112. package/dist/api/resources/document/client/Client.js +0 -132
  113. package/dist/api/resources/document/client/index.d.ts +0 -1
  114. package/dist/api/resources/embeddings/client/requests/EmbeddingsCreateCollectionRequest.d.ts +0 -13
  115. package/dist/api/resources/embeddings/client/requests/EmbeddingsSearchRequest.d.ts +0 -18
  116. package/dist/api/resources/embeddings/client/requests/GetEmbeddingsBasedOnChunkIdsRequest.d.ts +0 -18
  117. package/dist/api/resources/fetch/client/requests/FetchContentRequest.d.ts +0 -18
  118. package/dist/api/resources/search/client/requests/QnARequest.d.ts +0 -47
  119. package/dist/api/resources/sources/client/requests/SourceBodyParams.d.ts +0 -18
  120. package/dist/api/resources/tenant/client/requests/TenantDeleteSubTenantRequest.d.ts +0 -14
  121. package/dist/api/resources/tenant/client/requests/TenantGetSubTenantIdsRequest.d.ts +0 -12
  122. package/dist/api/resources/upload/client/requests/BodyBatchUpdateUploadBatchUpdatePatch.d.ts +0 -37
  123. package/dist/api/resources/upload/client/requests/BodyBatchUploadUploadBatchUploadPost.d.ts +0 -37
  124. package/dist/api/resources/upload/client/requests/BodyUpdateFileUploadUpdateDocumentPatch.d.ts +0 -38
  125. package/dist/api/resources/upload/client/requests/BodyUploadFilesUploadUploadDocumentPost.d.ts +0 -37
  126. package/dist/api/resources/upload/client/requests/EmbeddingsUpdateRequest.d.ts +0 -18
  127. package/dist/api/resources/upload/client/requests/EmbeddingsUploadRequest.d.ts +0 -21
  128. package/dist/api/resources/upload/client/requests/UploadBatchScrapeWebpageRequest.d.ts +0 -22
  129. package/dist/api/resources/upload/client/requests/UploadBatchUploadMarkdownRequest.d.ts +0 -22
  130. package/dist/api/resources/upload/client/requests/UploadBatchUploadTextRequest.d.ts +0 -22
  131. package/dist/api/resources/upload/client/requests/UploadScrapeWebpageRequest.d.ts +0 -25
  132. package/dist/api/resources/upload/client/requests/UploadUpdateMarkdownRequest.d.ts +0 -24
  133. package/dist/api/resources/upload/client/requests/UploadUpdateWebpageRequest.d.ts +0 -25
  134. package/dist/api/resources/upload/client/requests/UploadUploadAppSourcesRequest.d.ts +0 -20
  135. package/dist/api/resources/upload/client/requests/UploadUploadTextRequest.d.ts +0 -21
  136. package/dist/api/resources/user/client/Client.d.ts +0 -60
  137. package/dist/api/resources/user/client/Client.js +0 -152
  138. package/dist/api/resources/user/client/requests/BodyCreateTenantUserCreateTenantPost.d.ts +0 -15
  139. package/dist/api/resources/user/client/requests/index.d.ts +0 -1
  140. package/dist/api/resources/user/client/requests/index.js +0 -2
  141. package/dist/api/resources/user/index.d.ts +0 -1
  142. package/dist/api/resources/user/index.js +0 -17
  143. package/dist/api/resources/userMemory/client/Client.d.ts +0 -150
  144. package/dist/api/resources/userMemory/client/index.d.ts +0 -2
  145. package/dist/api/resources/userMemory/client/index.js +0 -17
  146. package/dist/api/resources/userMemory/client/requests/AddUserMemoryRequest.d.ts +0 -27
  147. package/dist/api/resources/userMemory/client/requests/RetrieveUserMemoryRequest.d.ts +0 -24
  148. package/dist/api/resources/userMemory/client/requests/UserMemoryDeleteUserMemoryRequest.d.ts +0 -19
  149. package/dist/api/resources/userMemory/client/requests/UserMemoryListUserMemoriesRequest.d.ts +0 -16
  150. package/dist/api/resources/userMemory/client/requests/index.d.ts +0 -4
  151. package/dist/api/resources/userMemory/client/requests/index.js +0 -2
  152. package/dist/api/resources/userMemory/index.d.ts +0 -1
  153. package/dist/api/resources/userMemory/index.js +0 -17
  154. package/dist/api/types/AddUserMemoryResponse.d.ts +0 -16
  155. package/dist/api/types/BatchUploadData.d.ts +0 -11
  156. package/dist/api/types/BodyScrapeWebpageUploadScrapeWebpagePost.d.ts +0 -5
  157. package/dist/api/types/BodyUpdateScrapeJobUploadUpdateWebpagePatch.d.ts +0 -5
  158. package/dist/api/types/DeleteMemoryRequest.d.ts +0 -11
  159. package/dist/api/types/DeleteSources.d.ts +0 -7
  160. package/dist/api/types/DeleteSubTenantData.d.ts +0 -15
  161. package/dist/api/types/EmbeddingsCreateCollectionData.d.ts +0 -13
  162. package/dist/api/types/EmbeddingsDeleteData.d.ts +0 -13
  163. package/dist/api/types/EmbeddingsGetData.d.ts +0 -13
  164. package/dist/api/types/EmbeddingsSearchData.d.ts +0 -13
  165. package/dist/api/types/ExtendedContext.d.ts +0 -8
  166. package/dist/api/types/FetchContentData.d.ts +0 -13
  167. package/dist/api/types/FileUploadResult.d.ts +0 -9
  168. package/dist/api/types/ListSourcesResponse.d.ts +0 -12
  169. package/dist/api/types/ListUserMemoriesResponse.d.ts +0 -13
  170. package/dist/api/types/MarkdownUploadRequest.d.ts +0 -22
  171. package/dist/api/types/RelatedChunk.d.ts +0 -9
  172. package/dist/api/types/RelatedChunk.js +0 -5
  173. package/dist/api/types/Relations.d.ts +0 -9
  174. package/dist/api/types/Relations.js +0 -5
  175. package/dist/api/types/RetrieveResponse.d.ts +0 -12
  176. package/dist/api/types/RetrieveResponse.js +0 -5
  177. package/dist/api/types/RetrieveUserMemoryResponse.d.ts +0 -15
  178. package/dist/api/types/RetrieveUserMemoryResponse.js +0 -5
  179. package/dist/api/types/SearchChunk.js +0 -5
  180. package/dist/api/types/SingleUploadData.d.ts +0 -10
  181. package/dist/api/types/SingleUploadData.js +0 -5
  182. package/dist/api/types/Source.d.ts +0 -19
  183. package/dist/api/types/Source.js +0 -5
  184. package/dist/api/types/SubTenantIdsData.d.ts +0 -17
  185. package/dist/api/types/SubTenantIdsData.js +0 -5
  186. package/dist/api/types/TenantCreateData.d.ts +0 -13
  187. package/dist/api/types/TenantCreateData.js +0 -5
  188. package/dist/api/types/TenantStats.d.ts +0 -15
  189. package/dist/api/types/TenantStats.js +0 -5
  190. package/dist/api/types/TripleWithEvidence.js +0 -5
  191. package/dist/api/types/UserMemory.d.ts +0 -12
  192. package/dist/api/types/UserMemory.js +0 -5
  193. package/dist/api/types/WebpageScrapeRequest.d.ts +0 -9
  194. package/dist/api/types/WebpageScrapeRequest.js +0 -5
  195. /package/dist/api/resources/{user → dashboard}/client/index.d.ts +0 -0
  196. /package/dist/api/resources/{user → dashboard}/client/index.js +0 -0
  197. /package/dist/api/resources/{embeddings/client/requests/EmbeddingsCreateCollectionRequest.js → dashboard/client/requests/CreateUserDashboardUserCreateUserPostRequest.js} +0 -0
  198. /package/dist/api/resources/{embeddings/client/requests/EmbeddingsSearchRequest.js → dashboard/client/requests/ListSourcesDashboardSourcesGetRequest.js} +0 -0
  199. /package/dist/api/resources/{document/client → dashboard/client/requests}/index.js +0 -0
  200. /package/dist/api/resources/{document → dashboard}/index.d.ts +0 -0
  201. /package/dist/api/resources/{document → dashboard}/index.js +0 -0
  202. /package/dist/api/resources/embeddings/client/requests/{GetEmbeddingsBasedOnChunkIdsRequest.js → BodyFilterRawEmbeddingsEndpointEmbeddingsFilterRawEmbeddingsPost.js} +0 -0
  203. /package/dist/api/resources/{fetch/client/requests/FetchContentRequest.js → embeddings/client/requests/BodyInsertRawEmbeddingsEndpointEmbeddingsInsertRawEmbeddingsPost.js} +0 -0
  204. /package/dist/api/resources/{search/client/requests/QnARequest.js → embeddings/client/requests/BodySearchRawEmbeddingsEndpointEmbeddingsSearchRawEmbeddingsPost.js} +0 -0
  205. /package/dist/api/resources/{search/client/requests/SearchRequest.js → fetch/client/requests/FetchGraphRelationsBySourceIdRequest.js} +0 -0
  206. /package/dist/api/resources/{sources/client/requests/SourceBodyParams.js → fetch/client/requests/FetchSourcesRequest.js} +0 -0
  207. /package/dist/api/resources/{sources/client/requests/SourcesGetAllRequest.js → fetch/client/requests/ListSourcesByIdRequest.js} +0 -0
  208. /package/dist/api/resources/{sources/client/requests/SourcesGetGraphRelationsByIdRequest.js → fetch/client/requests/SourceFetchRequest.js} +0 -0
  209. /package/dist/api/resources/{tenant/client/requests/TenantDeleteSubTenantRequest.js → search/client/requests/HybridSearchRequest.js} +0 -0
  210. /package/dist/api/resources/{tenant/client/requests/TenantGetSubTenantIdsRequest.js → search/client/requests/QnASearchRequest.js} +0 -0
  211. /package/dist/api/resources/{upload/client/requests/BodyBatchUpdateUploadBatchUpdatePatch.js → sources/client/requests/SourceDeleteRequest.js} +0 -0
  212. /package/dist/api/resources/{upload/client/requests/BodyBatchUploadUploadBatchUploadPost.js → tenant/client/requests/TenantCreateRequest.js} +0 -0
  213. /package/dist/api/resources/upload/client/requests/{BodyUpdateFileUploadUpdateDocumentPatch.js → BodyAddMemoryMemoriesAddMemoryPost.js} +0 -0
  214. /package/dist/api/resources/upload/client/requests/{BodyUploadFilesUploadUploadDocumentPost.js → BodyUploadAppIngestionUploadAppPost.js} +0 -0
  215. /package/dist/api/resources/upload/client/requests/{EmbeddingsUpdateRequest.js → BodyUploadDocumentIngestionUploadDocumentPost.js} +0 -0
  216. /package/dist/api/resources/upload/client/requests/{EmbeddingsUploadRequest.js → UploadDeleteMemoryRequest.js} +0 -0
  217. /package/dist/api/{resources/upload/client/requests/UploadBatchScrapeWebpageRequest.js → types/AddMemoryResponse.js} +0 -0
  218. /package/dist/api/{resources/upload/client/requests/UploadBatchUploadMarkdownRequest.js → types/ApiKeyInfo.js} +0 -0
  219. /package/dist/api/{resources/upload/client/requests/UploadBatchUploadTextRequest.js → types/CollectionStats.js} +0 -0
  220. /package/dist/api/{resources/upload/client/requests/UploadScrapeWebpageRequest.js → types/CustomPropertyDefinition.js} +0 -0
  221. /package/dist/api/{resources/upload/client/requests/UploadUpdateMarkdownRequest.js → types/DashboardApisResponse.js} +0 -0
  222. /package/dist/api/{resources/upload/client/requests/UploadUpdateTextRequest.js → types/DashboardSourcesResponse.js} +0 -0
  223. /package/dist/api/{resources/upload/client/requests/UploadUpdateWebpageRequest.js → types/DashboardTenantsResponse.js} +0 -0
  224. /package/dist/api/{resources/upload/client/requests/UploadUploadAppSourcesRequest.js → types/DeleteResult.js} +0 -0
  225. /package/dist/api/{resources/upload/client/requests/UploadUploadMarkdownRequest.js → types/GraphContext.js} +0 -0
  226. /package/dist/api/{resources/upload/client/requests/UploadUploadTextRequest.js → types/Infra.js} +0 -0
  227. /package/dist/api/{resources/user/client/requests/BodyCreateTenantUserCreateTenantPost.js → types/InsertResult.js} +0 -0
  228. /package/dist/api/{resources/userMemory/client/requests/AddUserMemoryRequest.js → types/MemoryItem.js} +0 -0
  229. /package/dist/api/{resources/userMemory/client/requests/RetrieveUserMemoryRequest.js → types/MemoryResultItem.js} +0 -0
  230. /package/dist/api/{resources/userMemory/client/requests/UserMemoryDeleteUserMemoryRequest.js → types/PathTriplet.js} +0 -0
  231. /package/dist/api/{resources/userMemory/client/requests/UserMemoryListUserMemoriesRequest.js → types/QnASearchResponse.js} +0 -0
  232. /package/dist/api/types/{AddUserMemoryResponse.js → RawEmbeddingDocument.js} +0 -0
  233. /package/dist/api/types/{BatchUploadData.js → RawEmbeddingSearchResult.js} +0 -0
  234. /package/dist/api/types/{BodyScrapeWebpageUploadScrapeWebpagePost.js → RawEmbeddingVector.js} +0 -0
  235. /package/dist/api/types/{BodyUpdateScrapeJobUploadUpdateWebpagePatch.js → RetrievalResult.js} +0 -0
  236. /package/dist/api/types/{DeleteMemoryRequest.js → ScoredPathResponse.js} +0 -0
  237. /package/dist/api/types/{DeleteSources.js → SourceDeleteResponse.js} +0 -0
  238. /package/dist/api/types/{DeleteSubTenantData.js → SourceDeleteResultItem.js} +0 -0
  239. /package/dist/api/types/{EmbeddingsCreateCollectionData.js → SourceFetchResponse.js} +0 -0
  240. /package/dist/api/types/{EmbeddingsDeleteData.js → SourceGraphRelationsResponse.js} +0 -0
  241. /package/dist/api/types/{EmbeddingsGetData.js → SourceListResponse.js} +0 -0
  242. /package/dist/api/types/{EmbeddingsSearchData.js → SourceUploadResponse.js} +0 -0
  243. /package/dist/api/types/{ExtendedContext.js → SourceUploadResultItem.js} +0 -0
  244. /package/dist/api/types/{FetchContentData.js → TenantCreateResponse.js} +0 -0
  245. /package/dist/api/types/{FileUploadResult.js → TenantInfo.js} +0 -0
  246. /package/dist/api/types/{GraphRelationsResponse.js → TenantMetadataSchemaInfo.js} +0 -0
  247. /package/dist/api/types/{ListSourcesResponse.js → TenantStatsResponse.js} +0 -0
  248. /package/dist/api/types/{ListUserMemoriesResponse.js → TripletWithEvidence.js} +0 -0
  249. /package/dist/api/types/{MarkdownUploadRequest.js → VectorStoreChunk.js} +0 -0
@@ -25,17 +25,6 @@ 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
- };
39
28
  Object.defineProperty(exports, "__esModule", { value: true });
40
29
  exports.Upload = void 0;
41
30
  const environments = __importStar(require("../../../../environments.js"));
@@ -48,13 +37,12 @@ class Upload {
48
37
  this._options = _options;
49
38
  }
50
39
  /**
51
- * Upload multiple documents simultaneously for efficient bulk processing.
52
- *
53
- * This endpoint allows you to upload several files at once, which is ideal for large document collections or periodic data imports. Each file gets processed asynchronously, and you can track the progress of individual files using their returned file IDs.
54
- *
55
- * The system automatically handles file parsing, content extraction, and indexing across all uploaded documents. You'll receive confirmation once all files are queued for processing.
40
+ * Upload one or more documents for ingestion.
41
+ * Supports both single and batch uploads.
42
+ * For single file: send one file with the 'files' field.
43
+ * For batch: send multiple files with the 'files' field (FastAPI will parse as list).
56
44
  *
57
- * @param {CortexAI.BodyBatchUploadUploadBatchUploadPost} request
45
+ * @param {CortexAI.BodyUploadDocumentIngestionUploadDocumentPost} request
58
46
  * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
59
47
  *
60
48
  * @throws {@link CortexAI.BadRequestError}
@@ -67,150 +55,37 @@ class Upload {
67
55
  *
68
56
  * @example
69
57
  * import { createReadStream } from "fs";
70
- * await client.upload.batchUpload({
58
+ * await client.upload.uploadDocument({
71
59
  * files: [fs.createReadStream("/path/to/your/file")],
72
- * tenant_id: "tenant_1234",
73
- * sub_tenant_id: "sub_tenant_4567"
60
+ * tenant_id: "tenant_id"
74
61
  * })
75
62
  */
76
- batchUpload(request, requestOptions) {
77
- return core.HttpResponsePromise.fromPromise(this.__batchUpload(request, requestOptions));
63
+ uploadDocument(request, requestOptions) {
64
+ return core.HttpResponsePromise.fromPromise(this.__uploadDocument(request, requestOptions));
78
65
  }
79
- async __batchUpload(request, requestOptions) {
66
+ async __uploadDocument(request, requestOptions) {
80
67
  var _a, _b, _c;
81
- const _queryParams = {};
82
- _queryParams["tenant_id"] = request.tenant_id;
83
- if (request.sub_tenant_id != null) {
84
- _queryParams["sub_tenant_id"] = request.sub_tenant_id;
85
- }
86
68
  const _request = await core.newFormData();
87
69
  for (const _file of request.files) {
88
70
  await _request.appendFile("files", _file);
89
71
  }
90
- if (request.file_ids != null) {
91
- _request.append("file_ids", request.file_ids);
92
- }
93
- if (request.tenant_metadata != null) {
94
- _request.append("tenant_metadata", request.tenant_metadata);
95
- }
96
- if (request.document_metadata != null) {
97
- _request.append("document_metadata", request.document_metadata);
98
- }
99
- const _maybeEncodedRequest = await _request.getRequest();
100
- let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({ Authorization: await this._getAuthorizationHeader() }, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
101
- const _response = await core.fetcher({
102
- url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "upload/batch_upload"),
103
- method: "POST",
104
- headers: _headers,
105
- queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
106
- requestType: "file",
107
- duplex: _maybeEncodedRequest.duplex,
108
- body: _maybeEncodedRequest.body,
109
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
110
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
111
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
112
- });
113
- if (_response.ok) {
114
- return { data: _response.body, rawResponse: _response.rawResponse };
115
- }
116
- if (_response.error.reason === "status-code") {
117
- switch (_response.error.statusCode) {
118
- case 400:
119
- throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
120
- case 401:
121
- throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
122
- case 403:
123
- throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
124
- case 404:
125
- throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
126
- case 422:
127
- throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
128
- case 500:
129
- throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
130
- case 503:
131
- throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
132
- default:
133
- throw new errors.CortexAIError({
134
- statusCode: _response.error.statusCode,
135
- body: _response.error.body,
136
- rawResponse: _response.rawResponse,
137
- });
138
- }
139
- }
140
- switch (_response.error.reason) {
141
- case "non-json":
142
- throw new errors.CortexAIError({
143
- statusCode: _response.error.statusCode,
144
- body: _response.error.rawBody,
145
- rawResponse: _response.rawResponse,
146
- });
147
- case "timeout":
148
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /upload/batch_upload.");
149
- case "unknown":
150
- throw new errors.CortexAIError({
151
- message: _response.error.errorMessage,
152
- rawResponse: _response.rawResponse,
153
- });
154
- }
155
- }
156
- /**
157
- * Update multiple existing documents with new content and metadata.
158
- *
159
- * Use this endpoint when you need to replace or modify several documents that are already in your knowledge base. Each file must correspond to an existing source ID, ensuring that updates are applied to the correct documents.
160
- *
161
- * The system processes updates asynchronously, allowing you to continue working while your documents are re-indexed. Track the progress using the returned file IDs to know when updates are complete.
162
- *
163
- * @param {CortexAI.BodyBatchUpdateUploadBatchUpdatePatch} request
164
- * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
165
- *
166
- * @throws {@link CortexAI.BadRequestError}
167
- * @throws {@link CortexAI.UnauthorizedError}
168
- * @throws {@link CortexAI.ForbiddenError}
169
- * @throws {@link CortexAI.NotFoundError}
170
- * @throws {@link CortexAI.UnprocessableEntityError}
171
- * @throws {@link CortexAI.InternalServerError}
172
- * @throws {@link CortexAI.ServiceUnavailableError}
173
- *
174
- * @example
175
- * import { createReadStream } from "fs";
176
- * await client.upload.batchUpdate({
177
- * files: [fs.createReadStream("/path/to/your/file")],
178
- * tenant_id: "tenant_1234",
179
- * sub_tenant_id: "sub_tenant_4567"
180
- * })
181
- */
182
- batchUpdate(request, requestOptions) {
183
- return core.HttpResponsePromise.fromPromise(this.__batchUpdate(request, requestOptions));
184
- }
185
- async __batchUpdate(request, requestOptions) {
186
- var _a, _b, _c;
187
- const _queryParams = {};
188
- _queryParams["tenant_id"] = request.tenant_id;
72
+ _request.append("tenant_id", request.tenant_id);
189
73
  if (request.sub_tenant_id != null) {
190
- _queryParams["sub_tenant_id"] = request.sub_tenant_id;
191
- }
192
- const _request = await core.newFormData();
193
- for (const _file of request.files) {
194
- await _request.appendFile("files", _file);
195
- }
196
- if (request.source_ids != null) {
197
- for (const _item of request.source_ids) {
198
- _request.append("source_ids", _item);
199
- }
74
+ _request.append("sub_tenant_id", request.sub_tenant_id);
200
75
  }
201
- if (request.tenant_metadata != null) {
202
- _request.append("tenant_metadata", request.tenant_metadata);
76
+ if (request.upsert != null) {
77
+ _request.append("upsert", request.upsert.toString());
203
78
  }
204
- if (request.document_metadata != null) {
205
- _request.append("document_metadata", request.document_metadata);
79
+ if (request.file_metadata != null) {
80
+ _request.append("file_metadata", request.file_metadata);
206
81
  }
207
82
  const _maybeEncodedRequest = await _request.getRequest();
208
83
  let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({ Authorization: await this._getAuthorizationHeader() }, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
209
84
  const _response = await core.fetcher({
210
- url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "upload/batch_update"),
211
- method: "PATCH",
85
+ 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, "ingestion/upload-document"),
86
+ method: "POST",
212
87
  headers: _headers,
213
- queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
88
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
214
89
  requestType: "file",
215
90
  duplex: _maybeEncodedRequest.duplex,
216
91
  body: _maybeEncodedRequest.body,
@@ -253,7 +128,7 @@ class Upload {
253
128
  rawResponse: _response.rawResponse,
254
129
  });
255
130
  case "timeout":
256
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling PATCH /upload/batch_update.");
131
+ throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /ingestion/upload-document.");
257
132
  case "unknown":
258
133
  throw new errors.CortexAIError({
259
134
  message: _response.error.errorMessage,
@@ -262,13 +137,10 @@ class Upload {
262
137
  }
263
138
  }
264
139
  /**
265
- * Upload a single document for processing and indexing into your knowledge base.
140
+ * Upload structured sources generated by first-party or third-party apps.
141
+ * Supports both single and batch uploads.
266
142
  *
267
- * This endpoint accepts documents in various formats and processes them for search and retrieval. You can include custom metadata to help organize and categorize your content.
268
- *
269
- * The system extracts text content, processes it asynchronously, and makes it available for search queries. You can track the processing status using the returned file ID.
270
- *
271
- * @param {CortexAI.BodyUploadFilesUploadUploadDocumentPost} request
143
+ * @param {CortexAI.BodyUploadAppIngestionUploadAppPost} request
272
144
  * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
273
145
  *
274
146
  * @throws {@link CortexAI.BadRequestError}
@@ -280,44 +152,29 @@ class Upload {
280
152
  * @throws {@link CortexAI.ServiceUnavailableError}
281
153
  *
282
154
  * @example
283
- * import { createReadStream } from "fs";
284
- * await client.upload.uploadDocument({
285
- * file: fs.createReadStream("/path/to/your/file"),
286
- * tenant_id: "tenant_1234",
287
- * sub_tenant_id: "sub_tenant_4567"
155
+ * await client.upload.uploadAppSources({
156
+ * app_sources: {
157
+ * id: "id",
158
+ * tenant_id: "tenant_id",
159
+ * sub_tenant_id: "sub_tenant_id"
160
+ * },
161
+ * tenant_id: "tenant_id"
288
162
  * })
289
163
  */
290
- uploadDocument(request, requestOptions) {
291
- return core.HttpResponsePromise.fromPromise(this.__uploadDocument(request, requestOptions));
164
+ uploadAppSources(request, requestOptions) {
165
+ return core.HttpResponsePromise.fromPromise(this.__uploadAppSources(request, requestOptions));
292
166
  }
293
- async __uploadDocument(request, requestOptions) {
167
+ async __uploadAppSources(request, requestOptions) {
294
168
  var _a, _b, _c;
295
- const _queryParams = {};
296
- _queryParams["tenant_id"] = request.tenant_id;
297
- if (request.sub_tenant_id != null) {
298
- _queryParams["sub_tenant_id"] = request.sub_tenant_id;
299
- }
300
- const _request = await core.newFormData();
301
- await _request.appendFile("file", request.file);
302
- if (request.file_id != null) {
303
- _request.append("file_id", request.file_id);
304
- }
305
- if (request.tenant_metadata != null) {
306
- _request.append("tenant_metadata", request.tenant_metadata);
307
- }
308
- if (request.document_metadata != null) {
309
- _request.append("document_metadata", request.document_metadata);
310
- }
311
- const _maybeEncodedRequest = await _request.getRequest();
312
- let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({ Authorization: await this._getAuthorizationHeader() }, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
169
+ 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);
313
170
  const _response = await core.fetcher({
314
- url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "upload/upload_document"),
171
+ 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, "ingestion/upload-app"),
315
172
  method: "POST",
316
173
  headers: _headers,
317
- queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
318
- requestType: "file",
319
- duplex: _maybeEncodedRequest.duplex,
320
- body: _maybeEncodedRequest.body,
174
+ contentType: "application/json",
175
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
176
+ requestType: "json",
177
+ body: request,
321
178
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
322
179
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
323
180
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -357,7 +214,7 @@ class Upload {
357
214
  rawResponse: _response.rawResponse,
358
215
  });
359
216
  case "timeout":
360
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /upload/upload_document.");
217
+ throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /ingestion/upload-app.");
361
218
  case "unknown":
362
219
  throw new errors.CortexAIError({
363
220
  message: _response.error.errorMessage,
@@ -366,13 +223,13 @@ class Upload {
366
223
  }
367
224
  }
368
225
  /**
369
- * Replace an existing document with updated content.
226
+ * Check the current processing status of your uploaded content.
370
227
  *
371
- * This endpoint allows you to update a specific document that's already in your knowledge base. Provide the source ID of the document you want to modify, along with the new file content.
228
+ * This endpoint allows you to monitor the progress of documents, text, or other content you've uploaded. Simply provide the file ID to see whether processing is complete, still in progress, or if any errors occurred.
372
229
  *
373
- * The system will process your update asynchronously and re-index the document with the new content. You can monitor the progress using the returned file ID.
230
+ * Use this to determine when your content is ready for search and retrieval, or to troubleshoot any processing issues.
374
231
  *
375
- * @param {CortexAI.BodyUpdateFileUploadUpdateDocumentPatch} request
232
+ * @param {CortexAI.UploadVerifyProcessingRequest} request
376
233
  * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
377
234
  *
378
235
  * @throws {@link CortexAI.BadRequestError}
@@ -384,135 +241,30 @@ class Upload {
384
241
  * @throws {@link CortexAI.ServiceUnavailableError}
385
242
  *
386
243
  * @example
387
- * import { createReadStream } from "fs";
388
- * await client.upload.updateDocument({
389
- * file: fs.createReadStream("/path/to/your/file"),
390
- * source_id: "CortexDoc1234",
391
- * tenant_id: "tenant_1234",
392
- * sub_tenant_id: "sub_tenant_4567"
244
+ * await client.upload.verifyProcessing({
245
+ * file_id: "file_id"
393
246
  * })
394
247
  */
395
- updateDocument(request, requestOptions) {
396
- return core.HttpResponsePromise.fromPromise(this.__updateDocument(request, requestOptions));
248
+ verifyProcessing(request, requestOptions) {
249
+ return core.HttpResponsePromise.fromPromise(this.__verifyProcessing(request, requestOptions));
397
250
  }
398
- async __updateDocument(request, requestOptions) {
251
+ async __verifyProcessing(request, requestOptions) {
399
252
  var _a, _b, _c;
253
+ const { file_id: fileId, tenant_id: tenantId, sub_tenant_id: subTenantId } = request;
400
254
  const _queryParams = {};
401
- _queryParams["source_id"] = request.source_id;
402
- _queryParams["tenant_id"] = request.tenant_id;
403
- if (request.sub_tenant_id != null) {
404
- _queryParams["sub_tenant_id"] = request.sub_tenant_id;
405
- }
406
- const _request = await core.newFormData();
407
- await _request.appendFile("file", request.file);
408
- if (request.tenant_metadata != null) {
409
- _request.append("tenant_metadata", request.tenant_metadata);
410
- }
411
- if (request.document_metadata != null) {
412
- _request.append("document_metadata", request.document_metadata);
413
- }
414
- const _maybeEncodedRequest = await _request.getRequest();
415
- let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({ Authorization: await this._getAuthorizationHeader() }, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
416
- const _response = await core.fetcher({
417
- url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "upload/update_document"),
418
- method: "PATCH",
419
- headers: _headers,
420
- queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
421
- requestType: "file",
422
- duplex: _maybeEncodedRequest.duplex,
423
- body: _maybeEncodedRequest.body,
424
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
425
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
426
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
427
- });
428
- if (_response.ok) {
429
- return { data: _response.body, rawResponse: _response.rawResponse };
430
- }
431
- if (_response.error.reason === "status-code") {
432
- switch (_response.error.statusCode) {
433
- case 400:
434
- throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
435
- case 401:
436
- throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
437
- case 403:
438
- throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
439
- case 404:
440
- throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
441
- case 422:
442
- throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
443
- case 500:
444
- throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
445
- case 503:
446
- throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
447
- default:
448
- throw new errors.CortexAIError({
449
- statusCode: _response.error.statusCode,
450
- body: _response.error.body,
451
- rawResponse: _response.rawResponse,
452
- });
453
- }
454
- }
455
- switch (_response.error.reason) {
456
- case "non-json":
457
- throw new errors.CortexAIError({
458
- statusCode: _response.error.statusCode,
459
- body: _response.error.rawBody,
460
- rawResponse: _response.rawResponse,
461
- });
462
- case "timeout":
463
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling PATCH /upload/update_document.");
464
- case "unknown":
465
- throw new errors.CortexAIError({
466
- message: _response.error.errorMessage,
467
- rawResponse: _response.rawResponse,
468
- });
255
+ _queryParams["file_id"] = fileId;
256
+ if (tenantId != null) {
257
+ _queryParams["tenant_id"] = tenantId;
469
258
  }
470
- }
471
- /**
472
- * Upload structured data from applications or APIs for indexing.
473
- *
474
- * This endpoint is designed for importing data from applications. If you are specifically using Cortex to provide search to an application, you should prefer this endpoint. It accepts structured source objects and allows you to clearly define contents of attachments
475
- *
476
- * The system processes each source asynchronously and makes the content available for search and retrieval. Use this when you need to integrate search and indexing from data in your applications into your knowledge base.
477
- *
478
- * @param {CortexAI.UploadUploadAppSourcesRequest} request
479
- * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
480
- *
481
- * @throws {@link CortexAI.BadRequestError}
482
- * @throws {@link CortexAI.UnauthorizedError}
483
- * @throws {@link CortexAI.ForbiddenError}
484
- * @throws {@link CortexAI.NotFoundError}
485
- * @throws {@link CortexAI.UnprocessableEntityError}
486
- * @throws {@link CortexAI.InternalServerError}
487
- * @throws {@link CortexAI.ServiceUnavailableError}
488
- *
489
- * @example
490
- * await client.upload.uploadAppSources({
491
- * tenant_id: "tenant_1234",
492
- * sub_tenant_id: "sub_tenant_4567",
493
- * body: [{}]
494
- * })
495
- */
496
- uploadAppSources(request, requestOptions) {
497
- return core.HttpResponsePromise.fromPromise(this.__uploadAppSources(request, requestOptions));
498
- }
499
- async __uploadAppSources(request, requestOptions) {
500
- var _a, _b, _c;
501
- const { tenant_id: tenantId, sub_tenant_id: subTenantId, body: _body } = request;
502
- const _queryParams = {};
503
- _queryParams["tenant_id"] = tenantId;
504
259
  if (subTenantId != null) {
505
260
  _queryParams["sub_tenant_id"] = subTenantId;
506
261
  }
507
262
  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);
508
263
  const _response = await core.fetcher({
509
- url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "upload/upload_app_sources"),
264
+ 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, "ingestion/verify-processing"),
510
265
  method: "POST",
511
266
  headers: _headers,
512
- contentType: "application/json",
513
267
  queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
514
- requestType: "json",
515
- body: _body,
516
268
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
517
269
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
518
270
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -552,7 +304,7 @@ class Upload {
552
304
  rawResponse: _response.rawResponse,
553
305
  });
554
306
  case "timeout":
555
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /upload/upload_app_sources.");
307
+ throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /ingestion/verify-processing.");
556
308
  case "unknown":
557
309
  throw new errors.CortexAIError({
558
310
  message: _response.error.errorMessage,
@@ -561,13 +313,25 @@ class Upload {
561
313
  }
562
314
  }
563
315
  /**
564
- * Upload text or markdown content directly for processing.
316
+ * Add memories for indexing and retrieval.
317
+ *
318
+ * This API provides a unified entry point for ingesting various types of content:
565
319
  *
566
- * This endpoint accepts plain text or markdown-formatted content that you want to add to your knowledge base. It's perfect for notes, documentation, articles, or any text-based content you want to make searchable.
320
+ * **Content Types Supported:**
321
+ * - Raw text content (`text` field)
322
+ * - Markdown formatted content (`text` + `is_markdown=true`)
323
+ * - User/assistant conversation pairs (`user_assistant_pairs` field)
567
324
  *
568
- * You can include custom metadata to help organize and categorize your content. You can track the processing status using the returned file ID.
325
+ * **Key Features:**
326
+ * - **Inference Mode (`infer=true`)**: When enabled, the system extracts additional
327
+ * insights and implicit information from your content. Useful for conversation
328
+ * analysis and knowledge extraction.
329
+ * - **Direct Mode (`infer=false`)**: Content is chunked and indexed as-is without
330
+ * additional processing.
569
331
  *
570
- * @param {CortexAI.UploadUploadMarkdownRequest} request
332
+ * Use `/ingestion/verify-processing` endpoint to check the processing status.
333
+ *
334
+ * @param {CortexAI.BodyAddMemoryMemoriesAddMemoryPost} request
571
335
  * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
572
336
  *
573
337
  * @throws {@link CortexAI.BadRequestError}
@@ -579,34 +343,25 @@ class Upload {
579
343
  * @throws {@link CortexAI.ServiceUnavailableError}
580
344
  *
581
345
  * @example
582
- * await client.upload.uploadMarkdown({
583
- * tenant_id: "tenant_1234",
584
- * sub_tenant_id: "sub_tenant_4567",
585
- * body: {
586
- * content: "<content>"
587
- * }
346
+ * await client.upload.addMemory({
347
+ * memories: [{}],
348
+ * tenant_id: "tenant_id"
588
349
  * })
589
350
  */
590
- uploadMarkdown(request, requestOptions) {
591
- return core.HttpResponsePromise.fromPromise(this.__uploadMarkdown(request, requestOptions));
351
+ addMemory(request, requestOptions) {
352
+ return core.HttpResponsePromise.fromPromise(this.__addMemory(request, requestOptions));
592
353
  }
593
- async __uploadMarkdown(request, requestOptions) {
354
+ async __addMemory(request, requestOptions) {
594
355
  var _a, _b, _c;
595
- const { tenant_id: tenantId, sub_tenant_id: subTenantId, body: _body } = request;
596
- const _queryParams = {};
597
- _queryParams["tenant_id"] = tenantId;
598
- if (subTenantId != null) {
599
- _queryParams["sub_tenant_id"] = subTenantId;
600
- }
601
356
  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);
602
357
  const _response = await core.fetcher({
603
- url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "upload/upload_markdown"),
358
+ 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, "memories/add_memory"),
604
359
  method: "POST",
605
360
  headers: _headers,
606
361
  contentType: "application/json",
607
- queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
362
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
608
363
  requestType: "json",
609
- body: _body,
364
+ body: request,
610
365
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
611
366
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
612
367
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -646,7 +401,7 @@ class Upload {
646
401
  rawResponse: _response.rawResponse,
647
402
  });
648
403
  case "timeout":
649
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /upload/upload_markdown.");
404
+ throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /memories/add_memory.");
650
405
  case "unknown":
651
406
  throw new errors.CortexAIError({
652
407
  message: _response.error.errorMessage,
@@ -655,13 +410,15 @@ class Upload {
655
410
  }
656
411
  }
657
412
  /**
658
- * Upload text or markdown content directly for processing.
413
+ * Permanently remove a specific memory from storage.
659
414
  *
660
- * This endpoint accepts plain text or markdown-formatted content that you want to add to your knowledge base. It's perfect for notes, documentation, articles, or any text-based content you want to make searchable.
415
+ * This API allows you to delete a memory by its unique identifier.
416
+ * Once deleted, the memory cannot be recovered, so use this operation carefully.
661
417
  *
662
- * You can include custom metadata to help organize and categorize your content. You can track the processing status using the returned file ID.
418
+ * The memory will be removed from your tenant's storage and will no longer
419
+ * appear in search results or memory listings.
663
420
  *
664
- * @param {CortexAI.UploadUploadTextRequest} request
421
+ * @param {CortexAI.UploadDeleteMemoryRequest} request
665
422
  * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
666
423
  *
667
424
  * @throws {@link CortexAI.BadRequestError}
@@ -673,1105 +430,28 @@ class Upload {
673
430
  * @throws {@link CortexAI.ServiceUnavailableError}
674
431
  *
675
432
  * @example
676
- * await client.upload.uploadText({
677
- * tenant_id: "tenant_1234",
678
- * sub_tenant_id: "sub_tenant_4567",
679
- * body: {
680
- * content: "<content>"
681
- * }
433
+ * await client.upload.deleteMemory({
434
+ * tenant_id: "tenant_id",
435
+ * memory_id: "memory_id"
682
436
  * })
683
437
  */
684
- uploadText(request, requestOptions) {
685
- return core.HttpResponsePromise.fromPromise(this.__uploadText(request, requestOptions));
438
+ deleteMemory(request, requestOptions) {
439
+ return core.HttpResponsePromise.fromPromise(this.__deleteMemory(request, requestOptions));
686
440
  }
687
- async __uploadText(request, requestOptions) {
441
+ async __deleteMemory(request, requestOptions) {
688
442
  var _a, _b, _c;
689
- const { tenant_id: tenantId, sub_tenant_id: subTenantId, body: _body } = request;
443
+ const { tenant_id: tenantId, memory_id: memoryId, sub_tenant_id: subTenantId } = request;
690
444
  const _queryParams = {};
691
445
  _queryParams["tenant_id"] = tenantId;
446
+ _queryParams["memory_id"] = memoryId;
692
447
  if (subTenantId != null) {
693
448
  _queryParams["sub_tenant_id"] = subTenantId;
694
449
  }
695
450
  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);
696
451
  const _response = await core.fetcher({
697
- url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "upload/upload_text"),
698
- method: "POST",
699
- headers: _headers,
700
- contentType: "application/json",
701
- queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
702
- requestType: "json",
703
- body: _body,
704
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
705
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
706
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
707
- });
708
- if (_response.ok) {
709
- return { data: _response.body, rawResponse: _response.rawResponse };
710
- }
711
- if (_response.error.reason === "status-code") {
712
- switch (_response.error.statusCode) {
713
- case 400:
714
- throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
715
- case 401:
716
- throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
717
- case 403:
718
- throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
719
- case 404:
720
- throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
721
- case 422:
722
- throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
723
- case 500:
724
- throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
725
- case 503:
726
- throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
727
- default:
728
- throw new errors.CortexAIError({
729
- statusCode: _response.error.statusCode,
730
- body: _response.error.body,
731
- rawResponse: _response.rawResponse,
732
- });
733
- }
734
- }
735
- switch (_response.error.reason) {
736
- case "non-json":
737
- throw new errors.CortexAIError({
738
- statusCode: _response.error.statusCode,
739
- body: _response.error.rawBody,
740
- rawResponse: _response.rawResponse,
741
- });
742
- case "timeout":
743
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /upload/upload_text.");
744
- case "unknown":
745
- throw new errors.CortexAIError({
746
- message: _response.error.errorMessage,
747
- rawResponse: _response.rawResponse,
748
- });
749
- }
750
- }
751
- /**
752
- * Update existing text or markdown content with new information.
753
- *
754
- * This endpoint allows you to modify text or markdown content that's already in your knowledge base. Provide the source ID of the content you want to update, along with the new text.
755
- *
756
- * The system will reprocess and re-index the updated content asynchronously. Use this when you need to correct information, add details, or refresh existing documentation.
757
- *
758
- * @param {CortexAI.UploadUpdateMarkdownRequest} request
759
- * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
760
- *
761
- * @throws {@link CortexAI.BadRequestError}
762
- * @throws {@link CortexAI.UnauthorizedError}
763
- * @throws {@link CortexAI.ForbiddenError}
764
- * @throws {@link CortexAI.NotFoundError}
765
- * @throws {@link CortexAI.UnprocessableEntityError}
766
- * @throws {@link CortexAI.InternalServerError}
767
- * @throws {@link CortexAI.ServiceUnavailableError}
768
- *
769
- * @example
770
- * await client.upload.updateMarkdown({
771
- * source_id: "CortexDoc1234",
772
- * tenant_id: "tenant_1234",
773
- * sub_tenant_id: "sub_tenant_4567",
774
- * body: {
775
- * content: "<content>"
776
- * }
777
- * })
778
- */
779
- updateMarkdown(request, requestOptions) {
780
- return core.HttpResponsePromise.fromPromise(this.__updateMarkdown(request, requestOptions));
781
- }
782
- async __updateMarkdown(request, requestOptions) {
783
- var _a, _b, _c;
784
- const { source_id: sourceId, tenant_id: tenantId, sub_tenant_id: subTenantId, body: _body } = request;
785
- const _queryParams = {};
786
- _queryParams["source_id"] = sourceId;
787
- _queryParams["tenant_id"] = tenantId;
788
- if (subTenantId != null) {
789
- _queryParams["sub_tenant_id"] = subTenantId;
790
- }
791
- 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);
792
- const _response = await core.fetcher({
793
- url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "upload/update_markdown"),
794
- method: "PATCH",
795
- headers: _headers,
796
- contentType: "application/json",
797
- queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
798
- requestType: "json",
799
- body: _body,
800
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
801
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
802
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
803
- });
804
- if (_response.ok) {
805
- return { data: _response.body, rawResponse: _response.rawResponse };
806
- }
807
- if (_response.error.reason === "status-code") {
808
- switch (_response.error.statusCode) {
809
- case 400:
810
- throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
811
- case 401:
812
- throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
813
- case 403:
814
- throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
815
- case 404:
816
- throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
817
- case 422:
818
- throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
819
- case 500:
820
- throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
821
- case 503:
822
- throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
823
- default:
824
- throw new errors.CortexAIError({
825
- statusCode: _response.error.statusCode,
826
- body: _response.error.body,
827
- rawResponse: _response.rawResponse,
828
- });
829
- }
830
- }
831
- switch (_response.error.reason) {
832
- case "non-json":
833
- throw new errors.CortexAIError({
834
- statusCode: _response.error.statusCode,
835
- body: _response.error.rawBody,
836
- rawResponse: _response.rawResponse,
837
- });
838
- case "timeout":
839
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling PATCH /upload/update_markdown.");
840
- case "unknown":
841
- throw new errors.CortexAIError({
842
- message: _response.error.errorMessage,
843
- rawResponse: _response.rawResponse,
844
- });
845
- }
846
- }
847
- /**
848
- * Update existing text or markdown content with new information.
849
- *
850
- * This endpoint allows you to modify text or markdown content that's already in your knowledge base. Provide the source ID of the content you want to update, along with the new text.
851
- *
852
- * The system will reprocess and re-index the updated content asynchronously. Use this when you need to correct information, add details, or refresh existing documentation.
853
- *
854
- * @param {CortexAI.UploadUpdateTextRequest} request
855
- * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
856
- *
857
- * @throws {@link CortexAI.BadRequestError}
858
- * @throws {@link CortexAI.UnauthorizedError}
859
- * @throws {@link CortexAI.ForbiddenError}
860
- * @throws {@link CortexAI.NotFoundError}
861
- * @throws {@link CortexAI.UnprocessableEntityError}
862
- * @throws {@link CortexAI.InternalServerError}
863
- * @throws {@link CortexAI.ServiceUnavailableError}
864
- *
865
- * @example
866
- * await client.upload.updateText({
867
- * source_id: "CortexDoc1234",
868
- * tenant_id: "tenant_1234",
869
- * sub_tenant_id: "sub_tenant_4567",
870
- * body: {
871
- * content: "<content>"
872
- * }
873
- * })
874
- */
875
- updateText(request, requestOptions) {
876
- return core.HttpResponsePromise.fromPromise(this.__updateText(request, requestOptions));
877
- }
878
- async __updateText(request, requestOptions) {
879
- var _a, _b, _c;
880
- const { source_id: sourceId, tenant_id: tenantId, sub_tenant_id: subTenantId, body: _body } = request;
881
- const _queryParams = {};
882
- _queryParams["source_id"] = sourceId;
883
- _queryParams["tenant_id"] = tenantId;
884
- if (subTenantId != null) {
885
- _queryParams["sub_tenant_id"] = subTenantId;
886
- }
887
- 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);
888
- const _response = await core.fetcher({
889
- url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "upload/update_text"),
890
- method: "PATCH",
891
- headers: _headers,
892
- contentType: "application/json",
893
- queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
894
- requestType: "json",
895
- body: _body,
896
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
897
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
898
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
899
- });
900
- if (_response.ok) {
901
- return { data: _response.body, rawResponse: _response.rawResponse };
902
- }
903
- if (_response.error.reason === "status-code") {
904
- switch (_response.error.statusCode) {
905
- case 400:
906
- throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
907
- case 401:
908
- throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
909
- case 403:
910
- throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
911
- case 404:
912
- throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
913
- case 422:
914
- throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
915
- case 500:
916
- throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
917
- case 503:
918
- throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
919
- default:
920
- throw new errors.CortexAIError({
921
- statusCode: _response.error.statusCode,
922
- body: _response.error.body,
923
- rawResponse: _response.rawResponse,
924
- });
925
- }
926
- }
927
- switch (_response.error.reason) {
928
- case "non-json":
929
- throw new errors.CortexAIError({
930
- statusCode: _response.error.statusCode,
931
- body: _response.error.rawBody,
932
- rawResponse: _response.rawResponse,
933
- });
934
- case "timeout":
935
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling PATCH /upload/update_text.");
936
- case "unknown":
937
- throw new errors.CortexAIError({
938
- message: _response.error.errorMessage,
939
- rawResponse: _response.rawResponse,
940
- });
941
- }
942
- }
943
- /**
944
- * Upload multiple markdown/text documents simultaneously for efficient bulk processing.
945
- *
946
- * This endpoint allows you to upload several markdown or text contents at once. Each content item gets processed asynchronously, and you can track the progress using their returned file IDs.
947
- *
948
- * @param {CortexAI.UploadBatchUploadMarkdownRequest} request
949
- * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
950
- *
951
- * @throws {@link CortexAI.BadRequestError}
952
- * @throws {@link CortexAI.UnauthorizedError}
953
- * @throws {@link CortexAI.ForbiddenError}
954
- * @throws {@link CortexAI.NotFoundError}
955
- * @throws {@link CortexAI.UnprocessableEntityError}
956
- * @throws {@link CortexAI.InternalServerError}
957
- * @throws {@link CortexAI.ServiceUnavailableError}
958
- *
959
- * @example
960
- * await client.upload.batchUploadMarkdown({
961
- * tenant_id: "tenant_1234",
962
- * sub_tenant_id: "sub_tenant_4567",
963
- * body: [{
964
- * content: "<content>"
965
- * }]
966
- * })
967
- */
968
- batchUploadMarkdown(request, requestOptions) {
969
- return core.HttpResponsePromise.fromPromise(this.__batchUploadMarkdown(request, requestOptions));
970
- }
971
- async __batchUploadMarkdown(request, requestOptions) {
972
- var _a, _b, _c;
973
- const { tenant_id: tenantId, sub_tenant_id: subTenantId, body: _body } = request;
974
- const _queryParams = {};
975
- _queryParams["tenant_id"] = tenantId;
976
- if (subTenantId != null) {
977
- _queryParams["sub_tenant_id"] = subTenantId;
978
- }
979
- let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: await this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
980
- const _response = await core.fetcher({
981
- url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "upload/batch_upload_markdown"),
982
- method: "POST",
983
- headers: _headers,
984
- contentType: "application/json",
985
- queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
986
- requestType: "json",
987
- body: _body,
988
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
989
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
990
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
991
- });
992
- if (_response.ok) {
993
- return { data: _response.body, rawResponse: _response.rawResponse };
994
- }
995
- if (_response.error.reason === "status-code") {
996
- switch (_response.error.statusCode) {
997
- case 400:
998
- throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
999
- case 401:
1000
- throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
1001
- case 403:
1002
- throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
1003
- case 404:
1004
- throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
1005
- case 422:
1006
- throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
1007
- case 500:
1008
- throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
1009
- case 503:
1010
- throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
1011
- default:
1012
- throw new errors.CortexAIError({
1013
- statusCode: _response.error.statusCode,
1014
- body: _response.error.body,
1015
- rawResponse: _response.rawResponse,
1016
- });
1017
- }
1018
- }
1019
- switch (_response.error.reason) {
1020
- case "non-json":
1021
- throw new errors.CortexAIError({
1022
- statusCode: _response.error.statusCode,
1023
- body: _response.error.rawBody,
1024
- rawResponse: _response.rawResponse,
1025
- });
1026
- case "timeout":
1027
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /upload/batch_upload_markdown.");
1028
- case "unknown":
1029
- throw new errors.CortexAIError({
1030
- message: _response.error.errorMessage,
1031
- rawResponse: _response.rawResponse,
1032
- });
1033
- }
1034
- }
1035
- /**
1036
- * Upload multiple markdown/text documents simultaneously for efficient bulk processing.
1037
- *
1038
- * This endpoint allows you to upload several markdown or text contents at once. Each content item gets processed asynchronously, and you can track the progress using their returned file IDs.
1039
- *
1040
- * @param {CortexAI.UploadBatchUploadTextRequest} request
1041
- * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
1042
- *
1043
- * @throws {@link CortexAI.BadRequestError}
1044
- * @throws {@link CortexAI.UnauthorizedError}
1045
- * @throws {@link CortexAI.ForbiddenError}
1046
- * @throws {@link CortexAI.NotFoundError}
1047
- * @throws {@link CortexAI.UnprocessableEntityError}
1048
- * @throws {@link CortexAI.InternalServerError}
1049
- * @throws {@link CortexAI.ServiceUnavailableError}
1050
- *
1051
- * @example
1052
- * await client.upload.batchUploadText({
1053
- * tenant_id: "tenant_1234",
1054
- * sub_tenant_id: "sub_tenant_4567",
1055
- * body: [{
1056
- * content: "<content>"
1057
- * }]
1058
- * })
1059
- */
1060
- batchUploadText(request, requestOptions) {
1061
- return core.HttpResponsePromise.fromPromise(this.__batchUploadText(request, requestOptions));
1062
- }
1063
- async __batchUploadText(request, requestOptions) {
1064
- var _a, _b, _c;
1065
- const { tenant_id: tenantId, sub_tenant_id: subTenantId, body: _body } = request;
1066
- const _queryParams = {};
1067
- _queryParams["tenant_id"] = tenantId;
1068
- if (subTenantId != null) {
1069
- _queryParams["sub_tenant_id"] = subTenantId;
1070
- }
1071
- let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: await this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1072
- const _response = await core.fetcher({
1073
- url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "upload/batch_upload_text"),
1074
- method: "POST",
1075
- headers: _headers,
1076
- contentType: "application/json",
1077
- queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
1078
- requestType: "json",
1079
- body: _body,
1080
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
1081
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
1082
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1083
- });
1084
- if (_response.ok) {
1085
- return { data: _response.body, rawResponse: _response.rawResponse };
1086
- }
1087
- if (_response.error.reason === "status-code") {
1088
- switch (_response.error.statusCode) {
1089
- case 400:
1090
- throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
1091
- case 401:
1092
- throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
1093
- case 403:
1094
- throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
1095
- case 404:
1096
- throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
1097
- case 422:
1098
- throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
1099
- case 500:
1100
- throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
1101
- case 503:
1102
- throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
1103
- default:
1104
- throw new errors.CortexAIError({
1105
- statusCode: _response.error.statusCode,
1106
- body: _response.error.body,
1107
- rawResponse: _response.rawResponse,
1108
- });
1109
- }
1110
- }
1111
- switch (_response.error.reason) {
1112
- case "non-json":
1113
- throw new errors.CortexAIError({
1114
- statusCode: _response.error.statusCode,
1115
- body: _response.error.rawBody,
1116
- rawResponse: _response.rawResponse,
1117
- });
1118
- case "timeout":
1119
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /upload/batch_upload_text.");
1120
- case "unknown":
1121
- throw new errors.CortexAIError({
1122
- message: _response.error.errorMessage,
1123
- rawResponse: _response.rawResponse,
1124
- });
1125
- }
1126
- }
1127
- /**
1128
- * Upload pre-computed embeddings for advanced similarity search.
1129
- *
1130
- * This endpoint accepts vector embeddings that you've generated externally, allowing you to integrate with custom embedding models or existing vector databases. The embeddings represent chunks of your content as numerical vectors.
1131
- *
1132
- * The system stores these embeddings and makes them available for semantic search and similarity matching. Use this when you want to leverage specialized embedding models or have existing vector representations.
1133
- *
1134
- * @param {CortexAI.EmbeddingsUploadRequest} request
1135
- * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
1136
- *
1137
- * @throws {@link CortexAI.BadRequestError}
1138
- * @throws {@link CortexAI.UnauthorizedError}
1139
- * @throws {@link CortexAI.ForbiddenError}
1140
- * @throws {@link CortexAI.NotFoundError}
1141
- * @throws {@link CortexAI.UnprocessableEntityError}
1142
- * @throws {@link CortexAI.InternalServerError}
1143
- * @throws {@link CortexAI.ServiceUnavailableError}
1144
- *
1145
- * @example
1146
- * await client.upload.uploadEmbeddings({
1147
- * tenant_id: "tenant_1234",
1148
- * sub_tenant_id: "sub_tenant_4567",
1149
- * embeddings: [[0.123413, 0.655367, 0.987654, 0.123456, 0.789012], [0.123413, 0.655367, 0.987654, 0.123456, 0.789012]]
1150
- * })
1151
- */
1152
- uploadEmbeddings(request, requestOptions) {
1153
- return core.HttpResponsePromise.fromPromise(this.__uploadEmbeddings(request, requestOptions));
1154
- }
1155
- async __uploadEmbeddings(request, requestOptions) {
1156
- var _a, _b, _c;
1157
- const { tenant_id: tenantId, sub_tenant_id: subTenantId } = request, _body = __rest(request, ["tenant_id", "sub_tenant_id"]);
1158
- const _queryParams = {};
1159
- _queryParams["tenant_id"] = tenantId;
1160
- if (subTenantId != null) {
1161
- _queryParams["sub_tenant_id"] = subTenantId;
1162
- }
1163
- 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);
1164
- const _response = await core.fetcher({
1165
- url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "upload/upload_embeddings"),
1166
- method: "POST",
1167
- headers: _headers,
1168
- contentType: "application/json",
1169
- queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
1170
- requestType: "json",
1171
- body: _body,
1172
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
1173
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
1174
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1175
- });
1176
- if (_response.ok) {
1177
- return { data: _response.body, rawResponse: _response.rawResponse };
1178
- }
1179
- if (_response.error.reason === "status-code") {
1180
- switch (_response.error.statusCode) {
1181
- case 400:
1182
- throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
1183
- case 401:
1184
- throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
1185
- case 403:
1186
- throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
1187
- case 404:
1188
- throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
1189
- case 422:
1190
- throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
1191
- case 500:
1192
- throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
1193
- case 503:
1194
- throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
1195
- default:
1196
- throw new errors.CortexAIError({
1197
- statusCode: _response.error.statusCode,
1198
- body: _response.error.body,
1199
- rawResponse: _response.rawResponse,
1200
- });
1201
- }
1202
- }
1203
- switch (_response.error.reason) {
1204
- case "non-json":
1205
- throw new errors.CortexAIError({
1206
- statusCode: _response.error.statusCode,
1207
- body: _response.error.rawBody,
1208
- rawResponse: _response.rawResponse,
1209
- });
1210
- case "timeout":
1211
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /upload/upload_embeddings.");
1212
- case "unknown":
1213
- throw new errors.CortexAIError({
1214
- message: _response.error.errorMessage,
1215
- rawResponse: _response.rawResponse,
1216
- });
1217
- }
1218
- }
1219
- /**
1220
- * Update existing embeddings with new vector representations.
1221
- *
1222
- * This endpoint allows you to modify embeddings that are already stored in your knowledge base. Provide updated vector representations for specific chunks of content, identified by their chunk IDs.
1223
- *
1224
- * The system will replace the existing embeddings with your new ones, ensuring that similarity searches reflect the most current vector representations. Use this when you need to update embeddings due to model improvements or content changes.
1225
- *
1226
- * @param {CortexAI.EmbeddingsUpdateRequest} request
1227
- * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
1228
- *
1229
- * @throws {@link CortexAI.BadRequestError}
1230
- * @throws {@link CortexAI.UnauthorizedError}
1231
- * @throws {@link CortexAI.ForbiddenError}
1232
- * @throws {@link CortexAI.NotFoundError}
1233
- * @throws {@link CortexAI.UnprocessableEntityError}
1234
- * @throws {@link CortexAI.InternalServerError}
1235
- * @throws {@link CortexAI.ServiceUnavailableError}
1236
- *
1237
- * @example
1238
- * await client.upload.updateEmbeddings({
1239
- * tenant_id: "tenant_1234",
1240
- * sub_tenant_id: "sub_tenant_4567"
1241
- * })
1242
- */
1243
- updateEmbeddings(request, requestOptions) {
1244
- return core.HttpResponsePromise.fromPromise(this.__updateEmbeddings(request, requestOptions));
1245
- }
1246
- async __updateEmbeddings(request, requestOptions) {
1247
- var _a, _b, _c;
1248
- const { tenant_id: tenantId, sub_tenant_id: subTenantId } = request, _body = __rest(request, ["tenant_id", "sub_tenant_id"]);
1249
- const _queryParams = {};
1250
- _queryParams["tenant_id"] = tenantId;
1251
- if (subTenantId != null) {
1252
- _queryParams["sub_tenant_id"] = subTenantId;
1253
- }
1254
- 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);
1255
- const _response = await core.fetcher({
1256
- url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "upload/update_embeddings"),
1257
- method: "PATCH",
1258
- headers: _headers,
1259
- contentType: "application/json",
1260
- queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
1261
- requestType: "json",
1262
- body: _body,
1263
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
1264
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
1265
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1266
- });
1267
- if (_response.ok) {
1268
- return { data: _response.body, rawResponse: _response.rawResponse };
1269
- }
1270
- if (_response.error.reason === "status-code") {
1271
- switch (_response.error.statusCode) {
1272
- case 400:
1273
- throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
1274
- case 401:
1275
- throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
1276
- case 403:
1277
- throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
1278
- case 404:
1279
- throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
1280
- case 422:
1281
- throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
1282
- case 500:
1283
- throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
1284
- case 503:
1285
- throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
1286
- default:
1287
- throw new errors.CortexAIError({
1288
- statusCode: _response.error.statusCode,
1289
- body: _response.error.body,
1290
- rawResponse: _response.rawResponse,
1291
- });
1292
- }
1293
- }
1294
- switch (_response.error.reason) {
1295
- case "non-json":
1296
- throw new errors.CortexAIError({
1297
- statusCode: _response.error.statusCode,
1298
- body: _response.error.rawBody,
1299
- rawResponse: _response.rawResponse,
1300
- });
1301
- case "timeout":
1302
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling PATCH /upload/update_embeddings.");
1303
- case "unknown":
1304
- throw new errors.CortexAIError({
1305
- message: _response.error.errorMessage,
1306
- rawResponse: _response.rawResponse,
1307
- });
1308
- }
1309
- }
1310
- /**
1311
- * Extract and index content from web pages automatically.
1312
- *
1313
- * This endpoint initiates web scraping for the specified URL, extracting the main content, text, and structure from the webpage. It's perfect for capturing articles, documentation, or any web content you want to include in your knowledge base.
1314
- *
1315
- * The system processes the webpage content asynchronously, cleaning and structuring the information for optimal search and retrieval. Use this when you need to add web content without manual copying and pasting.
1316
- *
1317
- * @param {CortexAI.UploadScrapeWebpageRequest} request
1318
- * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
1319
- *
1320
- * @throws {@link CortexAI.BadRequestError}
1321
- * @throws {@link CortexAI.UnauthorizedError}
1322
- * @throws {@link CortexAI.ForbiddenError}
1323
- * @throws {@link CortexAI.NotFoundError}
1324
- * @throws {@link CortexAI.UnprocessableEntityError}
1325
- * @throws {@link CortexAI.InternalServerError}
1326
- * @throws {@link CortexAI.ServiceUnavailableError}
1327
- *
1328
- * @example
1329
- * await client.upload.scrapeWebpage({
1330
- * web_url: "https://www.usecortex.ai/",
1331
- * tenant_id: "tenant_1234",
1332
- * sub_tenant_id: "sub_tenant_4567",
1333
- * file_id: "CortexDoc1234",
1334
- * body: {}
1335
- * })
1336
- */
1337
- scrapeWebpage(request, requestOptions) {
1338
- return core.HttpResponsePromise.fromPromise(this.__scrapeWebpage(request, requestOptions));
1339
- }
1340
- async __scrapeWebpage(request, requestOptions) {
1341
- var _a, _b, _c;
1342
- const { web_url: webUrl, tenant_id: tenantId, sub_tenant_id: subTenantId, file_id: fileId, body: _body, } = request;
1343
- const _queryParams = {};
1344
- _queryParams["web_url"] = webUrl;
1345
- _queryParams["tenant_id"] = tenantId;
1346
- if (subTenantId != null) {
1347
- _queryParams["sub_tenant_id"] = subTenantId;
1348
- }
1349
- if (fileId != null) {
1350
- _queryParams["file_id"] = fileId;
1351
- }
1352
- 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);
1353
- const _response = await core.fetcher({
1354
- url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "upload/scrape_webpage"),
1355
- method: "POST",
1356
- headers: _headers,
1357
- contentType: "application/x-www-form-urlencoded",
1358
- queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
1359
- requestType: "json",
1360
- body: _body,
1361
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
1362
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
1363
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1364
- });
1365
- if (_response.ok) {
1366
- return { data: _response.body, rawResponse: _response.rawResponse };
1367
- }
1368
- if (_response.error.reason === "status-code") {
1369
- switch (_response.error.statusCode) {
1370
- case 400:
1371
- throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
1372
- case 401:
1373
- throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
1374
- case 403:
1375
- throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
1376
- case 404:
1377
- throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
1378
- case 422:
1379
- throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
1380
- case 500:
1381
- throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
1382
- case 503:
1383
- throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
1384
- default:
1385
- throw new errors.CortexAIError({
1386
- statusCode: _response.error.statusCode,
1387
- body: _response.error.body,
1388
- rawResponse: _response.rawResponse,
1389
- });
1390
- }
1391
- }
1392
- switch (_response.error.reason) {
1393
- case "non-json":
1394
- throw new errors.CortexAIError({
1395
- statusCode: _response.error.statusCode,
1396
- body: _response.error.rawBody,
1397
- rawResponse: _response.rawResponse,
1398
- });
1399
- case "timeout":
1400
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /upload/scrape_webpage.");
1401
- case "unknown":
1402
- throw new errors.CortexAIError({
1403
- message: _response.error.errorMessage,
1404
- rawResponse: _response.rawResponse,
1405
- });
1406
- }
1407
- }
1408
- /**
1409
- * Update web scraping content with fresh data from the source URL.
1410
- *
1411
- * This endpoint refreshes the content for an existing web scraping job. Provide the source ID of the webpage content you want to update, and the system will re-scrape the URL to capture any changes.
1412
- *
1413
- * The updated content gets processed asynchronously and re-indexed in your knowledge base. Use this to keep web content current when the source pages are frequently updated.
1414
- *
1415
- * @param {CortexAI.UploadUpdateWebpageRequest} request
1416
- * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
1417
- *
1418
- * @throws {@link CortexAI.BadRequestError}
1419
- * @throws {@link CortexAI.UnauthorizedError}
1420
- * @throws {@link CortexAI.ForbiddenError}
1421
- * @throws {@link CortexAI.NotFoundError}
1422
- * @throws {@link CortexAI.UnprocessableEntityError}
1423
- * @throws {@link CortexAI.InternalServerError}
1424
- * @throws {@link CortexAI.ServiceUnavailableError}
1425
- *
1426
- * @example
1427
- * await client.upload.updateWebpage({
1428
- * web_url: "https://www.usecortex.ai/",
1429
- * source_id: "CortexDoc1234",
1430
- * tenant_id: "tenant_1234",
1431
- * sub_tenant_id: "sub_tenant_4567",
1432
- * body: {}
1433
- * })
1434
- */
1435
- updateWebpage(request, requestOptions) {
1436
- return core.HttpResponsePromise.fromPromise(this.__updateWebpage(request, requestOptions));
1437
- }
1438
- async __updateWebpage(request, requestOptions) {
1439
- var _a, _b, _c;
1440
- const { web_url: webUrl, source_id: sourceId, tenant_id: tenantId, sub_tenant_id: subTenantId, body: _body, } = request;
1441
- const _queryParams = {};
1442
- _queryParams["web_url"] = webUrl;
1443
- _queryParams["source_id"] = sourceId;
1444
- _queryParams["tenant_id"] = tenantId;
1445
- if (subTenantId != null) {
1446
- _queryParams["sub_tenant_id"] = subTenantId;
1447
- }
1448
- 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);
1449
- const _response = await core.fetcher({
1450
- url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "upload/update_webpage"),
1451
- method: "PATCH",
1452
- headers: _headers,
1453
- contentType: "application/x-www-form-urlencoded",
1454
- queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
1455
- requestType: "json",
1456
- body: _body,
1457
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
1458
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
1459
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1460
- });
1461
- if (_response.ok) {
1462
- return { data: _response.body, rawResponse: _response.rawResponse };
1463
- }
1464
- if (_response.error.reason === "status-code") {
1465
- switch (_response.error.statusCode) {
1466
- case 400:
1467
- throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
1468
- case 401:
1469
- throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
1470
- case 403:
1471
- throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
1472
- case 404:
1473
- throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
1474
- case 422:
1475
- throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
1476
- case 500:
1477
- throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
1478
- case 503:
1479
- throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
1480
- default:
1481
- throw new errors.CortexAIError({
1482
- statusCode: _response.error.statusCode,
1483
- body: _response.error.body,
1484
- rawResponse: _response.rawResponse,
1485
- });
1486
- }
1487
- }
1488
- switch (_response.error.reason) {
1489
- case "non-json":
1490
- throw new errors.CortexAIError({
1491
- statusCode: _response.error.statusCode,
1492
- body: _response.error.rawBody,
1493
- rawResponse: _response.rawResponse,
1494
- });
1495
- case "timeout":
1496
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling PATCH /upload/update_webpage.");
1497
- case "unknown":
1498
- throw new errors.CortexAIError({
1499
- message: _response.error.errorMessage,
1500
- rawResponse: _response.rawResponse,
1501
- });
1502
- }
1503
- }
1504
- /**
1505
- * Extract and index content from multiple web pages simultaneously.
1506
- *
1507
- * This endpoint initiates web scraping for multiple URLs at once, extracting the main content, text, and structure from each webpage. It's perfect for capturing multiple articles, documentation pages, or any web content you want to include in your knowledge base.
1508
- *
1509
- * The system processes all webpage content asynchronously, cleaning and structuring the information for optimal search and retrieval.
1510
- *
1511
- * @param {CortexAI.UploadBatchScrapeWebpageRequest} request
1512
- * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
1513
- *
1514
- * @throws {@link CortexAI.BadRequestError}
1515
- * @throws {@link CortexAI.UnauthorizedError}
1516
- * @throws {@link CortexAI.ForbiddenError}
1517
- * @throws {@link CortexAI.NotFoundError}
1518
- * @throws {@link CortexAI.UnprocessableEntityError}
1519
- * @throws {@link CortexAI.InternalServerError}
1520
- * @throws {@link CortexAI.ServiceUnavailableError}
1521
- *
1522
- * @example
1523
- * await client.upload.batchScrapeWebpage({
1524
- * tenant_id: "tenant_1234",
1525
- * sub_tenant_id: "sub_tenant_4567",
1526
- * body: [{
1527
- * web_url: "https://www.usecortex.ai/"
1528
- * }]
1529
- * })
1530
- */
1531
- batchScrapeWebpage(request, requestOptions) {
1532
- return core.HttpResponsePromise.fromPromise(this.__batchScrapeWebpage(request, requestOptions));
1533
- }
1534
- async __batchScrapeWebpage(request, requestOptions) {
1535
- var _a, _b, _c;
1536
- const { tenant_id: tenantId, sub_tenant_id: subTenantId, body: _body } = request;
1537
- const _queryParams = {};
1538
- _queryParams["tenant_id"] = tenantId;
1539
- if (subTenantId != null) {
1540
- _queryParams["sub_tenant_id"] = subTenantId;
1541
- }
1542
- let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: await this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1543
- const _response = await core.fetcher({
1544
- url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "upload/batch_scrape_webpage"),
1545
- method: "POST",
1546
- headers: _headers,
1547
- contentType: "application/json",
1548
- queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
1549
- requestType: "json",
1550
- body: _body,
1551
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
1552
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
1553
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1554
- });
1555
- if (_response.ok) {
1556
- return { data: _response.body, rawResponse: _response.rawResponse };
1557
- }
1558
- if (_response.error.reason === "status-code") {
1559
- switch (_response.error.statusCode) {
1560
- case 400:
1561
- throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
1562
- case 401:
1563
- throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
1564
- case 403:
1565
- throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
1566
- case 404:
1567
- throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
1568
- case 422:
1569
- throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
1570
- case 500:
1571
- throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
1572
- case 503:
1573
- throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
1574
- default:
1575
- throw new errors.CortexAIError({
1576
- statusCode: _response.error.statusCode,
1577
- body: _response.error.body,
1578
- rawResponse: _response.rawResponse,
1579
- });
1580
- }
1581
- }
1582
- switch (_response.error.reason) {
1583
- case "non-json":
1584
- throw new errors.CortexAIError({
1585
- statusCode: _response.error.statusCode,
1586
- body: _response.error.rawBody,
1587
- rawResponse: _response.rawResponse,
1588
- });
1589
- case "timeout":
1590
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /upload/batch_scrape_webpage.");
1591
- case "unknown":
1592
- throw new errors.CortexAIError({
1593
- message: _response.error.errorMessage,
1594
- rawResponse: _response.rawResponse,
1595
- });
1596
- }
1597
- }
1598
- /**
1599
- * Remove documents and content from your knowledge base.
1600
- *
1601
- * This endpoint permanently deletes the specified sources from your knowledge base. Once deleted, the content will no longer be available for search or retrieval.
1602
- *
1603
- * Use this carefully as the action cannot be undone. The system will confirm successful deletion of each source ID you specify.
1604
- *
1605
- * @param {CortexAI.DeleteMemoryRequest} request
1606
- * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
1607
- *
1608
- * @throws {@link CortexAI.UnprocessableEntityError}
1609
- *
1610
- * @example
1611
- * await client.upload.deleteSource({
1612
- * tenant_id: "tenant_1234",
1613
- * source_ids: ["CortexDoc1234", "CortexDoc4567"]
1614
- * })
1615
- */
1616
- deleteSource(request, requestOptions) {
1617
- return core.HttpResponsePromise.fromPromise(this.__deleteSource(request, requestOptions));
1618
- }
1619
- async __deleteSource(request, requestOptions) {
1620
- var _a, _b, _c;
1621
- 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);
1622
- const _response = await core.fetcher({
1623
- url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "upload/delete_source"),
1624
- method: "DELETE",
1625
- headers: _headers,
1626
- contentType: "application/json",
1627
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
1628
- requestType: "json",
1629
- body: request,
1630
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
1631
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
1632
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1633
- });
1634
- if (_response.ok) {
1635
- return { data: _response.body, rawResponse: _response.rawResponse };
1636
- }
1637
- if (_response.error.reason === "status-code") {
1638
- switch (_response.error.statusCode) {
1639
- case 422:
1640
- throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
1641
- default:
1642
- throw new errors.CortexAIError({
1643
- statusCode: _response.error.statusCode,
1644
- body: _response.error.body,
1645
- rawResponse: _response.rawResponse,
1646
- });
1647
- }
1648
- }
1649
- switch (_response.error.reason) {
1650
- case "non-json":
1651
- throw new errors.CortexAIError({
1652
- statusCode: _response.error.statusCode,
1653
- body: _response.error.rawBody,
1654
- rawResponse: _response.rawResponse,
1655
- });
1656
- case "timeout":
1657
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling DELETE /upload/delete_source.");
1658
- case "unknown":
1659
- throw new errors.CortexAIError({
1660
- message: _response.error.errorMessage,
1661
- rawResponse: _response.rawResponse,
1662
- });
1663
- }
1664
- }
1665
- /**
1666
- * Remove documents and content from your knowledge base.
1667
- *
1668
- * This endpoint permanently deletes the specified sources from your knowledge base. Once deleted, the content will no longer be available for search or retrieval.
1669
- *
1670
- * Use this carefully as the action cannot be undone. The system will confirm successful deletion of each source ID you specify.
1671
- *
1672
- * @param {CortexAI.DeleteMemoryRequest} request
1673
- * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
1674
- *
1675
- * @throws {@link CortexAI.UnprocessableEntityError}
1676
- *
1677
- * @example
1678
- * await client.upload.deleteMemory({
1679
- * tenant_id: "tenant_1234",
1680
- * source_ids: ["CortexDoc1234", "CortexDoc4567"]
1681
- * })
1682
- */
1683
- deleteMemory(request, requestOptions) {
1684
- return core.HttpResponsePromise.fromPromise(this.__deleteMemory(request, requestOptions));
1685
- }
1686
- async __deleteMemory(request, requestOptions) {
1687
- var _a, _b, _c;
1688
- 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);
1689
- const _response = await core.fetcher({
1690
- url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "upload/delete_memory"),
452
+ 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, "memories/delete_memory"),
1691
453
  method: "DELETE",
1692
454
  headers: _headers,
1693
- contentType: "application/json",
1694
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
1695
- requestType: "json",
1696
- body: request,
1697
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
1698
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
1699
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1700
- });
1701
- if (_response.ok) {
1702
- return { data: _response.body, rawResponse: _response.rawResponse };
1703
- }
1704
- if (_response.error.reason === "status-code") {
1705
- switch (_response.error.statusCode) {
1706
- case 422:
1707
- throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
1708
- default:
1709
- throw new errors.CortexAIError({
1710
- statusCode: _response.error.statusCode,
1711
- body: _response.error.body,
1712
- rawResponse: _response.rawResponse,
1713
- });
1714
- }
1715
- }
1716
- switch (_response.error.reason) {
1717
- case "non-json":
1718
- throw new errors.CortexAIError({
1719
- statusCode: _response.error.statusCode,
1720
- body: _response.error.rawBody,
1721
- rawResponse: _response.rawResponse,
1722
- });
1723
- case "timeout":
1724
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling DELETE /upload/delete_memory.");
1725
- case "unknown":
1726
- throw new errors.CortexAIError({
1727
- message: _response.error.errorMessage,
1728
- rawResponse: _response.rawResponse,
1729
- });
1730
- }
1731
- }
1732
- /**
1733
- * Check the current processing status of your uploaded content.
1734
- *
1735
- * This endpoint allows you to monitor the progress of documents, text, or other content you've uploaded. Simply provide the file ID to see whether processing is complete, still in progress, or if any errors occurred.
1736
- *
1737
- * Use this to determine when your content is ready for search and retrieval, or to troubleshoot any processing issues.
1738
- *
1739
- * @param {CortexAI.UploadVerifyProcessingRequest} request
1740
- * @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
1741
- *
1742
- * @throws {@link CortexAI.BadRequestError}
1743
- * @throws {@link CortexAI.UnauthorizedError}
1744
- * @throws {@link CortexAI.ForbiddenError}
1745
- * @throws {@link CortexAI.NotFoundError}
1746
- * @throws {@link CortexAI.UnprocessableEntityError}
1747
- * @throws {@link CortexAI.InternalServerError}
1748
- * @throws {@link CortexAI.ServiceUnavailableError}
1749
- *
1750
- * @example
1751
- * await client.upload.verifyProcessing({
1752
- * file_id: "CortexDoc1234",
1753
- * tenant_id: "tenant_1234"
1754
- * })
1755
- */
1756
- verifyProcessing(request, requestOptions) {
1757
- return core.HttpResponsePromise.fromPromise(this.__verifyProcessing(request, requestOptions));
1758
- }
1759
- async __verifyProcessing(request, requestOptions) {
1760
- var _a, _b, _c;
1761
- const { file_id: fileId, tenant_id: tenantId, sub_tenant_id: subTenantId } = request;
1762
- const _queryParams = {};
1763
- _queryParams["file_id"] = fileId;
1764
- if (tenantId != null) {
1765
- _queryParams["tenant_id"] = tenantId;
1766
- }
1767
- if (subTenantId != null) {
1768
- _queryParams["sub_tenant_id"] = subTenantId;
1769
- }
1770
- 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);
1771
- const _response = await core.fetcher({
1772
- url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "upload/verify_processing"),
1773
- method: "POST",
1774
- headers: _headers,
1775
455
  queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
1776
456
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
1777
457
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
@@ -1812,7 +492,7 @@ class Upload {
1812
492
  rawResponse: _response.rawResponse,
1813
493
  });
1814
494
  case "timeout":
1815
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /upload/verify_processing.");
495
+ throw new errors.CortexAITimeoutError("Timeout exceeded when calling DELETE /memories/delete_memory.");
1816
496
  case "unknown":
1817
497
  throw new errors.CortexAIError({
1818
498
  message: _response.error.errorMessage,