@vfarcic/dot-ai
Version:
Universal Kubernetes application deployment agent with CLI and MCP interfaces
86 lines • 2.57 kB
TypeScript
/**
* Base Vector Service
*
* Generic vector operations that can be extended for different data types
* (patterns, capabilities, dependencies, etc.)
*/
import { VectorDBService } from './vector-db-service';
import { EmbeddingService } from './embedding-service';
export interface BaseSearchOptions {
limit?: number;
scoreThreshold?: number;
keywordWeight?: number;
}
export interface BaseSearchResult<T> {
data: T;
score: number;
matchType: 'keyword' | 'semantic' | 'hybrid';
}
export interface SearchMode {
semantic: boolean;
provider?: string;
reason?: string;
}
/**
* Abstract base class for vector-based data services
*/
export declare abstract class BaseVectorService<T> {
protected vectorDB: VectorDBService;
protected embeddingService: EmbeddingService;
protected collectionName: string;
constructor(collectionName: string, vectorDB?: VectorDBService, embeddingService?: EmbeddingService);
/**
* Initialize the collection
*/
initialize(): Promise<void>;
/**
* Health check for Vector DB connection
*/
healthCheck(): Promise<boolean>;
/**
* Store data in Vector DB with optional semantic embedding
*/
storeData(data: T): Promise<void>;
/**
* Search for data using hybrid semantic + keyword matching
*/
searchData(query: string, options?: BaseSearchOptions): Promise<BaseSearchResult<T>[]>;
/**
* Get data by ID
*/
getData(id: string): Promise<T | null>;
/**
* Delete data by ID
*/
deleteData(id: string): Promise<void>;
/**
* Get all data (limited)
*/
getAllData(limit?: number): Promise<T[]>;
/**
* Get total count of data items
*/
getDataCount(): Promise<number>;
/**
* Get current search mode (semantic vs keyword-only)
*/
getSearchMode(): SearchMode;
protected abstract createSearchText(data: T): string;
protected abstract extractId(data: T): string;
protected abstract createPayload(data: T): Record<string, any>;
protected abstract payloadToData(payload: Record<string, any>): T;
protected extractKeywords(query: string): string[];
/**
* Hybrid search combining semantic and keyword matching
*/
private hybridSearch;
/**
* Keyword-only search (fallback when embeddings not available)
*/
private keywordOnlySearch;
/**
* Combine semantic and keyword results with hybrid ranking
*/
private combineHybridResults;
}
//# sourceMappingURL=base-vector-service.d.ts.map