/** * EmbeddingAgent - Text embedding generation agent * * Python parity with praisonaiagents/agent/embedding_agent.py * Generates embeddings for text using embedding models. */ /** * Configuration for Embedding settings. */ export interface EmbeddingConfig { /** Embedding model to use */ model?: string; /** Dimensions for the embedding */ dimensions?: number; /** Batch size for processing multiple texts */ batchSize?: number; /** Timeout in seconds */ timeout?: number; } /** * Result of embedding generation. */ export interface EmbeddingResult { /** The embedding vector */ embedding: number[]; /** Model used */ model: string; /** Token usage */ usage?: { promptTokens: number; totalTokens: number; }; } /** * Result of batch embedding generation. */ export interface BatchEmbeddingResult { /** Array of embeddings */ embeddings: number[][]; /** Model used */ model: string; /** Total token usage */ usage?: { promptTokens: number; totalTokens: number; }; } /** * Configuration for creating an EmbeddingAgent. */ export interface EmbeddingAgentConfig { /** Agent name */ name?: string; /** Embedding model */ llm?: string; /** Alias for llm */ model?: string; /** Embedding configuration */ embedding?: boolean | EmbeddingConfig; /** Enable verbose output */ verbose?: boolean; } /** * Agent for generating text embeddings. * * @example * ```typescript * import { EmbeddingAgent } from 'praisonai'; * * const agent = new EmbeddingAgent({}); * * // Generate embedding for text * const result = await agent.embed('Hello, world!'); * console.log(result.embedding.length); // 1536 * * // Generate embeddings for multiple texts * const results = await agent.embedMany(['Hello', 'World']); * ``` */ export declare class EmbeddingAgent { static readonly DEFAULT_MODEL = "text-embedding-3-small"; readonly name: string; private readonly model; private readonly verbose; private readonly embeddingConfig; constructor(config: EmbeddingAgentConfig); private log; /** * Generate embedding for a single text. * * @param text - Text to embed * @returns EmbeddingResult with the embedding vector */ embed(text: string): Promise; /** * Generate embeddings for multiple texts. * * @param texts - Array of texts to embed * @returns BatchEmbeddingResult with all embeddings */ embedMany(texts: string[]): Promise; /** * Calculate cosine similarity between two embeddings. */ cosineSimilarity(a: number[], b: number[]): number; /** * Find the most similar text from a list. */ findMostSimilar(query: string, candidates: string[]): Promise<{ text: string; similarity: number; index: number; }>; } /** * Create an EmbeddingAgent instance. */ export declare function createEmbeddingAgent(config: EmbeddingAgentConfig): EmbeddingAgent;