UNPKG

crewai-ts

Version:

TypeScript port of crewAI for agent-based workflows

96 lines 3.05 kB
/** * Embedder Factory * * Simplified creation of optimized embedders for the knowledge system * with standardized configuration and performance optimizations */ import { OpenAIEmbedder, OpenAIEmbedderOptions, CohereEmbedder, CohereEmbedderOptions, HuggingFaceEmbedder, HuggingFaceEmbedderOptions, FastEmbedder, FastEmbedderOptions, FastTextEmbedder, FastTextEmbedderOptions, CustomEmbedder, CustomEmbedderOptions, AnyEmbedder } from './index.js'; import { EmbedderConfig } from '../types.js'; /** * Factory options for creating embedders */ export interface EmbedderFactoryOptions { /** * Default cache size for all embedders * @default 1000 */ defaultCacheSize?: number; /** * Default cache TTL in milliseconds * @default 3600000 (1 hour) */ defaultCacheTTL?: number; /** * Default batch size for embedding operations * @default 16 */ defaultBatchSize?: number; /** * Whether to enable debugging by default * @default false */ debug?: boolean; /** * Whether to normalize embeddings by default * @default true */ normalize?: boolean; /** * API keys for different providers */ apiKeys?: { openai?: string; cohere?: string; huggingface?: string; }; } /** * EmbedderFactory - Simplified creation of optimized embedders * * Provides easy access to all embedder implementations with smart defaults * and performance optimizations */ export declare class EmbedderFactory { /** * Default options for all embedders */ private options; /** * Constructor for the EmbedderFactory */ constructor(options?: EmbedderFactoryOptions); /** * Create an OpenAI embedder with optimized settings */ createOpenAIEmbedder(options?: Partial<OpenAIEmbedderOptions>): OpenAIEmbedder; /** * Create a Cohere embedder with optimized settings */ createCohereEmbedder(options?: Partial<CohereEmbedderOptions>): CohereEmbedder; /** * Create a HuggingFace embedder with optimized settings */ createHuggingFaceEmbedder(options?: Partial<HuggingFaceEmbedderOptions>): HuggingFaceEmbedder; /** * Create a FastEmbed local embedder with optimized settings */ createFastEmbedder(options?: Partial<FastEmbedderOptions>): FastEmbedder; /** * Create a FastText embedder with optimized settings */ createFastTextEmbedder(options?: Partial<FastTextEmbedderOptions>): FastTextEmbedder; /** * Create a custom embedder with optimized settings */ createCustomEmbedder(options: CustomEmbedderOptions): CustomEmbedder; /** * Create an embedder based on provider type and options * Automatically selects the appropriate embedder implementation */ createEmbedder(config: EmbedderConfig): AnyEmbedder; /** * Auto-detect the best provider based on available API keys */ private detectDefaultProvider; } //# sourceMappingURL=EmbedderFactory.d.ts.map