Embedding
BaseEmbedding
Bases: ABC
Base class for text embedding models.
__init__(config)
Initialize the base embedding model.
Parameters:
-
config(BaseEmbeddingConfig) –Configuration for the embedding model.
generate_embedding(text)
abstractmethod
async
Asynchronously generate an embedding for the given text.
Parameters:
-
text(str) –Input text to generate an embedding.
Returns:
-
List[float]–A list of floats representing the text embedding.
OpenAIEmbedding
Bases: BaseEmbedding, RetryMixin
OpenAI Embedding model wrapper with async embedding generation and robust retries.
__init__(llm_manager, config)
Initialize the OpenAI Embedding wrapper.
Parameters:
-
llm_manager(OpenAIManager) –Manager for OpenAI LLM interactions.
-
config(OpenAIEmbeddingConfig | Dict | str | Path) –Configuration for the embedding model.
generate_embedding(text)
async
Generate embedding asynchronously with retry for robustness.
Parameters:
-
text(str) –The input text to generate embeddings for.
Returns:
-
List[float]–The normalized embedding vector.