pyseekdb.utils.embedding_functions.GoogleVertexEmbeddingFunction
- class pyseekdb.utils.embedding_functions.GoogleVertexEmbeddingFunction(model_name: str = 'textembedding-gecko', project_id: str = 'cloud-large-language-models', region: str = 'us-central1', api_key_env: str | None = 'GOOGLE_VERTEX_API_KEY')[source]
Bases:
EmbeddingFunction[str|list[str]]A convenient embedding function for Google Vertex AI embedding models.
For more information about Google Vertex AI models, see https://docs.cloud.google.com/vertex-ai/generative-ai/docs/model-reference/text-embeddings-api
Example
pip install pyseekdb google-cloud-aiplatform
- __init__(model_name: str = 'textembedding-gecko', project_id: str = 'cloud-large-language-models', region: str = 'us-central1', api_key_env: str | None = 'GOOGLE_VERTEX_API_KEY')[source]
Initialize the GoogleVertexEmbeddingFunction.
- Parameters:
api_key_env (str, optional) – Environment variable name that contains your API key for the Google Vertex AI API. Defaults to “GOOGLE_VERTEX_API_KEY”.
model_name (str, optional) – The name of the model to use for text embeddings. Defaults to “textembedding-gecko”.
project_id (str, optional) – The Google Cloud project ID. Defaults to “cloud-large-language-models”.
region (str, optional) – The Google Cloud region. Defaults to “us-central1”.
Methods
__init__([model_name, project_id, region, ...])Initialize the GoogleVertexEmbeddingFunction.
build_from_config(config)Get the configuration dictionary for the embedding function.
name()support_persistence(embedding_function)Check if the embedding function supports persistence.
- get_config() dict[str, Any][source]
Get the configuration dictionary for the embedding function.
This method should return a dictionary that contains all the information needed to restore the embedding function after restart.
- Returns:
Dictionary containing the embedding function’s configuration. Note: The ‘name’ field is not included as it’s handled by the upper layer for routing.