Google Vertex AI
Google Vertex AIは、さまざまなテキスト埋め込みモデルを提供しています。seekdbは GoogleVertexEmbeddingFunction パッケージを提供しており、documents に書き込む際や query_texts でクエリを実行する際に、自動的にVertex AIを呼び出してベクトルを生成し、類似性検索を完了します。
ヒント
Google Vertex AIサービスの利用には、Google Cloudの料金規則に従う必要があり、それに伴う費用が発生する場合があります。続行する前に、公式Webサイトをご覧いただくか、関連ドキュメントを確認し、その料金体系をご確認の上、ご同意いただく必要があります。同意いただけない場合は、操作を続けないでください。
依存関係と認証
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プロジェクトID。model_name:Vertex AI Embeddingモデル名。例ではtextembedding-geckoです。ご利用可能なモデルは、ご自身のプロジェクトに準じます。