Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Bei der generativen KI ist Fundierung die Fähigkeit, die Modellausgabe mit überprüfbaren Informationsquellen zu verbinden. Wenn Sie den Modellen Zugang zu bestimmten Datenquellen gewähren, dann bindet die Fundierung ihre Ausgabe an diese Daten und verringert die Wahrscheinlichkeit, dass Inhalte erfunden werden.
Mit Vertex AI können Sie Modellausgaben so fundieren:
Mit der Google Suche fundieren – Ein Modell mit öffentlich verfügbaren Webdaten fundieren.
Fundierung auf Ihren eigenen Daten – Fundieren Sie ein Modell mit Ihren eigenen Daten aus Vertex AI Search als Datenspeicher.
Einzelheiten zur Implementierung finden Sie in den Beispielen.
GoogleSearchRetrieval
Fundieren Sie die Antwort mit öffentlichen Daten.
Parameter
google_search_retrieval
Erforderlich: Object
Fundieren Sie mit öffentlich verfügbaren Webdaten.
Retrieval
Fundieren Sie die Antwort mit privaten Daten aus Vertex AI Search als Datenspeicher.
Definiert ein Abruftool, das das Modell aufrufen kann, um auf externes Wissen zuzugreifen.
Parameter
source
Erforderlich: VertexAISearch
Fundierung mit Vertex AI Search-Datenquellen
VertexAISearch
Parameter
datastore
Erforderlich: string
Vollständig qualifizierte Datenspeicher-Ressourcen-ID aus Vertex AI Search im folgenden Format: projects/{project}/locations/{location}/collections/default_collection/dataStores/{datastore}
Beispiele
Fundierungsantwort zu öffentlichen Webdaten mit der Google Suche
Fundieren Sie die Antwort mit öffentlichen Daten aus der Google Suche. Fügen Sie das google_search_retrieval-Tool in die Anfrage ein. Es sind keine zusätzlichen Parameter erforderlich.
Umgebungsvariablen für die Verwendung des Gen AI SDK mit Vertex AI festlegen:
# Replace the `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` values# with appropriate values for your project.exportGOOGLE_CLOUD_PROJECT=GOOGLE_CLOUD_PROJECTexportGOOGLE_CLOUD_LOCATION=globalexportGOOGLE_GENAI_USE_VERTEXAI=True
fromgoogleimportgenaifromgoogle.genai.typesimport(GenerateContentConfig,GoogleSearch,HttpOptions,Tool,)client=genai.Client(http_options=HttpOptions(api_version="v1"))response=client.models.generate_content(model="gemini-2.5-flash",contents="When is the next total solar eclipse in the United States?",config=GenerateContentConfig(tools=[# Use Google Search ToolTool(google_search=GoogleSearch())],),)print(response.text)# Example response:# 'The next total solar eclipse in the United States will occur on ...'
Umgebungsvariablen für die Verwendung des Gen AI SDK mit Vertex AI festlegen:
# Replace the `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` values# with appropriate values for your project.exportGOOGLE_CLOUD_PROJECT=GOOGLE_CLOUD_PROJECTexportGOOGLE_CLOUD_LOCATION=globalexportGOOGLE_GENAI_USE_VERTEXAI=True
import("context""fmt""io"genai"google.golang.org/genai")//generateWithGoogleSearchshowshowtogeneratetextusingGoogleSearch.funcgenerateWithGoogleSearch(wio.Writer)error{ctx:=context.Background()client,err:=genai.NewClient(ctx, &genai.ClientConfig{HTTPOptions:genai.HTTPOptions{APIVersion:"v1"},})iferr!=nil{returnfmt.Errorf("failed to create genai client: %w",err)}modelName:="gemini-2.5-flash"contents:=[]*genai.Content{{Parts:[]*genai.Part{{Text:"When is the next total solar eclipse in the United States?"},},Role:"user"},}config:= &genai.GenerateContentConfig{Tools:[]*genai.Tool{{GoogleSearch: &genai.GoogleSearch{}},},}resp,err:=client.Models.GenerateContent(ctx,modelName,contents,config)iferr!=nil{returnfmt.Errorf("failed to generate content: %w",err)}respText:=resp.Text()fmt.Fprintln(w,respText)//Exampleresponse://ThenexttotalsolareclipseintheUnitedStateswilloccuronMarch30,2033,butitwillonly...returnnil}
Fundierungsantwort für private Daten mit Vertex AI Search
Fundieren Sie die Antwort mit Daten aus einem Vertex AI Search-Datenspeicher.
Weitere Informationen finden Sie unter KI-Anwendungen.
ACHTUNG: Derzeit wird der „Chunk-Modus“ von Vertex AI Search in dieser Oberfläche für die Fundierung nicht unterstützt.
Gen AI SDK für Python
fromgoogleimportgenaifromgoogle.genai.typesimport(GenerateContentConfig,HttpOptions,Retrieval,Tool,VertexAISearch,)client=genai.Client(http_options=HttpOptions(api_version="v1"))# Load Data Store ID from Vertex AI Search# datastore = "projects/111111111111/locations/global/collections/default_collection/dataStores/data-store-id"response=client.models.generate_content(model="gemini-2.5-flash",contents="How do I make an appointment to renew my driver's license?",config=GenerateContentConfig(tools=[# Use Vertex AI Search ToolTool(retrieval=Retrieval(vertex_ai_search=VertexAISearch(datastore=datastore,)))],),)print(response.text)# Example response:# 'The process for making an appointment to renew your driver's license varies depending on your location. To provide you with the most accurate instructions...'
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[],[],null,["# Grounding\n\nIn generative AI, grounding is the ability to connect model output to verifiable\nsources of information. If you provide models with access to specific data\nsources, then grounding tethers their output to these data and reduces the\nchances of inventing content.\n\nWith Vertex AI, you can ground model outputs in the following ways:\n\n- Ground with Google Search - ground a model with publicly available web data.\n- Ground to your own data - ground a model with your own data from Vertex AI Search as a data store.\n\nFor more information about grounding, see [Grounding overview](/vertex-ai/generative-ai/docs/grounding/overview).\n\nSupported models\n----------------\n\n- [Gemini 2.5 Flash-Lite](/vertex-ai/generative-ai/docs/models/gemini/2-5-flash-lite)\n- [Gemini 2.5 Flash with Live API native audio](/vertex-ai/generative-ai/docs/models/gemini/2-5-flash#live-api-native-audio) (Preview)\n- [Gemini 2.0 Flash with Live API](/vertex-ai/generative-ai/docs/models/gemini/2-0-flash#live-api) (Preview)\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\nParameter list\n--------------\n\nSee [examples](#examples) for implementation details.\n\n#### `GoogleSearchRetrieval`\n\nGround the response with public data.\n\n#### `Retrieval`\n\nGround the response with private data from Vertex AI Search as a data store.\nDefines a retrieval tool that the model can call to access external knowledge.\n\n#### `VertexAISearch`\n\nExamples\n--------\n\n### Ground response on public web data using Google Search\n\nGround the response with Google Search public data. Include the `google_search_retrieval` tool in the request. No additional parameters are required. \n\n### Python\n\n#### Install\n\n```\npip install --upgrade google-genai\n```\n\n\nTo learn more, see the\n[SDK reference documentation](https://googleapis.github.io/python-genai/).\n\n\nSet environment variables to use the Gen AI SDK with Vertex AI:\n\n```bash\n# Replace the `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` values\n# with appropriate values for your project.\nexport GOOGLE_CLOUD_PROJECT=GOOGLE_CLOUD_PROJECT\nexport GOOGLE_CLOUD_LOCATION=global\nexport GOOGLE_GENAI_USE_VERTEXAI=True\n```\n\n\u003cbr /\u003e\n\n from google import genai\n from google.genai.types import (\n GenerateContentConfig,\n GoogleSearch,\n HttpOptions,\n Tool,\n )\n\n client = genai.Client(http_options=HttpOptions(api_version=\"v1\"))\n\n response = client.models.generate_content(\n model=\"gemini-2.5-flash\",\n contents=\"When is the next total solar eclipse in the United States?\",\n config=GenerateContentConfig(\n tools=[\n # Use Google Search Tool\n Tool(google_search=GoogleSearch())\n ],\n ),\n )\n\n print(response.text)\n # Example response:\n # 'The next total solar eclipse in the United States will occur on ...'\n\n### Go\n\nLearn how to install or update the [Go](/vertex-ai/generative-ai/docs/sdks/overview).\n\n\nTo learn more, see the\n[SDK reference documentation](https://pkg.go.dev/google.golang.org/genai).\n\n\nSet environment variables to use the Gen AI SDK with Vertex AI:\n\n```bash\n# Replace the `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` values\n# with appropriate values for your project.\nexport GOOGLE_CLOUD_PROJECT=GOOGLE_CLOUD_PROJECT\nexport GOOGLE_CLOUD_LOCATION=global\nexport GOOGLE_GENAI_USE_VERTEXAI=True\n```\n\n\u003cbr /\u003e\n\n import (\n \t\"context\"\n \t\"fmt\"\n \t\"io\"\n\n \tgenai \"google.golang.org/genai\"\n )\n\n // generateWithGoogleSearch shows how to generate text using Google Search.\n func generateWithGoogleSearch(w io.Writer) error {\n \tctx := context.Background()\n\n \tclient, err := genai.NewClient(ctx, &genai.ClientConfig{\n \t\tHTTPOptions: genai.HTTPOptions{APIVersion: \"v1\"},\n \t})\n \tif err != nil {\n \t\treturn fmt.Errorf(\"failed to create genai client: %w\", err)\n \t}\n\n \tmodelName := \"gemini-2.5-flash\"\n \tcontents := []*genai.Content{\n \t\t{Parts: []*genai.Part{\n \t\t\t{Text: \"When is the next total solar eclipse in the United States?\"},\n \t\t},\n \t\t\tRole: \"user\"},\n \t}\n \tconfig := &genai.GenerateContentConfig{\n \t\tTools: []*genai.Tool{\n \t\t\t{GoogleSearch: &genai.GoogleSearch{}},\n \t\t},\n \t}\n\n \tresp, err := client.Models.GenerateContent(ctx, modelName, contents, config)\n \tif err != nil {\n \t\treturn fmt.Errorf(\"failed to generate content: %w\", err)\n \t}\n\n \trespText := resp.Text()\n\n \tfmt.Fprintln(w, respText)\n\n \t// Example response:\n \t// The next total solar eclipse in the United States will occur on March 30, 2033, but it will only ...\n\n \treturn nil\n }\n\n\u003cbr /\u003e\n\n### Ground response on private data using Vertex AI Search\n\nGround the response with data from a Vertex AI Search data store.\nFor more information, see [AI Applications](/vertex-ai-search-and-conversation).\n\nBefore you ground a response with private data, [create a data store](/generative-ai-app-builder/docs/create-data-store-es) and a [search app](/generative-ai-app-builder/docs/create-engine-es).\n\nWARNING: For the time being, this \"grounding\" interface does not support Vertex AI Search \"chunk mode\". \n\n### Gen AI SDK for Python\n\n from google import genai\n from google.genai.types import (\n GenerateContentConfig,\n HttpOptions,\n Retrieval,\n Tool,\n VertexAISearch,\n )\n\n client = genai.Client(http_options=HttpOptions(api_version=\"v1\"))\n\n # Load Data Store ID from Vertex AI Search\n # datastore = \"projects/111111111111/locations/global/collections/default_collection/dataStores/data-store-id\"\n\n response = client.models.generate_content(\n model=\"gemini-2.5-flash\",\n contents=\"How do I make an appointment to renew my driver's license?\",\n config=GenerateContentConfig(\n tools=[\n # Use Vertex AI Search Tool\n Tool(\n retrieval=Retrieval(\n vertex_ai_search=VertexAISearch(\n datastore=datastore,\n )\n )\n )\n ],\n ),\n )\n\n print(response.text)\n # Example response:\n # 'The process for making an appointment to renew your driver's license varies depending on your location. To provide you with the most accurate instructions...'\n\nWhat's next\n-----------\n\nFor detailed documentation, see the following:\n\n- [Grounding](/vertex-ai/generative-ai/docs/grounding/overview)\n- [Gemini API](/vertex-ai/generative-ai/docs/model-reference/gemini)"]]