Auf dieser Seite wird die Suche mit Antwort und Follow-ups für Vertex AI Search vorgestellt. Außerdem wird gezeigt, wie Sie sie für benutzerdefinierte Suchanwendungen mithilfe von Methodenaufrufen implementieren.
Hinweis  :Die Funktionen „Antworten“ und „Follow-ups“ können nicht auf Media- oder Gesundheitsdaten-Stores angewendet werden. Die Suche mit Antwort und Follow-ups basiert auf der Antwortmethode. Die Methode „answer“ ersetzt die Zusammenfassungsfunktionen der älteren Methode search  und alle Funktionen der eingestellten Methode converse .
Die Antwortmethode bietet auch einige wichtige zusätzliche Funktionen, z. B. die Möglichkeit, komplexe Anfragen zu verarbeiten.
Wichtiger Begriff  :Auf dieser Seite bezieht sich der Begriff Antwort  auf eine KI-generierte Antwort, die auf Suchergebnissen einer Anfrage basiert. Sie ist im Wesentlichen identisch mit der Zusammenfassung , die mit der Suchmethode generiert werden kann. Funktionen der Antwortmethode 
Die wichtigsten Funktionen der Antwortmethode sind:
Die Fähigkeit, Antworten auf komplexe Anfragen zu generieren. Die Antwortmethode kann beispielsweise zusammengesetzte Anfragen wie die folgende in mehrere kleinere Anfragen aufteilen, um bessere Ergebnisse zu liefern, die für bessere Antworten verwendet werden:
„Wie hoch sind die jeweiligen Einnahmen von Google Cloud und Google Ads im Jahr 2024?“ 
„Nach wie vielen Jahren seit der Gründung hat Google einen Umsatz von 1 Milliarde US-Dollar erreicht?“ 
 Die Möglichkeit, die Suche und die Antwortgenerierung in einer mehrstufigen Unterhaltung zu kombinieren, indem die Antwortmethode in jeder Runde aufgerufen wird.
Die Möglichkeit, die Suchmethode zu kombinieren, um die Suchlatenz zu verringern. Sie können die Suchmethode und die Antwortmethode separat aufrufen und die Suchergebnisse und Antworten zu unterschiedlichen Zeiten in verschiedenen iFrames rendern. Das bedeutet, dass Sie Ihren Nutzern Suchergebnisse (die 10 blauen Links) innerhalb von Millisekunden anzeigen können. Sie müssen nicht warten, bis Antworten generiert wurden, bevor Sie Suchergebnisse anzeigen können.
 
Die Funktionen für Antworten und Follow-ups lassen sich in drei Phasen der Anfrage unterteilen: Anfrage, Suche und Antwort:
Wann sollte die Antwort- und wann die Suchfunktion verwendet werden? 
Vertex AI Search bietet zwei Methoden zum Abfragen von Apps. Sie haben unterschiedliche, aber sich überschneidende Funktionen.
Verwenden Sie die Methode answer , wenn:
Sie möchten eine KI-generierte Antwort (oder Zusammenfassung) der Suchergebnisse.
Sie möchten die Suche in mehreren Schritten nutzen, bei der der Kontext beibehalten wird, sodass Sie weiterführende Fragen stellen können.
 
Verwenden Sie die Methode search  in den folgenden Fällen:
Sie benötigen nur Suchergebnisse, keine generierte Antwort.
Sie haben eines der folgenden:
Media- oder Gesundheitsdaten 
Eigene Einbettungen 
Synonym- oder Weiterleitungssteuerelemente 
Facetten 
Ländercodes des Nutzers 
 Sie müssen die Daten in Ihrem generischen Datenspeicher durchsuchen .
 
Verwenden Sie die Antwort- und Suchmethoden zusammen, wenn:
Sie möchten mehr als zehn Suchergebnisse zurückgeben und  eine generierte Antwort erhalten.
Sie haben Probleme mit der Latenz und möchten Suchergebnisse schnell zurückgeben und anzeigen, bevor die generierte Antwort zurückgegeben wird.
 
Funktionen für die Abfragephase 
Die Funktion „Antworten und Follow-ups“ unterstützt die Verarbeitung von Anfragen in natürlicher Sprache.
In diesem Abschnitt werden die verschiedenen Optionen für die Umformulierung und Klassifizierung von Anfragen beschrieben und veranschaulicht.
Abfrage umformulieren 
Die Umformulierung von Anfragen ist standardmäßig aktiviert. Mit dieser Funktion wird automatisch die beste Möglichkeit ausgewählt, Anfragen umzuformulieren, um die Suchergebnisse zu verbessern. Diese Funktion kann auch Anfragen bearbeiten, die nicht umformuliert werden müssen.
Komplexe Abfragen in mehrere Abfragen aufteilen und synchrone Unterabfragen ausführen.
Beispiel: Eine komplexe Abfrage wird in vier kleinere, einfachere Abfragen aufgeteilt.
    
      Nutzereingabe 
      Aus der komplexen Abfrage erstellte Unterabfragen 
     
    
      Welche Jobs und Hobbys haben Andie Ram und Arnaud Clément gemeinsam? 
      
        
          Andie Ram-Beruf 
          Arnaud Clément Beruf 
          Andie Ram hobby 
          Arnaud Clément Hobby 
         
       
     
Multi-Turn-Anfragen zusammenführen, damit Folgefragen kontextbezogen und zustandsbehaftet sind.
Beispiel: Abfragen, die in jeder Runde aus Nutzereingaben generiert werden, könnten so aussehen:
    
      Nutzereingabe 
      Abfrage synthetisiert 
     
    
      1. Runde: Laptops für die Schule 
      laptops für die schule 
     
    
      Turn 2: not mac 
      Laptops für die Schule, keine Macs 
     
    
      Turn 3: bigger screen and i also need wireless keyboard and
mouse 
      Laptops mit größerem Display für die Schule, keine Macs, mit kabelloser Tastatur und Maus 
     
    
      4. Zug: und ein Rucksack dafür 
      Laptops mit größerem Display für die Schule, kein Mac, mit kabelloser Tastatur und Maus und einem Rucksack dafür 
     
Lange Anfragen vereinfachen, um die Abrufung zu verbessern (erfordert erweiterte LLM-Funktionen ).
Beispiel: Eine lange Anfrage wird zu einer typischen Anfrage verkürzt.
    
      Nutzereingabe 
      Abfrage vereinfacht 
     
    
       Ich möchte herausfinden, warum die Schaltfläche „In den Warenkorb“ auf unserer Website nicht richtig funktioniert. Wenn ein Nutzer auf die Schaltfläche klickt, wird der Artikel nicht in den Einkaufswagen gelegt und er erhält eine Fehlermeldung. Ich habe den Code überprüft und er scheint korrekt zu sein. Ich bin mir daher nicht sicher, woran das Problem liegen könnte. Kannst du mir helfen, das Problem zu beheben? 
      Die Schaltfläche „In den Einkaufswagen“ funktioniert auf der Website nicht. 
     
Mehrstufige Problemlösung
Wichtige Begriffe :Schritte  (auch als Hops  bezeichnet) werden verwendet, um komplexe Fragen zu beantworten. Die Frage wird in mehrere Schritte zur Informationsbeschaffung und ‑ableitung unterteilt.
 
Die mehrstufige Analyse basiert auf dem ReAct-Paradigma (reason + act), das es LLMs ermöglicht, komplexe Aufgaben mithilfe von Natural Language Reasoning zu lösen.
Standardmäßig sind maximal fünf Schritte möglich.
Beispiel:
    
      Nutzereingabe 
       Antwort in zwei Schritten generieren 
     
    
      Nach wie vielen Jahren seit der Gründung erreichte Google einen Umsatz von 1 Milliarde US-Dollar? 
      Schritt 1 :Step 2 : 
Für die mehrstufige Problemlösung sind erweiterte LLM-Features  erforderlich.
 
Abfrageklassifizierung 
Mit den Optionen zur Abfrageklassifizierung lassen sich feindselige und nicht antwortsuchende Anfragen erkennen. Die Optionen für die Abfrageklassifizierung sind standardmäßig deaktiviert.
Weitere Informationen zu feindseligen und nicht auf Antworten ausgerichteten Anfragen finden Sie unter Feindselige Anfragen ignorieren  und Nicht auf Zusammenfassungen ausgerichtete Anfragen ignorieren .
Funktionen der Suchphase 
Für die Suche hat die Antwortmethode dieselben Optionen wie die Suchmethode. Beispiel:
Funktionen der Antwortphase 
Während der Antwortphase, wenn Antworten aus den Suchergebnissen generiert werden, können Sie dieselben Funktionen wie in der Suchmethode aktivieren. Beispiel:
Zusätzliche Funktionen der Antwortphase, die in der Suchmethode nicht verfügbar sind:
Für jede Behauptung (Satz in der generierten Antwort) wird ein Support-Score ermittelt.
Der Support-Score ist ein Gleitkommawert im Bereich [0,1], der angibt, wie gut die Behauptung durch die Daten im Datenspeicher belegt wird. Weitere Informationen finden Sie unter Support-Scores für die Fundierung zurückgeben .
Eine zusammengefasste Support-Bewertung für die Antwort erhalten. Der Support-Score gibt an, wie gut die Antwort auf den Daten im Datenspeicher basiert. Weitere Informationen finden Sie unter Support-Scores für die Fundierung von Rückgaben zurückgeben .
Gib nur fundierte Antworten zurück. Sie können festlegen, dass nur Antworten zurückgegeben werden, die einen bestimmten Support-Score-Grenzwert erreichen. Weitere Informationen 
Wählen Sie aus, ob ähnliche Fragen zurückgegeben werden sollen. Ähnliche Fragen sind Vorschläge, die Ihre Nutzer auswählen können, anstatt eigene Fragen einzugeben.
Fügen Sie Anfragen Personalisierungsinformationen hinzu, damit die Antworten für einzelne Nutzer angepasst werden können. Weitere Informationen finden Sie unter Antworten personalisieren .
 
Wenn Sie multimodale Antworten mit Diagrammen oder Bildern zusätzlich zu Text erhalten möchten, haben Sie folgende Möglichkeiten:
Antworten mit Diagrammen und Grafiken, in denen die in den Antworten enthaltenen Daten dargestellt werden. Weitere Informationen finden Sie unter Diagramme für Antworten generieren .
Bilder aus dem Datenspeicher abrufen. Wenn der Datenspeicher Bilder enthält, kann die Antwortmethode ein Bild in der Antwort zurückgeben. Bilder aus dem Datenspeicher können auch in Referenzen zurückgegeben werden, wenn Zitationen angefordert werden. Weitere Informationen finden Sie unter Vorhandene Bilder aus dem Datenspeicher abrufen .
 
Hinweise 
Je nach Art Ihrer App müssen Sie die folgenden Anforderungen erfüllen:
Wenn Sie eine App für die strukturierte, unstrukturierte oder Websitesuche haben, aktivieren Sie die folgenden Optionen:
Features der Enterprise-Version : Damit erhalten Sie Zugriff auf die wichtigsten Funktionen für generative Antworten. Dazu gehören alle Funktionen zur Generierung von Antworten mit Ausnahme von erweiterten Funktionen zur Generierung von Antworten wie ähnliche Fragen, Vereinfachung von Anfragen, Anfragen mit mehreren Schritten und multimodale Antworten, die Bilder und Diagramme zurückgeben.Erweiterte LLM-Funktionen : Damit erhalten Sie Zugriff auf die erweiterten Funktionen für generative Antworten, die mehrstufige Schlussfolgerungen, die Vereinfachung von Anfragen, Anfragen in mehreren Schritten, ähnliche Fragen und multimodale Antworten mit Bildern und Diagrammen erfordern. Wenn Sie einen Datenspeicher für die Website-Suche haben, aktivieren Sie außerdem die erweiterte Websiteindexierung .
 
Suchen und beantworten (einfach) 
Der folgende Befehl zeigt, wie die Methode answer  aufgerufen wird, um eine generierte Antwort und eine Liste von Suchergebnissen mit Links zu den Quellen zurückzugeben.
Mit diesem Befehl wird nur die erforderliche Eingabe angezeigt. Die Optionen werden mit den Standardwerten belassen.
  
  
  
  
  
    
  
  
  REST So suchen Sie und erhalten Ergebnisse mit einer generierten Antwort:
