@ooples/token-optimizer-mcp
Version:
Intelligent context window optimization for Claude Code - store content externally via caching and compression, freeing up your context window for what matters
39 lines • 1.19 kB
TypeScript
import { IVectorStore } from '../interfaces/IVectorStore.js';
/**
* An in-memory vector store implementation using cosine similarity
* Stores vectors in memory for fast similarity search
*/
export declare class InMemoryVectorStore implements IVectorStore {
private vectors;
constructor();
/**
* Add a vector to the store
*/
add(id: string, vector: number[]): Promise<void>;
/**
* Search for similar vectors using cosine similarity
* Returns results sorted by similarity (highest first)
*/
search(queryVector: number[], topK: number, threshold: number): Promise<Array<{
id: string;
similarity: number;
}>>;
/**
* Delete a vector from the store
*/
delete(id: string): Promise<void>;
/**
* Get the total number of vectors in the store
*/
size(): Promise<number>;
/**
* Clear all vectors from the store
*/
clear(): Promise<void>;
/**
* Compute cosine similarity between two vectors
* Returns a value between -1 and 1 (1 = identical, 0 = orthogonal, -1 = opposite)
*/
private cosineSimilarity;
}
//# sourceMappingURL=InMemoryVectorStore.d.ts.map