/** * Vector store interface and implementations for Agentis memory */ /** * Configuration for vector stores */ export interface VectorStoreConfig { dimensions: number; namespace?: string; index?: string; } /** * A vector is an array of numbers representing embeddings */ export type Vector = number[]; /** * Document with vector embedding */ export interface VectorDocument { id: string; vector: Vector; metadata: Record; text?: string; } /** * Interface for vector stores */ export interface VectorStoreInterface { /** * Stores a vector in the database * * @param document - The document to store * @returns Promise resolving to success indicator */ storeVector(document: VectorDocument): Promise; /** * Searches for vectors similar to the query vector * * @param queryVector - The vector to search for * @param limit - Maximum number of results * @param filter - Optional filter to apply to the search * @returns Promise resolving to array of similar documents */ searchVector(queryVector: Vector, limit?: number, filter?: Record): Promise; /** * Deletes a vector from the database * * @param id - ID of the vector to delete * @returns Promise resolving to success indicator */ deleteVector(id: string): Promise; /** * Initializes the vector store * * @returns Promise resolving when initialization is complete */ initialize(): Promise; } /** * In-memory vector store for testing and demonstration */ export declare class InMemoryVectorStore implements VectorStoreInterface { private vectors; private config; /** * Creates an in-memory vector store * * @param config - Configuration options */ constructor(config: VectorStoreConfig); /** * Initializes the vector store (no-op for in-memory store) */ initialize(): Promise; /** * Stores a vector in memory * * @param document - The document to store * @returns Promise resolving to success indicator */ storeVector(document: VectorDocument): Promise; /** * Calculates cosine similarity between two vectors * * @param vectorA - First vector * @param vectorB - Second vector * @returns Cosine similarity score (1 = identical, 0 = orthogonal, -1 = opposite) */ private cosineSimilarity; /** * Searches for vectors similar to the query vector * * @param queryVector - The vector to search for * @param limit - Maximum number of results * @param filter - Optional filter to apply to the search * @returns Promise resolving to array of similar documents */ searchVector(queryVector: Vector, limit?: number, filter?: Record): Promise; /** * Deletes a vector from memory * * @param id - ID of the vector to delete * @returns Promise resolving to success indicator */ deleteVector(id: string): Promise; }