@hydradb/sdk 0.0.1
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 +578 -0
- package/dist/BaseClient.d.ts +42 -0
- package/dist/BaseClient.js +65 -0
- package/dist/Client.d.ts +58 -0
- package/dist/Client.js +142 -0
- package/dist/api/errors/BadRequestError.d.ts +5 -0
- package/dist/api/errors/BadRequestError.js +44 -0
- package/dist/api/errors/ForbiddenError.d.ts +5 -0
- package/dist/api/errors/ForbiddenError.js +44 -0
- package/dist/api/errors/InternalServerError.d.ts +5 -0
- package/dist/api/errors/InternalServerError.js +44 -0
- package/dist/api/errors/NotFoundError.d.ts +5 -0
- package/dist/api/errors/NotFoundError.js +44 -0
- package/dist/api/errors/ServiceUnavailableError.d.ts +5 -0
- package/dist/api/errors/ServiceUnavailableError.js +44 -0
- package/dist/api/errors/TooManyRequestsError.d.ts +6 -0
- package/dist/api/errors/TooManyRequestsError.js +44 -0
- package/dist/api/errors/UnauthorizedError.d.ts +5 -0
- package/dist/api/errors/UnauthorizedError.js +44 -0
- package/dist/api/errors/UnprocessableEntityError.d.ts +5 -0
- package/dist/api/errors/UnprocessableEntityError.js +44 -0
- package/dist/api/errors/index.d.ts +8 -0
- package/dist/api/errors/index.js +24 -0
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.js +19 -0
- package/dist/api/resources/data/client/Client.d.ts +33 -0
- package/dist/api/resources/data/client/Client.js +108 -0
- package/dist/api/resources/data/client/index.d.ts +1 -0
- package/dist/api/resources/data/client/index.js +17 -0
- package/dist/api/resources/data/client/requests/SourceDeleteRequest.d.ts +13 -0
- package/dist/api/resources/data/client/requests/SourceDeleteRequest.js +3 -0
- package/dist/api/resources/data/client/requests/index.d.ts +1 -0
- package/dist/api/resources/data/client/requests/index.js +2 -0
- package/dist/api/resources/data/exports.d.ts +2 -0
- package/dist/api/resources/data/exports.js +21 -0
- package/dist/api/resources/data/index.d.ts +1 -0
- package/dist/api/resources/data/index.js +17 -0
- package/dist/api/resources/embeddings/client/Client.d.ts +111 -0
- package/dist/api/resources/embeddings/client/Client.js +339 -0
- package/dist/api/resources/embeddings/client/index.d.ts +1 -0
- package/dist/api/resources/embeddings/client/index.js +17 -0
- package/dist/api/resources/embeddings/client/requests/BodyFilterRawEmbeddingsEndpointEmbeddingsFilterRawEmbeddingsPost.d.ts +21 -0
- package/dist/api/resources/embeddings/client/requests/BodyFilterRawEmbeddingsEndpointEmbeddingsFilterRawEmbeddingsPost.js +3 -0
- package/dist/api/resources/embeddings/client/requests/BodyInsertRawEmbeddingsEndpointEmbeddingsInsertRawEmbeddingsPost.d.ts +36 -0
- package/dist/api/resources/embeddings/client/requests/BodyInsertRawEmbeddingsEndpointEmbeddingsInsertRawEmbeddingsPost.js +3 -0
- package/dist/api/resources/embeddings/client/requests/BodySearchRawEmbeddingsEndpointEmbeddingsSearchRawEmbeddingsPost.d.ts +22 -0
- package/dist/api/resources/embeddings/client/requests/BodySearchRawEmbeddingsEndpointEmbeddingsSearchRawEmbeddingsPost.js +3 -0
- package/dist/api/resources/embeddings/client/requests/DeleteEmbeddingsRequest.d.ts +16 -0
- package/dist/api/resources/embeddings/client/requests/DeleteEmbeddingsRequest.js +3 -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/exports.d.ts +2 -0
- package/dist/api/resources/embeddings/exports.js +21 -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 +72 -0
- package/dist/api/resources/fetch/client/Client.js +252 -0
- package/dist/api/resources/fetch/client/index.d.ts +1 -0
- package/dist/api/resources/fetch/client/index.js +17 -0
- package/dist/api/resources/fetch/client/requests/GraphRelationsBySourceIdFetchRequest.d.ts +19 -0
- package/dist/api/resources/fetch/client/requests/GraphRelationsBySourceIdFetchRequest.js +3 -0
- package/dist/api/resources/fetch/client/requests/ListContentRequest.d.ts +25 -0
- package/dist/api/resources/fetch/client/requests/ListContentRequest.js +3 -0
- package/dist/api/resources/fetch/client/requests/SourceFetchRequest.d.ts +20 -0
- package/dist/api/resources/fetch/client/requests/SourceFetchRequest.js +3 -0
- package/dist/api/resources/fetch/client/requests/index.d.ts +3 -0
- package/dist/api/resources/fetch/client/requests/index.js +2 -0
- package/dist/api/resources/fetch/exports.d.ts +2 -0
- package/dist/api/resources/fetch/exports.js +21 -0
- package/dist/api/resources/fetch/index.d.ts +2 -0
- package/dist/api/resources/fetch/index.js +18 -0
- package/dist/api/resources/fetch/types/ListDataFetchResponse.d.ts +2 -0
- package/dist/api/resources/fetch/types/ListDataFetchResponse.js +3 -0
- package/dist/api/resources/fetch/types/index.d.ts +1 -0
- package/dist/api/resources/fetch/types/index.js +17 -0
- package/dist/api/resources/graphHealth/client/Client.d.ts +32 -0
- package/dist/api/resources/graphHealth/client/Client.js +115 -0
- package/dist/api/resources/graphHealth/client/index.d.ts +1 -0
- package/dist/api/resources/graphHealth/client/index.js +17 -0
- package/dist/api/resources/graphHealth/client/requests/GetSuperNodesGraphHealthSuperNodesGetRequest.d.ts +16 -0
- package/dist/api/resources/graphHealth/client/requests/GetSuperNodesGraphHealthSuperNodesGetRequest.js +3 -0
- package/dist/api/resources/graphHealth/client/requests/index.d.ts +1 -0
- package/dist/api/resources/graphHealth/client/requests/index.js +2 -0
- package/dist/api/resources/graphHealth/exports.d.ts +2 -0
- package/dist/api/resources/graphHealth/exports.js +21 -0
- package/dist/api/resources/graphHealth/index.d.ts +1 -0
- package/dist/api/resources/graphHealth/index.js +17 -0
- package/dist/api/resources/index.d.ts +19 -0
- package/dist/api/resources/index.js +48 -0
- package/dist/api/resources/ingestionPipeline/client/Client.d.ts +27 -0
- package/dist/api/resources/ingestionPipeline/client/Client.js +90 -0
- package/dist/api/resources/ingestionPipeline/client/index.d.ts +1 -0
- package/dist/api/resources/ingestionPipeline/client/index.js +17 -0
- package/dist/api/resources/ingestionPipeline/client/requests/MemoryIngestRequest.d.ts +19 -0
- package/dist/api/resources/ingestionPipeline/client/requests/MemoryIngestRequest.js +3 -0
- package/dist/api/resources/ingestionPipeline/client/requests/index.d.ts +1 -0
- package/dist/api/resources/ingestionPipeline/client/requests/index.js +2 -0
- package/dist/api/resources/ingestionPipeline/exports.d.ts +2 -0
- package/dist/api/resources/ingestionPipeline/exports.js +21 -0
- package/dist/api/resources/ingestionPipeline/index.d.ts +1 -0
- package/dist/api/resources/ingestionPipeline/index.js +17 -0
- package/dist/api/resources/key/client/Client.d.ts +30 -0
- package/dist/api/resources/key/client/Client.js +104 -0
- package/dist/api/resources/key/client/index.d.ts +1 -0
- package/dist/api/resources/key/client/index.js +17 -0
- package/dist/api/resources/key/client/requests/ApiKeyCreateRequest.d.ts +14 -0
- package/dist/api/resources/key/client/requests/ApiKeyCreateRequest.js +3 -0
- package/dist/api/resources/key/client/requests/index.d.ts +1 -0
- package/dist/api/resources/key/client/requests/index.js +2 -0
- package/dist/api/resources/key/exports.d.ts +2 -0
- package/dist/api/resources/key/exports.js +21 -0
- package/dist/api/resources/key/index.d.ts +1 -0
- package/dist/api/resources/key/index.js +17 -0
- package/dist/api/resources/recall/client/Client.d.ts +97 -0
- package/dist/api/resources/recall/client/Client.js +324 -0
- package/dist/api/resources/recall/client/index.d.ts +1 -0
- package/dist/api/resources/recall/client/index.js +17 -0
- package/dist/api/resources/recall/client/requests/FullTextSearchRequest.d.ts +22 -0
- package/dist/api/resources/recall/client/requests/FullTextSearchRequest.js +3 -0
- package/dist/api/resources/recall/client/requests/QnASearchRequest.d.ts +38 -0
- package/dist/api/resources/recall/client/requests/QnASearchRequest.js +3 -0
- package/dist/api/resources/recall/client/requests/index.d.ts +2 -0
- package/dist/api/resources/recall/client/requests/index.js +2 -0
- package/dist/api/resources/recall/exports.d.ts +2 -0
- package/dist/api/resources/recall/exports.js +21 -0
- package/dist/api/resources/recall/index.d.ts +1 -0
- package/dist/api/resources/recall/index.js +17 -0
- package/dist/api/resources/tenant/client/Client.d.ts +124 -0
- package/dist/api/resources/tenant/client/Client.js +456 -0
- package/dist/api/resources/tenant/client/index.d.ts +1 -0
- package/dist/api/resources/tenant/client/index.js +17 -0
- package/dist/api/resources/tenant/client/requests/DeleteTenantTenantRequest.d.ts +10 -0
- package/dist/api/resources/tenant/client/requests/DeleteTenantTenantRequest.js +3 -0
- package/dist/api/resources/tenant/client/requests/GetInfraStatusTenantRequest.d.ts +10 -0
- package/dist/api/resources/tenant/client/requests/GetInfraStatusTenantRequest.js +3 -0
- package/dist/api/resources/tenant/client/requests/GetSubTenantIdsTenantRequest.d.ts +10 -0
- package/dist/api/resources/tenant/client/requests/GetSubTenantIdsTenantRequest.js +3 -0
- package/dist/api/resources/tenant/client/requests/MonitorTenantRequest.d.ts +10 -0
- package/dist/api/resources/tenant/client/requests/MonitorTenantRequest.js +3 -0
- package/dist/api/resources/tenant/client/requests/TenantCreateRequest.d.ts +17 -0
- package/dist/api/resources/tenant/client/requests/TenantCreateRequest.js +3 -0
- package/dist/api/resources/tenant/client/requests/index.d.ts +5 -0
- package/dist/api/resources/tenant/client/requests/index.js +2 -0
- package/dist/api/resources/tenant/exports.d.ts +2 -0
- package/dist/api/resources/tenant/exports.js +21 -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 +92 -0
- package/dist/api/resources/upload/client/Client.js +349 -0
- package/dist/api/resources/upload/client/index.d.ts +1 -0
- package/dist/api/resources/upload/client/index.js +17 -0
- package/dist/api/resources/upload/client/requests/BodyAddMemoryMemoriesAddMemoryPost.d.ts +18 -0
- package/dist/api/resources/upload/client/requests/BodyAddMemoryMemoriesAddMemoryPost.js +3 -0
- package/dist/api/resources/upload/client/requests/BodyUploadKnowledgeIngestionUploadKnowledgePost.d.ts +23 -0
- package/dist/api/resources/upload/client/requests/BodyUploadKnowledgeIngestionUploadKnowledgePost.js +3 -0
- package/dist/api/resources/upload/client/requests/DeleteMemoryUploadRequest.d.ts +15 -0
- package/dist/api/resources/upload/client/requests/DeleteMemoryUploadRequest.js +3 -0
- package/dist/api/resources/upload/client/requests/VerifyProcessingUploadRequest.d.ts +16 -0
- package/dist/api/resources/upload/client/requests/VerifyProcessingUploadRequest.js +3 -0
- package/dist/api/resources/upload/client/requests/index.d.ts +4 -0
- package/dist/api/resources/upload/client/requests/index.js +2 -0
- package/dist/api/resources/upload/exports.d.ts +2 -0
- package/dist/api/resources/upload/exports.js +21 -0
- package/dist/api/resources/upload/index.d.ts +1 -0
- package/dist/api/resources/upload/index.js +17 -0
- package/dist/api/types/ActualErrorResponse.d.ts +4 -0
- package/dist/api/types/ActualErrorResponse.js +3 -0
- package/dist/api/types/AddMemoryResponse.d.ts +14 -0
- package/dist/api/types/AddMemoryResponse.js +3 -0
- package/dist/api/types/ApiKeyCreateResponse.d.ts +14 -0
- package/dist/api/types/ApiKeyCreateResponse.js +3 -0
- package/dist/api/types/AttachmentModel.d.ts +17 -0
- package/dist/api/types/AttachmentModel.js +3 -0
- package/dist/api/types/BatchProcessingStatus.d.ts +5 -0
- package/dist/api/types/BatchProcessingStatus.js +3 -0
- package/dist/api/types/Bm25OperatorType.d.ts +6 -0
- package/dist/api/types/Bm25OperatorType.js +9 -0
- package/dist/api/types/CollectionStats.d.ts +6 -0
- package/dist/api/types/CollectionStats.js +3 -0
- package/dist/api/types/ContentFilter.d.ts +24 -0
- package/dist/api/types/ContentFilter.js +3 -0
- package/dist/api/types/ContentModel.d.ts +14 -0
- package/dist/api/types/ContentModel.js +3 -0
- package/dist/api/types/CortexModelsResponseCommonsActualErrorResponse.d.ts +4 -0
- package/dist/api/types/CortexModelsResponseCommonsActualErrorResponse.js +3 -0
- package/dist/api/types/CortexModelsResponseCommonsErrorResponse.d.ts +5 -0
- package/dist/api/types/CortexModelsResponseCommonsErrorResponse.js +3 -0
- package/dist/api/types/CustomPropertyDefinition.d.ts +34 -0
- package/dist/api/types/CustomPropertyDefinition.js +3 -0
- package/dist/api/types/DeleteResult.d.ts +11 -0
- package/dist/api/types/DeleteResult.js +3 -0
- package/dist/api/types/DeleteUserMemoryResponse.d.ts +9 -0
- package/dist/api/types/DeleteUserMemoryResponse.js +3 -0
- package/dist/api/types/Entity.d.ts +12 -0
- package/dist/api/types/Entity.js +3 -0
- package/dist/api/types/ErrorResponse.d.ts +5 -0
- package/dist/api/types/ErrorResponse.js +3 -0
- package/dist/api/types/FetchMode.d.ts +7 -0
- package/dist/api/types/FetchMode.js +10 -0
- package/dist/api/types/ForcefulRelationsPayload.d.ts +6 -0
- package/dist/api/types/ForcefulRelationsPayload.js +3 -0
- package/dist/api/types/GraphContext.d.ts +11 -0
- package/dist/api/types/GraphContext.js +3 -0
- package/dist/api/types/HttpValidationError.d.ts +4 -0
- package/dist/api/types/HttpValidationError.js +3 -0
- package/dist/api/types/Infra.d.ts +5 -0
- package/dist/api/types/Infra.js +3 -0
- package/dist/api/types/InfraStatusResponse.d.ts +14 -0
- package/dist/api/types/InfraStatusResponse.js +3 -0
- package/dist/api/types/IngestResponse.d.ts +4 -0
- package/dist/api/types/IngestResponse.js +3 -0
- package/dist/api/types/InsertResult.d.ts +13 -0
- package/dist/api/types/InsertResult.js +3 -0
- package/dist/api/types/ListContentKind.d.ts +5 -0
- package/dist/api/types/ListContentKind.js +8 -0
- package/dist/api/types/ListUserMemoriesResponse.d.ts +14 -0
- package/dist/api/types/ListUserMemoriesResponse.js +3 -0
- package/dist/api/types/MemoryItem.d.ts +44 -0
- package/dist/api/types/MemoryItem.js +3 -0
- package/dist/api/types/MemoryResultItem.d.ts +16 -0
- package/dist/api/types/MemoryResultItem.js +3 -0
- package/dist/api/types/MilvusDataType.d.ts +16 -0
- package/dist/api/types/MilvusDataType.js +19 -0
- package/dist/api/types/PaginationMeta.d.ts +17 -0
- package/dist/api/types/PaginationMeta.js +3 -0
- package/dist/api/types/PathTriplet.d.ts +6 -0
- package/dist/api/types/PathTriplet.js +3 -0
- package/dist/api/types/ProcessingStatus.d.ts +26 -0
- package/dist/api/types/ProcessingStatus.js +16 -0
- package/dist/api/types/QnASearchResponse.d.ts +17 -0
- package/dist/api/types/QnASearchResponse.js +3 -0
- package/dist/api/types/RawEmbeddingDocument.d.ts +16 -0
- package/dist/api/types/RawEmbeddingDocument.js +3 -0
- package/dist/api/types/RawEmbeddingSearchResult.d.ts +16 -0
- package/dist/api/types/RawEmbeddingSearchResult.js +3 -0
- package/dist/api/types/RawEmbeddingVector.d.ts +9 -0
- package/dist/api/types/RawEmbeddingVector.js +3 -0
- package/dist/api/types/RecallSearchRequest.d.ts +34 -0
- package/dist/api/types/RecallSearchRequest.js +3 -0
- package/dist/api/types/RelationEvidence.d.ts +25 -0
- package/dist/api/types/RelationEvidence.js +3 -0
- package/dist/api/types/RetrievalResult.d.ts +12 -0
- package/dist/api/types/RetrievalResult.js +3 -0
- package/dist/api/types/RetrieveMode.d.ts +5 -0
- package/dist/api/types/RetrieveMode.js +8 -0
- package/dist/api/types/ScoredPathResponse.d.ts +10 -0
- package/dist/api/types/ScoredPathResponse.js +3 -0
- package/dist/api/types/SearchMode.d.ts +6 -0
- package/dist/api/types/SearchMode.js +9 -0
- package/dist/api/types/SourceDeleteResponse.d.ts +11 -0
- package/dist/api/types/SourceDeleteResponse.js +3 -0
- package/dist/api/types/SourceDeleteResultItem.d.ts +11 -0
- package/dist/api/types/SourceDeleteResultItem.js +3 -0
- package/dist/api/types/SourceFetchResponse.d.ts +23 -0
- package/dist/api/types/SourceFetchResponse.js +3 -0
- package/dist/api/types/SourceGraphRelationsResponse.d.ts +9 -0
- package/dist/api/types/SourceGraphRelationsResponse.js +3 -0
- package/dist/api/types/SourceInfo.d.ts +18 -0
- package/dist/api/types/SourceInfo.js +3 -0
- package/dist/api/types/SourceListResponse.d.ts +1 -0
- package/dist/api/types/SourceListResponse.js +3 -0
- package/dist/api/types/SourceModel.d.ts +42 -0
- package/dist/api/types/SourceModel.js +3 -0
- package/dist/api/types/SourceStatus.d.ts +7 -0
- package/dist/api/types/SourceStatus.js +10 -0
- package/dist/api/types/SourceUploadResponse.d.ts +11 -0
- package/dist/api/types/SourceUploadResponse.js +3 -0
- package/dist/api/types/SourceUploadResultItem.d.ts +11 -0
- package/dist/api/types/SourceUploadResultItem.js +3 -0
- package/dist/api/types/SubTenantIdsResponse.d.ts +9 -0
- package/dist/api/types/SubTenantIdsResponse.js +3 -0
- package/dist/api/types/SuperNodeItem.d.ts +9 -0
- package/dist/api/types/SuperNodeItem.js +3 -0
- package/dist/api/types/SuperNodeResponse.d.ts +11 -0
- package/dist/api/types/SuperNodeResponse.js +3 -0
- package/dist/api/types/SupportedLlmProviders.d.ts +8 -0
- package/dist/api/types/SupportedLlmProviders.js +11 -0
- package/dist/api/types/TenantCreateAcceptedResponse.d.ts +11 -0
- package/dist/api/types/TenantCreateAcceptedResponse.js +3 -0
- package/dist/api/types/TenantDeleteResponse.d.ts +6 -0
- package/dist/api/types/TenantDeleteResponse.js +3 -0
- package/dist/api/types/TenantIdsResponse.d.ts +8 -0
- package/dist/api/types/TenantIdsResponse.js +3 -0
- package/dist/api/types/TenantStatsResponse.d.ts +11 -0
- package/dist/api/types/TenantStatsResponse.js +3 -0
- package/dist/api/types/TripletWithEvidence.d.ts +12 -0
- package/dist/api/types/TripletWithEvidence.js +3 -0
- package/dist/api/types/UserAssistantPair.d.ts +9 -0
- package/dist/api/types/UserAssistantPair.js +3 -0
- package/dist/api/types/UserMemory.d.ts +9 -0
- package/dist/api/types/UserMemory.js +3 -0
- package/dist/api/types/ValidationError.d.ts +11 -0
- package/dist/api/types/ValidationError.js +3 -0
- package/dist/api/types/VectorStoreChunk.d.ts +26 -0
- package/dist/api/types/VectorStoreChunk.js +3 -0
- package/dist/api/types/index.d.ts +65 -0
- package/dist/api/types/index.js +81 -0
- package/dist/auth/BearerAuthProvider.d.ts +20 -0
- package/dist/auth/BearerAuthProvider.js +58 -0
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.js +5 -0
- package/dist/core/auth/AuthProvider.d.ts +8 -0
- package/dist/core/auth/AuthProvider.js +10 -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 +33 -0
- package/dist/core/auth/BearerToken.d.ts +7 -0
- package/dist/core/auth/BearerToken.js +16 -0
- package/dist/core/auth/NoOpAuthProvider.d.ts +5 -0
- package/dist/core/auth/NoOpAuthProvider.js +9 -0
- package/dist/core/auth/index.d.ts +5 -0
- package/dist/core/auth/index.js +11 -0
- package/dist/core/base64.d.ts +2 -0
- package/dist/core/base64.js +27 -0
- package/dist/core/exports.d.ts +2 -0
- package/dist/core/exports.js +18 -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 +19 -0
- package/dist/core/fetcher/BinaryResponse.js +18 -0
- package/dist/core/fetcher/EndpointMetadata.d.ts +13 -0
- package/dist/core/fetcher/EndpointMetadata.js +2 -0
- package/dist/core/fetcher/EndpointSupplier.d.ts +12 -0
- package/dist/core/fetcher/EndpointSupplier.js +13 -0
- package/dist/core/fetcher/Fetcher.d.ts +56 -0
- package/dist/core/fetcher/Fetcher.js +312 -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/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 +35 -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 +17 -0
- package/dist/core/fetcher/getResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getResponseBody.js +59 -0
- package/dist/core/fetcher/index.d.ts +13 -0
- package/dist/core/fetcher/index.js +19 -0
- package/dist/core/fetcher/makePassthroughRequest.d.ts +49 -0
- package/dist/core/fetcher/makePassthroughRequest.js +123 -0
- package/dist/core/fetcher/makeRequest.d.ts +6 -0
- package/dist/core/fetcher/makeRequest.js +52 -0
- package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/core/fetcher/requestWithRetries.js +60 -0
- package/dist/core/fetcher/signals.d.ts +5 -0
- package/dist/core/fetcher/signals.js +25 -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 +10 -0
- package/dist/core/file/file.js +194 -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 +15 -0
- package/dist/core/form-data-utils/FormDataWrapper.js +155 -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 +8 -0
- package/dist/core/index.js +37 -0
- package/dist/core/json.d.ts +15 -0
- package/dist/core/json.js +24 -0
- package/dist/core/logging/exports.d.ts +18 -0
- package/dist/core/logging/exports.js +35 -0
- package/dist/core/logging/index.d.ts +1 -0
- package/dist/core/logging/index.js +17 -0
- package/dist/core/logging/logger.d.ts +126 -0
- package/dist/core/logging/logger.js +144 -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 +104 -0
- package/dist/core/url/QueryStringBuilder.d.ts +47 -0
- package/dist/core/url/QueryStringBuilder.js +84 -0
- package/dist/core/url/encodePathParam.d.ts +1 -0
- package/dist/core/url/encodePathParam.js +22 -0
- package/dist/core/url/index.d.ts +4 -0
- package/dist/core/url/index.js +11 -0
- package/dist/core/url/join.d.ts +1 -0
- package/dist/core/url/join.js +69 -0
- package/dist/core/url/qs.d.ts +7 -0
- package/dist/core/url/qs.js +77 -0
- package/dist/environments.d.ts +4 -0
- package/dist/environments.js +7 -0
- package/dist/errors/HydraDBError.d.ts +14 -0
- package/dist/errors/HydraDBError.js +35 -0
- package/dist/errors/HydraDBTimeoutError.d.ts +6 -0
- package/dist/errors/HydraDBTimeoutError.js +18 -0
- package/dist/errors/handleNonStatusCodeError.d.ts +2 -0
- package/dist/errors/handleNonStatusCodeError.js +59 -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 +6 -0
- package/dist/index.js +38 -0
- package/package.json +34 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Copyright (c) 2024 Cortex AI
|
|
2
|
+
|
|
3
|
+
All Rights Reserved.
|
|
4
|
+
|
|
5
|
+
PROPRIETARY AND CONFIDENTIAL
|
|
6
|
+
|
|
7
|
+
This software is the proprietary and confidential property of Cortex AI ("the Company").
|
|
8
|
+
Permission is hereby granted to authorized users to install and use this software as part of the Cortex AI service, subject to the terms and conditions of the service agreement entered into with the Company.
|
|
9
|
+
|
|
10
|
+
You may not, without the express written permission of the Company:
|
|
11
|
+
|
|
12
|
+
Copy, modify, or create derivative works of the software.
|
|
13
|
+
|
|
14
|
+
Distribute, sell, rent, lease, sublicense, or otherwise transfer the software to any third party.
|
|
15
|
+
|
|
16
|
+
Reverse engineer, decompile, or disassemble the software, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
# Hydra DB TypeScript SDK
|
|
2
|
+
|
|
3
|
+
The official TypeScript SDK for the Hydra DB platform. Build powerful, context-aware AI applications in your Node.js or TypeScript projects.
|
|
4
|
+
|
|
5
|
+
**Hydra DB** is your plug-and-play memory infrastructure. It powers intelligent, context-aware retrieval for any AI app or agent. Whether you're building a customer support bot, research copilot, or internal knowledge assistant - Hydra DB handles all!
|
|
6
|
+
|
|
7
|
+
[Learn more about the SDK from our docs](https://docs.hydradb.com/)
|
|
8
|
+
|
|
9
|
+
## Core features
|
|
10
|
+
|
|
11
|
+
* **Dynamic retrieval and querying** that always retrieves the most relevant context
|
|
12
|
+
* **Built-in long-term memory** that evolves with every user interaction
|
|
13
|
+
* **Personalization hooks** for user preferences, intent, and history
|
|
14
|
+
* **Raw embeddings support** for bring-your-own vector workflows
|
|
15
|
+
* **Developer-first SDK** with the most flexible APIs and fine-grained controls
|
|
16
|
+
|
|
17
|
+
## Getting started
|
|
18
|
+
|
|
19
|
+
### Installation
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
npm i @hydra_db/node
|
|
23
|
+
# or
|
|
24
|
+
yarn add @hydra_db/node
|
|
25
|
+
# or
|
|
26
|
+
pnpm add @hydra_db/node
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Client setup
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { HydraDBClient } from "@hydra_db/node";
|
|
33
|
+
|
|
34
|
+
process.loadEnvFile(".env");
|
|
35
|
+
|
|
36
|
+
const client = new HydraDBClient({
|
|
37
|
+
token: process.env.HYDRA_DB_API_KEY,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const TENANT_ID = process.env.HYDRA_TENANT_ID ?? "my-company";
|
|
41
|
+
const SUB_TENANT_ID = process.env.HYDRA_SUB_TENANT_ID ?? "";
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Tenant Management
|
|
47
|
+
|
|
48
|
+
A `tenant` is a single isolated database. Within it you can create further isolated collections called `sub-tenants`. [Learn more](https://docs.hydradb.com/essentials/multi-tenant)
|
|
49
|
+
|
|
50
|
+
### Create a Tenant
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
const tenantResponse = await client.tenant.create({
|
|
54
|
+
tenant_id: TENANT_ID,
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
You can also create a tenant optimised for raw vector embeddings:
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
const embeddingsTenant = await client.tenant.create({
|
|
62
|
+
tenant_id: "my-embeddings-tenant",
|
|
63
|
+
is_embeddings_tenant: true,
|
|
64
|
+
embeddings_dimension: 1536,
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Get Sub-Tenant IDs
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
const subTenants = await client.tenant.getSubTenantIds({
|
|
72
|
+
tenant_id: TENANT_ID,
|
|
73
|
+
});
|
|
74
|
+
// subTenants.sub_tenant_ids -> string[]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Get Infrastructure Status
|
|
78
|
+
|
|
79
|
+
Check whether the tenant's underlying infrastructure is ready:
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
const infraStatus = await client.tenant.getInfraStatus({
|
|
83
|
+
tenant_id: TENANT_ID,
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Monitor Tenant Stats
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
const stats = await client.tenant.monitor({
|
|
91
|
+
tenant_id: TENANT_ID,
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Delete a Tenant
|
|
96
|
+
|
|
97
|
+
> **Warning:** This is irreversible and permanently removes all data.
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
await client.tenant.deleteTenant({
|
|
101
|
+
tenant_id: TENANT_ID,
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Index Your Data
|
|
108
|
+
|
|
109
|
+
### Upload Knowledge (Files)
|
|
110
|
+
|
|
111
|
+
Upload documents to make them retrievable via natural language search. Supports PDFs, text files, and other document formats.
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
import fs from "node:fs";
|
|
115
|
+
|
|
116
|
+
const uploadResult = await client.upload.knowledge({
|
|
117
|
+
tenant_id: TENANT_ID,
|
|
118
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
119
|
+
files: [
|
|
120
|
+
fs.readFileSync("report.pdf"),
|
|
121
|
+
fs.readFileSync("notes.txt"),
|
|
122
|
+
],
|
|
123
|
+
upsert: true,
|
|
124
|
+
});
|
|
125
|
+
// uploadResult.results[0].source_id -> ID you can use later
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
You can attach metadata to each file by passing a JSON string. Each object in the array corresponds to the file at the same index:
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
const fileMetadata = [
|
|
132
|
+
{
|
|
133
|
+
id: "doc_a",
|
|
134
|
+
tenant_metadata: { dept: "sales" },
|
|
135
|
+
document_metadata: { author: "Alice" },
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
id: "doc_b",
|
|
139
|
+
tenant_metadata: { dept: "marketing" },
|
|
140
|
+
document_metadata: { author: "Bob" },
|
|
141
|
+
relations: {
|
|
142
|
+
cortex_source_ids: ["doc_a"],
|
|
143
|
+
properties: { relation: "same_upload_batch" },
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
];
|
|
147
|
+
|
|
148
|
+
const uploadWithMeta = await client.upload.knowledge({
|
|
149
|
+
tenant_id: TENANT_ID,
|
|
150
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
151
|
+
files: [
|
|
152
|
+
fs.readFileSync("a.pdf"),
|
|
153
|
+
fs.readFileSync("b.pdf"),
|
|
154
|
+
],
|
|
155
|
+
file_metadata: JSON.stringify(fileMetadata),
|
|
156
|
+
upsert: true,
|
|
157
|
+
});
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Verify Processing Status
|
|
161
|
+
|
|
162
|
+
After uploading, check when files have finished indexing:
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
const status = await client.upload.verifyProcessing({
|
|
166
|
+
tenant_id: TENANT_ID,
|
|
167
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
168
|
+
file_ids: ["source-id-1", "source-id-2"],
|
|
169
|
+
});
|
|
170
|
+
// status.statuses[0].indexing_status -> "queued" | "processing" | "completed" | "errored"
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Add Memories
|
|
174
|
+
|
|
175
|
+
Index free-form text, markdown content, or conversation pairs as searchable memories.
|
|
176
|
+
|
|
177
|
+
**Plain text:**
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
await client.upload.addMemory({
|
|
181
|
+
tenant_id: TENANT_ID,
|
|
182
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
183
|
+
upsert: true,
|
|
184
|
+
memories: [
|
|
185
|
+
{
|
|
186
|
+
text: "User prefers detailed explanations and dark mode",
|
|
187
|
+
infer: true,
|
|
188
|
+
user_name: "John",
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
});
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Markdown:**
|
|
195
|
+
|
|
196
|
+
```ts
|
|
197
|
+
await client.upload.addMemory({
|
|
198
|
+
tenant_id: TENANT_ID,
|
|
199
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
200
|
+
upsert: true,
|
|
201
|
+
memories: [
|
|
202
|
+
{
|
|
203
|
+
text: "# Meeting Notes\n\n## Key Points\n- Budget approved\n- Launch date: Q2",
|
|
204
|
+
is_markdown: true,
|
|
205
|
+
infer: false,
|
|
206
|
+
title: "Meeting Notes",
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
});
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**User–assistant conversation pairs:**
|
|
213
|
+
|
|
214
|
+
```ts
|
|
215
|
+
await client.upload.addMemory({
|
|
216
|
+
tenant_id: TENANT_ID,
|
|
217
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
218
|
+
upsert: true,
|
|
219
|
+
memories: [
|
|
220
|
+
{
|
|
221
|
+
user_assistant_pairs: [
|
|
222
|
+
{ user: "What are my preferences?", assistant: "You prefer dark mode and detailed explanations." },
|
|
223
|
+
{ user: "How do I like my reports?", assistant: "You prefer weekly summary reports with charts." },
|
|
224
|
+
],
|
|
225
|
+
infer: true,
|
|
226
|
+
user_name: "John",
|
|
227
|
+
custom_instructions: "Extract user preferences",
|
|
228
|
+
},
|
|
229
|
+
],
|
|
230
|
+
});
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Delete a Memory
|
|
234
|
+
|
|
235
|
+
```ts
|
|
236
|
+
await client.upload.deleteMemory({
|
|
237
|
+
tenant_id: TENANT_ID,
|
|
238
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
239
|
+
memory_id: "memory-source-id",
|
|
240
|
+
});
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Search & Retrieval
|
|
246
|
+
|
|
247
|
+
### Full Recall
|
|
248
|
+
|
|
249
|
+
Hybrid semantic + keyword search across both knowledge and memories:
|
|
250
|
+
|
|
251
|
+
```ts
|
|
252
|
+
const results = await client.recall.fullRecall({
|
|
253
|
+
tenant_id: TENANT_ID,
|
|
254
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
255
|
+
query: "Which mode does the user prefer?",
|
|
256
|
+
alpha: 0.8, // 1.0 = pure semantic, 0.0 = pure keyword
|
|
257
|
+
recency_bias: 0, // 0.0 = no bias, 1.0 = strongly prefer recent
|
|
258
|
+
max_results: 10,
|
|
259
|
+
});
|
|
260
|
+
// results.chunks -> VectorStoreChunk[]
|
|
261
|
+
// results.sources -> SourceInfo[]
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Recall Preferences
|
|
265
|
+
|
|
266
|
+
Search only user memory/preference data:
|
|
267
|
+
|
|
268
|
+
```ts
|
|
269
|
+
const preferences = await client.recall.recallPreferences({
|
|
270
|
+
tenant_id: TENANT_ID,
|
|
271
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
272
|
+
query: "dark mode preference",
|
|
273
|
+
max_results: 5,
|
|
274
|
+
});
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Boolean Recall
|
|
278
|
+
|
|
279
|
+
Exact keyword / phrase / boolean search (BM25):
|
|
280
|
+
|
|
281
|
+
```ts
|
|
282
|
+
const boolResults = await client.recall.booleanRecall({
|
|
283
|
+
tenant_id: TENANT_ID,
|
|
284
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
285
|
+
query: "dark mode",
|
|
286
|
+
operator: "phrase", // "or" | "and" | "phrase"
|
|
287
|
+
max_results: 10,
|
|
288
|
+
search_mode: "memories", // "sources" | "memories"
|
|
289
|
+
});
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Q&A (LLM-powered answer)
|
|
293
|
+
|
|
294
|
+
Ask a question and get a grounded answer generated by an LLM over your indexed content:
|
|
295
|
+
|
|
296
|
+
```ts
|
|
297
|
+
const answer = await client.recall.qna({
|
|
298
|
+
tenant_id: TENANT_ID,
|
|
299
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
300
|
+
question: "What is the user's preferred reporting format?",
|
|
301
|
+
mode: "fast", // "fast" | "thinking"
|
|
302
|
+
search_mode: "memories",
|
|
303
|
+
max_chunks: 6,
|
|
304
|
+
});
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
You can optionally choose the LLM provider and model:
|
|
308
|
+
|
|
309
|
+
```ts
|
|
310
|
+
const customAnswer = await client.recall.qna({
|
|
311
|
+
tenant_id: TENANT_ID,
|
|
312
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
313
|
+
question: "Summarise the budget decisions from the meeting notes.",
|
|
314
|
+
mode: "thinking",
|
|
315
|
+
search_mode: "sources",
|
|
316
|
+
max_chunks: 10,
|
|
317
|
+
llm_provider: "anthropic",
|
|
318
|
+
model: "claude-sonnet-4-6",
|
|
319
|
+
temperature: 0.2,
|
|
320
|
+
max_tokens: 1024,
|
|
321
|
+
});
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## Fetch & Inspect Data
|
|
327
|
+
|
|
328
|
+
### List All Data
|
|
329
|
+
|
|
330
|
+
List sources (knowledge) or memories with optional filtering and pagination:
|
|
331
|
+
|
|
332
|
+
```ts
|
|
333
|
+
// List knowledge sources
|
|
334
|
+
const sources = await client.fetch.listData({
|
|
335
|
+
tenant_id: TENANT_ID,
|
|
336
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
337
|
+
kind: "knowledge",
|
|
338
|
+
page: 1,
|
|
339
|
+
page_size: 50,
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
// List user memories
|
|
343
|
+
const memories = await client.fetch.listData({
|
|
344
|
+
tenant_id: TENANT_ID,
|
|
345
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
346
|
+
kind: "memories",
|
|
347
|
+
});
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Filter by metadata:
|
|
351
|
+
|
|
352
|
+
```ts
|
|
353
|
+
const filtered = await client.fetch.listData({
|
|
354
|
+
tenant_id: TENANT_ID,
|
|
355
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
356
|
+
kind: "knowledge",
|
|
357
|
+
filters: {
|
|
358
|
+
tenant_metadata: { dept: "sales" },
|
|
359
|
+
},
|
|
360
|
+
});
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### Fetch Source Content
|
|
364
|
+
|
|
365
|
+
Retrieve the full content of a specific source by its ID:
|
|
366
|
+
|
|
367
|
+
```ts
|
|
368
|
+
const source = await client.fetch.content({
|
|
369
|
+
tenant_id: TENANT_ID,
|
|
370
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
371
|
+
source_id: "your-source-id",
|
|
372
|
+
mode: "content", // "content" | "url" | "both"
|
|
373
|
+
});
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Fetch Graph Relations
|
|
377
|
+
|
|
378
|
+
Retrieve the graph relations (linked sources) for a given source:
|
|
379
|
+
|
|
380
|
+
```ts
|
|
381
|
+
const relations = await client.fetch.graphRelationsBySourceId({
|
|
382
|
+
tenant_id: TENANT_ID,
|
|
383
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
384
|
+
source_id: "your-source-id",
|
|
385
|
+
is_memory: false,
|
|
386
|
+
limit: 10,
|
|
387
|
+
});
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
---
|
|
391
|
+
|
|
392
|
+
## Delete Data
|
|
393
|
+
|
|
394
|
+
Delete one or more sources (knowledge or memories) by their IDs:
|
|
395
|
+
|
|
396
|
+
```ts
|
|
397
|
+
await client.data.delete({
|
|
398
|
+
tenant_id: TENANT_ID,
|
|
399
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
400
|
+
ids: ["source-id-1", "source-id-2"],
|
|
401
|
+
});
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
---
|
|
405
|
+
|
|
406
|
+
## API Key Management
|
|
407
|
+
|
|
408
|
+
> **Note:** This endpoint requires a dashboard session token (obtained via your Hydra DB dashboard login), not a standard API key. Use it from a server-side admin context where you have a valid user session.
|
|
409
|
+
|
|
410
|
+
Create scoped API keys for controlled access:
|
|
411
|
+
|
|
412
|
+
```ts
|
|
413
|
+
const newKey = await client.key.createApiKey({
|
|
414
|
+
owner: "service-account@myapp.com",
|
|
415
|
+
scopes: ["query"],
|
|
416
|
+
env: "live",
|
|
417
|
+
prefix: "sk",
|
|
418
|
+
});
|
|
419
|
+
// newKey.full_api_key -> the actual key (only shown once)
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
---
|
|
423
|
+
|
|
424
|
+
## Raw Embeddings
|
|
425
|
+
|
|
426
|
+
Use Hydra DB as a vector store with your own embeddings — useful when you want to manage embedding generation yourself.
|
|
427
|
+
|
|
428
|
+
> **Note:** Raw embeddings require a tenant created with `is_embeddings_tenant: true` and a fixed `embeddings_dimension`. A standard knowledge tenant does not support raw embedding operations.
|
|
429
|
+
>
|
|
430
|
+
> ```ts
|
|
431
|
+
> await client.tenant.create({
|
|
432
|
+
> tenant_id: "my-embeddings-tenant",
|
|
433
|
+
> is_embeddings_tenant: true,
|
|
434
|
+
> embeddings_dimension: 1536,
|
|
435
|
+
> });
|
|
436
|
+
> ```
|
|
437
|
+
|
|
438
|
+
### Insert Embeddings
|
|
439
|
+
|
|
440
|
+
```ts
|
|
441
|
+
await client.embeddings.insert({
|
|
442
|
+
tenant_id: TENANT_ID,
|
|
443
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
444
|
+
upsert: true,
|
|
445
|
+
embeddings: [
|
|
446
|
+
{
|
|
447
|
+
source_id: "my-doc-001",
|
|
448
|
+
metadata: { category: "finance", year: 2024 },
|
|
449
|
+
embeddings: [
|
|
450
|
+
{ chunk_id: "my-doc-001-chunk-0", embedding: [0.1, 0.2, 0.3 /* ... 1536 dims */] },
|
|
451
|
+
{ chunk_id: "my-doc-001-chunk-1", embedding: [0.4, 0.5, 0.6 /* ... 1536 dims */] },
|
|
452
|
+
],
|
|
453
|
+
},
|
|
454
|
+
],
|
|
455
|
+
});
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### Search by Vector
|
|
459
|
+
|
|
460
|
+
Find the most similar chunks to a query embedding:
|
|
461
|
+
|
|
462
|
+
```ts
|
|
463
|
+
const searchResults = await client.embeddings.search({
|
|
464
|
+
tenant_id: TENANT_ID,
|
|
465
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
466
|
+
query_embedding: [0.1, 0.2, 0.3 /* ... 1536 dims */],
|
|
467
|
+
limit: 10,
|
|
468
|
+
});
|
|
469
|
+
// searchResults -> RawEmbeddingSearchResult[]
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
### Filter Embeddings
|
|
473
|
+
|
|
474
|
+
Retrieve stored embeddings for a specific source or set of chunk IDs:
|
|
475
|
+
|
|
476
|
+
```ts
|
|
477
|
+
// By source
|
|
478
|
+
const bySource = await client.embeddings.filter({
|
|
479
|
+
tenant_id: TENANT_ID,
|
|
480
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
481
|
+
source_id: "my-doc-001",
|
|
482
|
+
limit: 50,
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
// By chunk IDs
|
|
486
|
+
const byChunks = await client.embeddings.filter({
|
|
487
|
+
tenant_id: TENANT_ID,
|
|
488
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
489
|
+
chunk_ids: ["my-doc-001-chunk-0", "my-doc-001-chunk-1"],
|
|
490
|
+
});
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
### Delete Embeddings
|
|
494
|
+
|
|
495
|
+
```ts
|
|
496
|
+
// Delete all embeddings for a source
|
|
497
|
+
await client.embeddings.delete({
|
|
498
|
+
tenant_id: TENANT_ID,
|
|
499
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
500
|
+
source_id: "my-doc-001",
|
|
501
|
+
});
|
|
502
|
+
|
|
503
|
+
// Delete specific chunks
|
|
504
|
+
await client.embeddings.delete({
|
|
505
|
+
tenant_id: TENANT_ID,
|
|
506
|
+
sub_tenant_id: SUB_TENANT_ID,
|
|
507
|
+
chunk_ids: ["my-doc-001-chunk-0"],
|
|
508
|
+
});
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
---
|
|
512
|
+
|
|
513
|
+
## Platform Metrics
|
|
514
|
+
|
|
515
|
+
Retrieve platform-level health and usage metrics:
|
|
516
|
+
|
|
517
|
+
```ts
|
|
518
|
+
const metrics = await client.metricsMetricsGet();
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
---
|
|
522
|
+
|
|
523
|
+
## SDK Method Reference
|
|
524
|
+
|
|
525
|
+
| Method | Description |
|
|
526
|
+
|---|---|
|
|
527
|
+
| `client.tenant.create` | Create a new tenant (standard or embeddings) |
|
|
528
|
+
| `client.tenant.getSubTenantIds` | List all sub-tenant IDs within a tenant |
|
|
529
|
+
| `client.tenant.getInfraStatus` | Check tenant infrastructure readiness |
|
|
530
|
+
| `client.tenant.monitor` | Get tenant usage and stats |
|
|
531
|
+
| `client.tenant.deleteTenant` | Permanently delete a tenant and all its data |
|
|
532
|
+
| `client.upload.knowledge` | Upload files to the knowledge base |
|
|
533
|
+
| `client.upload.verifyProcessing` | Poll indexing status of uploaded files |
|
|
534
|
+
| `client.upload.addMemory` | Index text, markdown, or conversation pairs as memories |
|
|
535
|
+
| `client.upload.deleteMemory` | Delete a specific memory by ID |
|
|
536
|
+
| `client.recall.fullRecall` | Hybrid semantic + keyword search |
|
|
537
|
+
| `client.recall.recallPreferences` | Search user memory / preference data only |
|
|
538
|
+
| `client.recall.booleanRecall` | Exact keyword / phrase / boolean search |
|
|
539
|
+
| `client.recall.qna` | LLM-powered question answering over indexed content |
|
|
540
|
+
| `client.fetch.listData` | List all knowledge sources or memories |
|
|
541
|
+
| `client.fetch.content` | Fetch full content of a source by ID |
|
|
542
|
+
| `client.fetch.graphRelationsBySourceId` | Fetch graph relations for a source |
|
|
543
|
+
| `client.data.delete` | Delete sources or memories by ID |
|
|
544
|
+
| `client.key.createApiKey` | Create a scoped API key *(requires dashboard session token)* |
|
|
545
|
+
| `client.embeddings.insert` | Store raw vector embeddings *(requires embeddings tenant)* |
|
|
546
|
+
| `client.embeddings.search` | Vector similarity search |
|
|
547
|
+
| `client.embeddings.filter` | Retrieve embeddings by source or chunk IDs |
|
|
548
|
+
| `client.embeddings.delete` | Delete embeddings by source or chunk IDs |
|
|
549
|
+
| `client.metricsMetricsGet` | Retrieve platform metrics |
|
|
550
|
+
|
|
551
|
+
> **Method Mapping:** `client.<group>.<method>` mirrors `api.hydradb.com/<group>/<method>`
|
|
552
|
+
>
|
|
553
|
+
> For example: `client.upload.knowledge()` → `POST /ingestion/upload_knowledge`
|
|
554
|
+
|
|
555
|
+
---
|
|
556
|
+
|
|
557
|
+
## Type Safety & IDE Support
|
|
558
|
+
|
|
559
|
+
The SDK provides exact type parity with the API:
|
|
560
|
+
|
|
561
|
+
- **Request parameters** — every field (required, optional, type, validation) is reflected in the method signature
|
|
562
|
+
- **Response objects** — return types match the exact JSON schema from each endpoint
|
|
563
|
+
- **Nested objects** — complex parameters and responses preserve their full structure
|
|
564
|
+
|
|
565
|
+
Your IDE will automatically provide autocompletion, type-checking, inline documentation, and compile-time validation for every method. Just hit **Cmd+Space / Ctrl+Space**.
|
|
566
|
+
|
|
567
|
+
---
|
|
568
|
+
|
|
569
|
+
## Links
|
|
570
|
+
|
|
571
|
+
- **Homepage:** [hydradb.com](https://www.hydradb.com/)
|
|
572
|
+
- **Documentation:** [docs.hydradb.com](https://docs.hydradb.com/)
|
|
573
|
+
- **API Reference:** [docs.hydradb.com/api-reference/introduction](https://docs.hydradb.com/api-reference/introduction)
|
|
574
|
+
|
|
575
|
+
## Support
|
|
576
|
+
|
|
577
|
+
If you have any questions or need help, reach out at [founders@hydradb.com](mailto:founders@usecortex.ai).
|
|
578
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BearerAuthProvider } from "./auth/BearerAuthProvider.js";
|
|
2
|
+
import * as core from "./core/index.js";
|
|
3
|
+
import type * as environments from "./environments.js";
|
|
4
|
+
export type AuthOption = false | core.AuthProvider["getAuthRequest"] | core.AuthProvider | BearerAuthProvider.AuthOptions;
|
|
5
|
+
export type BaseClientOptions = {
|
|
6
|
+
environment?: core.Supplier<environments.HydraDBEnvironment | string>;
|
|
7
|
+
/** Specify a custom URL to connect the client to. */
|
|
8
|
+
baseUrl?: core.Supplier<string>;
|
|
9
|
+
/** Additional headers to include in requests. */
|
|
10
|
+
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
11
|
+
/** The default maximum time to wait for a response in seconds. */
|
|
12
|
+
timeoutInSeconds?: number;
|
|
13
|
+
/** The default number of times to retry the request. Defaults to 2. */
|
|
14
|
+
maxRetries?: number;
|
|
15
|
+
/** Provide a custom fetch implementation. Useful for platforms that don't have a built-in fetch or need a custom implementation. */
|
|
16
|
+
fetch?: typeof fetch;
|
|
17
|
+
/** Configure logging for the client. */
|
|
18
|
+
logging?: core.logging.LogConfig | core.logging.Logger;
|
|
19
|
+
/** Override auth. Pass false to disable, a function returning auth headers, an AuthProvider, or auth options. */
|
|
20
|
+
auth?: AuthOption;
|
|
21
|
+
} & BearerAuthProvider.AuthOptions;
|
|
22
|
+
export interface BaseRequestOptions {
|
|
23
|
+
/** The maximum time to wait for a response in seconds. */
|
|
24
|
+
timeoutInSeconds?: number;
|
|
25
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
26
|
+
maxRetries?: number;
|
|
27
|
+
/** A hook to abort the request. */
|
|
28
|
+
abortSignal?: AbortSignal;
|
|
29
|
+
/** Additional query string parameters to include in the request. */
|
|
30
|
+
queryParams?: Record<string, unknown>;
|
|
31
|
+
/** Additional headers to include in the request. */
|
|
32
|
+
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
33
|
+
}
|
|
34
|
+
export type NormalizedClientOptions<T extends BaseClientOptions = BaseClientOptions> = T & {
|
|
35
|
+
logging: core.logging.Logger;
|
|
36
|
+
authProvider?: core.AuthProvider;
|
|
37
|
+
};
|
|
38
|
+
export type NormalizedClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions> = NormalizedClientOptions<T> & {
|
|
39
|
+
authProvider: core.AuthProvider;
|
|
40
|
+
};
|
|
41
|
+
export declare function normalizeClientOptions<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptions<T>;
|
|
42
|
+
export declare function normalizeClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptionsWithAuth<T>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.normalizeClientOptionsWithAuth = exports.normalizeClientOptions = void 0;
|
|
28
|
+
const BearerAuthProvider_js_1 = require("./auth/BearerAuthProvider.js");
|
|
29
|
+
const headers_js_1 = require("./core/headers.js");
|
|
30
|
+
const core = __importStar(require("./core/index.js"));
|
|
31
|
+
function normalizeClientOptions(options) {
|
|
32
|
+
const headers = (0, headers_js_1.mergeHeaders)({
|
|
33
|
+
"X-Fern-Language": "JavaScript",
|
|
34
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
35
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
36
|
+
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
37
|
+
return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
|
|
38
|
+
}
|
|
39
|
+
exports.normalizeClientOptions = normalizeClientOptions;
|
|
40
|
+
function normalizeClientOptionsWithAuth(options) {
|
|
41
|
+
var _a;
|
|
42
|
+
const normalized = normalizeClientOptions(options);
|
|
43
|
+
if (options.auth === false) {
|
|
44
|
+
normalized.authProvider = new core.NoOpAuthProvider();
|
|
45
|
+
return normalized;
|
|
46
|
+
}
|
|
47
|
+
if (options.auth != null) {
|
|
48
|
+
if (typeof options.auth === "function") {
|
|
49
|
+
normalized.authProvider = { getAuthRequest: options.auth };
|
|
50
|
+
return normalized;
|
|
51
|
+
}
|
|
52
|
+
if (core.isAuthProvider(options.auth)) {
|
|
53
|
+
normalized.authProvider = options.auth;
|
|
54
|
+
return normalized;
|
|
55
|
+
}
|
|
56
|
+
Object.assign(normalized, options.auth);
|
|
57
|
+
}
|
|
58
|
+
const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized);
|
|
59
|
+
(_a = normalized.authProvider) !== null && _a !== void 0 ? _a : (normalized.authProvider = new BearerAuthProvider_js_1.BearerAuthProvider(normalizedWithNoOpAuthProvider));
|
|
60
|
+
return normalized;
|
|
61
|
+
}
|
|
62
|
+
exports.normalizeClientOptionsWithAuth = normalizeClientOptionsWithAuth;
|
|
63
|
+
function withNoOpAuthProvider(options) {
|
|
64
|
+
return Object.assign(Object.assign({}, options), { authProvider: new core.NoOpAuthProvider() });
|
|
65
|
+
}
|