pyseekdb.utils.embedding_functions.SiliconflowEmbeddingFunction

class pyseekdb.utils.embedding_functions.SiliconflowEmbeddingFunction(model_name: str = 'BAAI/bge-large-zh-v1.5', api_key_env: str | None = None, api_base: str | None = None, dimensions: int | None = None, **kwargs: Any)[source]

Bases: OpenAIBaseEmbeddingFunction

A convenient embedding function for SiliconFlow embedding models.

This class provides a simplified interface to SiliconFlow embedding models using the OpenAI-compatible API. SiliconFlow provides OpenAI-compatible API endpoints for embedding generation.

For more information about SiliconFlow models, see https://docs.siliconflow.cn/en/api-reference/embeddings/create-embeddings

Example

pip install pyseekdb openai

__init__(model_name: str = 'BAAI/bge-large-zh-v1.5', api_key_env: str | None = None, api_base: str | None = None, dimensions: int | None = None, **kwargs: Any)[source]

Initialize SiliconflowEmbeddingFunction.

Parameters:

Methods

__init__([model_name, api_key_env, ...])

Initialize SiliconflowEmbeddingFunction.

build_from_config(config)

get_config()

Get the configuration dictionary for the OpenAIBaseEmbeddingFunction.

name()

support_persistence(embedding_function)

Check if the embedding function supports persistence.

Attributes

dimension

Get the dimension of embeddings produced by this function.

get_config() dict[str, Any][source]

Get the configuration dictionary for the OpenAIBaseEmbeddingFunction.

Subclasses should override the name() method to provide the correct name for routing.

Returns:

Dictionary containing configuration needed to restore this embedding function