Gemini モデルで Vertex AI RAG Engine を使用する場合、ファインチューニングされた Gemini モデルはサポートされていません。
セルフデプロイ モデル
Vertex AI RAG Engine は、Model Garden のすべてのモデルをサポートしています。
セルフデプロイしたオープンモデル エンドポイントで Vertex AI RAG Engine を使用します。
コードサンプルで使用されている変数を置き換えます。
PROJECT_ID: 実際のプロジェクト ID。
LOCATION: リクエストを処理するリージョン。
ENDPOINT_ID: エンドポイント ID。
# Create a model instance with your self-deployed open model endpointrag_model=GenerativeModel("projects/PROJECT_ID/locations/LOCATION/endpoints/ENDPOINT_ID",tools=[rag_retrieval_tool])
Vertex AI のマネージド API を使用するモデル
Vertex AI RAG Engine をサポートする Vertex AI のマネージド API を使用するモデルには、次のようなものがあります。
次のコードサンプルは、Gemini GenerateContent API を使用して生成モデル インスタンスを作成する方法を示しています。モデル ID /publisher/meta/models/llama-3.1-405B-instruct-maas は、モデルカードにあります。
コードサンプルで使用されている変数を置き換えます。
PROJECT_ID: 実際のプロジェクト ID。
LOCATION: リクエストを処理するリージョン。
RAG_RETRIEVAL_TOOL: RAG 取得ツール。
# Create a model instance with Llama 3.1 MaaS endpointrag_model=GenerativeModel("projects/PROJECT_ID/locations/LOCATION/publisher/meta/models/llama-3.1-405B-instruct-maas",tools=RAG_RETRIEVAL_TOOL)
次のコードサンプルは、OpenAI 互換の ChatCompletions API を使用してモデル レスポンスを生成する方法を示しています。
INPUT_PROMPT: コンテンツ生成のために LLM に送信されるテキスト。Vertex AI Search のドキュメントに関連するプロンプトを使用します。
RAG_CORPUS_ID: RAG コーパス リソースの ID。
ROLE: ロール。
USER: ユーザー名。
CONTENT: コンテンツ。
# Generate a response with Llama 3.1 MaaS endpointresponse=client.chat.completions.create(model="MODEL_ID",messages=[{"ROLE":"USER","content":"CONTENT"}],extra_body={"extra_body":{"google":{"vertex_rag_store":{"rag_resources":{"rag_corpus":"RAG_CORPUS_ID"},"similarity_top_k":10}}}},)
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[],[],null,["# Vertex AI RAG Engine supported models\n\n| The [VPC-SC security controls](/vertex-ai/generative-ai/docs/security-controls) and\n| CMEK are supported by Vertex AI RAG Engine. Data residency and AXT security controls aren't\n| supported.\n\nThis page lists Gemini models, self-deployed models, and models with\nmanaged APIs on Vertex AI that support Vertex AI RAG Engine.\n\nGemini models\n-------------\n\nThe following table lists the Gemini models and their versions that\nsupport Vertex AI RAG Engine:\n\n- [Gemini 2.5 Flash-Lite](/vertex-ai/generative-ai/docs/models/gemini/2-5-flash-lite)\n- [Gemini 2.5 Pro](/vertex-ai/generative-ai/docs/models/gemini/2-5-pro)\n- [Gemini 2.5 Flash](/vertex-ai/generative-ai/docs/models/gemini/2-5-flash)\n- [Gemini 2.0 Flash](/vertex-ai/generative-ai/docs/models/gemini/2-0-flash)\n\nFine-tuned Gemini models are unsupported when the Gemini\nmodels use Vertex AI RAG Engine.\n\nSelf-deployed models\n--------------------\n\nVertex AI RAG Engine supports all models in\n[Model Garden](/vertex-ai/generative-ai/docs/model-garden/explore-models).\n\nUse Vertex AI RAG Engine with your self-deployed open model endpoints.\n\nReplace the variables used in the code sample:\n\n- **\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e**: Your project ID.\n- **\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e**: The region to process your request.\n- **\u003cvar translate=\"no\"\u003eENDPOINT_ID\u003c/var\u003e**: Your endpoint ID.\n\n # Create a model instance with your self-deployed open model endpoint\n rag_model = GenerativeModel(\n \"projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e/endpoints/\u003cvar translate=\"no\"\u003eENDPOINT_ID\u003c/var\u003e\",\n tools=[rag_retrieval_tool]\n )\n\nModels with managed APIs on Vertex AI\n-------------------------------------\n\nThe models with managed APIs on Vertex AI that support\nVertex AI RAG Engine include the following:\n\n- [Mistral on Vertex AI](/vertex-ai/generative-ai/docs/partner-models/mistral)\n- [Llama 3.1 and 3.2](/vertex-ai/generative-ai/docs/partner-models/llama)\n\nThe following code sample demonstrates how to use the Gemini\n`GenerateContent` API to create a generative model instance. The model ID,\n`/publisher/meta/models/llama-3.1-405B-instruct-maas`, is found in the\n[model card](/vertex-ai/generative-ai/docs/model-garden/explore-models).\n\nReplace the variables used in the code sample:\n\n- **\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e**: Your project ID.\n- **\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e**: The region to process your request.\n- **\u003cvar translate=\"no\"\u003eRAG_RETRIEVAL_TOOL\u003c/var\u003e**: Your RAG retrieval tool.\n\n # Create a model instance with Llama 3.1 MaaS endpoint\n rag_model = GenerativeModel(\n \"projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e/publisher/meta/models/llama-3.1-405B-instruct-maas\",\n tools=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eRAG_RETRIEVAL_TOOL\u003c/span\u003e\u003c/var\u003e\n )\n\nThe following code sample demonstrates how to use the OpenAI compatible\n`ChatCompletions` API to generate a model response.\n\nReplace the variables used in the code sample:\n\n- **\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e**: Your project ID.\n- **\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e**: The region to process your request.\n- **\u003cvar translate=\"no\"\u003eMODEL_ID\u003c/var\u003e** : LLM model for content generation. For example, `meta/llama-3.1-405b-instruct-maas`.\n- **\u003cvar translate=\"no\"\u003eINPUT_PROMPT\u003c/var\u003e**: The text sent to the LLM for content generation. Use a prompt relevant to the documents in Vertex AI Search.\n- **\u003cvar translate=\"no\"\u003eRAG_CORPUS_ID\u003c/var\u003e**: The ID of the RAG corpus resource.\n- **\u003cvar translate=\"no\"\u003eROLE\u003c/var\u003e**: Your role.\n- **\u003cvar translate=\"no\"\u003eUSER\u003c/var\u003e**: Your username.\n- **\u003cvar translate=\"no\"\u003eCONTENT\u003c/var\u003e**: Your content.\n\n # Generate a response with Llama 3.1 MaaS endpoint\n response = client.chat.completions.create(\n model=\"\u003cvar translate=\"no\"\u003eMODEL_ID\u003c/var\u003e\",\n messages=[{\"\u003cvar translate=\"no\"\u003eROLE\u003c/var\u003e\": \"\u003cvar translate=\"no\"\u003eUSER\u003c/var\u003e\", \"content\": \"\u003cvar translate=\"no\"\u003eCONTENT\u003c/var\u003e\"}],\n extra_body={\n \"extra_body\": {\n \"google\": {\n \"vertex_rag_store\": {\n \"rag_resources\": {\n \"rag_corpus\": \"\u003cvar translate=\"no\"\u003eRAG_CORPUS_ID\u003c/var\u003e\"\n },\n \"similarity_top_k\": 10\n }\n }\n }\n },\n )\n\nWhat's next\n-----------\n\n- [Use Embedding models with Vertex AI RAG Engine](/vertex-ai/generative-ai/docs/use-embedding-models)."]]