Google Vertex AI
Google Vertex AI 提供多种文本 Embedding 模型。seekdb 提供 GoogleVertexEmbeddingFunction 封装,用于在写入 documents 或使用 query_texts 查询时,自动调用 Vertex AI 生成向量并完成相似性检索。
提示
使用 Google Vertex AI 服务需要遵循 Google Cloud 的收费规则,可能产生相应费用。请在继续前,访问其官网或查阅相关文档,确认并接受其收费标准。如不同意,请勿继续操作。
依赖与鉴权
GoogleVertexEmbeddingFunction 通过 Google Vertex AI 的 SDK 调用 Embedding 接口。通常需要:
- 已开通 Google Cloud / Vertex AI,并具备调用 Embedding 模型的权限。
- Python 环境安装
pyseekdb与google-cloud-aiplatform。 - 已配置 Google Application Default Credentials。
示例:创建 Google Vertex Embedding Function
from pyseekdb.utils.embedding_functions import GoogleVertexEmbeddingFunction
ef = GoogleVertexEmbeddingFunction(
project_id="your-project-id",
model_name="textembedding-gecko",
)
参数说明:
project_id:Google Cloud Project ID。model_name:Vertex AI Embedding 模型名称,例如示例中的textembedding-gecko。请以您的项目可用模型为准。