Führen Sie den folgenden curl-Befehl aus:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /servingConfigs/default_search:answer" \
  -d '{
        "query": { "text": "QUERY "}
      }'
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID QUERY  
Beispielbefehl und Teilergebnis 
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://discoveryengine.googleapis.com/v1/projects/my-project-123/locations/global/collections/default_collection/engines/my-app/servingConfigs/default_search:answer" \
-d '{"query": { "text": "Which database is faster, bigquery or spanner?"}}'
         What is the performance of BigQuery? "
            },
            "observation": {
              "searchResults": [
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/9ab3ef91bcfde1fcd091efe9df7c699c",
                  "uri": "https://cloud.google.com/bigquery/docs/best-practices-performance-overview",
                  "title": "Introduction to optimizing query performance | BigQuery | Google Cloud",
                  "snippetInfo": [
                    {
                      "snippet": "After a query begins execution, \u003cb\u003eBigQuery\u003c/b\u003e calculates how many slots each query stage uses based on the stage size and complexity and the number of slots ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/4e545c5cb69b06b251265114d9099cb4",
                  "uri": "https://cloud.google.com/bigquery/docs/query-insights",
                  "title": "Get query performance insights | BigQuery | Google Cloud",
                  "snippetInfo": [
                    {
                      "snippet": "This document describes how to use the query execution graph to diagnose query \u003cb\u003eperformance\u003c/b\u003e issues, and to see query \u003cb\u003eperformance\u003c/b\u003e insights. \u003cb\u003eBigQuery\u003c/b\u003e offers ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/d34672d877eefe596f9c7d1a3d7076b1",
                  "uri": "https://cloud.google.com/bigquery/docs/best-practices-performance-compute",
                  "title": "Optimize query computation | BigQuery | Google Cloud",
                  "snippetInfo": [
                    {
                      "snippet": "After addressing the query \u003cb\u003eperformance\u003c/b\u003e insights, you can further optimize your query by performing the following tasks: Reduce data that is to be processed ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                ...
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/75ce2f05833683e60ddc21a11ce0466f",
                  "uri": "https://cloud.google.com/blog/products/data-analytics/troubleshoot-and-optimize-your-bigquery-analytics-queries-with-query-execution-graph/",
                  "title": "Troubleshoot and optimize your BigQuery analytics queries with query execution graph | Google Cloud Blog",
                  "snippetInfo": [
                    {
                      "snippet": "Since query \u003cb\u003eperformance\u003c/b\u003e is multi-faceted, \u003cb\u003eperformance\u003c/b\u003e insights might only provide a partial picture of the overall query \u003cb\u003eperformance\u003c/b\u003e. Execution graph. When ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                }
              ]
            }
          },
          {
            "searchAction": {
              "query": " What is the performance of Spanner? "
            },
            "observation": {
              "searchResults": [
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/f3d036b60379873acf7c73081c5e5b5c",
                  "uri": "https://cloud.google.com/spanner/docs/performance",
                  "title": "Performance overview | Spanner | Google Cloud",
                  "snippetInfo": [
                    {
                      "snippet": "These \u003cb\u003eperformance\u003c/b\u003e improvements should result in higher throughput and better latency in \u003cb\u003eSpanner\u003c/b\u003e nodes in both regional and multi-region instance configurations.",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/422496248ade354c73b4c906b8eb9b5f",
                  "uri": "https://cloud.google.com/blog/products/databases/announcing-cloud-spanner-price-performance-updates",
                  "title": "Announcing Cloud Spanner price-performance updates | Google Cloud Blog",
                  "snippetInfo": [
                    {
                      "snippet": "Alongside lower costs, Cloud \u003cb\u003eSpanner\u003c/b\u003e provides single-digit ms latencies and strong consistency across multiple availability zones in the same region.",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/53c2a1a6990480ba4aa05cc6b4404562",
                  "uri": "https://cloud.google.com/blog/topics/developers-practitioners/understanding-cloud-spanner-performance-metrics-scale-key-visualizer",
                  "title": "Understanding Cloud Spanner performance metrics at scale with Key Visualizer | Google Cloud Blog",
                  "snippetInfo": [
                    {
                      "snippet": "Designed for \u003cb\u003eperformance\u003c/b\u003e tuning and instance sizing, you can use Key Visualizer today in the web-based Cloud Console for all \u003cb\u003eSpanner\u003c/b\u003e databases at no additional ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                ...
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/a6501ecd5d6391e3ade49097bab0ad3a",
                  "uri": "https://cloud.google.com/blog/products/databases/a-technical-overview-of-cloud-spanners-query-optimizer",
                  "title": "A technical overview of Cloud Spanner's query optimizer | Google Cloud Blog",
                  "snippetInfo": [
                    {
                      "snippet": "... performance. Typically, a join will ... Google is continuously improving out-of-the-box \u003cb\u003eperformance of Spanner\u003c/b\u003e and reducing the need for manual tuning.",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                }
              ]
            }
          }
        ]
      }
    ]
  },
  "answerQueryToken": "NMwKDAj1_d62BhC72_X_AhIkNjZkN2I4YWEtMDAwMC0yYTdiLWIxMmMtMDg5ZTA4MjhlNzY0"
}
 In diesem Beispiel wird die Anfrage in die Teile „Wie ist die Leistung von Spanner?“ und „Wie ist die Leistung von BigQuery?“ zerlegt.
 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
  
   
 
Befehle für die Abfragephase 
In diesem Abschnitt wird beschrieben, wie Sie Optionen für die Abfragephase des answer -Methodenaufrufs angeben.
Suchen und antworten (Umformulierung deaktiviert) 
Der folgende Befehl zeigt, wie Sie die Methode answer  aufrufen und eine generierte Antwort und eine Liste von Suchergebnissen zurückgeben. Die Antwort kann sich von der vorherigen Antwort unterscheiden, da die Option zum Umformulieren deaktiviert ist.
  
  
  
  
  
    
  
  
  REST So suchen Sie und erhalten Ergebnisse mit einer generierten Antwort, ohne dass die Anfrage umformuliert wird:
Führen Sie den folgenden curl-Befehl aus:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /servingConfigs/default_search:answer" \
  -d '{
        "query": { "text": "QUERY "},
        "queryUnderstandingSpec": {
           "queryRephraserSpec": {
              "disable": true 
        }
    }
      }'
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID QUERY  
Beispielbefehl und Teilergebnis 
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://discoveryengine.googleapis.com/v1/projects/my-project-123/locations/global/collections/default_collection/engines/my-app/servingConfigs/default_search:answer" \
-d '{
      "query": { "text": "Which database is faster, bigquery or spanner?"},
      "queryUnderstandingSpec": { "queryRephraserSpec": { "disable": true  } }
    }'
    Which database is faster, bigquery or spanner? "
            },
            "observation": {
              "searchResults": [
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/ecc0e7547253f4ca3ff3328ce89995af",
                  "uri": "https://cloud.google.com/blog/topics/developers-practitioners/how-spanner-and-bigquery-work-together-handle-transactional-and-analytical-workloads",
                  "title": "How Spanner and BigQuery work together to handle transactional and analytical workloads | Google Cloud Blog",
                  "snippetInfo": [
                    {
                      "snippet": "A federated \u003cb\u003equery\u003c/b\u003e might not be as \u003cb\u003efast\u003c/b\u003e as querying local \u003cb\u003eBigQuery tables\u003c/b\u003e. There may be higher latency because of the small wait time for the source \u003cb\u003edatabase\u003c/b\u003e to ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/d7e238f73608a860e00b752ef80e2941",
                  "uri": "https://cloud.google.com/blog/products/databases/cloud-spanner-gets-stronger-with-bigquery-federated-queries",
                  "title": "Cloud Spanner gets stronger with BigQuery-federated queries | Google Cloud Blog",
                  "snippetInfo": [
                    {
                      "snippet": "... \u003cb\u003equick\u003c/b\u003e lookup on \u003cb\u003edata\u003c/b\u003e that's in \u003cb\u003eSpanner\u003c/b\u003e -- you can ... Set up an external \u003cb\u003edata\u003c/b\u003e source for the \u003cb\u003eSpanner\u003c/b\u003e shopping \u003cb\u003edatabase\u003c/b\u003e in \u003cb\u003eBigQuery\u003c/b\u003e. ... The \u003cb\u003equery\u003c/b\u003e is executed in ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/f3d036b60379873acf7c73081c5e5b5c",
                  "uri": "https://cloud.google.com/spanner/docs/performance",
                  "title": "Performance overview | Spanner | Google Cloud",
                  "snippetInfo": [
                    {
                      "snippet": "The information on this page applies to both GoogleSQL and PostgreSQL \u003cb\u003edatabases\u003c/b\u003e. Note: We are in the process of rolling out \u003cb\u003eperformance\u003c/b\u003e and storage changes that ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                ...
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/47b09cb5ad5e3ab3b1eb93d99ecb0896",
                  "uri": "https://cloud.google.com/blog/products/databases/rewe-uses-cloud-spanner-to-optimize-for-speed-and-performance",
                  "title": "REWE uses Cloud Spanner to optimize for speed and performance | Google Cloud Blog",
                  "snippetInfo": [
                    {
                      "snippet": "As a fully managed relational \u003cb\u003edatabase\u003c/b\u003e, \u003cb\u003eSpanner\u003c/b\u003e provides unlimited scale, strong consistency, and up to 99.999% availability. By choosing this approach to ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                }
              ]
            }
          }
        ]
      }
    ]
  },
  "answerQueryToken": "M8gKCwjp_t62BhC7wOFMEiQ2NmQ3YjhhZS0wMDAwLTJhN2ItYjEyYy0wODllMDgyOGU3NjQ"
}
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
  
   
 
Suchen und beantworten (maximale Anzahl von Schritten angeben) 
Der folgende Befehl zeigt, wie Sie die Methode answer  aufrufen und eine generierte Antwort und eine Liste von Suchergebnissen zurückgeben. Die Antwort unterscheidet sich von den vorherigen Antworten, da die Anzahl der Umformulierungsschritte erhöht wurde.
  
  
  
  
  
    
  
  
  REST So suchen Sie und erhalten Ergebnisse mit einer generierten Antwort, die bis zu fünf Umformulierungen ermöglicht:
Führen Sie den folgenden curl-Befehl aus:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /servingConfigs/default_search:answer" \
  -d '{
        "query": { "text": "QUERY "},
        "queryUnderstandingSpec": {
            "queryRephraserSpec": {
                "maxRephraseSteps": MAX_REPHRASE  
             }
         }
      }'
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID QUERY MAX_REPHRASE 5.
  Wenn der Wert nicht festgelegt oder auf einen Wert unter 1 gesetzt ist, wird der Standardwert 1 verwendet.
   
Beispielbefehl  
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://discoveryengine.googleapis.com/v1/projects/my-project-123/locations/global/collections/default_collection/engines/my-app/servingConfigs/default_search:answer" \
  -d '{
        "query": { "text": "How much longer does it take to train a recommendations model than a search model"},
        "queryUnderstandingSpec": {
            "queryRephraserSpec": {
            "maxRephraseSteps": 5 
             }
         }
      }'
        
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
  
   
 
Suchen und Antworten mit Abfrageklassifizierung 
Der folgende Befehl zeigt, wie die Methode answer  aufgerufen wird, um zu prüfen, ob eine Anfrage feindselig ist, nicht auf eine Antwort abzielt oder keines von beidem.
Die Antwort enthält den Klassifizierungstyp für die Anfrage, die Antwort selbst wird jedoch nicht durch die Klassifizierung beeinflusst.
Wenn Sie das Antwortverhalten entsprechend dem Abfragetyp ändern möchten, können Sie dies in der Antwortphase tun. Weitere Informationen finden Sie unter Bösartige Anfragen ignorieren  und Anfragen ignorieren, die nicht auf eine Zusammenfassung abzielen .
  
  
  
  
  
    
  
  
  REST So stellen Sie fest, ob eine Anfrage feindselig ist oder nicht auf eine Antwort abzielt:
Führen Sie den folgenden curl-Befehl aus:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /servingConfigs/default_search:answer" \
  -d '{
        "query": { "text": "QUERY "},
        "queryUnderstandingSpec": {
            "queryClassificationSpec": {
                "types": ["QUERY_CLASSIFICATION_TYPE "] 
             }
         }
      }'
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID QUERY QUERY_CLASSIFICATION_TYPE ADVERSARIAL_QUERY, NON_ANSWER_SEEKING_QUERY oder beide. 
Beispielbefehl und Teilergebnis 
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://discoveryengine.googleapis.com/v1/projects/my-project-123/locations/global/collections/default_collection/engines/my-app/servingConfigs/default_search:answer" \
-d '{
      "query": {
          "text": "Hello!"},
          "queryUnderstandingSpec": {
             "queryClassificationSpec": {
             "types": ["ADVERSARIAL_QUERY", "NON_ANSWER_SEEKING_QUERY"] 
              }
          }
}'
"type": "NON_ANSWER_SEEKING_QUERY",
          "positive": true 
        }
      ]
    }
  },
  "answerQueryToken": "NMwKDAjVloK3BhCdt8u9AhIkNjZkYmFhNWItMDAwMC0yZTBkLTg0ZDAtMDg5ZTA4MmRjYjg0"
}
 In diesem Beispiel ist die Anfrage „Hallo“ nicht feindselig, wird aber als nicht antwortorientiert klassifiziert.
 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
  
   
 
Befehle für die Suchphase: Suchen und antworten mit Optionen für Suchergebnisse 
In diesem Abschnitt erfahren Sie, wie Sie Optionen für den Suchphasenteil des answer -Methodenaufrufs angeben, z. B. das Festlegen der maximalen Anzahl der zurückgegebenen Dokumente, das Verstärken und Filtern, und wie Sie eine Antwort erhalten, wenn Sie Ihre eigenen Suchergebnisse angeben.
Der folgende Befehl zeigt, wie die Methode answer  aufgerufen und verschiedene Optionen für die Rückgabe des Suchergebnisses angegeben werden. Die Suchergebnisse sind unabhängig von der Antwort.
  
  
  
  
  
    
  
  
  REST So legen Sie verschiedene Optionen dafür fest, welche und wie Suchergebnisse zurückgegeben werden:
Führen Sie den folgenden curl-Befehl aus:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /servingConfigs/default_search:answer" \
  -d '{
        "query": { "text": "QUERY "},
          "searchSpec": {
          "searchParams": {
            "maxReturnResults": MAX_RETURN_RESULTS ,
            "filter": "FILTER ",
            "boostSpec": BOOST_SPEC ,
            "orderBy": "ORDER_BY ",
            "searchResultMode": SEARCH_RESULT_MODE 
           }
         }
      }'
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID QUERY MAX_RETURN_RESULTS 10. Der Höchstwert ist 25.FILTER Benutzerdefinierte Suche nach strukturierten oder unstrukturierten Daten filtern .BOOST_SPEC Suchergebnisse optimieren .ORDER_BY Document -Objekt sortiert werden. Beim Ausdruck orderBy wird zwischen Groß- und Kleinschreibung unterschieden.
  Wenn dieses Feld nicht erkannt wird, wird INVALID_ARGUMENT zurückgegeben.SEARCH_RESULT_MODE DOCUMENTS oder CHUNKS. Weitere Informationen finden Sie unter Dokumente parsen und in Chunks aufteilen  und ContentSearchSpec .
  Dieses Feld ist nur in der v1alpha-Version der API verfügbar.
  
   
Beispielbefehl und -ergebnis 
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://discoveryengine.googleapis.com/v1/projects/my-project-123/locations/global/collections/default_collection/engines/my-app/servingConfigs/default_search:answer" \
-d '{
      "query": {
          "text": "Does spanner database have an API?"},
          "searchSpec": {
          "searchParams": { "maxReturnResults": 3 } 
          }
    }'
     In diesem Beispiel ist die Anzahl der zurückgegebenen Dokumente auf drei begrenzt.
 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
  
   
 
