pyseekdb.utils.embedding_functions.MorphEmbeddingFunction
- class pyseekdb.utils.embedding_functions.MorphEmbeddingFunction(model_name: str, api_key_env: str | None = None, api_base: str | None = None, **kwargs: Any)[source]
Bases:
OpenAIBaseEmbeddingFunctionA convenient embedding function for Morph embedding models.
This class provides a simplified interface to Morph embedding models using the OpenAI-compatible API.
Example
pip install pyseekdb openai
- __init__(model_name: str, api_key_env: str | None = None, api_base: str | None = None, **kwargs: Any)[source]
Initialize MorphEmbeddingFunction.
- Parameters:
model_name (str) – Name of the Morph embedding model.
api_key_env (str, optional) – Name of the environment variable containing the Morph API key. Defaults to “MORPH_API_KEY” if not provided.
api_base (str, optional) – Base URL for the Morph API endpoint. Defaults to “https://api.morphllm.com/v1” if not provided.
**kwargs – Additional arguments to pass to the OpenAI client. Common options include: - timeout: Request timeout in seconds - max_retries: Maximum number of retries - See https://github.com/openai/openai-python for more options
Methods
__init__(model_name[, api_key_env, api_base])Initialize MorphEmbeddingFunction.
build_from_config(config)Get the configuration dictionary for the OpenAIBaseEmbeddingFunction.
name()Get the unique name identifier for MorphEmbeddingFunction.
support_persistence(embedding_function)Check if the embedding function supports persistence.
Attributes
dimensionGet the dimension of embeddings produced by this function.