/** * Base adapter class for embedding providers * * @packageDocumentation */ import type { EmbeddingProvider, EmbeddingConfig, EmbeddingAdapter, EmbeddingResult, BatchEmbeddingResult } from '../types/graphrag.js'; /** * Embedding-related errors */ export declare class EmbeddingError extends Error { readonly code: EmbeddingErrorCode; readonly provider: EmbeddingProvider; readonly cause?: Error | undefined; constructor(message: string, code: EmbeddingErrorCode, provider: EmbeddingProvider, cause?: Error | undefined); } export type EmbeddingErrorCode = 'NOT_CONFIGURED' | 'API_ERROR' | 'RATE_LIMIT' | 'INVALID_RESPONSE' | 'TIMEOUT' | 'NETWORK_ERROR' | 'MODEL_NOT_FOUND'; /** * Default configuration values */ export declare const DEFAULT_EMBEDDING_CONFIG: { timeout: number; retries: number; batchSize: number; }; /** * Abstract base class for embedding adapters */ export declare abstract class BaseEmbeddingAdapter implements EmbeddingAdapter { protected config: EmbeddingConfig; constructor(config: EmbeddingConfig); abstract get provider(): EmbeddingProvider; abstract get model(): string; abstract get dimensions(): number; abstract embed(text: string): Promise; abstract embedBatch(texts: string[]): Promise; abstract isConfigured(): boolean; getConfig(): Omit; /** * Retry a function with exponential backoff */ protected withRetry(fn: () => Promise, maxRetries?: number): Promise; /** * Calculate cosine similarity between two vectors */ protected cosineSimilarity(a: number[], b: number[]): number; /** * Normalize a vector to unit length */ protected normalizeVector(vector: number[]): number[]; } //# sourceMappingURL=base.d.ts.map