UNPKG

@gensx/storage

Version:

Cloud storage, blobs, sqlite, and vector database providers/hooks for GenSX.

110 lines 3.68 kB
import { DeleteNamespaceResult, EnsureNamespaceResult, Namespace, QueryOptions, QueryResults, Schema, SearchStorage as ISearchStorage, WriteParams } from "./types.js"; /** * Error types for search operations */ export type SearchErrorCode = "NOT_FOUND" | "PERMISSION_DENIED" | "INVALID_ARGUMENT" | "SEARCH_ERROR" | "NOT_IMPLEMENTED" | "NETWORK_ERROR"; /** * Abstract base error class for search operations */ export declare abstract class SearchError extends Error { readonly code: SearchErrorCode; readonly cause?: Error | undefined; constructor(code: SearchErrorCode, message: string, cause?: Error | undefined); } /** * Error class for when a vector is not found */ export declare class SearchNotFoundError extends SearchError { constructor(message: string, cause?: Error); } /** * Error class for permission denied errors */ export declare class SearchPermissionDeniedError extends SearchError { constructor(message: string, cause?: Error); } /** * Error class for invalid argument errors */ export declare class SearchInvalidArgumentError extends SearchError { constructor(message: string, cause?: Error); } /** * Error class for API errors (bad requests, server errors, etc.) */ export declare class SearchApiError extends SearchError { constructor(message: string, cause?: Error); } /** * Error class for malformed or missing API responses */ export declare class SearchResponseError extends SearchError { constructor(message: string, cause?: Error); } /** * Error class for not implemented errors */ export declare class SearchNotImplementedError extends SearchError { constructor(message: string, cause?: Error); } /** * Error class for network errors */ export declare class SearchNetworkError extends SearchError { constructor(message: string, cause?: Error); } /** * Remote implementation of vector namespace */ export declare class SearchNamespace implements Namespace { readonly namespaceId: string; private apiBaseUrl; private apiKey; private org; private project; private environment; constructor(namespaceId: string, apiBaseUrl: string, apiKey: string, org: string, project: string, environment: string); write({ upsertColumns, upsertRows, patchColumns, patchRows, deletes, deleteByFilter, distanceMetric, schema, }: WriteParams): Promise<{ message: string; rowsAffected: number; }>; query({ topK, includeAttributes, filters, rankBy, aggregateBy, consistency, }: QueryOptions): Promise<QueryResults>; getSchema(): Promise<Schema>; updateSchema({ schema }: { schema: Schema; }): Promise<Schema>; } /** * Remote implementation of search */ export declare class SearchStorage implements ISearchStorage { private apiKey; private apiBaseUrl; private org; private project; private environment; private namespaces; constructor(project: string, environment: string); getNamespace(name: string): Namespace; ensureNamespace(name: string): Promise<EnsureNamespaceResult>; deleteNamespace(name: string): Promise<DeleteNamespaceResult>; listNamespaces(options?: { prefix?: string; limit?: number; cursor?: string; }): Promise<{ namespaces: { name: string; createdAt: Date; }[]; nextCursor?: string; }>; hasEnsuredNamespace(name: string): boolean; /** * Check if a namespace exists * @param name The namespace name to check * @returns Promise that resolves to true if the namespace exists */ namespaceExists(name: string): Promise<boolean>; } //# sourceMappingURL=remote.d.ts.map