crewai-ts
Version:
TypeScript port of crewAI for agent-based workflows
56 lines • 1.79 kB
TypeScript
/**
* Custom Embedder Implementation
*
* Wrapper for user-provided embedding functions
* with the same optimizations as built-in embedders
*/
import { BaseEmbedder, BaseEmbedderOptions } from './BaseEmbedder.js';
/**
* Custom Embedder Options
*/
export interface CustomEmbedderOptions extends BaseEmbedderOptions {
/**
* Embedding function to use
*/
embeddingFunction: (text: string) => Promise<Float32Array>;
/**
* Model name
*/
model?: string;
/**
* Provider name
*/
provider?: string;
/**
* Cache size
* @default 1000
*/
cacheSize?: number;
/**
* Cache TTL in milliseconds
* @default 3600000 (1 hour)
*/
cacheTTL?: number;
/**
* Dimensions of the embeddings
*/
dimensions: number;
}
/**
* Custom Embedder Implementation
*
* Allows using any embedding function with the standardized interface
* while benefiting from the optimizations in BaseEmbedder
*/
export declare class CustomEmbedder extends BaseEmbedder<CustomEmbedderOptions> {
protected _embeddingFunction: (text: string) => Promise<Float32Array>;
protected _dimensions: number;
constructor(options: CustomEmbedderOptions);
embed(text: string): Promise<Float32Array>;
embedBatch(texts: string[]): Promise<Float32Array[]>;
protected executeWithRetry<T>(operation: () => Promise<T>, maxRetries?: number, initialBackoff?: number, maxBackoff?: number): Promise<T>;
protected executeBatchWithRetry<T>(operation: () => Promise<T>, maxRetries?: number, initialBackoff?: number, maxBackoff?: number): Promise<T>;
protected isTransientError(error: Error): boolean;
protected embedText(text: string): Promise<Float32Array>;
}
//# sourceMappingURL=CustomEmbedder.d.ts.map