@wildcard-ai/deepcontext
Version:
Advanced codebase indexing and semantic search MCP server
77 lines • 2.58 kB
TypeScript
/**
* Turbopuffer Vector Store Service
* Handles all Turbopuffer API operations including vector storage, querying, and hybrid search
*/
import { TurbopufferStore } from '../types/search.js';
import { ConfigurationService } from './ConfigurationService.js';
export interface VectorStoreResult {
id: string;
score: number;
metadata: any;
}
export interface HybridSearchOptions {
embedding: number[];
query: string;
limit?: number;
vectorWeight?: number;
bm25Weight?: number;
filters?: any;
}
export interface QueryOptions {
embedding?: number[];
query?: string;
rank_by?: any[];
limit?: number;
filters?: any;
include_attributes?: string[];
}
export declare class TurbopufferService implements TurbopufferStore {
private apiKey;
private configurationService;
private readonly baseUrl;
private readonly logger;
constructor(apiKey: string, configurationService: ConfigurationService, loggerName?: string);
/**
* Upsert vectors to Turbopuffer namespace
*/
upsert(namespace: string, vectors: any[]): Promise<void>;
/**
* Query Turbopuffer namespace with various options
*/
query(namespace: string, options: QueryOptions): Promise<VectorStoreResult[]>;
/**
* Basic search implementation for TurbopufferStore interface
*/
search(namespace: string, options: any): Promise<VectorStoreResult[]>;
/**
* Advanced hybrid search combining vector similarity and BM25 with RRF fusion
*/
hybridSearch(namespace: string, options: HybridSearchOptions): Promise<VectorStoreResult[]>;
/**
* Check if a namespace exists
*/
checkNamespaceExists(namespace: string): Promise<boolean>;
/**
* Clear/delete an entire namespace
*/
clearNamespace(namespace: string): Promise<void>;
/**
* Get chunk IDs for a specific file (for atomic updates)
*/
getChunkIdsForFile(namespace: string, filePath: string): Promise<string[]>;
/**
* Delete chunks by their IDs (for atomic updates)
*/
deleteChunksByIds(namespace: string, chunkIds: string[]): Promise<number>;
/**
* Fuse hybrid search results using optimized RRF (Reciprocal Rank Fusion)
* Enhanced formula for better score distribution: score = weight * (base / (k + rank))
* where base is scaled for better differentiation
*/
private fuseHybridResults;
/**
* Check if the service is available (API key provided)
*/
isAvailable(): boolean;
}
//# sourceMappingURL=TurbopufferService.d.ts.map