이 페이지에서는 Vertex AI Search의 답변과 질문이 포함된 검색을 소개하고 메서드 호출을 사용하여 일반 검색 앱에서 이를 구현하는 방법을 보여줍니다.
참고: 답변과 질문 기능은 미디어 또는 의료 데이터 스토어에 적용할 수 없습니다.
답변과 질문이 포함된 검색은 답변 메서드를 기반으로 합니다. 답변 메서드는 이전 검색 메서드의 요약 기능과 지원 중단된 대화 메서드의 모든 기능을 대체합니다.
답변 메서드에는 복잡한 쿼리를 처리하는 기능과 같은 몇 가지 중요한 추가 기능도 있습니다.
핵심 용어: 이 페이지에서 답변 이란 쿼리의 검색 결과를 기반으로 AI가 생성한 답변을 의미합니다. 이는 검색 메서드로 생성할 수 있는 요약 과 본질적으로 동일합니다.
답변 메서드의 특성
답변 메서드의 주요 특성은 다음과 같습니다.
복잡한 쿼리에 대한 답변을 생성하는 기능. 예를 들어 답변 메서드는 다음과 같은 복합 쿼리를 여러 개의 작은 쿼리로 세분화하여 더 나은 결과를 반환함으로써 더 나은 답변을 제공하는 데 사용할 수 있습니다.
'2024년 Google Cloud와 Google Ads의 수익은 각각 얼마인가요?'
'Google은 창립 후 몇 년 만에 10억 달러의 수익을 달성했나요?'
각 차례마다 답변 메서드를 호출하여 멀티턴 대화에서 검색과 답변 생성을 결합하는 기능
검색 메서드와 페어링하여 검색 지연 시간을 줄이는 기능. 검색 메서드와 답변 메서드를 별도로 호출하고 검색 결과와 답변을 각기 다른 시간에 각기 다른 iframe으로 렌더링할 수 있습니다. 즉, 밀리초 이내에 사용자에게 검색 결과(파란색 링크 10개)를 표시할 수 있습니다. 답변이 생성될 때까지 기다리지 않고 검색 결과를 표시할 수 있습니다.
답변과 질문의 기능은 쿼리, 검색, 답변의 세 단계로 나눌 수 있습니다.
답변을 사용해야 하는 경우와 검색을 사용해야 하는 경우
Vertex AI Search에는 앱 쿼리에 사용되는 두 가지 메서드가 있습니다. 서로 다른 기능을 제공하지만 중복되는 기능도 있습니다.
다음과 같은 경우 답변 메서드를 사용하세요.
다음과 같은 경우 검색 메서드를 사용하세요.
생성된 답변이 아닌 검색 결과만 필요한 경우
다음 중 하나에 해당하는 경우:
미디어 또는 의료 데이터
자체 임베딩
동의어 또는 리디렉션 컨트롤
패싯
사용자 국가 코드
다음과 같은 경우 답변 및 검색 메서드를 함께 사용하세요.
쿼리 단계 기능
답변 및 후속 질문 기능은 자연어 쿼리 처리를 지원합니다.
이 섹션에서는 쿼리 문구 수정 및 분류를 위한 다양한 옵션을 설명하고 보여줍니다.
쿼리 문구 수정
쿼리 문구 수정은 기본적으로 사용 설정되어 있습니다. 이 기능은 검색 결과를 개선하기 위해 자동으로 쿼리 문구를 수정하는 가장 좋은 방법을 선택합니다. 이 기능은 문구를 수정하지 않아도 되는 쿼리도 처리할 수 있습니다.
복잡한 쿼리를 여러 쿼리로 세분화하고 동기식 하위 쿼리를 수행합니다.
예: 복잡한 쿼리가 더 작고 간단한 4개의 쿼리로 세분화됩니다.
사용자 입력
복잡한 쿼리에서 생성된 하위 쿼리
Andie Ram과 Arnaud Clément의 직업과 취미에는 어떤 공통점이 있나요?
Andie Ram 직업
Arnaud Clément 직업
Andie Ram 취미
Arnaud Clément 취미
멀티턴 쿼리를 합성하여 후속 질문을 컨텍스트를 인식하는 스테이트풀(Stateful)로 설정할 수 있습니다.
예: 각 차례에서 사용자 입력으로부터 합성된 쿼리를 다음과 같이 표시될 수 있습니다.
사용자 입력
합성된 쿼리
1단계: 학교용 노트북
학교용 노트북
2단계: Mac 아님
Mac이 아닌 학교용 노트북
3단계: 대형 화면 그리고 무선 키보드와 마우스가 필요함
무선 키보드와 마우스가 있는 Mac이 아닌 학교용 대형 화면 노트북
4단계: 그리고 백팩
무선 키보드와 마우스가 있는 Mac이 아닌 학교용 대형 화면 노트북과 백팩
긴 쿼리를 간소화하여 검색을 개선합니다.
예를 들어 긴 쿼리를 간단한 쿼리로 줄입니다.
사용자 입력
간소화된 쿼리
웹사이트의 \'장바구니에 추가\' 버튼이 제대로 작동하지 않는 이유를 알아보고자 합니다. 사용자가 버튼을 클릭하면 상품이 장바구니에 추가되지 않고 오류 메시지가 표시되는 것 같습니다. 코드를 확인해 보니 올바른 것 같아 문제가 무엇인지 잘 모르겠습니다. 이 문제를 해결하는 것을 도와줄 수 있나요?
웹사이트의 '장바구니에 추가' 버튼이 작동하지 않습니다.
다단계 추론 수행
핵심 용어: 단계 (홉 이라고도 함)는 복잡한 질문에 답하는 데 사용됩니다. 질문은 정보 검색 및 추론의 여러 단계로 세분화됩니다.
다단계 추론은 LLM이 자연어 추론을 사용하여 복잡한 과제를 해결할 수 있도록 하는 ReAct(reason + act) 패러다임을 기반으로 합니다.
기본적으로 최대 단계 수는 5개입니다.
예를 들면 다음과 같습니다.
사용자 입력
답변을 생성하는 두 가지 단계
Google은 창립 후 몇 년 만에 10억 달러의 수익을 달성했나요?
1단계:
[생각]: Google이 설립된 시점을 알아야 그 이후의 수익을 쿼리할 수 있습니다.
[조치] 검색: Google은 언제 설립되었나요?[검색 결과 확인]: '1998년'
2단계:
[생각]: 이제 1998년 이후 Google의 연간 수익을 확인하고 처음으로 10억 달러를 초과한 시점을 알아야 합니다.
[조치] 검색: 1998년 이후 Google 수익
[검색 결과 확인] 1998년 Google 수익, 1999년 Google 수익…..
[답변]: Google은 1998년[2] 창립 이후 5년 만인 2003년[1]에 10억 달러 이상의 수익을 달성했습니다.
쿼리 분류
쿼리 분류 옵션은 적대적인 쿼리와 답변을 구하지 않는 쿼리를 식별하는 것입니다. 기본적으로 쿼리 분류 옵션은 사용 중지되어 있습니다.
적대적인 쿼리 및 답변을 구하지 않는 쿼리에 관한 자세한 내용은 적대적인 쿼리 무시 및 요약을 구하지 않는 쿼리 무시 를 참조하세요.
검색 단계 기능
검색의 경우 답변 메서드에는 검색 메서드와 동일한 옵션이 있습니다. 예를 들면 다음과 같습니다.
답변 단계 기능
답변 단계에서 검색 결과에서 답변이 생성되면 검색 메서드와 동일한 기능을 사용 설정할 수 있습니다. 예를 들면 다음과 같습니다.
답변의 각 문장에 대한 출처를 나타내는 인용문을 가져옵니다. 자세한 내용은 인용 포함 을 참조하세요.
프롬프트 프리앰블을 사용하여 어조, 스타일, 세부정보 수준 등의 답변을 맞춤설정합니다.
자세한 내용은 커스텀 프리앰블 지정 을 참조하세요.
답변 생성에 사용할 Vertex AI 모델을 선택합니다.
자세한 내용은 답변 생성 모델 버전 및 수명 주기 를 참조하세요.
적대적이거나 답변을 구하지 않는 것으로 분류된 쿼리를 무시할지 선택합니다.
적대적인 쿼리 및 답변을 구하지 않는 쿼리에 관한 자세한 내용은 적대적인 쿼리 무시 및 요약을 구하지 않는 쿼리 무시 를 참조하세요. 답변을 구하지 않는 쿼리는 요약을 구하지 않는 쿼리라고도 합니다.
검색 결과에서 사용할 수 없는 추가적인 답변 문구 기능은 다음과 같습니다.
각 클레임의 지원 점수 가져오기(생성된 답변의 문장).
지원 점수는 클레임이 데이터 스토어의 데이터에서 그라운딩된 정도를 나타내는 [0,1] 범위의 부동 소수점 값입니다. 자세한 내용은 그라운딩 지원 점수 반환 을 참조하세요.
답변의 집계된 지원 점수 가져오기. 지원 점수는 데이터 스토어의 데이터에서 답변이 그라운됭된 정도를 나타냅니다. 자세한 내용은 그라운딩 지원 점수 반환 을 참조하세요.
올바르게 그라운딩된 답변만 반환합니다. 특정 지원 점수 기준점을 충족하는 답변만 반환하도록 선택할 수 있습니다. 자세한 내용은 올바르게 그라운딩된 답변만 표시 를 참조하세요.
개별 사용자에 맞게 답변을 맞춤설정할 수 있도록 쿼리에 맞춤설정 정보를 추가합니다. 자세한 내용은 답변 맞춤설정 을 참고하세요.
텍스트 외에도 차트나 이미지가 포함된 멀티모달 답변을 받으려면 다음 옵션을 사용할 수 있습니다.
답변에 포함된 데이터를 표시하는 차트와 그래프가 포함된 답변을 가져옵니다. 자세한 내용은 답변에 대한 차트 생성 을 참고하세요.
데이터 스토어에서 이미지를 가져오는 중입니다. 데이터 스토어에 이미지가 포함되어 있으면 대답 메서드가 대답에 이미지를 반환할 수 있습니다. 인용이 요청된 경우 데이터 저장소의 이미지도 참조로 반환될 수 있습니다. 자세한 내용은 데이터 스토어에서 기존 이미지 검색 을 참고하세요.
시작하기 전에
사용 중인 앱 유형에 따라 다음 요구사항을 완료합니다.
정형 또는 비정형 검색 앱을 사용 중이면 고급 LLM 기능 이 사용 설정되어 있는지 확인합니다.
웹사이트 검색 앱을 사용 중이면 다음 기능이 사용 설정되어 있는지 확인합니다.
혼합된 검색 앱(하나 이상의 데이터 스토어에 연결된 앱)이 있으면 Google 계정팀에 연락하여 혼합된 검색으로 답변 API를 이용할 수 있는 허용 목록에 추가해 달라고 요청하세요.
검색 및 답변(기본)
다음 명령어는 답변 메서드를 호출하고 생성된 답변과 출처 링크가 포함된 검색 결과 목록을 반환하는 방법을 보여줍니다.
이 명령어는 필수 입력만 표시합니다. 옵션은 기본값으로 유지합니다.
REST
생성된 답변으로 검색하고 결과를 얻으려면 다음 단계를 따르세요.
다음 curl 명령어를 실행합니다.
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 "}
}'
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: 쿼리할 Vertex AI Search 앱의 ID입니다.
QUERY
: 질문 또는 검색어를 포함하는 자유 텍스트 문자열입니다. 예: 'BigQuery와 Spanner 데이터베이스를 비교해 주세요.'
명령어 및 부분 결과 예시
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?"}}'
{
"answer": {
"state": "SUCCEEDED",
"answerText": "The provided sources do not directly compare the speed of BigQuery and Spanner. However, they do highlight the performance capabilities of each database. BigQuery is described as having strong query performance, particularly for short and complex queries. It also offers a serverless architecture that provides consistent performance regardless of query complexity. Spanner is described as having high performance at virtually unlimited scale, with single-digit millisecond latency for strongly-consistent reads and writes. It also offers a five-nines availability SLA. Ultimately, the best database for a particular use case will depend on the specific requirements of the application. \n",
"steps": [
{
"state": "SUCCEEDED",
"description": "Rephrase the query and search.",
"actions": [
{
"searchAction": {
"query": " 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"
}
이 예시에서 쿼리는 'Spanner의 성능은 무엇인가요?' 및 'BigQuery의 성능은 무엇인가요?'로 분리됩니다.
쿼리 단계 명령어
이 섹션에서는 답변 메서드 호출의 쿼리 단계에서 옵션을 지정하는 방법을 보여줍니다.
검색 및 답변(문구 수정 사용 중지)
다음 명령어는 답변 메서드를 호출하고 생성된 답변과 검색 결과 목록을 반환하는 방법을 보여줍니다. 문구 수정 옵션이 사용 중지되어 답변이 이전 답변과 다를 수 있습니다.
REST
쿼리 문구 수정을 적용하지 않은 생성된 답변으로 검색하고 결과를 얻으려면 다음 단계를 따르세요.
다음 curl 명령어를 실행합니다.
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
}
}
}'
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: Vertex AI Search 앱의 ID입니다.
QUERY
: 질문 또는 검색어를 포함하는 자유 텍스트 문자열입니다. 예: 'BigQuery와 Spanner 데이터베이스를 비교해 주세요.'
명령어 및 부분 결과 예시
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 } }
}'
{
"answer": {
"state": "SUCCEEDED",
"answerText": "The sources provided do not directly compare the speed of BigQuery and Spanner. They do mention that Spanner is optimized for transactional workloads and BigQuery is optimized for analytical workloads. Spanner is a fully managed relational database that provides seamless replication across regions in Google Cloud. BigQuery is a serverless, highly scalable, and cost-effective multi-cloud data warehouse. Spanner is designed to scale horizontally across multiple regions and continents. BigQuery is designed for business agility. \n",
"steps": [
{
"state": "SUCCEEDED",
"description": "Rephrase the query and search.",
"actions": [
{
"searchAction": {
"query": "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"
}
검색 및 답변 (최대 단계 지정)
다음 명령어는 답변 메서드를 호출하고 생성된 답변과 검색 결과 목록을 반환하는 방법을 보여줍니다. 문구 수정 단계 수가 증가했기 때문에 답변이 이전 답변과 다릅니다.
REST
최대 5단계의 문구 수정을 허용하는 생성된 답변으로 검색하고 결과를 얻으려면 다음 단계를 따르세요.
다음 curl 명령어를 실행합니다.
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
}
}
}'
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: 쿼리할 Vertex AI Search 앱의 ID입니다.
QUERY
: 질문 또는 검색어를 포함하는 자유 텍스트 문자열입니다. 예: 'BigQuery와 Spanner 데이터베이스를 비교해 주세요.'
MAX_REPHRASE
: 최대 문구 수정 단계 수입니다. 허용되는 최댓값은 5
입니다.
설정하지 않거나 1
보다 작은 값으로 설정하면 값은 기본값인 1
입니다.
명령어 예
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
}
}
}'
쿼리 분류로 검색 및 답변
다음 명령어는 답변 메서드를 호출하여 쿼리가 적대적인 쿼리인지, 답변을 구하지 않는 쿼리인지, 둘 다 아닌지 묻는 방법을 보여줍니다.
응답에는 쿼리의 분류 유형이 포함되지만 답변 자체는 분류의 영향을 받지 않습니다.
쿼리 유형에 따라 답변 동작을 변경하려면 답변 단계에서 변경하면 됩니다. 적대적인 쿼리 무시 및 요약 외 탐색 쿼리 무시 를 참조하세요.
REST
쿼리가 적대적인 쿼리인지, 답변을 구하지 않는 쿼리인지 확인하려면 다음 단계를 따르세요.
다음 curl 명령어를 실행합니다.
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 "]
}
}
}'
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: 쿼리할 Vertex AI Search 앱의 ID입니다.
QUERY
: 질문 또는 검색어를 포함하는 자유 텍스트 문자열입니다. 예: 'hello'
QUERY_CLASSIFICATION_TYPE
: 식별하려는 쿼리 유형입니다(ADVERSARIAL_QUERY
, NON_ANSWER_SEEKING_QUERY
또는 둘 다).
명령어 및 부분 결과 예시
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"]
}
}
}'
{
"answer": {
"state": "SUCCEEDED",
"answerText": "A user reported that their Google Voice account was randomly sending \"Hello!\" replies to incoming texts. The user was frustrated because they did not want to send these replies and found the behavior random. The user was unable to find any linked accounts, Google extensions, or other settings that could be causing the issue. The user confirmed that Google Voice does not have auto-reply functions. The user was seeking help to stop the automatic replies. \n",
"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/44fb313bcc09877e7239f3810ddb132b",
"uri": "https://support.google.com/mail/thread/58174131/gmail-sends-random-email-saying-hello-to-my-emails-without-me-touching-it?hl=en",
"title": "Gmail sends random email saying \"Hello!!\" to my emails without me touching it",
"snippetInfo": [
{
"snippet": "Gmail sends random email saying "\u003cb\u003eHello\u003c/b\u003e!!" to my emails without me touching it. Whenever I email somebody and they reply, a random email from my Gmail is sent to ...",
"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/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"
}
]
}
]
}
}
]
}
],
"queryUnderstandingInfo": {
"queryClassificationInfo": [
{
"type": "ADVERSARIAL_QUERY"
},
{
"type": "NON_ANSWER_SEEKING_QUERY",
"positive": true
}
]
}
},
"answerQueryToken": "NMwKDAjVloK3BhCdt8u9AhIkNjZkYmFhNWItMDAwMC0yZTBkLTg0ZDAtMDg5ZTA4MmRjYjg0"
}
이 예시에서 쿼리 'hello'는 적대적이지는 않지만 답변을 구하지 않는 것으로 분류됩니다.
검색 단계 명령어: 검색 결과 옵션으로 검색 및 답변
이 섹션에서는 답변 메서드 호출의 검색 단계 부분에 대한 옵션 지정 방법, 반환되는 최대 문서 수 설정, 부스팅, 필터링 등의 옵션, 자체 검색 결과를 제공할 때 답변을 얻는 방법에 대해 설명합니다.
다음 명령어는 답변 메서드를 호출하고 검색 결과 반환 방법에 관한 다양한 옵션을 지정하는 방법을 보여줍니다. 검색 결과는 답변과는 무관합니다.
REST
반환되는 검색 결과와 반환 방식과 관련된 다양한 옵션을 설정하려면 다음 단계를 따르세요.
다음 curl 명령어를 실행합니다.
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
}
}
}'
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: 쿼리할 Vertex AI Search 앱의 ID입니다.
QUERY
: 질문 또는 검색어를 포함하는 자유 텍스트 문자열입니다. 예: 'BigQuery와 Spanner 데이터베이스를 비교해 주세요.'
MAX_RETURN_RESULTS
: 반환할 검색 결과 수입니다. 기본값은 10
입니다. 최댓값은 25
입니다.
FILTER
: 쿼리할 문서를 지정하는 필터입니다. 문서의 메타데이터가 필터 사양을 충족하면 문서가 쿼리됩니다. 필터 구문 등에 대한 자세한 내용은 정형 데이터 또는 비정형 데이터의 일반 검색 필터링 을 참조하세요.
BOOST_SPEC
: 부스트 사양을 사용하면 검색 결과에서 특정 문서를 부스팅할 수 있으며, 이는 대답에 영향을 줄 수 있습니다.
부스트 사양 구문 등에 대한 자세한 내용은 검색 결과 부스트 를 참조하세요.
ORDER_BY
: 문서가 반환되는 순서입니다. 문서는 문서 객체의 필드별로 정렬할 수 있습니다. orderBy
표현식은 대소문자를 구분합니다.
이 필드를 인식할 수 없으면 INVALID_ARGUMENT
가 반환됩니다.
SEARCH_RESULT_MODE
: 검색 결과 모드를 지정합니다(DOCUMENTS
또는 CHUNKS
). 자세한 내용은 문서 파싱 및 청크 처리 및 ContentSearchSpec 을 참조하세요.
이 필드는 API의 v1alpha 버전에서만 사용할 수 있습니다.
명령어 및 결과 예시
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 }
}
}'
{
"answer": {
"state": "SUCCEEDED",
"answerText": "Spanner database has an API that provides programmatic access to the database. The API is available through client libraries, RPC, and REST. The client libraries allow you to interact with Spanner in your preferred language. The RPC API and REST API provide programmatic access to Spanner. The Cloud Spanner API is a managed, mission-critical, globally consistent and scalable relational database service. \n",
"steps": [
{
"state": "SUCCEEDED",
"description": "Rephrase the query and search.",
"actions": [
{
"searchAction": {
"query": "Does spanner database have an API?"
},
"observation": {
"searchResults": [
{
"document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/d135b46c4a44d0cc6b652538c1887f4d",
"uri": "https://cloud.google.com/spanner/docs/apis",
"title": "APIs & reference | Spanner | Google Cloud",
"snippetInfo": [
{
"snippet": "The client libraries, the RPC \u003cb\u003eAPI\u003c/b\u003e, and the REST \u003cb\u003eAPI\u003c/b\u003e provide programmatic access to \u003cb\u003eSpanner\u003c/b\u003e. \u003cb\u003eSpanner\u003c/b\u003e client libraries. \u003cb\u003eGet\u003c/b\u003e started with \u003cb\u003eSpanner\u003c/b\u003e in your language ...",
"snippetStatus": "SUCCESS"
}
]
},
{
"document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/7a744d43e61ccd33539de74d5c1f6313",
"uri": "https://cloud.google.com/spanner/docs/reference/rest",
"title": "Cloud Spanner API",
"snippetInfo": [
{
"snippet": "Returns permissions that the caller \u003cb\u003ehas\u003c/b\u003e on the specified \u003cb\u003edatabase\u003c/b\u003e or backup resource. updateDdl, PATCH /v1/{\u003cb\u003edatabase\u003c/b\u003e=projects/*/instances/*/\u003cb\u003edatabases\u003c/b\u003e/*}/ddl",
"snippetStatus": "SUCCESS"
}
]
},
{
"document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/70834ebf4b72b6dc69e06c44ee80f90b",
"uri": "https://cloud.google.com/spanner/docs/reference/rpc",
"title": "Cloud Spanner API",
"snippetInfo": [
{
"snippet": "ChangeQuorum \u003cb\u003eis\u003c/b\u003e strictly restricted to \u003cb\u003edatabases\u003c/b\u003e ... Returns the schema of a Cloud \u003cb\u003eSpanner database\u003c/b\u003e ... Returns permissions that the caller \u003cb\u003ehas\u003c/b\u003e on the specified ...",
"snippetStatus": "SUCCESS"
}
]
}
]
}
}
]
}
]
},
"answerQueryToken": "NMwKDAj2l4K3BhCqiv66ARIkNjZkYmFhNmMtMDAwMC0yZTBkLTg0ZDAtMDg5ZTA4MmRjYjg0"
}
이 예시에서는 반환되는 문서 수가 3개로 제한됩니다.
답변 단계 명령어
이 섹션에서는 answer
메서드 호출을 맞춤설정하는 방법을 보여줍니다.
필요에 따라 다음 옵션을 결합할 수 있습니다.
적대적인 쿼리와 답변을 구하지 않는 쿼리 무시
다음 명령어는 답변 메서드를 호출할 때 적대적인 쿼리 및 답변을 구하지 않는 쿼리에 답변하지 않는 방법을 보여줍니다.
REST
적대적이거나 답변을 구하지 않는 쿼리에 대한 답변을 건너뛰려면 다음 단계를 따르세요.
다음 curl 명령어를 실행합니다.
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
}
}'
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: 쿼리할 Vertex AI Search 앱의 ID입니다.
QUERY
: 질문 또는 검색어를 포함하는 자유 텍스트 문자열입니다.
명령어 및 부분 결과 예시
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 }
}'
{
"answer": {
"state": "SUCCEEDED",
"answerText": "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"
}
이 예시에서는 쿼리가 답변을 구하지 않는 확인되어 답변이 생성되지 않습니다.
관련 답변만 표시
Vertex AI Search는 쿼리와 결과의 관련성을 평가할 수 있습니다. 충분히 관련성이 있다고 판단되는 결과가 없으면 관련성이 없거나 최소한의 관련성만 있는 결과에서 답변을 생성하는 대신 대체 답변인 'We do not have a summary for your query.
'를 반환하도록 선택할 수 있습니다.
다음 명령어는 답변 메서드를 호출할 때 관련 없는 결과가 나올 경우 대체 답변을 반환하는 방법을 보여줍니다.
REST
관련성 있는 결과가 없을 때 대체 답변을 반환하려면 다음 단계를 따르세요.
다음 curl 명령어를 실행합니다.
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
}
}'
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: 쿼리할 Vertex AI Search 앱의 ID입니다.
QUERY
: 질문 또는 검색어를 포함하는 자유 텍스트 문자열입니다.
명령어 및 결과 예시
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
} }'
{
"answer": {
"state": "SUCCEEDED",
"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"
}
이 예시에서는 결과가 쿼리와 충분히 관련이 없는 것으로 판단되어 생성된 답변 및 결과 대신 대세 답변이 반환되었습니다.
그라운딩 지원 점수 반환
다음 명령어는 답변 및 클레임의 그라운딩 지원 점수를 반환하는 방법을 보여줍니다.
Vertex AI의 그라운딩에 대한 일반적인 내용은 RAG로 그라운딩 검사 를 참조하세요. groundingConfigs.check
메서드는 답변 메서드로 호출됩니다.
REST
각 클레임의 지원 점수(답변의 문장) 및 답변의 집계된 지원 점수를 반환하려면 다음을 수행합니다.
다음 curl 명령어를 실행합니다.
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,
}
}'
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: 쿼리할 Vertex AI Search 앱의 ID입니다.
QUERY
: 질문 또는 검색어를 포함하는 자유 텍스트 문자열입니다.
명령어 및 부분 결과 예시
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,
}
}'
{
"answer": {
"state": "SUCCEEDED",
"answerText": "SQL stands for Structured Query Language. It is a database management programming language that is used to access and manage data in a database. SQL is used to create, update, and delete data in a database. It can also be used to query data and retrieve information. SQL is a standard language that is used by many different database systems.",
"groundingScore" 0.9
"groundingSupports": [
{
"endIndex": "41",
"sources": [
{
"referenceId": "1"
}
]
"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."
}
]
}
]
}
}
]
}
]
}
}
이 예시에서는 지원 점수(`groundingScore`)가 각 인용에 대해 반환됩니다.
올바르게 그라운딩된 답변만 표시
다음 명령어는 데이터 스토어의 정보인 코퍼스 에서 올바르게 그라운딩된 것으로 간주되는 답변만 반환하는 방법을 보여줍니다.
올바르게 그라운딩되지 않은 답변은 필터링됩니다.
그라운딩 지원 점수에 대해 낮거나 높은 수준의 기준점을 선택할 수 있습니다. 그러면 해당 수준을 충족하거나 초과하는 경우에만 답변이 반환됩니다. 2개의 필터 기준점을 사용하고 기준점을 사용하지 않는 경우를 실험하여 사용자에게 최선의 결과를 제공하는 필터 수준을 확인할 수 있습니다.
Vertex AI의 그라운딩에 대한 일반적인 내용은 RAG로 그라운딩 검사 를 참조하세요. groundingConfigs.check
메서드는 답변 메서드로 호출됩니다.
REST
지원 점수 기준점을 충족하는 경우에만 답변을 반환하려면 다음을 수행합니다.
다음 curl 명령어를 실행합니다.
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 "
}
}'
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: 쿼리할 Vertex AI Search 앱의 ID입니다.
QUERY
: 질문 또는 검색어를 포함하는 자유 텍스트 문자열입니다.
FILTER_LEVEL
: 그라운딩 지원 점수를 기준으로 답변을 필터링하는 열거형입니다. 옵션은 FILTERING_LEVEL_LOW
, FILTERING_LEVEL_HIGH
입니다. filteringLevel
가 포함되지 않은 경우 답변에 지원 점수 필터가 적용되지 않습니다.
명령어 및 부분 결과 예시
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 {
state: SUCCEEDED
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
}
이 예시에서는 높은 기준점이 충족되지 않았기 때문에 답변이 반환되지 않습니다.
답변 모델 지정
다음 명령어는 답변을 생성하는 데 사용되는 모델 버전을 변경하는 방법을 보여줍니다.
지원되는 모델에 대한 자세한 내용은 답변 생성 모델 버전 및 수명 주기 를 참조하세요.
REST
기본 모델과 다른 모델을 사용하여 답변을 생성하려면 다음 단계를 따르세요.
다음 curl 명령어를 실행합니다.
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 ",
}
}
}'
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: 쿼리할 Vertex AI Search 앱의 ID입니다.
QUERY
: 질문 또는 검색어를 포함하는 자유 텍스트 문자열입니다.
MODEL_VERSION
: 답변을 생성하는 데 사용할 모델 버전입니다. 자세한 내용은 답변 생성 모델 버전 및 수명 주기 를 참조하세요.
명령어 및 부분 결과 예시
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",
}
} }'
{
"answer": {
"state": "SUCCEEDED",
"answerText": "Cloud Spanner is a fully managed relational database optimized for transactional workloads. BigQuery is a serverless, highly scalable, and cost-effective multi-cloud data warehouse designed for business agility. BigQuery is optimized for ad-hoc analysis and reporting. Both Spanner and BigQuery are built on Google's distributed storage system, Colossus, and their internal cluster management system, Borg. They are also built on Jupiter, Google's in-house custom network hardware and software.\n\nBigQuery can query data stored in Spanner in real time without moving or copying the data. This is possible with BigQuery's query federation support. To run a federated query, you need to configure an external data source in BigQuery that points to the intended Spanner instance. You can then write queries that can be used to populate a BigQuery table on demand or scheduled to run as needed. You can also join the query with another BigQuery result set dynamically.\n\nYou can also use Dataflow to copy data from Spanner to BigQuery. Dataflow is a service that can be used to ingest Spanner data into BigQuery. This is useful for more complex transformations or external dependencies. For example, an online gaming company might use Spanner to store game data and BigQuery to perform analytics on player behavior. They can replicate data from Spanner into BigQuery and perform analytics against local data, or they can use federated queries to retrieve data from Spanner on-demand.\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/648c220055c1d2ac369165007d9f6650",
"uri": "https://cloud.google.com/blog/products/databases/choosing-cloud-spanner-for-game-development",
"title": "Choosing Cloud Spanner for game development | Google Cloud Blog",
"snippetInfo": [
{
"snippet": "To get started with \u003cb\u003eSpanner\u003c/b\u003e, create a \u003cb\u003edatabase\u003c/b\u003e, or try it out with a \u003cb\u003eSpanner\u003c/b\u003e Qwiklab. ... AlloyDB \u003cb\u003evs\u003c/b\u003e. ... SQL for SQL Server to \u003cb\u003eBigQuery\u003c/b\u003e. By Alexander ...",
"snippetStatus": "SUCCESS"
}
]
}
]
}
}
]
}
]
},
"answerQueryToken": "NMwKDAivmvy2BhCxnsqdARIkNjZkOTQ0NWEtMDAwMC0yMTBkLTllNmItZjQwMzA0NWRiZDMw"
}
이 예시에서는 기본 모델 대신 모델의 미리보기 버전이 사용됩니다.
커스텀 프리앰블 지정
다음 명령어는 생성된 답변의 프리앰블을 설정하는 방법을 보여줍니다. 프리앰블에는 답변을 맞춤설정하기 위한 자연어 안내가 포함되어 있습니다. 길이, 세부정보 수준, 출력 스타일(예: '간단'), 출력 언어, 답변의 포커스, 형식(예: 테이블, 글머리기호, XML)과 같은 맞춤설정을 요청할 수 있습니다. 예를 들어 프리앰블은 '열 살짜리 아이처럼 설명해 주세요.'와 같이 작성할 수 있습니다.
프리앰블은 생성된 답변의 품질에 중대한 영향을 줄 수 있습니다. 프리앰블에 기록할 내용과 올바른 프리앰블에 대한 예시는 커스텀 프리앰블 정보 를 참조하세요.
REST
기본 모델과 다른 모델을 사용하여 답변을 생성하려면 다음 단계를 따르세요.
다음 curl 명령어를 실행합니다.
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 ",
}
}
}'
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: 쿼리할 Vertex AI Search 앱의 ID입니다.
QUERY
: 질문 또는 검색어를 포함하는 자유 텍스트 문자열입니다.
PREAMBLE
: 답변을 맞춤설정하기 위한 자연어 안내입니다. 예를 들어 show the answer format in
an ordered list
또는 give a very detailed answer
을 사용해 보세요.
명령어 및 결과 예시
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 ",
}
}
}'
{
"answer": {
"state": "SUCCEEDED",
"answerText": "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"
}
이 예시에서 프리앰블은 기본값이 제공할 수 있는 것보다 더 간단한 답변을 요청합니다.
인용 포함
다음 명령어는 답변에 인용을 포함하도록 요청하는 방법을 보여줍니다.
참고: 응답에 반환되는 인용 메타데이터의 startIndex
및 endIndex
값은 문자가 아닌 UTF-8 유니코드 바이트로 측정됩니다.
다중 바이트 문자가 있는 경우 색인 측정값이 문자열 길이보다 깁니다.
REST
기본 모델과 다른 모델을 사용하여 답변을 생성하려면 다음 단계를 따르세요.
다음 curl 명령어를 실행합니다.
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
}
}'
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: 쿼리할 Vertex AI Search 앱의 ID입니다.
QUERY
: 질문 또는 검색어를 포함하는 자유 텍스트 문자열입니다.
INCLUDE_CITATIONS
: 답변에 인용 메타데이터를 포함할지 여부를 지정합니다. 기본값은 false
입니다.
명령어 및 부분 결과 예시
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
}
}'
{
"answer": {
"state": "SUCCEEDED",
"answerText": "SQL stands for Structured Query Language and is a programming language used to manage, query, and retrieve data in a relational database. It is the standard language used by relational database management systems (RDBMS) such as PostgreSQL, SQL Server, MySQL, and Oracle Database. SQL statements are written in a statement format for queries and other database operations, allowing users to manipulate data in relational database tables. SQL is used to create and update the structure of tables, read and write data, manage user permissions, and perform administrative tasks. While originally created for relational databases, SQL is now a foundation for many technology capabilities, making SQL knowledge essential for many technology roles. \n",
"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"
}
답변 언어 코드 설정
다음 명령어는 답변의 언어 코드를 설정하는 방법을 보여줍니다.
REST
기본 모델과 다른 모델을 사용하여 답변을 생성하려면 다음 단계를 따르세요.
다음 curl 명령어를 실행합니다.
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 "
}
}'
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: 쿼리할 Vertex AI Search 앱의 ID입니다.
QUERY
: 질문 또는 검색어를 포함하는 자유 텍스트 문자열입니다.
ANSWER_LANGUAGE_CODE
: 답변의 언어 코드입니다. BCP47: 언어 식별을 위한 태그 에 정의된 언어 태그를 사용합니다.
명령어 및 결과 예시
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"
}
}'
{
"answer": {
"state": "SUCCEEDED",
"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"
}
이 예시에서 원본 문서는 영어로 작성되었지만 답변은 스페인어로 제공됩니다.
답변 맞춤설정
프로필의 데이터와 같이 사용자에 관한 특정 정보가 있는 경우 endUserMetadata
객체에서 해당 정보를 지정하여 검색 결과를 사용자에게 맞춤설정할 수 있습니다.
예를 들어 로그인한 사용자가 휴대전화 업그레이드에 관한 정보를 검색하는 경우 현재 휴대전화 모델 및 요금제와 같은 프로필의 정보는 생성된 답변을 맞춤설정할 수 있는 정보를 제공합니다.
쿼리를 실행하는 사용자에 관한 개인 정보를 추가하고 개인 정보를 고려한 대답을 생성하려면 다음 단계를 따르세요.
다음 curl 명령어를 실행합니다.
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 "}
}
}
]
}
}'
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: 쿼리할 Vertex AI Search 앱의 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.
이 문자열의 길이 제한은 8,000자(영문 기준)입니다.
INFO_DESCRIPTION
: 맞춤설정 정보를 간략하게 설명하는 문자열입니다(예: Customer
profile data, including model, plan, and billing status.
). 모델은 쿼리에 대한 맞춤설정된 대답을 생성할 때 이 설명과 맞춤설정 정보를 모두 사용합니다.
명령어 및 결과 예시
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."}
}
}
]
}
}'
{
"answer": {
"state": "SUCCEEDED",
"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"
}
}
}
...
이 예시에서 모델은 endUserMetadata
를 사용하여 답변을 맞춤설정합니다. 이 예에서는 endUserMetadata
의 중요성을 알 수 있도록 인용문을 포함했습니다. endUserMetadata
는 항상 인용되는 첫 번째 참조입니다.
답변 차트 생성
Preview
This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section
of the Service Specific Terms .
Pre-GA features are available "as is" and might have limited support.
For more information, see the
launch stage descriptions .
answer 메서드는 차트를 생성하고 쿼리에 대한 대답의 일부로 반환할 수 있습니다.
답변에 차트를 포함하도록 구체적으로 요청할 수 있습니다(예: '사용 가능한 데이터를 사용하여 지난 몇 년간 중소기업 결제의 전년 대비 성장률을 표시해 줘'). 시스템에서 충분한 데이터가 있다고 판단하면 차트가 반환됩니다. 일반적으로 차트와 함께 일부 답변 텍스트가 반환됩니다.
또한 차트를 만들기에 충분한 데이터가 있는 경우 쿼리에서 차트를 명시적으로 요청하지 않았더라도 답변 메서드가 차트를 반환할 수 있습니다. 예를 들어 '2010년부터 2020년까지 10년 동안 깨끗한 식수에 대한 접근성이 개선되어 HDI 점수가 얼마나 향상되었나요?'
답변당 차트는 하나만 생성됩니다. 그러나 차트가 다른 더 작은 차트가 포함된 복합 차트일 수 있습니다. 복합 차트의 예는 다음과 같습니다.
제한사항
쿼리는 영어로 작성해야 합니다.
일반적인 오류 시나리오
답변과 함께 이미지가 반환되지 않는 경우도 있습니다. 데이터가 충분하지 않으면 그림을 생성할 수 없습니다.
다른 실패 시나리오에는 코드 실행 실패 및 시간 초과가 포함됩니다. 이 중 하나라도 발생하면 검색어를 바꾸고 다시 시도해 보세요.
시작하기 전에
생성된 차트를 요청하는 쿼리를 실행하기 전에 다음을 실행합니다.
절차
REST
다음과 같이 answer 메서드를 호출하여 데이터 스토어의 데이터에서 생성된 차트를 포함할 수 있는 답변을 반환합니다.
다음 curl 명령어를 실행합니다.
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 "
}
}
}'
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: 쿼리할 Vertex AI Search 앱의 ID입니다.
QUERY
: 질문 또는 검색어를 포함하는 영어로 된 자유 텍스트 문자열입니다.
MODEL_VERSION
: 모델 버전 gemini-2.0-flash-001/answer_gen/v1
이상 자세한 내용은 답변 생성 모델 버전 및 수명 주기 를 참고하세요.
IMAGE_SOURCE
: 답변에 생성된 차트(FIGURE_GENERATION_ONLY
)가 포함되도록 요청하거나 답변에 생성된 차트 또는 데이터 스토어의 기존 이미지 (ALL_AVAILABLE_SOURCES
)가 포함될 수 있음을 요청하는 열거형입니다.
명령어 및 부분 결과 예시
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"
}
}
}'
{
"answer": {
"state": "SUCCEEDED",
"answerText": "The composition of net cash used in investing activities for the nine months ended September 30, 2020 and 2019 includes several categories. These categories are purchases of property and equipment, purchases of marketable securities, maturities and sales of marketable securities, purchases of non-marketable investments, maturities and sales of non-marketable investments, acquisitions net of cash acquired and purchases of intangible assets, and other investing activities. For the nine months ended September 30, 2020, the net cash used in investing activities totaled $(25,492). For the nine months ended September 30, 2019, the net cash used in investing activities totaled $(24,788).\n\nHere's a breakdown of the specific cash flows for investing activities (in millions):\n\n* **Purchases of property and equipment:** $(16,802) in 2020 and $(17,496) in 2019\n* **Purchases of marketable securities:** $(104,932) in 2020 and $(80,968) in 2019\n* **Maturities and sales of marketable securities:** $97,751 in 2020 and $74,783 in 2019\n* **Purchases of non-marketable investments:** $(1,864) in 2020 and $(1,499) in 2019\n* **Maturities and sales of non-marketable investments:** $598 in 2020 and $297 in 2019\n* **Acquisitions, net of cash acquired, and purchases of intangible assets:** $(368) in 2020 and $(373) in 2019\n* **Other investing activities:** $125 in 2020 and $468 in 2019",
"steps": [
{
"state": "SUCCEEDED",
"description": "Rephrase the query and search.",
"actions": [
{
"searchAction": {
"query": "Plot composition of net cash used in investing activities"
},
"observation": {
"searchResults": [
{
"document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/b3133a895e0404984959736488992b53",
"uri": "gs://yipeiw_multimodal_0827/rzilleruelo_multimodal_datasets/20240806/Document Understanding Evaluation Dataset/boa-tabular/Testing_20201030-alphabet-cash flow statement.pdf",
"title": "Testing_20201030-alphabet-cash flow statement",
"snippetInfo": [
{
"snippet": "... \u003cb\u003eNet cash provided by operating activities\u003c/b\u003e 42,447 | 40,093 | | \u003cb\u003eInvesting activities\u003c/b\u003e | | | (16,802) Purchases of property and equipment | (17,496) ...",
"snippetStatus": "SUCCESS"
}
]
}
]
}
}
]
}
],
"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"
이 예에서는 쿼리가 플롯을 요청했고 차트를 생성하기에 충분한 데이터가 있었기 때문에 생성된 차트가 답변에 포함됩니다.
차트 이미지는 GENERATED
의 attributionType
와 함께 blobAttachments
출력으로 반환됩니다.
데이터 스토어에서 기존 이미지 가져오기
Preview
This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section
of the Service Specific Terms .
Pre-GA features are available "as is" and might have limited support.
For more information, see the
launch stage descriptions .
데이터 스토어의 이미지를 답변과 함께 반환하고 인용 참조에 포함하도록 선택할 수 있습니다. 데이터 스토어는 레이아웃 파서가 사용 설정된 비정형 데이터 스토어여야 합니다.
imageSource
가 CORPUS_IMAGE_ONLY
또는 ALL_AVAILABLE_SOURCES
이면 answer 메서드는 적절하게 데이터 스토어에서 이미지를 가져올 수 있습니다. 하지만 이 옵션을 사용 설정한다고 해서 이미지가 항상 반환되는 것은 아닙니다.
답변당 이미지를 최대 1개까지 받을 수 있습니다. 인용에는 여러 이미지가 포함될 수 있습니다.
제한사항
시작하기 전에
이미지를 검색하는 쿼리를 실행하기 전에 다음을 실행합니다.
Google 계정팀에 연락하여 이미지 식별 및 주석을 위한 허용 목록에 추가해 달라고 요청하세요.
이미지를 검색하려는 비정형 데이터 스토어에 이미지 주석 사용 설정 을 사용 설정합니다.
데이터 스토어의 데이터 페이지에서 처리 구성 을 클릭합니다.
기본 문서 파서 를 Layout Parser 로 설정합니다.
이미지 주석 사용 설정 을 선택합니다.
참고: 레이아웃 파서가 적용되지 않은 데이터 스토어에서 반환된 이미지를 가져올 수 있습니다. 하지만 품질 결과를 얻으려면 레이아웃 파서가 필요합니다.
절차
REST
다음과 같이 answer 메서드를 호출하여 데이터 스토어의 이미지를 답변에 포함할 수 있는 답변을 반환합니다.
다음 curl 명령어를 실행합니다.
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 "
}
}
}'
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: 쿼리할 Vertex AI Search 앱의 ID입니다.
QUERY
: 질문 또는 검색어를 포함하는 영어로 된 자유 텍스트 문자열입니다.
MODEL_VERSION
: 모델 버전 gemini-2.0-flash-001/answer_gen/v1
이상 자세한 내용은 답변 생성 모델 버전 및 수명 주기 를 참고하세요.
IMAGE_SOURCE
: 답변에 데이터 스토어의 이미지(CORPUS_IMAGE_ONLY
)가 포함되도록 요청하거나 답변에 데이터 스토어의 이미지 또는 생성된 차트 (ALL_AVAILABLE_SOURCES
)가 포함될 수 있음을 요청하는 열거형입니다.
명령어 및 부분 결과 예시
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
}
}
}'
{
"answer": {
"state": "SUCCEEDED",
"answerText": "Holiday spending over November-December was weakest among Gen Xers, followed by Millennials, while Baby Boomer spending was relatively more solid. In November, Baby Boomers saw solid spending growth. Both Millennials and Gen X consumers had lower holiday spending than in the same 30-day period last year. Baby Boomers' holiday spending started to pick up from the start of November and continued to rise throughout the month. Meanwhile, Millennials started to ramp up their holiday spending much later in the month. Gen X consumers consistently outspent other generations from late October through the end of November.\n",
"citations": [
{
"endIndex": "146",
"sources": [
{
"referenceId": "3"
}
]
},
{
"startIndex": "147",
"endIndex": "199",
"sources": [
{
"referenceId": "2"
}
]
},
{
"startIndex": "200",
"endIndex": "305",
"sources": [
{
"referenceId": "2"
}
]
},
{
"startIndex": "306",
"endIndex": "426",
"sources": [
{
"referenceId": "2"
}
]
},
{
"startIndex": "427",
"endIndex": "516",
"sources": [
{
"referenceId": "2"
}
]
},
{
"startIndex": "517",
"endIndex": "619",
"sources": [
{
"referenceId": "2"
}
]
}
],
"references": [
{
"chunkInfo": {
"content": "Bank of America aggregated credit/debit card spending per household includes spending from active US households only. Only.., Consumer and Small Business Mel Roasa Vice President, Digital and MarketingBANK OF AMERICA INSTITUTE09 November 20237",
"relevanceScore": 0.5,
"documentMetadata": {
"document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/f8d7887862167c5daf6c7a30e1d464e0",
"uri": "gs://yipeiw_multimodal_0827/rzilleruelo_multimodal_datasets/20240806/Document Understanding Evaluation Dataset/Bank of America/1WkoquhDpqHphSnqIVKX45iers7kvmGjZ.pdf",
"title": "1WkoquhDpqHphSnqIVKX45iers7kvmGjZ",
"pageIdentifier": "6"
}
}
},
{
"chunkInfo": {
"content": "Bank of America aggregated credit/debit card spending per household includes spending from active US households only. Only... Digital and Marketing Riley Fillius Vice President, Digital and MarketingBANK OF AMERICA INSTITUTE08 February 2024 7",
"relevanceScore": 0.4,
"documentMetadata": {
"document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/c4308d8610bcae3b3d2bb916090ef28b",
"uri": "gs://yipeiw_multimodal_0827/rzilleruelo_multimodal_datasets/20240806/Document Understanding Evaluation Dataset/Bank of America/1B3MJqELqk_S26aWb-KnLdSWwmpuB32os.pdf",
"title": "1B3MJqELqk_S26aWb-KnLdSWwmpuB32os",
"pageIdentifier": "6"
}
}
},
...
{
"chunkInfo": {
"content": "Bank of America aggregated credit/debit card spending per household includes spending from active US households only. Only consumer card holders making a minimum of five transactions a month are included in the dataset. Spending from corporate cards are excluded. Data regarding merchants who receive payments are identified and classified by the Merchant Categorization Code (MCC) defined by financial services companies. The data are mapped using proprietary methods from the MCCs to the North American Industry Classification System (NAICS), which is also used by the Census Bureau, in order to classify spending data by subsector. Spending data may also be classified by other proprietary methods not using MCCs. Generations, if discussed, are defined as follows: 1. Gen Z, born after 1995 2. Younger Millennials: born between 1989-1995 3. Older Millennials: born between 1978-19886 11 March 2024BANK OF AMERICA INSTITUTE4. Gen Xers: born between 1965-1977 5. Baby Boomer: 1946-1964 6. Traditionalists: pre-1946 Any reference to card spending per household on gasoline includes all purchases at gasoline stations and might include purchases of non-gas items. Additional information about the methodology used to aggregate the data is available upon request.\n\n## Contributors\n\nDavid Michael Tinsley Senior Economist, Bank of America Institute Joe Wadford Economist, Bank of America Institute Taylor Bowley Economist, Bank of America Institute Liz Everett Krisberg Head of Bank of America Institute\n\n## Sources\n\nLi Wei Director, Global Risk Analytics Kimberly Warren Director, Global Risk Analytics Ana Maxim Senior Vice President, Consumer and Small Business Mel Roasa Vice President, Digital and MarketingBANK OF AMERICA INSTITUTE11 March 2024 7",
"relevanceScore": 0.3,
"documentMetadata": {
"document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/719bfb7c1c0cde3888debd43542aabfe",
"uri": "gs://yipeiw_multimodal_0827/rzilleruelo_multimodal_datasets/20240806/Document Understanding Evaluation Dataset/Bank of America/1odEo6QRllsURLZRDwHNruCXK9bsWmhtR.pdf",
"title": "1odEo6QRllsURLZRDwHNruCXK9bsWmhtR",
"pageIdentifier": "6"
}
}
}
],
"steps": [
{
"state": "SUCCEEDED",
"description": "Rephrase the query and search.",
"actions": [
{
"searchAction": {
"query": "Rank generations from highest to lowest based on their spending on holiday items using cards."
},
"observation": {
"searchResults": [
{
"document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/935c4e1f18ccff2b5fa51d6d00e40dc4",
"uri": "gs://yipeiw_multimodal_0827/rzilleruelo_multimodal_datasets/20240806/Document Understanding Evaluation Dataset/Bank of America/1baMNJuizoK7u3P2-gYRwpVz_46-uOhn4.pdf",
"title": "1baMNJuizoK7u3P2-gYRwpVz_46-uOhn4",
"snippetInfo": [
{
"snippet": "## Exhibit 6: Credit and debit \u003cb\u003ecard spending\u003c/b\u003e per household on \u003cb\u003eholiday items\u003c/b\u003e by \u003cb\u003egeneration\u003c/b\u003e (index, Aug-Sep average=100 for each year, 7- day moving average) ...",
"snippetStatus": "SUCCESS"
}
]
},
{
"document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/0b4c8cfb6f5ed9ef0df70ffcd79fe2c0",
"uri": "gs://yipeiw_multimodal_0827/rzilleruelo_multimodal_datasets/20240806/Document Understanding Evaluation Dataset/Bank of America/1pVkzcMDNAy-p7AlrE0LRlhpbbDzCNndJ.pdf",
"title": "1pVkzcMDNAy-p7AlrE0LRlhpbbDzCNndJ",
"snippetInfo": [
{
"snippet": "Consumer \u003cb\u003espending\u003c/b\u003e finished solidly in 2023, \u003cb\u003ewith\u003c/b\u003e total \u003cb\u003ecard spending\u003c/b\u003e per household increasing by 0.2% year-over-year (YoY) in December, according to Bank of ...",
"snippetStatus": "SUCCESS"
}
]
},
{
"document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/f8d7887862167c5daf6c7a30e1d464e0",
"uri": "gs://yipeiw_multimodal_0827/rzilleruelo_multimodal_datasets/20240806/Document Understanding Evaluation Dataset/Bank of America/1WkoquhDpqHphSnqIVKX45iers7kvmGjZ.pdf",
"title": "1WkoquhDpqHphSnqIVKX45iers7kvmGjZ",
"snippetInfo": [
{
"snippet": "This could be due to an increasing customer \u003cb\u003ebase\u003c/b\u003e or inactive customers \u003cb\u003eusing their cards\u003c/b\u003e more frequently. Per household \u003cb\u003ecard spending\u003c/b\u003e growth only looks at ...",
"snippetStatus": "SUCCESS"
}
]
},
{
"document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/719bfb7c1c0cde3888debd43542aabfe",
"uri": "gs://yipeiw_multimodal_0827/rzilleruelo_multimodal_datasets/20240806/Document Understanding Evaluation Dataset/Bank of America/1odEo6QRllsURLZRDwHNruCXK9bsWmhtR.pdf",
"title": "1odEo6QRllsURLZRDwHNruCXK9bsWmhtR",
"snippetInfo": [
{
"snippet": "This could be due to an increasing customer \u003cb\u003ebase\u003c/b\u003e or inactive customers \u003cb\u003eusing their cards\u003c/b\u003e more frequently. Per household \u003cb\u003ecard spending\u003c/b\u003e growth only looks at ...",
"snippetStatus": "SUCCESS"
}
]
},
{
"document": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/c4308d8610bcae3b3d2bb916090ef28b",
"uri": "gs://yipeiw_multimodal_0827/rzilleruelo_multimodal_datasets/20240806/Document Understanding Evaluation Dataset/Bank of America/1B3MJqELqk_S26aWb-KnLdSWwmpuB32os.pdf",
"title": "1B3MJqELqk_S26aWb-KnLdSWwmpuB32os",
"snippetInfo": [
{
"snippet": "This could be due to an increasing customer \u003cb\u003ebase\u003c/b\u003e or inactive customers \u003cb\u003eusing their cards\u003c/b\u003e more frequently. Per household \u003cb\u003ecard spending\u003c/b\u003e growth only looks at ...",
"snippetStatus": "SUCCESS"
}
]
}
]
}
}
]
}
],
"blobAttachments": [
{
"data": {
"mimeType": "image/png",
"data": "iVBORw0KGgoAAAANSUhEUgAABcwAAAIjCAIAAACxms+ZAAAgAElEQVR42uzdd1xTV/...Vv/F0NDQ4NOp3+waz94PJ5Op7+/ibro6fRiWPX/AaZ6/dAGW00gAAAAAElFTkSuQmCC"
},
"attributionType": "CORPUS"
}
]
},
"answerQueryToken": "M8gKCwiPuOe-BhDyhpgIEiQ2N2Q2MWI0Mi0wMDAwLTJjNTgtODFiNy0wODllMDgyY2FkODA"
}
이미지는 출력의 blobAttachments
부분에 반환됩니다. 답변과 함께 반환되는 이미지는 항상 첫 번째 blobAttachments
에 있습니다. 있는 경우 다른 blobAttachments
에는 인용 참조에서 반환된 이미지가 포함됩니다. 답변과 함께 반환된 이미지는 인용과 함께 반환될 수도 있습니다 (실제로는 종종 그렇습니다). blobAttachmentIndexes
는 blobAttachment
를 답변 또는 인용 텍스트에 연결하는 색인입니다.
반환된 이미지의 attributionType
는 항상 CORPUS
이므로 이미지가 데이터 스토어에 있는 것을 나타냅니다.
후속 질문을 위한 명령어
후속 질문은 멀티턴 쿼리입니다. 후속 질문 세션의 첫 번째 쿼리 후 후속 '턴'에서는 이전 상호작용이 고려됩니다. 후속 질문에서는 답변 방식에서 사용자가 직접 후속 질문을 입력하는 대신 선택할 수 있는 관련 질문을 제안할 수도 있습니다.
인용, 필터, 세이프서치, 특정 유형의 쿼리 무시, 프리앰블 사용을 통한 답변 맞춤설정 등 이전 섹션에 설명된 모든 답변과 질문 기능은 후속 질문과 함께 적용할 수 있습니다.
후속 질문 세션의 예시
다음은 후속 질문이 있는 세션의 예시입니다. 멕시코에서 휴가를 보내는 방법을 알고 싶다고 가정해 보세요.
후속 질문이 없으면 '환율은 어떻게 되나요?'라는 질문에 대한 답을 얻을 수 없습니다. 일반 검색에서는 사용자가 멕시코 환율을 원한다는 사실을 알 수 없기 때문입니다. 마찬가지로 후속 질문이 없으면 멕시코의 기온을 구체적으로 알려주는 데 필요한 컨텍스트가 없습니다.
'멕시코에서 휴가를 즐기기에 가장 좋은 시기는 언제인가요?'라고 질문하면 질문에 답하는 것 외에도 답변과 후속 질문을 통해 '멕시코에서 휴가를 즐기기에 가장 저렴한 달은 언제인가요?', '멕시코의 관광 성수기는 언제인가요?'와 같은 다른 질문을 제안할 수 있습니다.
관련 질문 기능이 사용 설정되면 질문이 ConverseConversationResponse 에 문자열로 반환됩니다.
세션 정보
Vertex AI Search에서 후속 질문이 작동하는 방식을 이해하려면 세션에 관해 알아야 합니다.
세션은 사용자가 제공한 텍스트 쿼리와 Vertex AI Search에서 제공한 응답으로 구성됩니다.
이러한 쿼리와 응답 쌍을 턴 이라고도 합니다. 위 예시에서 두 번째 턴은 '환율은 어떻게 되나요?'와 '1달러는 약 17.65멕시코 페소입니다.'로 구성됩니다.
세션은 앱과 함께 저장됩니다. 앱에서 세션은 세션 리소스 로 표시됩니다.
쿼리 및 응답 메시지 외에도 세션 리소스에는 다음이 포함됩니다.
세션 정보 저장 및 응답 받기
명령줄을 사용하여 검색 응답과 답변을 생성하고 이를 각 쿼리와 함께 세션에 저장할 수 있습니다.
REST
명령줄을 사용하여 세션을 만들고 사용자 입력으로부터 응답을 생성하려면 다음 단계를 따르세요.
세션을 저장할 앱을 지정합니다.
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 "
}'
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: Vertex AI Search 앱의 ID입니다.
USER_PSEUDO_ID
: 검색 방문자를 추적하기 위한 고유 식별자입니다. 예를 들어 단일 기기에서 방문자를 고유하게 식별하는 HTTP 쿠키를 사용해서 이를 구현할 수 있습니다.
명령어 및 결과 예시
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"
}
JSON 응답의 name:
필드 끝에 있는 숫자인 세션 ID를 기록합니다. 다음 예시에서 ID는 5386462384953257772
입니다.
다음 단계에서 이 작업 ID가 필요합니다.
답변을 생성하고 앱의 세션에 추가합니다.
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 "} }
}'
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: Vertex AI Search 앱의 ID입니다.
QUERY
: 질문 또는 검색어를 포함하는 자유 텍스트 문자열입니다.
SESSION_ID
: 1단계에서 만든 세션의 ID입니다. 2단계에서 언급한 name:
필드 끝에 있는 숫자입니다. 세션의 경우 모든 턴에 동일한 세션 ID를 사용합니다.
FILTER
: 필터 표현식을 사용하여 검색을 필터링하기 위한 텍스트 필드입니다. 기본값은 빈 문자열입니다. 필터를 구성하는 방법은 메타데이터가 포함된 비정형 데이터인지, 정형 데이터인지, 웹사이트 데이터인지에 따라 다릅니다. 자세한 내용은 정형 데이터 또는 비정형 데이터의 일반 검색 필터링 및 웹사이트 검색 필터링 을 참조하세요.
명령어 및 결과 예시
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"
}
세션에서 새로운 쿼리가 있을 때마다 3단계를 반복합니다.
데이터 스토어에서 세션 가져오기
다음 명령어는 get
메서드를 호출하고 데이터 스토어에서 세션을 가져오는 방법을 보여줍니다.
REST
데이터 스토어에서 세션을 가져오려면 다음 단계를 따르세요.
다음 curl 명령어를 실행합니다.
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 "
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: Vertex AI Search 앱의 ID입니다.
SESSION_ID
: 가져올 세션의 ID입니다.
앱에서 세션 삭제
다음 명령어는 delete
메서드를 호출하고 데이터 스토어에서 세션을 삭제하는 방법을 보여줍니다.
기본적으로 60일이 지난 세션은 자동으로 삭제됩니다.
그러나 특정 세션을 삭제하려면 이 API 호출을 사용하여 삭제하세요.
그러나 특정 세션(예: 민감한 콘텐츠가 포함된 경우)을 삭제하려면 이 API 호출을 사용하여 삭제하세요.
REST
앱에서 세션을 삭제하려면 다음 단계를 따르세요.
다음 curl 명령어를 실행합니다.
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 "
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: Vertex AI Search 앱의 ID입니다.
SESSION_ID
: 삭제할 세션의 ID입니다.
명령어 및 결과 예시
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"
{}
세션 업데이트
세션을 업데이트하려는 이유는 다양합니다. 예를 들어 다음 중 하나일 수 있습니다.
세션을 완료로 표시
한 세션의 메시지를 다른 세션으로 병합
사용자의 유사 ID 변경
다음 명령어는 patch
메서드를 호출하고 데이터 스토어에서 세션을 업데이트하는 방법을 보여줍니다.
REST
앱에서 세션을 업데이트하려면 다음 단계를 따르세요.
다음 curl 명령어를 실행합니다.
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 "
}'
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: Vertex AI Search 앱의 ID입니다.
SESSION_ID
: 업데이트할 세션의 ID입니다.
NEW_STATE
: 상태의 새 값입니다(예: IN_PROGRESS
).
명령어 및 결과 예시
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"
}'
{
"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:49:41.579151Z"
}
이 예시에서는 세션 상태를 열림(진행 중)으로 변경합니다. 유사한 패턴을 따라 userPseudoId
를 업데이트합니다.
모든 세션 나열
다음 명령어는 list
메서드를 호출하고 데이터 스토어에 세션을 나열하는 방법을 보여줍니다.
REST
앱의 세션을 나열하려면 다음 단계를 따르세요.
다음 curl 명령어를 실행합니다.
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"
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: Vertex AI Search 앱의 ID입니다.
명령어 및 결과 예시
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"
{
"sessions": [
{
"name": "projects/123456/locations/global/collections/default_collection/engines/my-app/sessions/10000135306311111817",
"state": "IN_PROGRESS",
"turns": [
{
"query": {
"queryId": "projects/123456/locations/global/questions/10000135306311114276",
"text": "bugs reported by tiktok on grounding"
}
}
],
"startTime": "2024-09-03T00:38:40.338623Z",
"endTime": "2024-09-03T00:38:40.338623Z"
},
{
"name": "projects/123456/locations/global/collections/default_collection/engines/my-app/sessions/10000827040519035859",
"state": "IN_PROGRESS",
"turns": [
{
"query": {
"queryId": "projects/123456/locations/global/questions/10000827040519033518",
"text": "GDM models"
}
}
],
"startTime": "2024-07-19T15:53:06.521775Z"
},
{
"name": "projects/123456/locations/global/collections/default_collection/engines/my-app/sessions/10003910515245149877",
"state": "IN_PROGRESS",
"turns": [
{
"query": {
"queryId": "projects/123456/locations/global/questions/10003910515245148378",
"text": "gyorgyattila"
},
"answer": "projects/123456/locations/global/collections/default_collection/engines/my-app/sessions/10003910515245149877/answers/17036357111873257990"
}
],
"startTime": "2024-08-08T11:40:04.632463Z",
"endTime": "2024-08-08T11:40:04.632463Z"
},
...
{
"name": "projects/123456/locations/global/collections/default_collection/engines/my-app/sessions/10198752942940073431",
"state": "IN_PROGRESS",
"turns": [
{
"query": {
"queryId": "projects/123456/locations/global/questions/10198752942940071818",
"text": "hello"
},
"answer": "projects/123456/locations/global/collections/default_collection/engines/my-app/sessions/10198752942940073431/answers/13411441797796265380"
}
],
"startTime": "2024-08-14T17:30:21.203439Z",
"endTime": "2024-08-14T17:30:21.203439Z"
}
],
"nextPageToken": "IDEDgIwL_vuieLC"
}
응답에는 세션 목록과 nextPageToken이 포함됩니다. nextPageToken이 반환되지 않으면 나열할 세션이 더 없는 것입니다. 기본 페이지 크기는 50입니다.
사용자의 세션 나열
다음 명령어는 list
메서드를 호출하여 사용자 또는 방문자와 연결된 세션을 나열하는 방법을 보여줍니다.
REST
사용자 또는 방문자와 연결된 세션을 나열하려면 다음 단계를 따르세요.
다음 curl 명령어를 실행합니다.
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 "
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: Vertex AI Search 앱의 ID입니다.
USER_PSEUDO_ID
: 세션을 나열할 사용자의 가명 ID입니다.
명령어 및 결과 예시
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"
{
"sessions": [
{
"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:49:41.579151Z"
}
]
}
이 예시에서는 test_user와 연결된 세션이 하나 있습니다. 세션의 쿼리와 답변이 표시됩니다.
사용자의 세션 및 상태 나열
다음 명령어는 list
메서드를 호출하여 특정 상태에 있는 특정 사용자의 세션을 나열하는 방법을 보여줍니다.
REST
열리거나 닫혀 있고 특정 사용자 또는 방문자와 연결된 사용자의 세션을 나열하려면 다음 단계를 따르세요.
다음 curl 명령어를 실행합니다.
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 "
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID
APP_ID
: Vertex AI Search 앱의 ID입니다.
USER_PSEUDO_ID
: 세션을 나열할 사용자의 가명 ID입니다.
STATE
: 세션의 상태입니다(STATE_UNSPECIFIED
(닫힘 또는 알 수 없음) 또는 IN_PROGRESS
(열림)).
명령어 및 결과 예시
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"
{
"sessions": [
{
"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:49:41.579151Z"
}
]
}
예상 결과는 빈 응답입니다.