import { MastraVector } from '@mastra/core/vector'; import type { IndexStats, QueryResult, QueryVectorParams, CreateIndexParams, UpsertVectorParams, DescribeIndexParams, DeleteIndexParams, DeleteVectorParams, UpdateVectorParams, DeleteVectorsParams } from '@mastra/core/vector'; import type { LibSQLVectorFilter } from './filter.js'; interface LibSQLQueryVectorParams extends QueryVectorParams { minScore?: number; } export interface LibSQLVectorConfig { /** * The URL of the LibSQL database. * Examples: 'file:./dev.db', 'file::memory:', 'libsql://your-db.turso.io' */ url: string; authToken?: string; syncUrl?: string; syncInterval?: number; /** * Maximum number of retries for write operations if an SQLITE_BUSY error occurs. * @default 5 */ maxRetries?: number; /** * Initial backoff time in milliseconds for retrying write operations on SQLITE_BUSY. * The backoff time will double with each retry (exponential backoff). * @default 100 */ initialBackoffMs?: number; /** * Over-fetch multiplier for vector_top_k queries when metadata filters are present. * Since vector_top_k doesn't support inline WHERE clauses, we fetch topK * this multiplier * candidates and post-filter. Higher values improve recall at the cost of more data scanned. * @default 10 */ vectorTopKOverFetchMultiplier?: number; } export declare class LibSQLVector extends MastraVector { private turso; private readonly maxRetries; private readonly initialBackoffMs; private readonly overFetchMultiplier; private readonly isMemoryDb; private vectorIndexes; constructor({ url, authToken, syncUrl, syncInterval, maxRetries, initialBackoffMs, vectorTopKOverFetchMultiplier, id, }: LibSQLVectorConfig & { id: string; }); private discoverVectorIndexes; private executeWriteOperationWithRetry; transformFilter(filter?: LibSQLVectorFilter): LibSQLVectorFilter; private hasVectorIndex; private queryWithIndex; query({ indexName, queryVector, topK, filter, includeVector, minScore, }: LibSQLQueryVectorParams): Promise; upsert(args: UpsertVectorParams): Promise; private doUpsert; createIndex(args: CreateIndexParams): Promise; private doCreateIndex; deleteIndex(args: DeleteIndexParams): Promise; private doDeleteIndex; listIndexes(): Promise; /** * Retrieves statistics about a vector index. * * @param {string} indexName - The name of the index to describe * @returns A promise that resolves to the index statistics including dimension, count and metric */ describeIndex({ indexName }: DescribeIndexParams): Promise; /** * Updates a vector by its ID with the provided vector and/or metadata. * * @param indexName - The name of the index containing the vector. * @param id - The ID of the vector to update. * @param update - An object containing the vector and/or metadata to update. * @param update.vector - An optional array of numbers representing the new vector. * @param update.metadata - An optional record containing the new metadata. * @returns A promise that resolves when the update is complete. * @throws Will throw an error if no updates are provided or if the update operation fails. */ updateVector(args: UpdateVectorParams): Promise; private doUpdateVector; /** * Deletes a vector by its ID. * @param indexName - The name of the index containing the vector. * @param id - The ID of the vector to delete. * @returns A promise that resolves when the deletion is complete. * @throws Will throw an error if the deletion operation fails. */ deleteVector(args: DeleteVectorParams): Promise; private doDeleteVector; deleteVectors(args: DeleteVectorsParams): Promise; private doDeleteVectors; truncateIndex(args: DeleteIndexParams): Promise; private _doTruncateIndex; } export {}; //# sourceMappingURL=index.d.ts.map