Befehle für die Antwortphase 
In diesem Abschnitt wird gezeigt, wie Sie den Methodenaufruf answer
Feindselige und nicht auf Antworten ausgerichtete Anfragen ignorieren 
Der folgende Befehl zeigt, wie Sie beim Aufrufen der Methode answer  vermeiden, auf feindselige Anfragen und Anfragen, die keine Antwort suchen, zu antworten.
  
  
  
  
  
    
  
  
  REST So überspringen Sie die Beantwortung von Anfragen, die feindselig sind oder nicht auf eine Antwort abzielen:
Führen Sie den folgenden curl-Befehl aus:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /servingConfigs/default_search:answer" \
  -d '{
        "query": { "text": "QUERY "},
        "answerGenerationSpec": {
           "ignoreAdversarialQuery": true,
           "ignoreNonAnswerSeekingQuery": true 
        }
      }'
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID QUERY  
Beispielbefehl und Teilergebnis 
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)"
    -H "Content-Type: application/json"
    "https://discoveryengine.googleapis.com/v1/projects/my-project-123/locations/global/collections/default_collection/engines/my-app/servingConfigs/default_search:answer" \
    -d '{
      "query": { "text": "Hello"},
      "answerGenerationSpec": {
          "ignoreAdversarialQuery": true ,
          "ignoreNonAnswerSeekingQuery": true  }
        }'
        A summary could not be generated for your search query. Here are some search results. ",
    "steps": [
      {
        "state": "SUCCEEDED",
        "description": "Rephrase the query and search.",
        "actions": [
          {
            "searchAction": {
              "query": "Hello"
            },
            "observation": {
              "searchResults": [
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/69e92e5b1de5b1e583fbe95f94dd4cbf",
                  "uri": "https://support.google.com/voice/thread/152245405/google-voice-is-randomly-automatically-sending-hello-replies-to-incoming-texts?hl=en",
                  "title": "Google voice is randomly/automatically sending \"Hello!\" replies to incoming texts",
                  "snippetInfo": [
                    {
                      "snippet": "There IS a new "Smart reply" feature on the Android or iOS client apps, but you'd have to a) receive a SMS/MMS, b) open it up, c) look at the three suggested ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/16d65e2af7fa854d1a00995525646dc3",
                  "uri": "https://support.google.com/voice/thread/112990484/google-voice-sending-hello-in-response-to-text-messages?hl=en",
                  "title": "Google Voice sending \"Hello,\" in response to text messages",
                  "snippetInfo": [
                    {
                      "snippet": "When I receive text messages, a reply is instantly sent out reading "\u003cb\u003eHello\u003c/b\u003e," and I cannot figure out how this is happening. I have no linked accounts, ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/b3bdde4957f588a1458c533269626d09",
                  "uri": "https://support.google.com/voice/thread/4307458/lately-an-automatic-text-response-saying-hello-is-going-out-how-do-i-stop-this?hl=en",
                  "title": "Lately an automatic text response saying, \"Hello\" is going out. How do I stop this? - Google Voice Community",
                  "snippetInfo": [
                    {
                      "snippet": "You need to find out what app is causing it and deactivate or delete it. Last edited Apr 16, 2019.",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                ...
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/a828eb8f442f1dfbdda06dbeb52841b0",
                  "uri": "https://support.google.com/a/thread/161821861/hello-hello-the-lost-phone?hl=en",
                  "title": "Hello.Hello the lost phone - Google Workspace Admin Community",
                  "snippetInfo": [
                    {
                      "snippet": "\u003cb\u003eHello\u003c/b\u003e the lost phone. My wife lost her phone but she cannot remember her emails pasward to help track .",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                }
              ]
            }
          }
        ]
      }
    ],
    "answerSkippedReasons": [
      "NON_ANSWER_SEEKING_QUERY_IGNORED" 
    ]
  },
  "answerQueryToken": "NMwKDAjFgN-2BhDlsKaZARIkNjZkN2I0NmItMDAwMC0yZmQ5LTkwMDktZjQwMzA0M2E5YTg4"
}
 In diesem Beispiel wird die Anfrage als nicht antwortorientiert eingestuft und es wird keine Antwort generiert.
 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
  
   
 
Nur relevante Antworten anzeigen 
Vertex AI Search kann bewerten, wie relevant die Ergebnisse für eine Anfrage sind. Wenn keine Ergebnisse als ausreichend relevant eingestuft werden, können Sie anstelle einer Antwort, die auf nicht relevanten oder nur minimal relevanten Ergebnissen basiert, eine Fallback-Antwort zurückgeben: „We do not have a summary for your query.“.
Der folgende Befehl zeigt, wie die Fallback-Antwort zurückgegeben wird, wenn beim Aufrufen der Methode answer  irrelevante Ergebnisse zurückgegeben werden.
  
  
  
  
  
    
  
  
  REST So geben Sie eine Fallback-Antwort zurück, wenn keine relevanten Ergebnisse gefunden werden:
Führen Sie den folgenden curl-Befehl aus:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /servingConfigs/default_search:answer" \
  -d '{
        "query": { "text": "QUERY "},
        "answerGenerationSpec": {
           "ignoreLowRelevantContent": true 
        }
      }'
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID QUERY  
Beispielbefehl und -ergebnis 
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://discoveryengine.googleapis.com/v1/projects/my-project-123/locations/global/collections/default_collection/engines/my-app/servingConfigs/default_search:answer" \
-d '{"query": { "text": "foobar"}, "answerGenerationSpec": {
       "ignoreLowRelevantContent": true 
    } }'
    "answerText": "We do not have a summary for your query.", 
    "steps": [
      {
        "state": "SUCCEEDED",
        "description": "Rephrase the query and search.",
        "actions": [
          {
            "searchAction": {
              "query": "foobar"
            },
            "observation": {
              "searchResults": [
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/719b79786f0c143717c569eade5305d9",
                  "uri": "https://support.google.com/websearch/thread/261714267/google-foobar-bug-console-disappeared?hl=en",
                  "title": "Google Foobar Bug - Console Disappeared",
                  "snippetInfo": [
                    {
                      "snippet": "Google \u003cb\u003eFoobar\u003c/b\u003e Bug - Console Disappeared. After I logged in today the top bar says "The \u003cb\u003eFoobar\u003c/b\u003e Challenge will be turned down on 1 April 2024. If you run out of ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/932369826585ff45f6ab3eba01ba6933",
                  "uri": "https://support.google.com/websearch/thread/95251114/unable-to-contact-foobar-recruiter?hl=en",
                  "title": "Unable to contact Foobar Recruiter - Google Search Community",
                  "snippetInfo": [
                    {
                      "snippet": "Access is by invitation only so you will need to have the proper credentials to login. You can always reach out using the contact us button, but there is no ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/fb736a30ff90d058be755f0a04a522a8",
                  "uri": "https://support.google.com/websearch/thread/121151780/foobar-challenge-appeared-to-me-then-disappeared?hl=en",
                  "title": "Foobar challenge appeared to me then disappeared - Google Search Community",
                  "snippetInfo": [
                    {
                      "snippet": "Hi. I got the \u003cb\u003efoobar\u003c/b\u003e challenge some months ago. But then it disappeared immediately, maybe by misclick (though I don't think I misclicked).",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                ...
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/f56f2656b0d02b839509d0e67e60c1c9",
                  "uri": "https://support.google.com/chrome/thread/159931759/cannot-access-google-foobar-challenge?hl=en",
                  "title": "Cannot Access Google FooBar Challenge",
                  "snippetInfo": [
                    {
                      "snippet": "I knew I wouldn't have time for it today, so I just kept the tab in the background. Tonight, I went to go close all my tabs, but the page had changed. It said " ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                }
              ]
            }
          }
        ]
      }
    ],
    "answerSkippedReasons": [
      "NO_RELEVANT_CONTENT"
    ]
  },
  "answerQueryToken": "M8gKCwiokvy2BhDtv8EDEiQ2NmQ5NDQxZC0wMDAwLTIxMGQtOWU2Yi1mNDAzMDQ1ZGJkMzA"
}
 In diesem Beispiel wurden die Ergebnisse als nicht ausreichend relevant für die Anfrage eingestuft. Daher wurde die Fallback-Antwort anstelle einer generierten Antwort und Ergebnisse zurückgegeben.
 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
  
   
 
Fundierungsunterstützungswerte zurückgeben 
Der folgende Befehl zeigt, wie Sie die Grounding-Support-Werte für Antworten und Behauptungen zurückgeben.
Allgemeine Informationen zur Fundierung in Vertex AI finden Sie unter Fundierung mit RAG prüfen . Die Methode groundingConfigs.check
  
  
  
  
  
    
  
  
  REST So geben Sie für jede Behauptung (Satz in der Antwort) einen Support-Score und einen aggregierten Support-Score für die Antwort zurück:
Führen Sie den folgenden curl-Befehl aus:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /servingConfigs/default_search:answer" \
  -d '{
        "query": { "text": "QUERY "},
        "groundingSpec": {
           "includeGroundingSupports": true,
        }
      }'
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID QUERY  
Beispielbefehl und Teilergebnis 
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)"
-H "Content-Type: application/json"
"https://discoveryengine.googleapis.com/v1/projects/123456/locations/global/collections/default_collection/engines/my-app/servingConfigs/default_search:answer"
-d '{
    "query": { "text": "What is SQL?"},
    "groundingSpec": {
       "includeGroundingSupports": true,
    }
  }'
            "groundingScore": 0.9 
    "groundingCheckRequired": true
  },
  {
    "startIndex": "42",
    "endIndex": "144",
    "sources": [
      {
        "referenceId": "1"
      }
    ]
    "groundingScore": 0.8 
    "groundingCheckRequired": true
  },
  {
    "startIndex": "267",
    "endIndex": "342",
    "sources": [
      {
        "referenceId": "2"
      }
    ]
    "groundingScore": 0.6 
    "groundingCheckRequired": true
  }
],
"references": [
  {
    "chunkInfo": {
      "content": "There are a lot of Databases available in the market such as MS Access, Oracle and many others.For you to write programs that interact with these databases easily, there has to be a way where you could get information from all these databases using the same method.For this purpose SQL was developed.It is a kind of language (simple when compared to the likes of C or C++) which enables you to ask all your queries to a database without bothering about the exact type of database.When you use this Query the database engine would first find the table called people.Then it would find a column called firstname.Next it would compare all the values in that column with 'Reena'.Finally it would return all the details wherever it finds a match for the firstname.When you write a database program in VC++ or Java or any other language for that matter, you would make a database connection to your database and then you would query the database using SQL queries.When you query the database with any SQL query the database returns a recordset.A recordset is basically a set of records (all the entries that your query returns).This recordset is received in your program and all languages have a data structure which represents a recordset.",
      "documentMetadata": {
        "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/d993d922043374f5ef7ba297c158b106",
        "uri": "gs://my-bucket-123/documents/058dee0ec23a3e92f9bfd7cd29840e8f.txt"
        "structData": {
          "fields": [
            {
              "key": "cdoc_url"
              "value": { "stringValue": "058dee0ec23a3e92f9bfd7cd29840e8f" }
            },
            {
              "key": "doc_id"
              "value": { "stringValue": "d993d922043374f5ef7ba297c158b106" }
            }
          ]
        }
      }
    }
  },
  {
    "chunkInfo": {
      "content": "The Structured Query Language (SQL) is a database management programming language.SQL is a tool for accessing databases, and more specifically, relational databases, and can be used with different database products.This chapter will prepare you to learn basic database management using this language.SQLite – To implement SQL as a library, you need SQLite.SQLite is intended to provide users and programs a way to store data using a SQL interface within the program.SQLite3 can be used to manipulate SQLite databases for major Linux distros.SQL is used to access relational databases.Each database contains more or less tables which in turn contain more or less rows and columns.Hereby a single row is seen as a separate object with features represented by the tables' columns.To access a table's data you first have to connect to its database.With the same table, the query SELECT * FROM T WHERE C1 = 1 will result in all the elements of all the rows where the value of column C1 is '1' being shown.A WHERE clause specifies that a SQL statement should only affect rows that meet specified criteria.The criteria are expressed in the form of predicates.WHERE clauses are not mandatory clauses of SQL statements, but should be used to limit the number of rows affected by a SQL DML statement or returned by a query.",
      "documentMetadata": {
        "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/3825eac51ef9e934bbc558faa42f4c71",
        "uri": "gs://my-bucket-123/documents/26f5872b0719790cb966a697bfa1ea27.txt"
        "structData": {
          "fields": [
            {
              "key": "cdoc_url"
              "value": { "stringValue": "26f5872b0719790cb966a697bfa1ea27" }
            },
            {
              "key": "doc_id"
              "value": { "stringValue": "3825eac51ef9e934bbc558faa42f4c71" }
            }
          ]
        }
      }
    }
  },
  {
    "chunkInfo": {
      "content": "This chapter focuses on using Paradox as a client/server development tool.It does not talk about connecting; it is assumed you have already connected.If you are having trouble connecting to a particular SQL server, then refer to the Connection Guide for that particular server.This chapter does review what a user can do interactively with Paradox and how to use ObjectPAL with SQL servers.Structured Query Language (SQL) was developed to create a standard for accessing database information.The ANSI standard for SQL allows a user to become familiar with the commands needed to query many different types of data.After you learn ANSI SQL, you then can query many different databases.Is SQL a solid standard?Yes and no.Yes, the core ANSI SQL commands are solid and consistent from vendor to vendor.Every vendor, however, adds capability to its version of SQL.These improvements are expected because ANSI SQL does not go far enough to cover every feature of every high-end DBMS.The SQL standard is used by many companies for their high-end products.They include Oracle, Sybase, Microsoft SQL, Informix, and Interbase.Paradox also provides the capability to use standard ANSI SQL commands on local Paradox and dBASE tables.Although SQL by definition is a standard, various flavors are on the market.",
      "documentMetadata": {
        "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/b3e88db8676b87b99af1e6ecc7d8757f",
        "uri": "gs://my-bucket-123/documents/073c21335d37d8d14982cb3437a721c0.txt"
        "structData": {
          "fields": [
            {
              "key": "cdoc_url"
              "value": { "stringValue": "073c21335d37d8d14982cb3437a721c0" }
            },
            {
              "key": "doc_id"
              "value": { "stringValue": "b3e88db8676b87b99af1e6ecc7d8757f" }
            }
          ]
        }
      }
    }
  }
],
...
"steps": [
  {
    "state": "SUCCEEDED",
    "description": "Rephrase the query and search.",
    "actions": [
      {
        "searchAction": {
          "query": "What is SQL?"
        },
        "observation": {
          "searchResults": [
            {
              "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/d993d922043374f5ef7ba297c158b106",
              "uri": "gs://my-bucket-123/documents/058dee0ec23a3e92f9bfd7cd29840e8f.txt",
              "chunkInfo": [
                {
                  "content": "There are a lot of Databases available in the market such as MS Access, Oracle and many others.For you to write programs that interact with these databases easily, there has to be a way where you could get information from all these databases using the same method.For this purpose SQL was developed.It is a kind of language (simple when compared to the likes of C or C++) which enables you to ask all your queries to a database without bothering about the exact type of database.When you use this Query the database engine would first find the table called people.Then it would find a column called firstname.Next it would compare all the values in that column with 'Reena'.Finally it would return all the details wherever it finds a match for the firstname.When you write a database program in VC++ or Java or any other language for that matter, you would make a database connection to your database and then you would query the database using SQL queries.When you query the database with any SQL query the database returns a recordset.A recordset is basically a set of records (all the entries that your query returns).This recordset is received in your program and all languages have a data structure which represents a recordset."
                }
              ]
            },
            {
              "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/3825eac51ef9e934bbc558faa42f4c71",
              "uri": "gs://my-bucket-123/documents/26f5872b0719790cb966a697bfa1ea27.txt",
              "chunkInfo": [
                {
                  "content": "The Structured Query Language (SQL) is a database management programming language.SQL is a tool for accessing databases, and more specifically, relational databases, and can be used with different database products.This chapter will prepare you to learn basic database management using this language.SQLite – To implement SQL as a library, you need SQLite.SQLite is intended to provide users and programs a way to store data using a SQL interface within the program.SQLite3 can be used to manipulate SQLite databases for major Linux distros.SQL is used to access relational databases.Each database contains more or less tables which in turn contain more or less rows and columns.Hereby a single row is seen as a separate object with features represented by the tables' columns.To access a table's data you first have to connect to its database.With the same table, the query SELECT * FROM T WHERE C1 = 1 will result in all the elements of all the rows where the value of column C1 is '1' being shown.A WHERE clause specifies that a SQL statement should only affect rows that meet specified criteria.The criteria are expressed in the form of predicates.WHERE clauses are not mandatory clauses of SQL statements, but should be used to limit the number of rows affected by a SQL DML statement or returned by a query."
                }
              ]
            },
            {
              "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/b3e88db8676b87b99af1e6ecc7d8757f",
              "uri": "gs://my-bucket-123/documents/073c21335d37d8d14982cb3437a721c0.txt",
              "chunkInfo": [
                {
                  "content": "This chapter focuses on using Paradox as a client/server development tool.It does not talk about connecting; it is assumed you have already connected.If you are having trouble connecting to a particular SQL server, then refer to the Connection Guide for that particular server.This chapter does review what a user can do interactively with Paradox and how to use ObjectPAL with SQL servers.Structured Query Language (SQL) was developed to create a standard for accessing database information.The ANSI standard for SQL allows a user to become familiar with the commands needed to query many different types of data.After you learn ANSI SQL, you then can query many different databases.Is SQL a solid standard?Yes and no.Yes, the core ANSI SQL commands are solid and consistent from vendor to vendor.Every vendor, however, adds capability to its version of SQL.These improvements are expected because ANSI SQL does not go far enough to cover every feature of every high-end DBMS.The SQL standard is used by many companies for their high-end products.They include Oracle, Sybase, Microsoft SQL, Informix, and Interbase.Paradox also provides the capability to use standard ANSI SQL commands on local Paradox and dBASE tables.Although SQL by definition is a standard, various flavors are on the market."
                }
              ]
            },
...
            {
              "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/3dd4014e41044c5dd6a0fe380847f369",
              "uri": "gs://my-bucket-123/documents/76245cb33a66f4fbd9030a2a11eea00d.txt",
              "chunkInfo": [
                {
                  "content": "SQL injection is a code injection technique that might destroy your database.You can read more here OWASP sql injection testing sheet.Description: SQL injection ( second order) SQL injection vulnerabilities arise when user- controllable data is incorporated sheet into database SQL queries in an unsafe manner.This sheet cheat wiki assumes you have a basic understanding of SQL injection, please go here for an introduction if you are unfamiliar.Bypass login page with sql SQL injection [ closed].Gone are the days when knowledge sheet of just sql SQL Injection or XSS could help you land a lucrative high- paying InfoSec job.There is many sheet differnet variations you would login have probably have to try to make this exploit work ( sql especially if it is sql a blind SQL exploit).SQL injection usually occurs when you ask a user for input, like their.ゲストブック/ コメントの例.Submit Text Post.Get an ad- free experience with special benefits, and directly support Reddit.get reddit premium.SQL Injection Cheat.Many web applications have an authentication system: a user provides a user name and password, the web application checks them and stores the corresponding user id in the session hash.Login # 1 Login # 2 Login # 3 Login # 4."
                }
              ]
            }
          ]
        }
      }
    ]
  }
]
}
}
 In diesem Beispiel wird für jede Quellenangabe ein Support-Score („groundingScore“) zurückgegeben.
 
  
  
  
  
  
  
  
  
  
  
  
  
   
 
