@usecortex_ai/node 0.1.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.
- package/LICENSE +24 -0
- package/README.md +71 -0
- package/dist/Client.d.ts +64 -0
- package/dist/Client.js +137 -0
- package/dist/api/errors/BadRequestError.d.ts +9 -0
- package/dist/api/errors/BadRequestError.js +42 -0
- package/dist/api/errors/ForbiddenError.d.ts +9 -0
- package/dist/api/errors/ForbiddenError.js +42 -0
- package/dist/api/errors/InternalServerError.d.ts +9 -0
- package/dist/api/errors/InternalServerError.js +42 -0
- package/dist/api/errors/NotFoundError.d.ts +9 -0
- package/dist/api/errors/NotFoundError.js +42 -0
- package/dist/api/errors/ServiceUnavailableError.d.ts +9 -0
- package/dist/api/errors/ServiceUnavailableError.js +42 -0
- package/dist/api/errors/UnauthorizedError.d.ts +9 -0
- package/dist/api/errors/UnauthorizedError.js +42 -0
- package/dist/api/errors/UnprocessableEntityError.d.ts +8 -0
- package/dist/api/errors/UnprocessableEntityError.js +42 -0
- package/dist/api/errors/index.d.ts +7 -0
- package/dist/api/errors/index.js +23 -0
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.js +19 -0
- package/dist/api/resources/embeddings/client/Client.d.ts +157 -0
- package/dist/api/resources/embeddings/client/Client.js +410 -0
- package/dist/api/resources/embeddings/client/index.d.ts +2 -0
- package/dist/api/resources/embeddings/client/index.js +17 -0
- package/dist/api/resources/embeddings/client/requests/EmbeddingsCreateCollectionRequest.d.ts +12 -0
- package/dist/api/resources/embeddings/client/requests/EmbeddingsCreateCollectionRequest.js +5 -0
- package/dist/api/resources/embeddings/client/requests/EmbeddingsDeleteRequest.d.ts +15 -0
- package/dist/api/resources/embeddings/client/requests/EmbeddingsDeleteRequest.js +5 -0
- package/dist/api/resources/embeddings/client/requests/EmbeddingsSearchRequest.d.ts +17 -0
- package/dist/api/resources/embeddings/client/requests/EmbeddingsSearchRequest.js +5 -0
- package/dist/api/resources/embeddings/client/requests/GetEmbeddingsBasedOnChunkIdsRequest.d.ts +15 -0
- package/dist/api/resources/embeddings/client/requests/GetEmbeddingsBasedOnChunkIdsRequest.js +5 -0
- package/dist/api/resources/embeddings/client/requests/index.d.ts +4 -0
- package/dist/api/resources/embeddings/client/requests/index.js +2 -0
- package/dist/api/resources/embeddings/index.d.ts +1 -0
- package/dist/api/resources/embeddings/index.js +17 -0
- package/dist/api/resources/fetch/client/Client.d.ts +54 -0
- package/dist/api/resources/fetch/client/Client.js +127 -0
- package/dist/api/resources/fetch/client/index.d.ts +2 -0
- package/dist/api/resources/fetch/client/index.js +17 -0
- package/dist/api/resources/fetch/client/requests/FetchContentRequest.d.ts +18 -0
- package/dist/api/resources/fetch/client/requests/FetchContentRequest.js +5 -0
- package/dist/api/resources/fetch/client/requests/index.d.ts +1 -0
- package/dist/api/resources/fetch/client/requests/index.js +2 -0
- package/dist/api/resources/fetch/index.d.ts +1 -0
- package/dist/api/resources/fetch/index.js +17 -0
- package/dist/api/resources/index.d.ts +16 -0
- package/dist/api/resources/index.js +45 -0
- package/dist/api/resources/search/client/Client.d.ts +133 -0
- package/dist/api/resources/search/client/Client.js +324 -0
- package/dist/api/resources/search/client/index.d.ts +2 -0
- package/dist/api/resources/search/client/index.js +17 -0
- package/dist/api/resources/search/client/requests/FullTextSearchRequest.d.ts +18 -0
- package/dist/api/resources/search/client/requests/FullTextSearchRequest.js +5 -0
- package/dist/api/resources/search/client/requests/QnARequest.d.ts +30 -0
- package/dist/api/resources/search/client/requests/QnARequest.js +5 -0
- package/dist/api/resources/search/client/requests/SearchRequest.d.ts +22 -0
- package/dist/api/resources/search/client/requests/SearchRequest.js +5 -0
- package/dist/api/resources/search/client/requests/index.d.ts +3 -0
- package/dist/api/resources/search/client/requests/index.js +2 -0
- package/dist/api/resources/search/index.d.ts +1 -0
- package/dist/api/resources/search/index.js +17 -0
- package/dist/api/resources/sources/client/Client.d.ts +72 -0
- package/dist/api/resources/sources/client/Client.js +207 -0
- package/dist/api/resources/sources/client/index.d.ts +2 -0
- package/dist/api/resources/sources/client/index.js +17 -0
- package/dist/api/resources/sources/client/requests/SourceBodyParams.d.ts +14 -0
- package/dist/api/resources/sources/client/requests/SourceBodyParams.js +5 -0
- package/dist/api/resources/sources/client/requests/SourcesGetAllRequest.d.ts +13 -0
- package/dist/api/resources/sources/client/requests/SourcesGetAllRequest.js +5 -0
- package/dist/api/resources/sources/client/requests/index.d.ts +2 -0
- package/dist/api/resources/sources/client/requests/index.js +2 -0
- package/dist/api/resources/sources/index.d.ts +1 -0
- package/dist/api/resources/sources/index.js +17 -0
- package/dist/api/resources/tenant/client/Client.d.ts +56 -0
- package/dist/api/resources/tenant/client/Client.js +132 -0
- package/dist/api/resources/tenant/client/index.d.ts +2 -0
- package/dist/api/resources/tenant/client/index.js +17 -0
- package/dist/api/resources/tenant/client/requests/TenantStatsRequest.d.ts +13 -0
- package/dist/api/resources/tenant/client/requests/TenantStatsRequest.js +5 -0
- package/dist/api/resources/tenant/client/requests/index.d.ts +1 -0
- package/dist/api/resources/tenant/client/requests/index.js +2 -0
- package/dist/api/resources/tenant/index.d.ts +1 -0
- package/dist/api/resources/tenant/index.js +17 -0
- package/dist/api/resources/upload/client/Client.d.ts +369 -0
- package/dist/api/resources/upload/client/Client.js +1439 -0
- package/dist/api/resources/upload/client/index.d.ts +2 -0
- package/dist/api/resources/upload/client/index.js +17 -0
- package/dist/api/resources/upload/client/requests/BodyBatchUpdateUploadBatchUpdatePatch.d.ts +19 -0
- package/dist/api/resources/upload/client/requests/BodyBatchUpdateUploadBatchUpdatePatch.js +5 -0
- package/dist/api/resources/upload/client/requests/BodyBatchUploadUploadBatchUploadPost.d.ts +18 -0
- package/dist/api/resources/upload/client/requests/BodyBatchUploadUploadBatchUploadPost.js +5 -0
- package/dist/api/resources/upload/client/requests/BodyUpdateFileUploadUpdateDocumentPatch.d.ts +20 -0
- package/dist/api/resources/upload/client/requests/BodyUpdateFileUploadUpdateDocumentPatch.js +5 -0
- package/dist/api/resources/upload/client/requests/BodyUploadFilesUploadUploadDocumentPost.d.ts +18 -0
- package/dist/api/resources/upload/client/requests/BodyUploadFilesUploadUploadDocumentPost.js +5 -0
- package/dist/api/resources/upload/client/requests/EmbeddingsUpdateRequest.d.ts +18 -0
- package/dist/api/resources/upload/client/requests/EmbeddingsUpdateRequest.js +5 -0
- package/dist/api/resources/upload/client/requests/EmbeddingsUploadRequest.d.ts +16 -0
- package/dist/api/resources/upload/client/requests/EmbeddingsUploadRequest.js +5 -0
- package/dist/api/resources/upload/client/requests/UploadScrapeWebpageRequest.d.ts +16 -0
- package/dist/api/resources/upload/client/requests/UploadScrapeWebpageRequest.js +5 -0
- package/dist/api/resources/upload/client/requests/UploadUpdateMarkdownRequest.d.ts +20 -0
- package/dist/api/resources/upload/client/requests/UploadUpdateMarkdownRequest.js +5 -0
- package/dist/api/resources/upload/client/requests/UploadUpdateTextRequest.d.ts +20 -0
- package/dist/api/resources/upload/client/requests/UploadUpdateTextRequest.js +5 -0
- package/dist/api/resources/upload/client/requests/UploadUpdateWebpageRequest.d.ts +17 -0
- package/dist/api/resources/upload/client/requests/UploadUpdateWebpageRequest.js +5 -0
- package/dist/api/resources/upload/client/requests/UploadUploadAppSourcesRequest.d.ts +16 -0
- package/dist/api/resources/upload/client/requests/UploadUploadAppSourcesRequest.js +5 -0
- package/dist/api/resources/upload/client/requests/UploadUploadMarkdownRequest.d.ts +18 -0
- package/dist/api/resources/upload/client/requests/UploadUploadMarkdownRequest.js +5 -0
- package/dist/api/resources/upload/client/requests/UploadUploadTextRequest.d.ts +18 -0
- package/dist/api/resources/upload/client/requests/UploadUploadTextRequest.js +5 -0
- package/dist/api/resources/upload/client/requests/UploadVerifyProcessingRequest.d.ts +13 -0
- package/dist/api/resources/upload/client/requests/UploadVerifyProcessingRequest.js +5 -0
- package/dist/api/resources/upload/client/requests/index.d.ts +14 -0
- package/dist/api/resources/upload/client/requests/index.js +2 -0
- package/dist/api/resources/upload/index.d.ts +1 -0
- package/dist/api/resources/upload/index.js +17 -0
- package/dist/api/resources/user/client/Client.d.ts +55 -0
- package/dist/api/resources/user/client/Client.js +144 -0
- package/dist/api/resources/user/client/index.d.ts +2 -0
- package/dist/api/resources/user/client/index.js +17 -0
- package/dist/api/resources/user/client/requests/BodyCreateTenantUserCreateTenantPost.d.ts +11 -0
- package/dist/api/resources/user/client/requests/BodyCreateTenantUserCreateTenantPost.js +5 -0
- package/dist/api/resources/user/client/requests/index.d.ts +1 -0
- package/dist/api/resources/user/client/requests/index.js +2 -0
- package/dist/api/resources/user/index.d.ts +1 -0
- package/dist/api/resources/user/index.js +17 -0
- package/dist/api/resources/userMemory/client/Client.d.ts +108 -0
- package/dist/api/resources/userMemory/client/Client.js +370 -0
- package/dist/api/resources/userMemory/client/index.d.ts +2 -0
- package/dist/api/resources/userMemory/client/index.js +17 -0
- package/dist/api/resources/userMemory/client/requests/UserMemoryAddUserMemoryRequest.d.ts +16 -0
- package/dist/api/resources/userMemory/client/requests/UserMemoryAddUserMemoryRequest.js +5 -0
- package/dist/api/resources/userMemory/client/requests/UserMemoryDeleteUserMemoryRequest.d.ts +16 -0
- package/dist/api/resources/userMemory/client/requests/UserMemoryDeleteUserMemoryRequest.js +5 -0
- package/dist/api/resources/userMemory/client/requests/UserMemoryGenerateUserMemoryRequest.d.ts +18 -0
- package/dist/api/resources/userMemory/client/requests/UserMemoryGenerateUserMemoryRequest.js +5 -0
- package/dist/api/resources/userMemory/client/requests/UserMemoryListUserMemoriesRequest.d.ts +14 -0
- package/dist/api/resources/userMemory/client/requests/UserMemoryListUserMemoriesRequest.js +5 -0
- package/dist/api/resources/userMemory/client/requests/UserMemoryRetrieveUserMemoryRequest.d.ts +17 -0
- package/dist/api/resources/userMemory/client/requests/UserMemoryRetrieveUserMemoryRequest.js +5 -0
- package/dist/api/resources/userMemory/client/requests/index.d.ts +5 -0
- package/dist/api/resources/userMemory/client/requests/index.js +2 -0
- package/dist/api/resources/userMemory/index.d.ts +1 -0
- package/dist/api/resources/userMemory/index.js +17 -0
- package/dist/api/types/ActualErrorResponse.d.ts +7 -0
- package/dist/api/types/ActualErrorResponse.js +5 -0
- package/dist/api/types/AppSourcesUploadData.d.ts +9 -0
- package/dist/api/types/AppSourcesUploadData.js +5 -0
- package/dist/api/types/AttachmentModel.d.ts +13 -0
- package/dist/api/types/AttachmentModel.js +5 -0
- package/dist/api/types/BatchUploadData.d.ts +9 -0
- package/dist/api/types/BatchUploadData.js +5 -0
- package/dist/api/types/Bm25OperatorType.d.ts +8 -0
- package/dist/api/types/Bm25OperatorType.js +10 -0
- package/dist/api/types/ContentModel.d.ts +11 -0
- package/dist/api/types/ContentModel.js +5 -0
- package/dist/api/types/DeleteMemoryRequest.d.ts +8 -0
- package/dist/api/types/DeleteMemoryRequest.js +5 -0
- package/dist/api/types/EmbeddingsCreateCollectionData.d.ts +9 -0
- package/dist/api/types/EmbeddingsCreateCollectionData.js +5 -0
- package/dist/api/types/EmbeddingsDeleteData.d.ts +9 -0
- package/dist/api/types/EmbeddingsDeleteData.js +5 -0
- package/dist/api/types/EmbeddingsGetData.d.ts +9 -0
- package/dist/api/types/EmbeddingsGetData.js +5 -0
- package/dist/api/types/EmbeddingsSearchData.d.ts +9 -0
- package/dist/api/types/EmbeddingsSearchData.js +5 -0
- package/dist/api/types/ErrorResponse.d.ts +9 -0
- package/dist/api/types/ErrorResponse.js +5 -0
- package/dist/api/types/ExtendedContext.d.ts +7 -0
- package/dist/api/types/ExtendedContext.js +5 -0
- package/dist/api/types/FetchContentData.d.ts +10 -0
- package/dist/api/types/FetchContentData.js +5 -0
- package/dist/api/types/FileUploadResult.d.ts +7 -0
- package/dist/api/types/FileUploadResult.js +5 -0
- package/dist/api/types/FullTextSearchData.d.ts +9 -0
- package/dist/api/types/FullTextSearchData.js +5 -0
- package/dist/api/types/HttpValidationError.d.ts +7 -0
- package/dist/api/types/HttpValidationError.js +5 -0
- package/dist/api/types/ListSourcesResponse.d.ts +9 -0
- package/dist/api/types/ListSourcesResponse.js +5 -0
- package/dist/api/types/MarkdownUploadRequest.d.ts +8 -0
- package/dist/api/types/MarkdownUploadRequest.js +5 -0
- package/dist/api/types/ProcessingStatus.d.ts +9 -0
- package/dist/api/types/ProcessingStatus.js +5 -0
- package/dist/api/types/RelatedChunk.d.ts +9 -0
- package/dist/api/types/RelatedChunk.js +5 -0
- package/dist/api/types/SearchChunk.d.ts +21 -0
- package/dist/api/types/SearchChunk.js +5 -0
- package/dist/api/types/SearchData.d.ts +9 -0
- package/dist/api/types/SearchData.js +5 -0
- package/dist/api/types/SingleUploadData.d.ts +8 -0
- package/dist/api/types/SingleUploadData.js +5 -0
- package/dist/api/types/Source.d.ts +19 -0
- package/dist/api/types/Source.js +5 -0
- package/dist/api/types/SourceContent.d.ts +11 -0
- package/dist/api/types/SourceContent.js +5 -0
- package/dist/api/types/SourceModel.d.ts +18 -0
- package/dist/api/types/SourceModel.js +5 -0
- package/dist/api/types/TenantCreateData.d.ts +9 -0
- package/dist/api/types/TenantCreateData.js +5 -0
- package/dist/api/types/TenantStats.d.ts +10 -0
- package/dist/api/types/TenantStats.js +5 -0
- package/dist/api/types/ValidationError.d.ts +14 -0
- package/dist/api/types/ValidationError.js +5 -0
- package/dist/api/types/index.d.ts +30 -0
- package/dist/api/types/index.js +46 -0
- package/dist/core/auth/AuthProvider.d.ts +4 -0
- package/dist/core/auth/AuthProvider.js +2 -0
- package/dist/core/auth/AuthRequest.d.ts +9 -0
- package/dist/core/auth/AuthRequest.js +2 -0
- package/dist/core/auth/BasicAuth.d.ts +8 -0
- package/dist/core/auth/BasicAuth.js +26 -0
- package/dist/core/auth/BearerToken.d.ts +5 -0
- package/dist/core/auth/BearerToken.js +15 -0
- package/dist/core/auth/index.d.ts +4 -0
- package/dist/core/auth/index.js +7 -0
- package/dist/core/base64.d.ts +2 -0
- package/dist/core/base64.js +27 -0
- package/dist/core/exports.d.ts +1 -0
- package/dist/core/exports.js +17 -0
- package/dist/core/fetcher/APIResponse.d.ts +20 -0
- package/dist/core/fetcher/APIResponse.js +2 -0
- package/dist/core/fetcher/BinaryResponse.d.ts +20 -0
- package/dist/core/fetcher/BinaryResponse.js +18 -0
- package/dist/core/fetcher/Fetcher.d.ts +40 -0
- package/dist/core/fetcher/Fetcher.js +105 -0
- package/dist/core/fetcher/Headers.d.ts +3 -0
- package/dist/core/fetcher/Headers.js +92 -0
- package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/dist/core/fetcher/HttpResponsePromise.js +92 -0
- package/dist/core/fetcher/RawResponse.d.ts +29 -0
- package/dist/core/fetcher/RawResponse.js +44 -0
- package/dist/core/fetcher/ResponseWithBody.d.ts +4 -0
- package/dist/core/fetcher/ResponseWithBody.js +7 -0
- package/dist/core/fetcher/Supplier.d.ts +4 -0
- package/dist/core/fetcher/Supplier.js +13 -0
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/core/fetcher/createRequestUrl.js +9 -0
- package/dist/core/fetcher/getErrorResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getErrorResponseBody.js +34 -0
- package/dist/core/fetcher/getFetchFn.d.ts +1 -0
- package/dist/core/fetcher/getFetchFn.js +7 -0
- package/dist/core/fetcher/getHeader.d.ts +1 -0
- package/dist/core/fetcher/getHeader.js +12 -0
- package/dist/core/fetcher/getRequestBody.d.ts +7 -0
- package/dist/core/fetcher/getRequestBody.js +13 -0
- package/dist/core/fetcher/getResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getResponseBody.js +45 -0
- package/dist/core/fetcher/index.d.ts +9 -0
- package/dist/core/fetcher/index.js +15 -0
- package/dist/core/fetcher/makeRequest.d.ts +1 -0
- package/dist/core/fetcher/makeRequest.js +33 -0
- package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/core/fetcher/requestWithRetries.js +30 -0
- package/dist/core/fetcher/signals.d.ts +12 -0
- package/dist/core/fetcher/signals.js +37 -0
- package/dist/core/file/exports.d.ts +1 -0
- package/dist/core/file/exports.js +2 -0
- package/dist/core/file/file.d.ts +5 -0
- package/dist/core/file/file.js +177 -0
- package/dist/core/file/index.d.ts +2 -0
- package/dist/core/file/index.js +18 -0
- package/dist/core/file/types.d.ts +70 -0
- package/dist/core/file/types.js +2 -0
- package/dist/core/form-data-utils/FormDataWrapper.d.ts +16 -0
- package/dist/core/form-data-utils/FormDataWrapper.js +178 -0
- package/dist/core/form-data-utils/encodeAsFormParameter.d.ts +1 -0
- package/dist/core/form-data-utils/encodeAsFormParameter.js +13 -0
- package/dist/core/form-data-utils/index.d.ts +2 -0
- package/dist/core/form-data-utils/index.js +20 -0
- package/dist/core/headers.d.ts +3 -0
- package/dist/core/headers.js +30 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/index.js +36 -0
- package/dist/core/json.d.ts +15 -0
- package/dist/core/json.js +24 -0
- package/dist/core/runtime/index.d.ts +1 -0
- package/dist/core/runtime/index.js +5 -0
- package/dist/core/runtime/runtime.d.ts +9 -0
- package/dist/core/runtime/runtime.js +102 -0
- package/dist/core/url/index.d.ts +2 -0
- package/dist/core/url/index.js +7 -0
- package/dist/core/url/join.d.ts +1 -0
- package/dist/core/url/join.js +70 -0
- package/dist/core/url/qs.d.ts +6 -0
- package/dist/core/url/qs.js +65 -0
- package/dist/environments.d.ts +7 -0
- package/dist/environments.js +9 -0
- package/dist/errors/CortexAIError.d.ts +15 -0
- package/dist/errors/CortexAIError.js +30 -0
- package/dist/errors/CortexAITimeoutError.d.ts +6 -0
- package/dist/errors/CortexAITimeoutError.js +13 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +7 -0
- package/dist/exports.d.ts +1 -0
- package/dist/exports.js +17 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +38 -0
- package/package.json +30 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.UnprocessableEntityError = void 0;
|
|
30
|
+
const errors = __importStar(require("../../errors/index.js"));
|
|
31
|
+
class UnprocessableEntityError extends errors.CortexAIError {
|
|
32
|
+
constructor(body, rawResponse) {
|
|
33
|
+
super({
|
|
34
|
+
message: "UnprocessableEntityError",
|
|
35
|
+
statusCode: 422,
|
|
36
|
+
body: body,
|
|
37
|
+
rawResponse: rawResponse,
|
|
38
|
+
});
|
|
39
|
+
Object.setPrototypeOf(this, UnprocessableEntityError.prototype);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.UnprocessableEntityError = UnprocessableEntityError;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./BadRequestError.js";
|
|
2
|
+
export * from "./UnauthorizedError.js";
|
|
3
|
+
export * from "./ForbiddenError.js";
|
|
4
|
+
export * from "./NotFoundError.js";
|
|
5
|
+
export * from "./UnprocessableEntityError.js";
|
|
6
|
+
export * from "./InternalServerError.js";
|
|
7
|
+
export * from "./ServiceUnavailableError.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./BadRequestError.js"), exports);
|
|
18
|
+
__exportStar(require("./UnauthorizedError.js"), exports);
|
|
19
|
+
__exportStar(require("./ForbiddenError.js"), exports);
|
|
20
|
+
__exportStar(require("./NotFoundError.js"), exports);
|
|
21
|
+
__exportStar(require("./UnprocessableEntityError.js"), exports);
|
|
22
|
+
__exportStar(require("./InternalServerError.js"), exports);
|
|
23
|
+
__exportStar(require("./ServiceUnavailableError.js"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types/index.js"), exports);
|
|
18
|
+
__exportStar(require("./errors/index.js"), exports);
|
|
19
|
+
__exportStar(require("./resources/index.js"), exports);
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as environments from "../../../../environments.js";
|
|
5
|
+
import * as core from "../../../../core/index.js";
|
|
6
|
+
import * as CortexAI from "../../../index.js";
|
|
7
|
+
export declare namespace Embeddings {
|
|
8
|
+
interface Options {
|
|
9
|
+
environment?: core.Supplier<environments.CortexAIEnvironment | string>;
|
|
10
|
+
/** Specify a custom URL to connect the client to. */
|
|
11
|
+
baseUrl?: core.Supplier<string>;
|
|
12
|
+
token?: core.Supplier<core.BearerToken | undefined>;
|
|
13
|
+
/** Additional headers to include in requests. */
|
|
14
|
+
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
15
|
+
}
|
|
16
|
+
interface RequestOptions {
|
|
17
|
+
/** The maximum time to wait for a response in seconds. */
|
|
18
|
+
timeoutInSeconds?: number;
|
|
19
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
20
|
+
maxRetries?: number;
|
|
21
|
+
/** A hook to abort the request. */
|
|
22
|
+
abortSignal?: AbortSignal;
|
|
23
|
+
/** Additional query string parameters to include in the request. */
|
|
24
|
+
queryParams?: Record<string, unknown>;
|
|
25
|
+
/** Additional headers to include in the request. */
|
|
26
|
+
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export declare class Embeddings {
|
|
30
|
+
protected readonly _options: Embeddings.Options;
|
|
31
|
+
constructor(_options?: Embeddings.Options);
|
|
32
|
+
/**
|
|
33
|
+
* Delete specific embedding chunks from indexed sources.
|
|
34
|
+
*
|
|
35
|
+
* This endpoint deletes specified embedding chunks from the Findr backend by sending
|
|
36
|
+
* chunk IDs to the backend delete service.
|
|
37
|
+
*
|
|
38
|
+
* Args:
|
|
39
|
+
* request (EmbeddingsDeleteRequest): The delete request containing:
|
|
40
|
+
* - chunk_ids (List[str]): List of chunk IDs to delete
|
|
41
|
+
* - tenant_id (str): Tenant identifier for multi-tenancy
|
|
42
|
+
* - sub_tenant_id (str, optional): Sub-tenant identifier, defaults to tenant_id
|
|
43
|
+
* api_details (dict): Authentication details obtained from API key validation
|
|
44
|
+
*
|
|
45
|
+
* Returns:
|
|
46
|
+
* EmbeddingsDeleteData: Success response with deletion details
|
|
47
|
+
*
|
|
48
|
+
* @param {CortexAI.EmbeddingsDeleteRequest} request
|
|
49
|
+
* @param {Embeddings.RequestOptions} requestOptions - Request-specific configuration.
|
|
50
|
+
*
|
|
51
|
+
* @throws {@link CortexAI.BadRequestError}
|
|
52
|
+
* @throws {@link CortexAI.UnauthorizedError}
|
|
53
|
+
* @throws {@link CortexAI.ForbiddenError}
|
|
54
|
+
* @throws {@link CortexAI.NotFoundError}
|
|
55
|
+
* @throws {@link CortexAI.UnprocessableEntityError}
|
|
56
|
+
* @throws {@link CortexAI.InternalServerError}
|
|
57
|
+
* @throws {@link CortexAI.ServiceUnavailableError}
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* await client.embeddings.delete({
|
|
61
|
+
* chunk_ids: ["chunk_ids"],
|
|
62
|
+
* tenant_id: "tenant_id"
|
|
63
|
+
* })
|
|
64
|
+
*/
|
|
65
|
+
delete(request: CortexAI.EmbeddingsDeleteRequest, requestOptions?: Embeddings.RequestOptions): core.HttpResponsePromise<CortexAI.EmbeddingsDeleteData>;
|
|
66
|
+
private __delete;
|
|
67
|
+
/**
|
|
68
|
+
* Search for similar embedding chunks using vector similarity.
|
|
69
|
+
*
|
|
70
|
+
* This endpoint performs semantic search by sending an embedding vector to the Findr backend
|
|
71
|
+
* and returns a list of the most similar chunk IDs based on vector similarity.
|
|
72
|
+
*
|
|
73
|
+
* Args:
|
|
74
|
+
* request (EmbeddingsSearchRequest): The search request containing:
|
|
75
|
+
* - embeddings (List[float]): Single embedding vector for similarity search
|
|
76
|
+
* - tenant_id (str): Tenant identifier for multi-tenancy
|
|
77
|
+
* - sub_tenant_id (str, optional): Sub-tenant identifier, defaults to tenant_id
|
|
78
|
+
* - max_chunks (int, optional): Maximum number of chunk IDs to return (default: 10)
|
|
79
|
+
* api_details (dict): Authentication details obtained from API key validation
|
|
80
|
+
*
|
|
81
|
+
* Returns:
|
|
82
|
+
* EmbeddingsSearchData: List of chunk IDs with similarity scores
|
|
83
|
+
*
|
|
84
|
+
* @param {CortexAI.EmbeddingsSearchRequest} request
|
|
85
|
+
* @param {Embeddings.RequestOptions} requestOptions - Request-specific configuration.
|
|
86
|
+
*
|
|
87
|
+
* @throws {@link CortexAI.BadRequestError}
|
|
88
|
+
* @throws {@link CortexAI.UnauthorizedError}
|
|
89
|
+
* @throws {@link CortexAI.ForbiddenError}
|
|
90
|
+
* @throws {@link CortexAI.NotFoundError}
|
|
91
|
+
* @throws {@link CortexAI.UnprocessableEntityError}
|
|
92
|
+
* @throws {@link CortexAI.InternalServerError}
|
|
93
|
+
* @throws {@link CortexAI.ServiceUnavailableError}
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* await client.embeddings.search({
|
|
97
|
+
* embeddings: [1.1],
|
|
98
|
+
* tenant_id: "tenant_id"
|
|
99
|
+
* })
|
|
100
|
+
*/
|
|
101
|
+
search(request: CortexAI.EmbeddingsSearchRequest, requestOptions?: Embeddings.RequestOptions): core.HttpResponsePromise<CortexAI.EmbeddingsSearchData>;
|
|
102
|
+
private __search;
|
|
103
|
+
/**
|
|
104
|
+
* Get embeddings based on chunk IDs.
|
|
105
|
+
*
|
|
106
|
+
* This endpoint returns embeddings for a list of chunk IDs.
|
|
107
|
+
*
|
|
108
|
+
* Returns:
|
|
109
|
+
* EmbeddingsGetData: Embeddings data for the requested chunk IDs
|
|
110
|
+
*
|
|
111
|
+
* @param {CortexAI.GetEmbeddingsBasedOnChunkIdsRequest} request
|
|
112
|
+
* @param {Embeddings.RequestOptions} requestOptions - Request-specific configuration.
|
|
113
|
+
*
|
|
114
|
+
* @throws {@link CortexAI.BadRequestError}
|
|
115
|
+
* @throws {@link CortexAI.UnauthorizedError}
|
|
116
|
+
* @throws {@link CortexAI.ForbiddenError}
|
|
117
|
+
* @throws {@link CortexAI.NotFoundError}
|
|
118
|
+
* @throws {@link CortexAI.UnprocessableEntityError}
|
|
119
|
+
* @throws {@link CortexAI.InternalServerError}
|
|
120
|
+
* @throws {@link CortexAI.ServiceUnavailableError}
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* await client.embeddings.getByChunkIds({
|
|
124
|
+
* chunk_ids: ["chunk_ids"],
|
|
125
|
+
* tenant_id: "tenant_id"
|
|
126
|
+
* })
|
|
127
|
+
*/
|
|
128
|
+
getByChunkIds(request: CortexAI.GetEmbeddingsBasedOnChunkIdsRequest, requestOptions?: Embeddings.RequestOptions): core.HttpResponsePromise<CortexAI.EmbeddingsGetData>;
|
|
129
|
+
private __getByChunkIds;
|
|
130
|
+
/**
|
|
131
|
+
* Create an embeddings collection for the given tenant in Findr.
|
|
132
|
+
*
|
|
133
|
+
* sub_tenant_id is set to be the same as tenant_id as per requirements.
|
|
134
|
+
*
|
|
135
|
+
* Returns:
|
|
136
|
+
* EmbeddingsCreateCollectionData: Success response with collection details
|
|
137
|
+
*
|
|
138
|
+
* @param {CortexAI.EmbeddingsCreateCollectionRequest} request
|
|
139
|
+
* @param {Embeddings.RequestOptions} requestOptions - Request-specific configuration.
|
|
140
|
+
*
|
|
141
|
+
* @throws {@link CortexAI.BadRequestError}
|
|
142
|
+
* @throws {@link CortexAI.UnauthorizedError}
|
|
143
|
+
* @throws {@link CortexAI.ForbiddenError}
|
|
144
|
+
* @throws {@link CortexAI.NotFoundError}
|
|
145
|
+
* @throws {@link CortexAI.UnprocessableEntityError}
|
|
146
|
+
* @throws {@link CortexAI.InternalServerError}
|
|
147
|
+
* @throws {@link CortexAI.ServiceUnavailableError}
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* await client.embeddings.createCollection({
|
|
151
|
+
* tenant_id: "tenant_id"
|
|
152
|
+
* })
|
|
153
|
+
*/
|
|
154
|
+
createCollection(request: CortexAI.EmbeddingsCreateCollectionRequest, requestOptions?: Embeddings.RequestOptions): core.HttpResponsePromise<CortexAI.EmbeddingsCreateCollectionData>;
|
|
155
|
+
private __createCollection;
|
|
156
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
157
|
+
}
|
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.Embeddings = void 0;
|
|
30
|
+
const environments = __importStar(require("../../../../environments.js"));
|
|
31
|
+
const core = __importStar(require("../../../../core/index.js"));
|
|
32
|
+
const CortexAI = __importStar(require("../../../index.js"));
|
|
33
|
+
const headers_js_1 = require("../../../../core/headers.js");
|
|
34
|
+
const errors = __importStar(require("../../../../errors/index.js"));
|
|
35
|
+
class Embeddings {
|
|
36
|
+
constructor(_options = {}) {
|
|
37
|
+
this._options = _options;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Delete specific embedding chunks from indexed sources.
|
|
41
|
+
*
|
|
42
|
+
* This endpoint deletes specified embedding chunks from the Findr backend by sending
|
|
43
|
+
* chunk IDs to the backend delete service.
|
|
44
|
+
*
|
|
45
|
+
* Args:
|
|
46
|
+
* request (EmbeddingsDeleteRequest): The delete request containing:
|
|
47
|
+
* - chunk_ids (List[str]): List of chunk IDs to delete
|
|
48
|
+
* - tenant_id (str): Tenant identifier for multi-tenancy
|
|
49
|
+
* - sub_tenant_id (str, optional): Sub-tenant identifier, defaults to tenant_id
|
|
50
|
+
* api_details (dict): Authentication details obtained from API key validation
|
|
51
|
+
*
|
|
52
|
+
* Returns:
|
|
53
|
+
* EmbeddingsDeleteData: Success response with deletion details
|
|
54
|
+
*
|
|
55
|
+
* @param {CortexAI.EmbeddingsDeleteRequest} request
|
|
56
|
+
* @param {Embeddings.RequestOptions} requestOptions - Request-specific configuration.
|
|
57
|
+
*
|
|
58
|
+
* @throws {@link CortexAI.BadRequestError}
|
|
59
|
+
* @throws {@link CortexAI.UnauthorizedError}
|
|
60
|
+
* @throws {@link CortexAI.ForbiddenError}
|
|
61
|
+
* @throws {@link CortexAI.NotFoundError}
|
|
62
|
+
* @throws {@link CortexAI.UnprocessableEntityError}
|
|
63
|
+
* @throws {@link CortexAI.InternalServerError}
|
|
64
|
+
* @throws {@link CortexAI.ServiceUnavailableError}
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* await client.embeddings.delete({
|
|
68
|
+
* chunk_ids: ["chunk_ids"],
|
|
69
|
+
* tenant_id: "tenant_id"
|
|
70
|
+
* })
|
|
71
|
+
*/
|
|
72
|
+
delete(request, requestOptions) {
|
|
73
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions));
|
|
74
|
+
}
|
|
75
|
+
async __delete(request, requestOptions) {
|
|
76
|
+
var _a, _b, _c;
|
|
77
|
+
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);
|
|
78
|
+
const _response = await core.fetcher({
|
|
79
|
+
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, "embeddings/delete"),
|
|
80
|
+
method: "DELETE",
|
|
81
|
+
headers: _headers,
|
|
82
|
+
contentType: "application/json",
|
|
83
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
84
|
+
requestType: "json",
|
|
85
|
+
body: request,
|
|
86
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
87
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
88
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
89
|
+
});
|
|
90
|
+
if (_response.ok) {
|
|
91
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
92
|
+
}
|
|
93
|
+
if (_response.error.reason === "status-code") {
|
|
94
|
+
switch (_response.error.statusCode) {
|
|
95
|
+
case 400:
|
|
96
|
+
throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
|
|
97
|
+
case 401:
|
|
98
|
+
throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
99
|
+
case 403:
|
|
100
|
+
throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
101
|
+
case 404:
|
|
102
|
+
throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
|
|
103
|
+
case 422:
|
|
104
|
+
throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
105
|
+
case 500:
|
|
106
|
+
throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
107
|
+
case 503:
|
|
108
|
+
throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
109
|
+
default:
|
|
110
|
+
throw new errors.CortexAIError({
|
|
111
|
+
statusCode: _response.error.statusCode,
|
|
112
|
+
body: _response.error.body,
|
|
113
|
+
rawResponse: _response.rawResponse,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
switch (_response.error.reason) {
|
|
118
|
+
case "non-json":
|
|
119
|
+
throw new errors.CortexAIError({
|
|
120
|
+
statusCode: _response.error.statusCode,
|
|
121
|
+
body: _response.error.rawBody,
|
|
122
|
+
rawResponse: _response.rawResponse,
|
|
123
|
+
});
|
|
124
|
+
case "timeout":
|
|
125
|
+
throw new errors.CortexAITimeoutError("Timeout exceeded when calling DELETE /embeddings/delete.");
|
|
126
|
+
case "unknown":
|
|
127
|
+
throw new errors.CortexAIError({
|
|
128
|
+
message: _response.error.errorMessage,
|
|
129
|
+
rawResponse: _response.rawResponse,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Search for similar embedding chunks using vector similarity.
|
|
135
|
+
*
|
|
136
|
+
* This endpoint performs semantic search by sending an embedding vector to the Findr backend
|
|
137
|
+
* and returns a list of the most similar chunk IDs based on vector similarity.
|
|
138
|
+
*
|
|
139
|
+
* Args:
|
|
140
|
+
* request (EmbeddingsSearchRequest): The search request containing:
|
|
141
|
+
* - embeddings (List[float]): Single embedding vector for similarity search
|
|
142
|
+
* - tenant_id (str): Tenant identifier for multi-tenancy
|
|
143
|
+
* - sub_tenant_id (str, optional): Sub-tenant identifier, defaults to tenant_id
|
|
144
|
+
* - max_chunks (int, optional): Maximum number of chunk IDs to return (default: 10)
|
|
145
|
+
* api_details (dict): Authentication details obtained from API key validation
|
|
146
|
+
*
|
|
147
|
+
* Returns:
|
|
148
|
+
* EmbeddingsSearchData: List of chunk IDs with similarity scores
|
|
149
|
+
*
|
|
150
|
+
* @param {CortexAI.EmbeddingsSearchRequest} request
|
|
151
|
+
* @param {Embeddings.RequestOptions} requestOptions - Request-specific configuration.
|
|
152
|
+
*
|
|
153
|
+
* @throws {@link CortexAI.BadRequestError}
|
|
154
|
+
* @throws {@link CortexAI.UnauthorizedError}
|
|
155
|
+
* @throws {@link CortexAI.ForbiddenError}
|
|
156
|
+
* @throws {@link CortexAI.NotFoundError}
|
|
157
|
+
* @throws {@link CortexAI.UnprocessableEntityError}
|
|
158
|
+
* @throws {@link CortexAI.InternalServerError}
|
|
159
|
+
* @throws {@link CortexAI.ServiceUnavailableError}
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* await client.embeddings.search({
|
|
163
|
+
* embeddings: [1.1],
|
|
164
|
+
* tenant_id: "tenant_id"
|
|
165
|
+
* })
|
|
166
|
+
*/
|
|
167
|
+
search(request, requestOptions) {
|
|
168
|
+
return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions));
|
|
169
|
+
}
|
|
170
|
+
async __search(request, requestOptions) {
|
|
171
|
+
var _a, _b, _c;
|
|
172
|
+
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);
|
|
173
|
+
const _response = await core.fetcher({
|
|
174
|
+
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, "embeddings/search"),
|
|
175
|
+
method: "POST",
|
|
176
|
+
headers: _headers,
|
|
177
|
+
contentType: "application/json",
|
|
178
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
179
|
+
requestType: "json",
|
|
180
|
+
body: request,
|
|
181
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
182
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
183
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
184
|
+
});
|
|
185
|
+
if (_response.ok) {
|
|
186
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
187
|
+
}
|
|
188
|
+
if (_response.error.reason === "status-code") {
|
|
189
|
+
switch (_response.error.statusCode) {
|
|
190
|
+
case 400:
|
|
191
|
+
throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
|
|
192
|
+
case 401:
|
|
193
|
+
throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
194
|
+
case 403:
|
|
195
|
+
throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
196
|
+
case 404:
|
|
197
|
+
throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
|
|
198
|
+
case 422:
|
|
199
|
+
throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
200
|
+
case 500:
|
|
201
|
+
throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
202
|
+
case 503:
|
|
203
|
+
throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
204
|
+
default:
|
|
205
|
+
throw new errors.CortexAIError({
|
|
206
|
+
statusCode: _response.error.statusCode,
|
|
207
|
+
body: _response.error.body,
|
|
208
|
+
rawResponse: _response.rawResponse,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
switch (_response.error.reason) {
|
|
213
|
+
case "non-json":
|
|
214
|
+
throw new errors.CortexAIError({
|
|
215
|
+
statusCode: _response.error.statusCode,
|
|
216
|
+
body: _response.error.rawBody,
|
|
217
|
+
rawResponse: _response.rawResponse,
|
|
218
|
+
});
|
|
219
|
+
case "timeout":
|
|
220
|
+
throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /embeddings/search.");
|
|
221
|
+
case "unknown":
|
|
222
|
+
throw new errors.CortexAIError({
|
|
223
|
+
message: _response.error.errorMessage,
|
|
224
|
+
rawResponse: _response.rawResponse,
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Get embeddings based on chunk IDs.
|
|
230
|
+
*
|
|
231
|
+
* This endpoint returns embeddings for a list of chunk IDs.
|
|
232
|
+
*
|
|
233
|
+
* Returns:
|
|
234
|
+
* EmbeddingsGetData: Embeddings data for the requested chunk IDs
|
|
235
|
+
*
|
|
236
|
+
* @param {CortexAI.GetEmbeddingsBasedOnChunkIdsRequest} request
|
|
237
|
+
* @param {Embeddings.RequestOptions} requestOptions - Request-specific configuration.
|
|
238
|
+
*
|
|
239
|
+
* @throws {@link CortexAI.BadRequestError}
|
|
240
|
+
* @throws {@link CortexAI.UnauthorizedError}
|
|
241
|
+
* @throws {@link CortexAI.ForbiddenError}
|
|
242
|
+
* @throws {@link CortexAI.NotFoundError}
|
|
243
|
+
* @throws {@link CortexAI.UnprocessableEntityError}
|
|
244
|
+
* @throws {@link CortexAI.InternalServerError}
|
|
245
|
+
* @throws {@link CortexAI.ServiceUnavailableError}
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* await client.embeddings.getByChunkIds({
|
|
249
|
+
* chunk_ids: ["chunk_ids"],
|
|
250
|
+
* tenant_id: "tenant_id"
|
|
251
|
+
* })
|
|
252
|
+
*/
|
|
253
|
+
getByChunkIds(request, requestOptions) {
|
|
254
|
+
return core.HttpResponsePromise.fromPromise(this.__getByChunkIds(request, requestOptions));
|
|
255
|
+
}
|
|
256
|
+
async __getByChunkIds(request, requestOptions) {
|
|
257
|
+
var _a, _b, _c;
|
|
258
|
+
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);
|
|
259
|
+
const _response = await core.fetcher({
|
|
260
|
+
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, "embeddings/by-chunk-ids"),
|
|
261
|
+
method: "POST",
|
|
262
|
+
headers: _headers,
|
|
263
|
+
contentType: "application/json",
|
|
264
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
265
|
+
requestType: "json",
|
|
266
|
+
body: request,
|
|
267
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
268
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
269
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
270
|
+
});
|
|
271
|
+
if (_response.ok) {
|
|
272
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
273
|
+
}
|
|
274
|
+
if (_response.error.reason === "status-code") {
|
|
275
|
+
switch (_response.error.statusCode) {
|
|
276
|
+
case 400:
|
|
277
|
+
throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
|
|
278
|
+
case 401:
|
|
279
|
+
throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
280
|
+
case 403:
|
|
281
|
+
throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
282
|
+
case 404:
|
|
283
|
+
throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
|
|
284
|
+
case 422:
|
|
285
|
+
throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
286
|
+
case 500:
|
|
287
|
+
throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
288
|
+
case 503:
|
|
289
|
+
throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
290
|
+
default:
|
|
291
|
+
throw new errors.CortexAIError({
|
|
292
|
+
statusCode: _response.error.statusCode,
|
|
293
|
+
body: _response.error.body,
|
|
294
|
+
rawResponse: _response.rawResponse,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
switch (_response.error.reason) {
|
|
299
|
+
case "non-json":
|
|
300
|
+
throw new errors.CortexAIError({
|
|
301
|
+
statusCode: _response.error.statusCode,
|
|
302
|
+
body: _response.error.rawBody,
|
|
303
|
+
rawResponse: _response.rawResponse,
|
|
304
|
+
});
|
|
305
|
+
case "timeout":
|
|
306
|
+
throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /embeddings/by-chunk-ids.");
|
|
307
|
+
case "unknown":
|
|
308
|
+
throw new errors.CortexAIError({
|
|
309
|
+
message: _response.error.errorMessage,
|
|
310
|
+
rawResponse: _response.rawResponse,
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Create an embeddings collection for the given tenant in Findr.
|
|
316
|
+
*
|
|
317
|
+
* sub_tenant_id is set to be the same as tenant_id as per requirements.
|
|
318
|
+
*
|
|
319
|
+
* Returns:
|
|
320
|
+
* EmbeddingsCreateCollectionData: Success response with collection details
|
|
321
|
+
*
|
|
322
|
+
* @param {CortexAI.EmbeddingsCreateCollectionRequest} request
|
|
323
|
+
* @param {Embeddings.RequestOptions} requestOptions - Request-specific configuration.
|
|
324
|
+
*
|
|
325
|
+
* @throws {@link CortexAI.BadRequestError}
|
|
326
|
+
* @throws {@link CortexAI.UnauthorizedError}
|
|
327
|
+
* @throws {@link CortexAI.ForbiddenError}
|
|
328
|
+
* @throws {@link CortexAI.NotFoundError}
|
|
329
|
+
* @throws {@link CortexAI.UnprocessableEntityError}
|
|
330
|
+
* @throws {@link CortexAI.InternalServerError}
|
|
331
|
+
* @throws {@link CortexAI.ServiceUnavailableError}
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* await client.embeddings.createCollection({
|
|
335
|
+
* tenant_id: "tenant_id"
|
|
336
|
+
* })
|
|
337
|
+
*/
|
|
338
|
+
createCollection(request, requestOptions) {
|
|
339
|
+
return core.HttpResponsePromise.fromPromise(this.__createCollection(request, requestOptions));
|
|
340
|
+
}
|
|
341
|
+
async __createCollection(request, requestOptions) {
|
|
342
|
+
var _a, _b, _c;
|
|
343
|
+
const { tenant_id: tenantId } = request;
|
|
344
|
+
const _queryParams = {};
|
|
345
|
+
_queryParams["tenant_id"] = tenantId;
|
|
346
|
+
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);
|
|
347
|
+
const _response = await core.fetcher({
|
|
348
|
+
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, "embeddings/create_embeddings_tenant"),
|
|
349
|
+
method: "POST",
|
|
350
|
+
headers: _headers,
|
|
351
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
352
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
353
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
354
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
355
|
+
});
|
|
356
|
+
if (_response.ok) {
|
|
357
|
+
return {
|
|
358
|
+
data: _response.body,
|
|
359
|
+
rawResponse: _response.rawResponse,
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
if (_response.error.reason === "status-code") {
|
|
363
|
+
switch (_response.error.statusCode) {
|
|
364
|
+
case 400:
|
|
365
|
+
throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
|
|
366
|
+
case 401:
|
|
367
|
+
throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
368
|
+
case 403:
|
|
369
|
+
throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
370
|
+
case 404:
|
|
371
|
+
throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
|
|
372
|
+
case 422:
|
|
373
|
+
throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
374
|
+
case 500:
|
|
375
|
+
throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
376
|
+
case 503:
|
|
377
|
+
throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
378
|
+
default:
|
|
379
|
+
throw new errors.CortexAIError({
|
|
380
|
+
statusCode: _response.error.statusCode,
|
|
381
|
+
body: _response.error.body,
|
|
382
|
+
rawResponse: _response.rawResponse,
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
switch (_response.error.reason) {
|
|
387
|
+
case "non-json":
|
|
388
|
+
throw new errors.CortexAIError({
|
|
389
|
+
statusCode: _response.error.statusCode,
|
|
390
|
+
body: _response.error.rawBody,
|
|
391
|
+
rawResponse: _response.rawResponse,
|
|
392
|
+
});
|
|
393
|
+
case "timeout":
|
|
394
|
+
throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /embeddings/create_embeddings_tenant.");
|
|
395
|
+
case "unknown":
|
|
396
|
+
throw new errors.CortexAIError({
|
|
397
|
+
message: _response.error.errorMessage,
|
|
398
|
+
rawResponse: _response.rawResponse,
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
async _getAuthorizationHeader() {
|
|
403
|
+
const bearer = await core.Supplier.get(this._options.token);
|
|
404
|
+
if (bearer != null) {
|
|
405
|
+
return `Bearer ${bearer}`;
|
|
406
|
+
}
|
|
407
|
+
return undefined;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
exports.Embeddings = Embeddings;
|