Nur fundierte Antworten anzeigen 
Der folgende Befehl zeigt, wie nur die Antworten zurückgegeben werden, die als gut fundiert im Korpus , den Informationen im Datenspeicher, gelten.
Schlecht fundierte Antworten werden herausgefiltert.
Sie legen einen niedrigen oder hohen Schwellenwert für den Score für die Fundierung fest. Die Antwort wird nur zurückgegeben, wenn sie dieses Niveau erreicht oder übertrifft. Sie können mit den beiden Filtergrenzwerten und ohne Grenzwert experimentieren, um herauszufinden, welche Filterstufe wahrscheinlich die besten Ergebnisse für Ihre Nutzer liefert.
Allgemeine Informationen zur Fundierung in Vertex AI finden Sie unter Fundierung mit RAG prüfen . Die Methode groundingConfigs.check
  
  
  
  
  
    
  
  
  REST Wenn Sie eine Antwort nur zurückgeben möchten, wenn sie einen bestimmten Support-Score-Grenzwert erreicht, gehen Sie so vor:
Führen Sie den folgenden curl-Befehl aus:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /servingConfigs/default_search:answer" \
  -d '{
        "query": { "text": "QUERY "},
        "groundingSpec": {
           "filteringLevel": "FILTER_LEVEL "
        }
      }'
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID QUERY FILTER_LEVEL FILTERING_LEVEL_LOW und FILTERING_LEVEL_HIGH. Wenn filteringLevel nicht enthalten ist, wird kein Support-Score-Filter auf die Antwort angewendet.
   
Beispielbefehl und Teilergebnis 
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://discoveryengine.googleapis.com/v1/projects/123456/locations/global/collections/default_collection/engines/my-app/servingConfigs/default_search:answer" \
-d '{
    "query": { "text": "When can an NCD be made?"},
    "groundingSpec": {
       "filtering_level": "FILTERING_LEVEL_HIGH"
    }
  }'
  answer_text: "We do not have a summary for your query." 
      steps {
        state: SUCCEEDED
        description: "Rephrase the query and search."
        actions {
          search_action {
            query: "test?"
          }
          observation {
            search_results {
              document: "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/f7f5cfde02"
              uri: "gs://my-bucket-123/data/CoverageDocumentation.pdf"
              title: "ABC345_0101"
              chunk_info {
                content: "This notice implements part of section 731 of the Medicare Prescription Drug, Improvement, and Modernization Act of 2003 by describing a method of developing, and making available to the public, guidance documents under the Medicare program… "
              }
    ...
            search_results {
              document: "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/f7f5cfde02"
              uri: "gs://my-bucket-123/data/CoverageDocumentation.pdf"
              title: "ABC345_0101"
              chunk_info {
                content: "For the purposes of this notice, the term guidance documents means documents prepared for our staff, potential requestors of National Coverage Determinations, and other interested parties explaining the NCD process… "
              }
            }
          }
        }
      }
      answer_skipped_reasons: LOW_GROUNDED_CONTENT 
    }
 In diesem Beispiel wird keine Antwort zurückgegeben, da der hohe Schwellenwert nicht erreicht wurde.
 
  
  
  
  
  
  
  
  
  
  
  
  
   
 
Antwortmodell angeben 
Der folgende Befehl zeigt, wie Sie die Modellversion ändern, die zum Generieren von Antworten verwendet wird.
Informationen zu den unterstützten Modellen finden Sie unter Modellversionen und Lebenszyklus für die Antwortgenerierung .
  
  
  
  
  
    
  
  
  REST So generieren Sie eine Antwort mit einem anderen Modell als dem Standardmodell:
Führen Sie den folgenden curl-Befehl aus:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /servingConfigs/default_search:answer" \
  -d '{
        "query": { "text": "QUERY "},
        "answerGenerationSpec": {
           "modelSpec": {
              "modelVersion": "MODEL_VERSION ",
           }
         }
      }'
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID QUERY MODEL_VERSION Modellversionen und Lebenszyklus für die Antwortgenerierung .
   
Beispielbefehl und Teilergebnis 
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://discoveryengine.googleapis.com/v1/projects/my-project-123/locations/global/collections/default_collection/engines/my-app/servingConfigs/default_search:answer" \
-d '{"query": { "text": "Compare bigquery with spanner database?"},   "answerGenerationSpec": {
     "modelSpec": {
     "modelVersion": "preview", 
     }
   } }'
    In diesem Beispiel wird die Vorschauversion des Modells anstelle des Standardmodells verwendet.
 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
  
   
 
Benutzerdefinierte Präambel angeben 
Der folgende Befehl zeigt, wie Sie eine Präambel für die generierte Antwort festlegen. Eine Präambel enthält Anweisungen in natürlicher Sprache zum Anpassen der Antwort. Sie können Anpassungen wie Länge, Detaillierungsgrad, Ausgabestil (z. B. „einfach“), Ausgabesprache, Fokus der Antwort und Format (z. B. Tabellen, Aufzählungszeichen und XML) anfordern. Ein Beispiel für eine Präambel ist „Erkläre es, als wärst du ein zehnjähriges Kind.“
Die Präambel kann sich erheblich auf die Qualität der generierten Antwort auswirken. Informationen dazu, was Sie in Präambeln schreiben sollten, und Beispiele für gute Präambeln finden Sie unter Benutzerdefinierte Präambeln .
  
  
  
  
  
    
  
  
  REST So generieren Sie eine Antwort mit einem anderen Modell als dem Standardmodell:
Führen Sie den folgenden curl-Befehl aus:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /servingConfigs/default_search:answer" \
  -d '{
        "query": { "text": "QUERY "},
        "answerGenerationSpec": {
           "promptSpec": {
               "preamble": "PREAMBLE ",
           }
        }
      }'
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID QUERY PREAMBLE show the answer format in
  an ordered list oder give a very detailed answer.
   
Beispielbefehl und -ergebnis 
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)"
    -H "Content-Type: application/json"
    "https://discoveryengine.googleapis.com/v1/projects/my-project-123/locations/global/collections/default_collection/engines/my-app/servingConfigs/default_search:answer" \
    -d '{
          "query": { "text": "what is bigquery?"},
          "answerGenerationSpec": {
             "promptSpec": {
                "preamble": "Explain like you are a ten years old
                kid ",
     }
  }
}'
BigQuery is like a super-powered storage space for your data, but it's in the cloud, not on your computer. It's like a giant warehouse for all your information, but you don't have to build or manage it yourself. You can use BigQuery to find patterns and insights in your data, like figuring out what people like to buy or how many people visited your website. It's like having a super-smart assistant that can help you understand your data better. BigQuery is really good at working with lots of data, even billions of pieces of information. \n",
    "steps ": [
      {
        "state": "SUCCEEDED",
        "description": "Rephrase the query and search.",
        "actions": [
          {
            "searchAction": {
              "query": "What is BigQuery?"
            },
            "observation": {
              "searchResults": [
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/2d032dc582689e8c0ecea7fc7bfa3189",
                  "uri": "https://cloud.google.com/bigquery",
                  "title": "BigQuery enterprise data warehouse | Google Cloud",
                  "snippetInfo": [
                    {
                      "snippet": "\u003cb\u003eBigQuery\u003c/b\u003e is a fully managed, AI-ready data analytics platform that helps you maximize value from your data and is designed to be multi-engine, multi-format, ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/4474f4a5a18ecd611dedfe323dfe55d9",
                  "uri": "https://cloud.google.com/bigquery/docs/introduction",
                  "title": "BigQuery overview | Google Cloud",
                  "snippetInfo": [
                    {
                      "snippet": "\u003cb\u003eBigQuery\u003c/b\u003e is a fully managed, AI-ready data platform that helps you manage and analyze your data with built-in features like machine learning, search, ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/c840fdef90d86328f13bbedbdbf0ac10",
                  "uri": "https://cloud.google.com/bigquery/docs/query-overview",
                  "title": "Overview of BigQuery analytics | Google Cloud",
                  "snippetInfo": [
                    {
                      "snippet": "\u003cb\u003eBigQuery\u003c/b\u003e lets you save queries and share queries with others. When you save a query, it can be private (visible only to you), shared at the project level ( ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
...
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/5cbfab8ce1d5f6ffe45fef22900c9a00",
                  "uri": "https://cloud.google.com/curated-resources/bigquery",
                  "title": "Guides BigQuery | Google Cloud",
                  "snippetInfo": [
                    {
                      "snippet": "\u003cb\u003eBigQuery\u003c/b\u003e is Google Cloud's fully managed and serverless enterprise data warehouse solution, designed to help you make informed decisions quickly, so you can ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                }
              ]
            }
          }
        ]
      }
    ]
  },
  "answerQueryToken": "NMwKDAi8hN-2BhC0jMCPARIkNjZkN2I4MzItMDAwMC0yMTliLTkxN2EtMDg5ZTA4MjA0YjFj"
}
 In diesem Beispiel wird in der Präambel eine einfachere Antwort angefordert, als standardmäßig bereitgestellt wird.
 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
  
   
 
Bei der Antwortmethode können ähnliche Fragen vorgeschlagen werden, die Ihre Nutzer auswählen können, anstatt eigene Fragen einzugeben. Wenn Sie beispielsweise fragen: „Wann ist die beste Reisezeit für Mexiko?“, kann die Antwortmethode nicht nur Ihre Frage beantworten, sondern auch andere Fragen vorschlagen, die Sie stellen könnten, z. B. „In welchem Monat ist eine Reise nach Mexiko am günstigsten?“ und „Wann ist in Mexiko Hauptsaison?“.
Wenn Sie ähnliche Fragen erhalten möchten, müssen Sie sie in jeder Anfrage angeben. Sie werden als String-Array in der Antwort zurückgegeben.
Hinweise 
Achten Sie darauf, dass Sie erweiterte LLM-Funktionen  für die App aktiviert haben.
Prozedur 
Der folgende Befehl zeigt, wie Sie anfordern, dass der Antwort ähnliche Fragen beigefügt werden.
  
  
  
  
  
    
  
  
  REST So erhalten Sie ähnliche Fragen mit einer generierten Antwort:
Führen Sie den folgenden curl-Befehl aus:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /servingConfigs/default_search:answer" \
  -d '{
        "query": { "text": "QUERY "},
        "relatedQuestionsSpec": { "enable": true }
      }'
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID QUERY  
Beispielbefehl und Teilergebnis 
curl -X POST \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/123456/locations/global/collections/default_collection/engines/my-app/servingConfigs/default_search:answer" \
  -d '{
        "query": { "text": "what kinds of data can I import into Vertex AI Search?"},
        "session": "projects/123456/locations/global/collections/default_collection/engines/my-app/sessions/10291252835232308789",
        "searchSpec":{ "searchParams": {"filter": ""} },
        "relatedQuestionsSpec": { "enable": true }
}'
"relatedQuestions": [
      "Can you provide examples of structured data formats?",
      "What file types are supported for unstructured data?",
      "How does website data ingestion work?",
      "What are the limitations of healthcare data import?",
      "Is there a size limit for importing data?"
    ], 
    ...
  }
}
 In diesem Beispiel ist das Feld enabled im Objekt relatedQuestionsSpec auf true gesetzt und die Antwort enthält zugehörige Fragen im Array relatedQuestions.
  
  
 
  
  
  
  
  
  
  
  
  
  
   
 
Zitationen einfügen 
Der folgende Befehl zeigt, wie Sie anfordern, dass Zitationen in die Antwort aufgenommen werden.
Hinweis  :Die Werte startIndex und endIndex für Zitationsmetadaten, die in der Antwort zurückgegeben werden, werden in UTF-8-Unicode-Bytes und nicht in Zeichen gemessen.
Wenn es Multibyte-Zeichen gibt, ist die Indexmessung länger als die Stringlänge. 
  
  
  
  
  
    
  
  
  REST So generieren Sie eine Antwort mit einem anderen Modell als dem Standardmodell:
Führen Sie den folgenden curl-Befehl aus:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /servingConfigs/default_search:answer" \
  -d '{
        "query": { "text": "QUERY "},
        "answerGenerationSpec": {
           "includeCitations": INCLUDE_CITATIONS 
        }
      }'
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID QUERY INCLUDE_CITATIONS false.
   
Beispielbefehl und Teilergebnis 
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://discoveryengine.googleapis.com/v1/projects/my-project-123/locations/global/collections/default_collection/engines/my-app/servingConfigs/default_search:answer" \
-d '{"query": { "text": "What is SQL"},   "answerGenerationSpec": {
    "includeCitations": true
}
}'
"citations": [
      {
        "endIndex": "137",
        "sources": [
          {
            "referenceId": "0"
          },
          {
            "referenceId": "1"
          }
        ]
      },
      {
        "startIndex": "138",
        "endIndex": "437",
        "sources": [
          {
            "referenceId": "3"
          }
        ]
      },
      {
        "startIndex": "438",
        "endIndex": "575",
        "sources": [
          {
            "referenceId": "2"
          }
        ]
      },
      {
        "startIndex": "576",
        "endIndex": "742",
        "sources": [
          {
            "referenceId": "3"
          }
        ]
      }
    ],
    "references": [
      {
        "chunkInfo": {
          "content": "There may be a second table that stores visit information. A relational database uses a unique ID for each row to maintain the linked patient information across the two tables. This way, you can quickly look up the visits of each patient. Sign up for a free trial for any of Google Cloud's SQL databases, which include AlloyDB, Cloud SQL, and Spanner. Get started for free What is SQL? SQL (Structured Query Language) is a programming language used to store, retrieve, and manage data in a relational database. SQL statements are English-like, making the language accessible to software developers, data analysts, and other practitioners. Benefits of SQL databases Enterprises choose SQL databases for being: Efficient. Relational databases are incredibly efficient in managing complex queries. Fast. SQL databases can retrieve large amounts of data, quickly. This makes them highly desirable for real-time transactional data. Reliable. SQL databases provide a high degree of data integrity and are ACID-compliant. SQL database engines There are numerous SQL database engines (products) used to build software applications. Some of the most popular include PostgreSQL, MySQL, SQL Server, and Oracle. Some database engines are open source while others are commercial offerings. ",
          "relevanceScore": 0.9,
          "documentMetadata": {
            "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/7218ff4f57328d86059246d4af3a9953",
            "uri": "https://cloud.google.com/discover/what-are-sql-databases",
            "title": "SQL Databases | Google Cloud"
          }
        }
      },
      {
        "chunkInfo": {
          "content": "PostgreSQL vs. SQL Server: What's the difference? | Google Cloud Page Contents Topics PostgreSQL vs. SQL PostgreSQL vs SQL Server: What are the key differences? Trying to find the right database for your applications? When it comes to choosing a database technology, the most common SQL options to consider are PostgreSQL vs. SQL Server. While both systems share many core features, there are some key differences—the major one being that PostgreSQL is open source and SQL Server is owned by Microsoft. Today, it is more vital than ever for companies to be able to manage, store, and activate data for modern business operations. With the growing assortment of databases available to choose from, it can be overwhelming to pick the right one for your applications. The most important thing to remember is that no single database will be a good match for every project requirement, so it's critical to understand the option that will work best for your specific use case. So, what is PostgreSQL vs. SQL Server? In this short guide, we'll discuss the basic differences between PostgreSQL and SQL Server. Get started for freeStay informed What is SQL? Structured Query Language or SQL, as it's more commonly known, is a programming language used to manage, query, and retrieve data in a relational database. ",
          "relevanceScore": 0.8,
          "documentMetadata": {
            "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/f7cd9afab1282a9f57cdcee1885bb4c6",
            "uri": "https://cloud.google.com/learn/postgresql-vs-sql",
            "title": "PostgreSQL vs. SQL Server: What's the difference? | Google Cloud"
          }
        }
      },
      {
        "chunkInfo": {
          "content": "SQL Databases | Google Cloud Page Contents Topics What are SQL databases? What are SQL databases? A SQL database, also known as a relational database, is a system that stores and organizes data into highly structured tables of rows and columns. These databases offer Structured Query Language (SQL) to read and write the data, and are categorized as relational database management systems (RDBMS). SQL statements are used to create and update the structure of tables, read and write data, manage user permissions, and perform administrative tasks. For example, a CREATE statement is used to create a table, an INSERT statement adds a new row to a table, and a SELECT statement performs a database query. Statements that make structural or administrative changes are usually reserved for software developers and administrators, while read and write operations are performed by end-user applications. A relational database maintains the ability to link information across multiple tables. This format makes it easy to quickly gain insights about the relationships between various columns or data points in these tables. A relational database can create indexes for particular columns for faster lookups. For example, a healthcare facility might maintain a table containing rows of patient information, where each row is one patient and the columns contain data points, such as the patient's name, insurance information, and contact details. ",
          "relevanceScore": 0.8,
          "documentMetadata": {
            "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/7218ff4f57328d86059246d4af3a9953",
            "uri": "https://cloud.google.com/discover/what-are-sql-databases",
            "title": "SQL Databases | Google Cloud"
          }
        }
      },
      {
        "chunkInfo": {
          "content": "It is the standard language used by relational database management systems (RDBMS), including PostgreSQL, SQL Server, MySQL, and Oracle Database. SQL typically uses commands written in statement format for queries and other database operations, which allow users to manipulate data in relational database tables. While originally created for relational databases, SQL acts as a foundation for many of today's technology capabilities, making SQL knowledge an essential skill for many technology roles today, including data analysts, database engineers, and even backend programming. However, you will find that there are different variants of SQL depending on the database or database management system that you choose. What is Microsoft SQL Server? SQL Server is a leading RDBMS that is built on top of SQL and developed by Microsoft. It is used to manage and store data to support numerous enterprise use cases for business intelligence, transaction processing, data analytics, and machine learning services. SQL Server has a row-based table structure that allows you to connect related data elements from different tables without having to store data multiple times in a database. In general, Microsoft SQL Server is known for its high availability, fast performance when handling large workloads, and easy integration with other applications to gain business intelligence across your entire data estate. For more information, we recommend reviewing the official SQL Server documentation. ",
          "relevanceScore": 0.8,
          "documentMetadata": {
            "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/f7cd9afab1282a9f57cdcee1885bb4c6",
            "uri": "https://cloud.google.com/learn/postgresql-vs-sql",
            "title": "PostgreSQL vs. SQL Server: What's the difference? | Google Cloud"
          }
        }
      },
      {
        "chunkInfo": {
          "content": "Send feedback The GoogleSQL language in Spanner bookmark_borderbookmark Stay organized with collections Save and categorize content based on your preferences. Dismiss Got it GoogleSQL is the new name for Google Standard SQL! New name, same great SQL dialect. This page provides an overview of supported statements in GoogleSQL. GoogleSQL is an ANSI compliant Structured Query Language (SQL) which includes the following types of supported statements: Query statements, also known as Data Query Language (DQL) statements, are the primary method to analyze data in Spanner. They scan one or more tables or expressions and return the computed result rows. Data Definition Language (DDL) statements let you create and modify database objects such as tables, views, and database roles. Data Manipulation Language (DML) statements enable you to update, insert, and delete data from your Spanner tables. Data Access Control statements let you grant and revoke access privileges at the table and column level. Transaction Control statements allow you to manage transactions for data modifications. Was this helpful? Send feedback Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. ",
          "relevanceScore": 0.7,
          "documentMetadata": {
            "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/0c5c094170756eeb6bdfec6eb5c7d081",
            "uri": "https://cloud.google.com/spanner/docs/reference/standard-sql/overview",
            "title": "The GoogleSQL language in Spanner | Google Cloud"
          }
        }
      },
      {
        "chunkInfo": {
          "content": "FAQ Expand all What is Cloud SQL? Cloud SQL is a service that delivers fully managed relational databases in the cloud. It offers MySQL, PostgreSQL, and SQL Server database engines. How is Cloud SQL different from other cloud databases? Cloud SQL is valued for its openness, ease of use, security, cost-efficiency, and Google Cloud integration—in fact, more than 95% of Google Cloud's top 100 customers use it. If you're comparing PostgreSQL options on Google Cloud, view our comparison chart. What's the difference between the Enterprise and Enterprise Plus editions? For PostgreSQL, the Enterprise Plus edition brings enhanced availability, performance, and data protection capabilities. Specifically, it provides a 99.99% availability SLA with near-zero downtime maintenance, optimized hardware and software configurations, intelligent data caching for read-intensive transactional workloads, a configurable data cache option and 35 days of log retention. For MySQL, the Enterprise Plus edition brings enhanced availability, performance, and data protection capabilities. Specifically, it provides a 99.99% availability SLA with near-zero downtime maintenance, optimized hardware and software configurations, intelligent data caching for read-intensive transactional workloads, a configurable data cache option, 35 days of log retention and advanced disaster recovery capabilities like orchestrated failover and switchback. ",
          "relevanceScore": 0.7,
          "documentMetadata": {
            "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/931f2c8e19ed54a407857f1cad3b5aaa",
            "uri": "https://cloud.google.com/sql",
            "title": "Cloud SQL for MySQL, PostgreSQL, and SQL Server | Google Cloud"
          }
        }
      },
      {
        "chunkInfo": {
          "content": "PostgreSQL versus SQL PostgreSQL is an open-source, object-relational database (ORDBMS) designed for enterprise-level performance and is valued for its reliability and robust features. Its long history of development and its use of SQL makes it one of the most popular open source databases worldwide. Its default procedural language is an extension of pgSQL (PL/pgSQL), with procedural language extensions of Tcl, Perl, and Python included in the standard distribution (written as PL/Tcl, PL/Perl, and PL/Python). Many more languages are supported through extensions, including Java, Ruby, C, C++, Delphi, and JavaScript. For a more in-depth comparison, visit our PostgreSQL versus SQL guide. MySQL versus SQL MySQL is a popular open source relational database created in 1995 and currently sponsored by Oracle. It supports SQL queries and can be administered either through a graphical user interface (GUI) or a command line. MySQL can be deployed manually on a physical machine or through a cloud service provider. Enterprises are increasingly choosing fully managed services to reduce the maintenance burden of their databases. What is SQL Server? SQL Server is a Microsoft-owned database that runs SQL queries. Dive into the differences between PostgreSQL and SQL Server. ",
          "relevanceScore": 0.6,
          "documentMetadata": {
            "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/7218ff4f57328d86059246d4af3a9953",
            "uri": "https://cloud.google.com/discover/what-are-sql-databases",
            "title": "SQL Databases | Google Cloud"
          }
        }
      },
      {
        "chunkInfo": {
          "content": "Send feedback On this page BigQuery SQL dialects Changing from the default dialect What's next Introduction to SQL in BigQuery bookmark_borderbookmark Stay organized with collections Save and categorize content based on your preferences. Dismiss Got it GoogleSQL is the new name for Google Standard SQL! New name, same great SQL dialect. This document provides an overview of supported statements and SQL dialects in BigQuery. GoogleSQL is an ANSI compliant Structured Query Language (SQL) which includes the following types of supported statements: Query statements, also known as Data Query Language (DQL) statements, are the primary method to analyze data in BigQuery. They scan one or more tables or expressions and return the computed result rows. Procedural language statements are procedural extensions to GoogleSQL that allow you to execute multiple SQL statements in one request. Procedural statements can use variables and control-flow statements, and can have side effects. Data Definition Language (DDL) statements let you create and modify database objects such as tables, views, functions, and row-level access policies. Data Manipulation Language (DML) statements enable you to update, insert, and delete data from your BigQuery tables. Data Control Language (DCL) statements let you control BigQuery system resources such as access and capacity. Transaction Control Language (TCL) statements allow you to manage transactions for data modifications. ",
          "relevanceScore": 0.6,
          "documentMetadata": {
            "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/2f6fc3e29873518196cb50195d7ded45",
            "uri": "https://cloud.google.com/bigquery/docs/introduction-sql",
            "title": "Introduction to SQL in BigQuery | Google Cloud"
          }
        }
      },
      {
        "chunkInfo": {
          "content": "Database administration Cloud SQL pricing Connect to a Cloud SQL managed database Cloud SQL updates Configuration updates System updates What's next Home Cloud SQL Documentation Guides Was this helpful? Send feedback Cloud SQL overview bookmark_borderbookmark Stay organized with collections Save and categorize content based on your preferences. Dismiss Got it On this page Database configurations with Cloud SQL Use cases for Cloud SQL What Cloud SQL provides What is a Cloud SQL instance? Database administration Cloud SQL pricing Connect to a Cloud SQL managed database Cloud SQL updates Configuration updates System updates What's next Cloud SQL is a fully managed relational database service for MySQL, PostgreSQL, and SQL Server. This frees you from database administration tasks so that you have more time to manage your data. This page discusses basic concepts and terminology for Cloud SQL, which provides SQL data storage for Google Cloud. For a more in-depth explanation of key concepts, see the key terms and features pages. For information about how Cloud SQL databases compare with one another, see Cloud SQL feature support by database engine. Database configurations with Cloud SQL The following video shows you the benefits of using Cloud SQL. ",
          "relevanceScore": 0.6,
          "documentMetadata": {
            "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/4098ae11bfa400e8f1b8e9ba59d2b71b",
            "uri": "https://cloud.google.com/sql/docs/introduction",
            "title": "Cloud SQL overview"
          }
        }
      },
      {
        "chunkInfo": {
          "content": "Cloud SQL documentation View all product documentation Cloud SQL is a fully-managed database service that helps you set up, maintain, manage, and administer your relational databases on Google Cloud Platform. You can use Cloud SQL with MySQL, PostgreSQL, or SQL Server. Not sure what database option is right for you? Learn more about our database services. Learn more about Cloud SQL. Documentation resources Find quickstarts and guides, review key references, and get help with common issues. format_list_numbered Guides Cloud SQL overview Database engine feature support MySQL PostgreSQL SQL Server find_in_page Reference gcloud commands REST API Client libraries info Resources Pricing Release notes Resources Try Cloud SQL for yourself Create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads. Try Cloud SQL free Was this helpful? Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Last updated 2024-08-29 UTC. ",
          "relevanceScore": 0.5,
          "documentMetadata": {
            "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/37935181d99a6ad3b4897e673a7a7986",
            "uri": "https://cloud.google.com/sql/docs",
            "title": "Cloud SQL documentation"
          }
        }
      }
      ], 
    "steps": [
      {
        "state": "SUCCEEDED",
        "description": "Rephrase the query and search.",
        "actions": [
          {
            "searchAction": {
              "query": "What is SQL?"
            },
            "observation": {
              "searchResults": [
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/7218ff4f57328d86059246d4af3a9953",
                  "uri": "https://cloud.google.com/discover/what-are-sql-databases",
                  "title": "SQL Databases | Google Cloud",
                  "snippetInfo": [
                    {
                      "snippet": "\u003cb\u003eSQL\u003c/b\u003e (Structured Query Language) is a programming language used to store, retrieve, and manage data in a relational database. \u003cb\u003eSQL\u003c/b\u003e statements are English-like, ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/f7cd9afab1282a9f57cdcee1885bb4c6",
                  "uri": "https://cloud.google.com/learn/postgresql-vs-sql",
                  "title": "PostgreSQL vs. SQL Server: What's the difference? | Google Cloud",
                  "snippetInfo": [
                    {
                      "snippet": "\u003cb\u003eSQL\u003c/b\u003e typically uses commands written in statement format for queries and other database operations, which allow users to manipulate data in relational database ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/3afdede140d0906c2146a2f2b3a7821e",
                  "uri": "https://cloud.google.com/blog/topics/developers-practitioners/what-cloud-sql",
                  "title": "What is Cloud SQL? | Google Cloud Blog",
                  "snippetInfo": [
                    {
                      "snippet": "It is a fully managed relational database for MySQL, PostgreSQL and \u003cb\u003eSQL\u003c/b\u003e Server. It reduces maintenance cost and automates database provisioning, storage ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                ...
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/0c5c094170756eeb6bdfec6eb5c7d081",
                  "uri": "https://cloud.google.com/spanner/docs/reference/standard-sql/overview",
                  "title": "The GoogleSQL language in Spanner | Google Cloud",
                  "snippetInfo": [
                    {
                      "snippet": "\u003cb\u003eGoogleSQL\u003c/b\u003e is the new name for Google Standard \u003cb\u003eSQL\u003c/b\u003e! New name, same great \u003cb\u003eSQL\u003c/b\u003e dialect. This page provides an overview of supported statements in \u003cb\u003eGoogleSQL\u003c/b\u003e.",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                }
              ]
            }
          }
        ]
      }
    ]
  },
  "answerQueryToken": "NMwKDAiFm_y2BhC_nfrYAxIkNjZkYjg3NjItMDAwMC0yZTBkLTg0ZDAtMDg5ZTA4MmRjYjg0"
}
 
  
  
 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
  
   
 
Sprachcode für die Antwort festlegen 
Der folgende Befehl zeigt, wie der Sprachcode für Antworten festgelegt wird.
  
  
  
  
  
    
  
  
  REST So generieren Sie eine Antwort mit einem anderen Modell als dem Standardmodell:
Führen Sie den folgenden curl-Befehl aus:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /servingConfigs/default_search:answer" \
  -d '{
        "query": { "text": "QUERY "},
        "answerGenerationSpec": {
           "answerLanguageCode": "ANSWER_LANGUAGE_CODE "
           }
      }'
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID QUERY ANSWER_LANGUAGE_CODE BCP47: Tags for Identifying Languages  definiert sind.  
Beispielbefehl und -ergebnis 
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://discoveryengine.googleapis.com/v1/projects/my-project-123/locations/global/collections/default_collection/engines/my-app/servingConfigs/default_search:answer" \
-d '{"query": { "text": "What is SQL"},   "answerGenerationSpec": {
  "answerLanguageCode": "es" 
     }
}'
"answerText": "SQL, que significa Structured Query Language, es un lenguaje de programación utilizado para almacenar, recuperar y administrar datos en una base de datos relacional. Las instrucciones de SQL son similares al inglés, lo que hace que el lenguaje sea accesible para desarrolladores de software, analistas de datos y otros profesionales. Las bases de datos SQL se utilizan para administrar y almacenar datos para apoyar numerosos casos de uso empresariales, como la inteligencia empresarial, el procesamiento de transacciones, el análisis de datos y los servicios de aprendizaje automático. SQL es el lenguaje estándar utilizado por los sistemas de gestión de bases de datos relacionales (RDBMS), incluidos PostgreSQL, SQL Server, MySQL y Oracle Database. SQL se utiliza para crear y actualizar la estructura de las tablas, leer y escribir datos, administrar los permisos de los usuarios y realizar tareas administrativas. \n", 
    "steps": [
      {
        "state": "SUCCEEDED",
        "description": "Rephrase the query and search.",
        "actions": [
          {
            "searchAction": {
              "query": "What is SQL?"
            },
            "observation": {
              "searchResults": [
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/7218ff4f57328d86059246d4af3a9953",
                  "uri": "https://cloud.google.com/discover/what-are-sql-databases",
                  "title": "SQL Databases | Google Cloud",
                  "snippetInfo": [
                    {
                      "snippet": "\u003cb\u003eSQL\u003c/b\u003e (Structured Query Language) is a programming language used to store, retrieve, and manage data in a relational database. \u003cb\u003eSQL\u003c/b\u003e statements are English-like, ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/f7cd9afab1282a9f57cdcee1885bb4c6",
                  "uri": "https://cloud.google.com/learn/postgresql-vs-sql",
                  "title": "PostgreSQL vs. SQL Server: What's the difference? | Google Cloud",
                  "snippetInfo": [
                    {
                      "snippet": "\u003cb\u003eSQL\u003c/b\u003e typically uses commands written in statement format for queries and other database operations, which allow users to manipulate data in relational database ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/3afdede140d0906c2146a2f2b3a7821e",
                  "uri": "https://cloud.google.com/blog/topics/developers-practitioners/what-cloud-sql",
                  "title": "What is Cloud SQL? | Google Cloud Blog",
                  "snippetInfo": [
                    {
                      "snippet": "It is a fully managed relational database for MySQL, PostgreSQL and \u003cb\u003eSQL\u003c/b\u003e Server. It reduces maintenance cost and automates database provisioning, storage ...",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                },
                ...
                                {
                  "document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/0c5c094170756eeb6bdfec6eb5c7d081",
                  "uri": "https://cloud.google.com/spanner/docs/reference/standard-sql/overview",
                  "title": "The GoogleSQL language in Spanner | Google Cloud",
                  "snippetInfo": [
                    {
                      "snippet": "\u003cb\u003eGoogleSQL\u003c/b\u003e is the new name for Google Standard \u003cb\u003eSQL\u003c/b\u003e! New name, same great \u003cb\u003eSQL\u003c/b\u003e dialect. This page provides an overview of supported statements in \u003cb\u003eGoogleSQL\u003c/b\u003e.",
                      "snippetStatus": "SUCCESS"
                    }
                  ]
                }
              ]
            }
          }
        ]
      }
    ]
  },
  "answerQueryToken": "NMwKDAjim_y2BhDftIjEAhIkNjZkOTQ0NWQtMDAwMC0yMTBkLTllNmItZjQwMzA0NWRiZDMw"
}
 In diesem Beispiel sind die Quelldokumente zwar auf Englisch, die Antwort wird aber auf Spanisch gegeben.
 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
  
   
 
Antworten personalisieren 
Wenn bestimmte Informationen zum Nutzer verfügbar sind, z. B. Daten in einem Profil, können Sie diese Informationen im endUserMetadata
Wenn ein angemeldeter Nutzer beispielsweise nach Informationen zum Upgraden eines Smartphones sucht, können Informationen aus seinem Profil, z. B. das aktuelle Smartphone-Modell und der Mobilfunktarif, verwendet werden, um die generierte Antwort zu personalisieren.
So fügen Sie personenbezogene Daten des Nutzers hinzu, der eine Anfrage stellt, und generieren eine Antwort, die diese personenbezogenen Daten berücksichtigt:
Führen Sie den folgenden curl-Befehl aus:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /servingConfigs/default_search:answer" \
-d '{
    "query": { "text": "QUERY "},
    "endUserSpec": {
       "endUserMetadata": [
         {
           "chunkInfo": {
              "content": "PERSONALIZED_INFO ",
              "documentMetadata":  { "title": "INFO_DESCRIPTION "}
           }
         }
       ]
    }
  }'
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID QUERY PERSONALIZATION_INFO This customer has a Pixel 6 Pro  purchased over a period of
  24-months  starting 2023-01-15 . This customer is on the
  Business Plus International  plan. No payment is due at this
  time. Die Längenbeschränkung für diesen String beträgt 8.000 Zeichen.INFO_DESCRIPTION Customer
  profile data, including model, plan, and billing status.. Das Modell verwendet sowohl diese Beschreibung als auch die Personalisierungsinformationen, um eine benutzerdefinierte Antwort auf die Anfrage zu generieren. 
Beispielbefehl und -ergebnis 
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/my-project-123/locations/global/collections/default_collection/engines/my-app/servingConfigs/default_search:answer" \
  -d '{
        "query": { "text": "Can I upgrade my phone now?"},
        "answerGenerationSpec": { "includeCitations": true }
        "endUserSpec": {
           "endUserMetadata": [
             {
               "chunkInfo": {
                 "content": "This customer has a Pixel 6 Pro purchased over a period of 24-months starting 2023-01-15. This customer is on the Business Plus International plan. No payment is due at this time.",
                 "documentMetadata":  { "title": "Customer profile data, including model, plan, and billing status."}
               }
             }
           ]
        } 
      }'
"answerText": "Yes, you qualify for the yearly device upgrade because you've completed your 24-month payment plan.[1,3]  Since your account is fully paid you will not need to pay any additional monthly fees…  \n", 
    "citations": [
      {
        "end_index": 99
        "sources": [
           {
              "reference_id": "0"
           }
        ]
      },
      {
        "start_index": "100"
        "end_index": "240"
        "sources": [
           {
              "reference_id": "0"
           }
        ]
      },
      ...
    ]
    "references": [
      {
        "chunk_info": {
          "content":
          "+ "This customer has a Pixel 6 Pro purchased over a period of 24-months starting 2023-01-15. This customer is on the Business Plus International plan. No payment is due at this time.",
          "relevance_score": 0.3
          "documentMetadata":  {
            "title": "Customer profile data, including model, plan, and billing status."
          }
      {
        "chunk_info": {
          "content":
          "+ "For Cymbal Mobile upgrades, you can upgrade when you've paid off at least half of your current device's cost and have had it for 8 months…",
          "relevance_score": 0.8
          "documentMetadata":  {
            "document":
            "projects/123456/locations/us/collections/default_collection/dataStores/my-data-store/branches/0/documents/abcd1234567890"
            "uri": "https://www.example.com/help/device-upgrade"
            "title": "Upgrade eligibility"
          }
         }
      }
      ...
 In diesem Beispiel verwendet das Modell endUserMetadata, um die Antwort anzupassen. Zur Veranschaulichung enthält dieses Beispiel Zitationen, damit Sie die Bedeutung von endUserMetadata sehen können. Es ist immer die erste zitierte Referenz.
  
Diagramme für Antworten erstellen 
  
Mit der Methode answer  können Diagramme generiert und als Teil der Antwort auf eine Anfrage zurückgegeben werden.
Sie können auch explizit ein Diagramm in der Antwort anfordern, z. B. „Stelle die jährliche Wachstumsrate der Zahlungen von Kleinunternehmen für die Jahre mit verfügbaren Daten grafisch dar.“ Wenn das System feststellt, dass genügend Daten vorhanden sind, wird ein Diagramm zurückgegeben. Normalerweise wird zusammen mit dem Diagramm auch ein Antworttext zurückgegeben.
Wenn genügend Daten zum Erstellen eines Diagramms vorhanden sind, kann die Antwortmethode auch dann ein Diagramm zurückgeben, wenn in der Anfrage nicht explizit ein Diagramm angefordert wurde. Beispiel: „Welche Verbesserung der HDI-Werte war mit einem besseren Zugang zu sauberem Trinkwasser im Jahrzehnt zwischen 2010 und 2020 verbunden?“
Pro Antwort wird nur ein Diagramm generiert. Das Diagramm kann jedoch ein zusammengesetztes Diagramm sein, das andere kleinere Diagramme enthält. Beispiel für ein zusammengesetztes Diagramm:
Beschränkung 
Anfragen müssen auf Englisch gestellt werden.
Häufige Fehlerszenarien 
Sie erhalten nicht immer ein Bild als Antwort. Wenn nicht genügend Daten vorhanden sind, kann keine Zahl generiert werden.
Weitere Fehlerszenarien sind Fehler bei der Codeausführung und Zeitüberschreitungen. Wenn einer dieser Fälle eintritt, formulieren Sie Ihre Anfrage um und versuchen Sie es noch einmal.
Hinweise 
Bevor Sie eine Abfrage ausführen, in der generierte Diagramme angefordert werden, gehen Sie so vor:
Prozedur 
  
  
  
  
  
    
  
  
  REST Rufen Sie die Methode answer  wie folgt auf, um eine Antwort zurückzugeben, die ein Diagramm enthalten kann, das aus den Daten im Datenspeicher generiert wurde:
Führen Sie den folgenden curl-Befehl aus:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1beta/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /servingConfigs/default_search:answer" \
  -d '{
        "query": { "text": "QUERY "},
        "answerGenerationSpec": {
          "model_spec": {
             "model_version": "MODEL_VERSION "
         },
          "multimodalSpec": {
             "imageSource": "IMAGE_SOURCE "
             } 
        }
      }'
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID QUERY MODEL_VERSION gemini-2.0-flash-001/answer_gen/v1 oder höher. Weitere Informationen finden Sie unter Modellversionen und Lebenszyklus für die Antwortgenerierung .
  IMAGE_SOURCE FIGURE_GENERATION_ONLY) oder ein generiertes Diagramm oder ein vorhandenes Bild aus den Datenspeichern  (ALL_AVAILABLE_SOURCES) enthält. 
Beispielbefehl und Teilergebnis 
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://discoveryengine.googleapis.com/v1beta/projects/my-project-123/locations/global/collections/default_collection/engines/my-app/servingConfigs/default_search:answer" \
-d '{
    "query": { "text": "Plot composition of net cash used in investing activities"},
    "answerGenerationSpec": {
      "model_spec": {
         "model_version": "gemini-2.0-flash-001/answer_gen/v1"
         },
         "multimodalSpec": {
         "image_source": "FIGURE_GENERATION_ONLY"
         } 
    }
  }'
  "blobAttachments": [
      {
        "data": {
          "mimeType": "image/png",
          "data": "iVBORw0KGgoAAAANSUhEUgAACvAAZd8AEZFKHDp0CE5OTgCAZcuWYfr06QonIqIMXIGXiIhUITY2Vq4tLCxyNdbMzEyuk5OTtZaJiEgfZd5aMj4+Xq4zr1rztm3SMs/fXIGXiOjDGRgYyLWpqalcJyUlyfW/V7rJULVqVbl++PChDtIREemXr7766oPHPnr0CK1bt9ZeGCIiPXXlypWPGr9lyxYtJSEi0k9ly5bFzZs30bNnT0iSBEmS8PLlS1y6dAlHjhzBpUuX8PLlS/lcjx49cOPGDZQtW1bp6EREquHv7w9JkgAALVq0UDgNEWXGBl4iIlIFc3NzuY6MjMzV2ICAALkuVqyY1jIREemjzDdVb926JdeWlpZynXlr98z8/f3lunDhwtoPR0SkJzLPuYGBgXKd+bOun5/fG8dmXjE9PT1dB+mIiPTL8uXLP2hVm19++QV169aFt7e3DlIREemXDh06wMfHJ9fjwsLC0K1bN4wePVoHqYiI9EuRIkXwxx9/4MSJE3BycoKFhYXcsCtJEiwsLNC/f38cP34chw4dyrJQBBERfbxChQrJde...PrTn86//Mu/5Jhjjql1NACAAeP/AX0CwI314+qiAAAAAElFTkSuQmCC"
        },
        "attributionType": "GENERATED"
      }
      ] 
  },
  "answerQueryToken": "NMwKDAjEjOe-BhD-meX6ARIkNjdkNjBhM2QtMDAwMC0yYzU4LTgxYjctMDg5ZTA4MmNhZDgw"
 In diesem Beispiel ist ein generiertes Diagramm in der Antwort enthalten, da in der Anfrage ein Diagramm angefordert wurde und genügend Daten zum Generieren des Diagramms vorhanden waren.
Die Diagrammbilder werden in der Ausgabe blobAttachments mit dem attributionType von GENERATED zurückgegeben.
 
  
  
  
  
  
  
  
  
  
  
  
  
   
 
Vorhandene Bilder aus dem Datenspeicher abrufen 
  
Sie können festlegen, dass Bilder aus dem Datenspeicher mit der Antwort und in Zitatreferenzen  zurückgegeben werden. Der Datenspeicher muss ein unstrukturierter Datenspeicher sein, in dem der Layout-Parser aktiviert ist.
Wenn Sie Diagramme in den zurückgegebenen Antworten sehen möchten, müssen Sie die erweiterten LLM-Funktionen  aktivieren.
Wenn imageSource CORPUS_IMAGE_ONLY oder ALL_AVAILABLE_SOURCES ist, können mit der Methode answer  Bilder aus dem Datenspeicher abgerufen werden. Wenn Sie diese Option aktivieren, werden jedoch nicht immer Bilder zurückgegeben.
Sie erhalten maximal ein Bild pro Antwort. Zitationen können mehrere Bilder enthalten.
Beschränkungen 
Die verwendete App muss mit einem unstrukturierten Datenspeicher verbunden sein.
Bilder können nicht von Websites oder aus Datenspeichern mit strukturierten Daten zurückgegeben werden.
Anfragen müssen auf Englisch gestellt werden.
Die Bildannotation durch den Layout-Parser muss auf den Datenspeicher angewendet werden.
Informationen zum Layout-Parser finden Sie unter Dokumente parsen und in Chunks aufteilen .
 
Prozedur 
  
  
  
  
  
    
  
  
  REST Rufen Sie die Methode answer  wie folgt auf, um eine Antwort zurückzugeben, die ein Bild aus dem Datenspeicher enthalten kann:
Führen Sie den folgenden curl-Befehl aus:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1beta/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /servingConfigs/default_search:answer" \
  -d '{
        "query": { "text": "QUERY "},
        "answerGenerationSpec": {
          "model_spec": {
             "model_version": "MODEL_VERSION "
          },
          includeCitations: true,
          "multimodalSpec": {
             "imageSource": "IMAGE_SOURCE "
             } 
        }
      }'
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID QUERY MODEL_VERSION gemini-2.0-flash-001/answer_gen/v1 oder höher. Weitere Informationen finden Sie unter Modellversionen und Lebenszyklus für die Antwortgenerierung .
  IMAGE_SOURCE CORPUS_IMAGE_ONLY) oder ein Bild aus dem Datenspeicher oder ein generiertes Diagramm  (ALL_AVAILABLE_SOURCES) enthält. 
Beispielbefehl und Teilergebnis 
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
 -H "Content-Type: application/json" \
 "https://discoveryengine.googleapis.com/v1beta/projects/my-project-123//locations/global/collections/default_collection/engines/my-app/servingConfigs/default_search:answer"   -d '{
        "query": { "text": "Display the ranking of  generations from highest to lowest based on their spending on holiday items using cards."},
        "answerGenerationSpec": {"includeCitations": true,
        "model_spec": {
             "model_version": "gemini-2.0-flash-001/answer_gen/v1"
             },
             "multimodalSpec": {
      "imageSource": "CORPUS_IMAGE_ONLY"
      } 
  },
  "searchSpec": {
    "searchParams": {
      "maxReturnResults": 5
    }
  }
}'
"blobAttachments": [
      {
        "data": {
          "mimeType": "image/png",
          "data": "iVBORw0KGgoAAAANSUhEUgAABcwAAAIjCAIAAACxms+ZAAAgAElEQVR42uzdd1xTV/...Vv/F0NDQ4NOp3+waz94PJ5Op7+/ibro6fRiWPX/AaZ6/dAGW00gAAAAAElFTkSuQmCC"
        },
        "attributionType": "CORPUS"
      }
      ] 
  },
  "answerQueryToken": "M8gKCwiPuOe-BhDyhpgIEiQ2N2Q2MWI0Mi0wMDAwLTJjNTgtODFiNy0wODllMDgyY2FkODA"
}
 Die Bilder werden im blobAttachments-Teil der Ausgabe zurückgegeben. Das Bild, das mit der Antwort zurückgegeben wird, befindet sich immer in den ersten blobAttachments. Falls vorhanden, würden andere blobAttachments Bilder enthalten, die in den Quellenangaben zurückgegeben werden. Das mit der Antwort zurückgegebene Bild kann auch (und wird oft) mit einer Quellenangabe zurückgegeben. Der blobAttachmentIndexes ist der Index, der den blobAttachment dem Antwort- oder Zitattext zuordnet.
Der attributionType für zurückgegebene Bilder ist immer CORPUS, um anzugeben, dass das Bild aus dem Datenspeicher stammt.
 
  
  
  
  
  
  
  
  
  
  
  
  
   
 
Befehle für Folgefragen 
Follow-up-Anfragen sind Anfragen mit mehreren Turns. Nach der ersten Anfrage in einer Folgesitzung werden bei nachfolgenden „Zügen“ vorherige Interaktionen berücksichtigt. Bei Follow-up-Fragen können mit der Antwortmethode auch ähnliche Fragen vorgeschlagen werden, die Ihre Nutzer auswählen können, anstatt eigene Follow-up-Fragen einzugeben. Wenn Sie Vorschläge für ähnliche Fragen erhalten möchten, müssen Sie die erweiterten LLM-Funktionen  aktivieren.
Alle in den vorherigen Abschnitten beschriebenen Antwort- und Follow-up-Funktionen, z. B. Zitationen, Filter, SafeSearch, das Ignorieren bestimmter Arten von Anfragen und die Verwendung einer Präambel zum Anpassen von Antworten, können zusammen mit Follow-ups angewendet werden.
Beispiel für eine Folgesitzung 
Im Folgenden finden Sie ein Beispiel für eine Sitzung mit Follow-ups. Angenommen, Sie möchten etwas über einen Urlaub in Mexiko wissen:
Runde 1 :
2. Zug :
Sie :Wie lautet der Wechselkurs?
Antwort mit Follow-ups :1 USD entspricht ungefähr 17,65 mexikanischen Pesos.
 Runde 3: 
 
Ohne Follow-ups wäre Ihre Frage „What is the exchange rate?“ (Wie lautet der Wechselkurs?) nicht beantwortbar, da bei einer normalen Suche nicht klar wäre, dass Sie den mexikanischen Wechselkurs wissen möchten. Ohne Follow-ups gäbe es auch nicht den Kontext, der erforderlich ist, um Ihnen Temperaturen speziell für Mexiko zu nennen.
Informationen zu Sitzungen 
Um zu verstehen, wie Follow-ups in Vertex AI Search funktionieren, müssen Sie sich mit Sitzungen auskennen.
Eine Sitzung besteht aus Textanfragen eines Nutzers und Antworten von Vertex AI Search.
Diese Frage- und Antwortpaare werden manchmal als Gesprächsrunden  bezeichnet. Im vorherigen Beispiel besteht der zweite Turn aus „What is the exchange rate?“ (Wie lautet der Wechselkurs?) und „1 USD is equal to approximately 17.65 Mexican pesos.“ (1 USD entspricht ungefähr 17, 65 mexikanischen Pesos).
Sitzungen werden mit der App gespeichert.
In der App wird eine Sitzung durch die Sitzungsressource  dargestellt.
Die Sitzungsressource enthält neben den Nachrichten mit der Anfrage und der Antwort Folgendes:
Einen eindeutigen Namen (die Sitzungs-ID).
Einen Status („Wird verarbeitet“ oder „Abgeschlossen“)
Eine Pseudo-ID für den Nutzer, also eine Besucher-ID, mit der der Nutzer nachverfolgt wird. Sie kann programmatisch zugewiesen werden. Wenn das Modell der Pseudo-ID des Nutzers in den Nutzerereignissen Ihrer App zugeordnet wird, können Sie dem Nutzer personalisierte Ergebnisse präsentieren.
Eine Start- und eine Endzeit.
Ein Turn, der ein Frage-Antwort-Paar ist.
 
Hinweise 
Bevor Sie eine Anfrage mit weiterführenden Fragen ausführen, müssen Sie erweiterte LLM-Funktionen  für die App aktivieren.
Sitzungsinformationen speichern und Antworten erhalten 
Über die Befehlszeile können Sie Suchergebnisse und Antworten generieren und zusammen mit jeder Anfrage in einer Sitzung speichern.
  
  
  
  
    
  
  
  REST So erstellen Sie eine Sitzung über die Befehlszeile und generieren Antworten auf die Eingabe des Nutzers:
Geben Sie die App an, in der Sie die Sitzung speichern möchten:
curl  -X  POST  \ 
   -H  "Authorization: Bearer  $( gcloud  auth  print-access-token) "   \ 
   -H  "Content-Type: application/json"   \ 
   "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /sessions"   \ 
   -d  '{ 
        "userPseudoId": "USER_PSEUDO_ID " 
      }' 
Ersetzen Sie Folgendes:
PROJECT_ID 
APP_ID 
USER_PSEUDO_ID 
  Diese Kennung ändert sich nicht, wenn sich der Besucher auf einer Website an- oder abmeldet. 
  Dieses Feld darf nicht für mehrere Nutzer auf dieselbe Kennung festgelegt werden.
    Andernfalls können mit derselben User-ID Ereignisverläufe verschiedener Nutzer kombiniert werden, was die Modellqualität beeinträchtigen kann. 
  Dieses Feld darf keine personenidentifizierbaren Informationen enthalten. 
  Für eine bestimmte Such- oder Browseranfrage muss dieses Feld dem entsprechenden userPseudoId-Feld in den Nutzerereignissen zugeordnet werden. 
 
Weitere Informationen finden Sie unter userPseudoId
 
 
 Beispielbefehl und -ergebnis 
curl  -X  POST  -H  "Authorization: Bearer  $( gcloud  auth  print-access-token) " 
-H  "Content-Type: application/json" 
"https://discoveryengine.googleapis.com/v1/projects/my-project-123/locations/global/collections/default_collection/engines/my-app/sessions" 
-d  '{ 
"userPseudoId": "test_user" 
}' 
{ 
   "name" :  "projects/123456/locations/global/collections/default_collection/engines/my-app/sessions/16002628354770206943" ,
   "state" :  "IN_PROGRESS" ,
   "userPseudoId" :  "test_user" ,
   "startTime" :  "2024-09-13T18:47:10.465311Z" ,
   "endTime" :  "2024-09-13T18:47:10.465311Z" 
}   
 Notieren Sie sich die Sitzungs-ID, also die Zahlen am Ende des Felds name: in der JSON-Antwort. Im Beispielergebnis lautet die ID 5386462384953257772.
Sie benötigen diese ID im nächsten Schritt.
Antwort generieren und einer Sitzung in Ihrer App hinzufügen:
curl  -X  POST  \ 
   -H  "Authorization: Bearer  $( gcloud  auth  print-access-token) "   \ 
   -H  "Content-Type: application/json"   \ 
   "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /servingConfigs/default_search:answer"   \ 
   -d  '{ 
        "query": { "text": "QUERY "}, 
        "session": "projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /sessions/SESSION_ID ", 
          "searchSpec":{ "searchParams": {"filter": "FILTER "} } 
}' 
Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID QUERY SESSION_ID name:, die Sie in Schritt 2 notiert haben. Verwenden Sie für eine Sitzung in jeder Runde dieselbe Sitzungs-ID.
  FILTER Benutzerdefinierte Suche nach strukturierten oder unstrukturierten Daten filtern  und Website-Suche filtern .
   
 
 Beispielbefehl und -ergebnis 
curl  -X  POST  -H  "Authorization: Bearer  $( gcloud  auth  print-access-token) " 
-H  "Content-Type: application/json" 
"https://discoveryengine.googleapis.com/v1/projects/my-project-123/locations/global/collections/default_collection/engines/my-app/servingConfigs/default_search:answer" 
-d  '{ 
"query": { "text": "Compare bigquery with spanner database?"}, 
"session":  "projects/123456/locations/global/collections/default_collection/engines/my-app/sessions/16002628354770206943", 
}' 
     { 
   "answer" :  { 
     "name" :  "projects/123456/locations/global/collections/default_collection/engines/my-app/sessions/16002628354770206943/answers/4861507376861383072" ,
     "state" :  "SUCCEEDED" ,
     "answerText" :  "BigQuery and Spanner are both powerful tools that can be used together to handle transactional and analytical workloads. Spanner is a fully managed relational database optimized for transactional workloads, while BigQuery is a serverless data warehouse designed for business agility. Spanner provides seamless replication across regions in Google Cloud and processes over 1 billion requests per second at peak. BigQuery analyzes over 110 terabytes of data per second. Users can leverage federated queries to read data from Spanner and write to a native BigQuery table. \n" ,
     "steps" :  [ 
       { 
         "state" :  "SUCCEEDED" ,
         "description" :  "Rephrase the query and search." ,
         "actions" :  [ 
           { 
             "searchAction" :  { 
               "query" :  "Compare bigquery with spanner database?" 
             } ,
             "observation" :  { 
               "searchResults" :  [ 
                 { 
                   "document" :  "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/ecc0e7547253f4ca3ff3328ce89995af" ,
                   "uri" :  "https://cloud.google.com/blog/topics/developers-practitioners/how-spanner-and-bigquery-work-together-handle-transactional-and-analytical-workloads" ,
                   "title" :  "How Spanner and BigQuery work together to handle transactional and analytical workloads | Google Cloud Blog" ,
                   "snippetInfo" :  [ 
                     { 
                       "snippet" :  "Using Cloud \u003cb\u003eSpanner\u003c/b\u003e and \u003cb\u003eBigQuery\u003c/b\u003e also allows customers to build their \u003cb\u003edata\u003c/b\u003e clouds using Google Cloud, a unified, open approach to \u003cb\u003edata\u003c/b\u003e-driven transformation ..." ,
                       "snippetStatus" :  "SUCCESS" 
                     } 
                   ] 
                 } ,
                 { 
                   "document" :  "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/d7e238f73608a860e00b752ef80e2941" ,
                   "uri" :  "https://cloud.google.com/blog/products/databases/cloud-spanner-gets-stronger-with-bigquery-federated-queries" ,
                   "title" :  "Cloud Spanner gets stronger with BigQuery-federated queries | Google Cloud Blog" ,
                   "snippetInfo" :  [ 
                     { 
                       "snippet" :  "As enterprises compete for market share, their need for real-time insights has given rise to increased demand for transactional \u003cb\u003edatabases\u003c/b\u003e to support \u003cb\u003edata\u003c/b\u003e ..." ,
                       "snippetStatus" :  "SUCCESS" 
                     } 
                   ] 
                 } ,
                 { 
                   "document" :  "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/e10a5a3c267dc61579e7c00fefe656eb" ,
                   "uri" :  "https://cloud.google.com/blog/topics/developers-practitioners/replicating-cloud-spanner-bigquery-scale" ,
                   "title" :  "Replicating from Cloud Spanner to BigQuery at scale | Google Cloud Blog" ,
                   "snippetInfo" :  [ 
                     { 
                       "snippet" :  "... \u003cb\u003eSpanner data\u003c/b\u003e into \u003cb\u003eBigQuery\u003c/b\u003e for analytics. In this post, you will learn how to efficiently use this feature to replicate large tables with high throughput ..." ,
                       "snippetStatus" :  "SUCCESS" 
                     } 
                   ] 
                 } ,
                 ...
                 { 
                   "document" :  "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/8100ad36e1cac149eb9fc180a41d8f25" ,
                   "uri" :  "https://cloud.google.com/blog/products/gcp/from-nosql-to-new-sql-how-spanner-became-a-global-mission-critical-database" ,
                   "title" :  "How Spanner became a global, mission-critical database | Google Cloud Blog" ,
                   "snippetInfo" :  [ 
                     { 
                       "snippet" :  "... SQL \u003cb\u003evs\u003c/b\u003e. NoSQL dichotomy may no longer be relevant."   The  \u 003cb\u 003eSpanner\u 003c/b\u 003e  SQL  query  processor,  while   recognizable  as  a  standard  implementation,  has  unique ...", 
                      " snippetStatus": " SUCCESS" 
                    } 
                  ] 
                } 
              ] 
            } 
          } 
        ] 
      } 
    ] 
  }, 
  " session": { 
    " name": " projects/123456/locations/global/collections/default_collection/engines/my-app/sessions/16002628354770206943", 
    " state": " IN_PROGRESS", 
    " userPseudoId": " test_user", 
    " turns": [ 
      { 
        " query": { 
          " queryId": " projects/123456/locations/global/questions/741830", 
          " text": " Compare  bigquery  with  spanner  database?" 
        }, 
        " answer": " projects/123456/locations/global/collections/default_collection/engines/my-app/sessions/16002628354770206943/answers/4861507376861383072" 
      } 
    ], 
    " startTime": " 2024 -09-13T18:47:10.465311Z", 
    " endTime": " 2024 -09-13T18:47:10.465311Z" 
  }, 
  " answerQueryToken": " NMwKDAjFkpK3BhDU24uZAhIkNjZlNDIyZWYtMDAwMC0yMjVmLWIxMmQtZjQwMzA0M2FkYmNj" 
}   
 Wiederholen Sie Schritt 3 für jede neue Anfrage in der Sitzung.
 
  
 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
  
 
Sitzung aus dem Datenspeicher abrufen 
Im folgenden Befehl wird gezeigt, wie Sie die Methode get
  
  
  
  
  
    
  
  
  REST So rufen Sie eine Sitzung aus einem Datenspeicher ab:
Führen Sie den folgenden curl-Befehl aus:
curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /sessions/SESSION_ID "
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID SESSION_ID  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
  
   
 
Sitzung aus der App löschen 
Der folgende Befehl zeigt, wie die Methode delete
Standardmäßig werden Sitzungen, die älter als 60 Tage sind, automatisch gelöscht.
Wenn Sie jedoch eine bestimmte Sitzung löschen möchten, z. B. weil sie vertrauliche Inhalte enthält, verwenden Sie diesen API-Aufruf.
  
  
  
  
  
    
  
  
  REST So löschen Sie eine Sitzung aus einer App:
Führen Sie den folgenden curl-Befehl aus:
curl -X DELETE -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /sessions/SESSION_ID "
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID SESSION_ID  
Beispielbefehl und -ergebnis 
curl -X DELETE -H "Authorization: Bearer $(gcloud auth print-access-token)"
-H "Content-Type: application/json"
"https://discoveryengine.googleapis.com/v1/projects/123456/locations/global/collections/default_collection/engines/my-app/sessions/16002628354770206943"
      
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
  
   
 
Sitzung aktualisieren 
Es gibt verschiedene Gründe, warum Sie eine Sitzung aktualisieren möchten. Sie können beispielsweise folgende Aktionen ausführen:
Sitzung als abgeschlossen markieren 
Nachrichten aus einer Sitzung in eine andere zusammenführen 
Pseudo-ID eines Nutzers ändern 
 
Im folgenden Befehl wird gezeigt, wie die Methode patch
  
  
  
  
  
    
  
  
  REST So aktualisieren Sie eine Sitzung über eine App:
Führen Sie den folgenden curl-Befehl aus:
curl -X PATCH \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /sessions/SESSION_ID ?updateMask=state" \
  -d '{
        "state": "NEW_STATE "
      }'
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID SESSION_ID NEW_STATE IN_PROGRESS. 
Beispielbefehl und -ergebnis 
curl -X PATCH -H "Authorization: Bearer $(gcloud auth print-access-token)"
-H "Content-Type: application/json"
"https://discoveryengine.googleapis.com/v1/projects/123456/locations/global/collections/default_collection/engines/my-app/sessions/16002628354770206943?updateMask=state"
-d '{
"state": "IN_PROGRESS"
}'
     In diesem Beispiel wird der Status der Sitzung in „Offen“ (wird ausgeführt) geändert. Folgen Sie einem ähnlichen Muster, um die userPseudoId zu aktualisieren.
 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
  
   
 
Alle Sitzungen auflisten 
Im folgenden Befehl wird gezeigt, wie die Methode list
  
  
  
  
  
    
  
  
  REST So listen Sie die Sitzungen für eine App auf:
Führen Sie den folgenden curl-Befehl aus:
curl -X GET \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /sessions"
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID  
Beispielbefehl und -ergebnis 
curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)"
-H "Content-Type: application/json"
"https://discoveryengine.googleapis.com/v1/projects/123456/locations/global/collections/default_collection/engines/my-app/sessions"
     Die Antwort enthält eine Liste von Sitzungen und das nextPageToken. Wenn kein nextPageToken zurückgegeben wird, gibt es keine weiteren Sitzungen, die aufgelistet werden können. Die Standardseitengröße ist 50.
 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
  
   
 
Sitzungen für einen Nutzer auflisten 
Der folgende Befehl zeigt, wie die Methode list
  
  
  
  
  
    
  
  
  REST So listen Sie Sitzungen auf, die einem Nutzer oder Besucher zugeordnet sind:
Führen Sie den folgenden curl-Befehl aus:
curl -X GET \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /sessions?filter=userPseudoId=USER_PSEUDO_ID "
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID USER_PSEUDO_ID  
Beispielbefehl und -ergebnis 
curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)"
-H "Content-Type: application/json"
"https://discoveryengine.googleapis.com/v1/projects/123456/locations/global/collections/default_collection/engines/my-app/sessions?filter=userPseudoId=test_user"
     In diesem Beispiel ist dem test_user eine Sitzung zugeordnet. Die Anfragen und Antworten in der Sitzung werden aufgeführt.
 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
  
   
 
Sitzungen für einen Nutzer und einen Bundesstaat auflisten 
Im folgenden Befehl wird gezeigt, wie Sie die Methode list
  
  
  
  
  
    
  
  
  REST So listen Sie Sitzungen für einen Nutzer auf, die offen oder geschlossen sind und einem bestimmten Nutzer oder Besucher zugeordnet sind:
Führen Sie den folgenden curl-Befehl aus:
curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /sessions?filter=userPseudoId=USER_PSEUDO_ID %20AND%20state=STATE "
 Ersetzen Sie Folgendes:
  PROJECT_ID APP_ID USER_PSEUDO_ID STATE STATE_UNSPECIFIED (geschlossen oder unbekannt) oder
  IN_PROGRESS (offen).
   
 Beispielbefehl und -ergebnis 
 
 
curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)"
-H "Content-Type: application/json"
"https://discoveryengine.googleapis.com/v1/projects/123456/locations/global/collections/default_collection/engines/my-app/sessions?filter=userPseudoId=test_user%20AND%20state=IN_PROGRESS"