질문으로 검색

이 페이지에서는 Vertex AI Search의 후속 질문이 포함된 검색을 소개하고 API 호출을 사용하여 이를 구현하는 방법을 보여줍니다.

검색 위젯에 후속 질문이 포함된 검색을 추가하려면 검색 위젯의 결과 구성을 참조하세요.

후속 질문이 있는 검색은 비정형 데이터웹사이트가 포함된 검색 앱에 적용됩니다.

후속 질문이 포함된 검색은 Vertex AI Agents 앱에 적용되지 않습니다. Vertex AI Agents 앱은 최종 사용자와 콘텐츠 관련 대화를 나눌 수 있는 에이전트를 사용합니다. Vertex AI Agents에 대한 자세한 내용은 Vertex AI Agents 소개를 참조하세요.

후속 질문이 포함된 검색 정보

후속 질문이 포함된 검색은 생성형 AI 모델을 기반으로 합니다. 후속 질문이 포함된 검색은 동일한 검색 세션에서 이전 쿼리를 고려하기 때문에 일반적인 비정형 데이터 검색과 다릅니다.

후속 질문이 포함된 검색은 다음을 지원합니다.

  • 자연어 쿼리 처리: 인간 언어 입력을 처리 및 이해하고, 쿼리 뒤의 의도를 식별하고, 관련성 있는 결과를 반환합니다.

  • 컨텍스트 인식: 이전 상호작용의 컨텍스트를 이해하고 컨텍스트 인식 답변을 제공합니다.

  • 멀티턴: 사용자가 후속 질문을 묻고 관련 응답을 얻을 수 있습니다.

후속 질문이 포함된 검색 예시

다음은 후속 질문이 포함된 검색의 예시입니다. 멕시코에서 휴가를 보내는 방법을 알고 싶다고 가정해 보세요.

  • 나: 멕시코에서 휴가를 즐기기에 가장 좋은 시기는 언제인가요?

  • 후속 질문이 포함된 검색: 멕시코에서 휴가를 즐기기에 가장 좋은 시기는 11월부터 4월까지 이어지는 건기입니다.

  • 나: 환율은 어떻게 되나요?

  • 후속 질문이 포함된 검색: 1달러는 약 17.65멕시코 페소입니다.

  • 나: 12월 평균 기온은 얼마인가요?

  • 후속 질문이 포함된 검색: 평균 기온은 70~78°F입니다. 칸쿤의 평균 기온은 약 77°F입니다.

일반 검색에서 "환율은 얼마인가요?"와 같은 질문은 사용자가 원하는 것이 멕시코 환율인지 알지 못하기 때문에 답변할 수 없는 질문입니다. 마찬가지로 일반 검색에서는 멕시코 온도를 제공하는 컨텍스트가 유지되지 않습니다.

대화 정보

후속 조치가 포함된 검색에서는 사용자가 제공하는 텍스트 쿼리와 Vertex AI Search로 제공되는 응답으로 대화가 구성됩니다.

이러한 쿼리와 응답 쌍을 메시지라고도 합니다. 위 예시에서 두 번째 메시지는 "환율은 어떻게 되나요?"와 "1달러는 약 17.65멕시코 페소입니다."로 구성됩니다.

대화는 비정형 데이터가 보존되는 동일한 데이터 스토어에 저장됩니다. 데이터 스토어에서 대화는 대화 리소스로 표시됩니다. 쿼리 및 응답 메시지 외에도 대화 리소스에는 다음이 포함됩니다.

  • 고유한 이름(대화 ID)

  • 상태(진행 중이거나 완료된 상태)

  • 사용자를 추적하는 방문자 ID인 사용자 유사 ID. 프로그래매틱 방식으로 할당할 수 있습니다.

  • 시작 시간 및 종료 시간

시작하기 전에

다음 기본 요건이 충족되었는지 확인합니다. 요구사항은 사용 중인 앱 유형에 따라 다릅니다.

대화 저장 및 응답 얻기

명령줄 또는 클라이언트 라이브러리를 사용하여 검색 응답을 생성하고 후속 질문이 포함된 검색 대화를 저장할 수 있습니다.

REST

명령줄을 사용하여 대화를 생성하고 사용자 입력으로부터 응답을 생성하려면 다음 단계를 수행합니다.

  1. 대화 기록을 저장하려는 데이터 스토어를 지정합니다.

    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/dataStores/DATA_STORE_ID/conversations" \
    -d '{
      "user_pseudo_id": "USER_PSEUDO_ID"
    }'
    
    • PROJECT_ID: Google Cloud 프로젝트의 프로젝트 번호 또는 ID입니다.

    • DATA_STORE_ID: 앱과 연결된 데이터 스토어의 ID입니다.

    • USER_PSEUDO_ID: 검색 방문자를 추적하기 위한 고유 식별자입니다. 예를 들어 단일 기기에서 방문자를 고유하게 식별하는 HTTP 쿠키를 사용해서 이를 구현할 수 있습니다.

    POST 명령어의 응답 예시를 보려면 클릭하세요.

    {
      "name": "projects/12345/locations/global/collections/default_collection/dataStores/my-data-store_4321/conversations/11078281986791420687",
      "state": "IN_PROGRESS",
      "userPseudoId": "test_id",
      "startTime": "2023-08-15T20:08:12.094639Z"
    }
  2. 검색 응답을 생성하고 데이터 스토어에서 신규 또는 기존 대화에 추가합니다.

    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/dataStores/DATA_STORE_ID/conversations/CONVERSATION_ID:converse" \
    -d '{
      "query": { "input": "FREE_TEXT"},
      "filter": "FILTER"
    }'
    
    • PROJECT_ID: Google Cloud 프로젝트의 프로젝트 번호 또는 ID입니다.

    • DATA_STORE_ID: 앱과 연결된 데이터 스토어의 ID입니다.

    • CONVERSATION_ID: 대화의 고유 ID입니다. 예를 들면 123456입니다. 후속 질문이 포함된 검색 대화의 경우 모든 턴에 동일한 대화 ID를 사용합니다.

    • FREE_TEXT: 사용자 질문이 포함된 자유 텍스트 문자열입니다. 예를 들면 what is bigquery?입니다.

    • FILTER: 필터 표현식을 사용하여 검색을 필터링하기 위한 텍스트 필드입니다. 기본값은 빈 문자열입니다. 필터를 생성하는 방식은 웹사이트 데이터 또는 메타데이터가 포함된 비정형 데이터가 있는지에 따라 다릅니다. 자세한 내용은 후속 질문이 포함된 검색 필터링을 참조하세요.

    POST 명령어의 응답 예시를 보려면 클릭하세요.

    {
    "reply": {
    "summary": {
      "summaryText": "BigQuery is a cloud-based data warehouse that enables businesses to analyze all their data very quickly. It is a fully managed service that provides a simple and cost-effective way to store and analyze large amounts of data."
    }
    },
    "conversation": {
    "name": "projects/12345/locations/global/collections/default_collection/dataStores/my-data-store_4321/conversations/11078281986791420687",
    "state": "IN_PROGRESS",
    "userPseudoId": "test_id",
    "messages": [
      {
        "userInput": {
          "input": "what is bigquery?"
        }
      },
      {
        "reply": {
          "summary": {
            "summaryText": "BigQuery is a cloud-based data warehouse that enables businesses to analyze all their data very quickly. It is a fully managed service that provides a simple and cost-effective way to store and analyze large amounts of data."
          }
        }
      }
    ],
    "startTime": "2023-08-15T20:08:12.094639Z"
    },
    "searchResults": [
    {
      "id": "c86f19582746b56f71c9bb6929893835",
      "document": {
        "name": "projects/12345/locations/global/collections/default_collection/dataStores/my-data-store_4321/branches/0/documents/c86f19582746b56f71c9bb6929893835",
        "id": "c86f19582746b56f71c9bb6929893835",
        "derivedStructData": {
          "link": "gs://aquamuse-data-ucs-eval-dev/documents/94627ee0249dfdfda25b1b158c717bca.txt",
          "snippets": [
            {
              "snippet_status": "SUCCESS",
              "snippet": "For larger websites, talk to the IT team and/or utilize a big data solution such as Google \u003cb\u003eBigQuery\u003c/b\u003e to extract all URLs. It may also be necessary to ask the ..."
            }
          ],
          "extractive_answers": [
            {
              "content": "Alternatively, load the Server Log Files into Google BigQuery and use the Google BigQuery interface or the 360 Data Studio to analyze the data. To monitor the indexation numbers of the HTTP and the HTTPS version, keep an eye on all submitted XML Sitemaps."
            }
          ]
        }
      }
    },
    {
      "id": "774bd7ce2a3509ab4bbd1fc876f39dc2",
      "document": {
        "name": "projects/12345/locations/global/collections/default_collection/dataStores/my-data-store_4321/branches/0/documents/774bd7ce2a3509ab4bbd1fc876f39dc2",
        "id": "774bd7ce2a3509ab4bbd1fc876f39dc2",
        "derivedStructData": {
          "snippets": [
            {
              "snippet": "No snippet is available for this page.",
              "snippet_status": "NO_SNIPPET_AVAILABLE"
            }
          ],
          "extractive_answers": [
            {
              "content": "This consists of a collection of virtual tables. A virtual table exists for every queryable object type (content type if you prefer) in the repository. Each row in these virtual tables correspond to an instance of the corresponding object type (or of one of its subtypes)."
            }
          ],
          "link": "gs://aquamuse-data-ucs-eval-dev/documents/28841ef8590a105e9415f1390648a811.txt"
        }
      }
    },
    {
      "id": "3e1d306e49aefd9e23f2d5f7a66e6c76",
      "document": {
        "name": "projects/12345/locations/global/collections/default_collection/dataStores/my-data-store_4321/branches/0/documents/3e1d306e49aefd9e23f2d5f7a66e6c76",
        "id": "3e1d306e49aefd9e23f2d5f7a66e6c76",
        "derivedStructData": {
          "snippets": [
            {
              "snippet": "No snippet is available for this page.",
              "snippet_status": "NO_SNIPPET_AVAILABLE"
            }
          ],
          "extractive_answers": [
            {
              "content": "Other logo switches are based on search terms. For instance, if the term "ASCII art" is searched, an ASCII art version of the Google logo will appear next to the search box."
            }
          ],
          "link": "gs://aquamuse-data-ucs-eval-dev/documents/98008df3eef5d3ee1661c52f23189190.txt"
        }
      }
    },
    {
      "id": "cf94e24aacd47cd2c2f5effcbdeda832",
      "document": {
        "name": "projects/12345/locations/global/collections/default_collection/dataStores/my-data-store_4321/branches/0/documents/cf94e24aacd47cd2c2f5effcbdeda832",
        "id": "cf94e24aacd47cd2c2f5effcbdeda832",
        "derivedStructData": {
          "extractive_answers": [
            {
              "content": "The company is listed on the NASDAQ stock exchange under the ticker symbols GOOGL and GOOG, and on the Frankfurt Stock Exchange under the ticker symbol GGQ1. These ticker symbols now refer to Alphabet Inc., Google's holding company, since the fourth quarter of 2015."
            }
          ],
          "snippets": [
            {
              "snippet": "No snippet is available for this page.",
              "snippet_status": "NO_SNIPPET_AVAILABLE"
            }
          ],
          "link": "gs://aquamuse-data-ucs-eval-dev/documents/d80204083ef1096799fa4b7257548b33.txt"
        }
      }
    },
    {
      "id": "05bc6497a4e7e6ca36b2e495b354b764",
      "document": {
        "name": "projects/12345/locations/global/collections/default_collection/dataStores/my-data-store_4321/branches/0/documents/05bc6497a4e7e6ca36b2e495b354b764",
        "id": "05bc6497a4e7e6ca36b2e495b354b764",
        "derivedStructData": {
          "extractive_answers": [
            {
              "content": "SQL injection countermeasures are designed to utilize secure programming methods. By changing the variables used by the application code, weaknesses in applications can be greatly minimized. This report will detail how to perform a SQL injection and explore the best countermeasures to prevent the attack."
            }
          ],
          "link": "gs://aquamuse-data-ucs-eval-dev/documents/7cba75d646f5774a21d96801bec68bb3.txt",
          "snippets": [
            {
              "snippet_status": "NO_SNIPPET_AVAILABLE",
              "snippet": "No snippet is available for this page."
            }
          ]
        }
      }
    }
    ]
    }
  3. 대화에서 새로운 질문이 있을 때마다 2단계를 반복합니다.

Python

자세한 내용은 Vertex AI Agent Builder Python API 참고 문서를 확인하세요.

Vertex AI Agent Builder에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

from typing import List

from google.api_core.client_options import ClientOptions
from google.cloud import discoveryengine_v1 as discoveryengine

# TODO(developer): Uncomment these variables before running the sample.
# project_id = "YOUR_PROJECT_ID"
# location = "YOUR_LOCATION"                    # Values: "global", "us", "eu"
# data_store_id = "YOUR_DATA_STORE_ID"
# search_queries = ["YOUR_FIRST_SEARCH_QUERY", "YOUR_SECOND_SEARCH_QUERY"]


def multi_turn_search_sample(
    project_id: str,
    location: str,
    data_store_id: str,
    search_queries: List[str],
) -> List[discoveryengine.ConverseConversationResponse]:
    #  For more information, refer to:
    # https://cloud.google.com/generative-ai-app-builder/docs/locations#specify_a_multi-region_for_your_data_store
    client_options = (
        ClientOptions(api_endpoint=f"{location}-discoveryengine.googleapis.com")
        if location != "global"
        else None
    )

    # Create a client
    client = discoveryengine.ConversationalSearchServiceClient(
        client_options=client_options
    )

    # Initialize Multi-Turn Session
    conversation = client.create_conversation(
        # The full resource name of the data store
        # e.g. projects/{project_id}/locations/{location}/dataStores/{data_store_id}
        parent=client.data_store_path(
            project=project_id, location=location, data_store=data_store_id
        ),
        conversation=discoveryengine.Conversation(),
    )


    for search_query in search_queries:
        # Add new message to session
        request = discoveryengine.ConverseConversationRequest(
            name=conversation.name,
            query=discoveryengine.TextInput(input=search_query),
            serving_config=client.serving_config_path(
                project=project_id,
                location=location,
                data_store=data_store_id,
                serving_config="default_config",
            ),
            # Options for the returned summary
            summary_spec=discoveryengine.SearchRequest.ContentSearchSpec.SummarySpec(
                # Number of results to include in summary
                summary_result_count=3,
                include_citations=True,
            ),
        )
        response = client.converse_conversation(request)

        print(f"Reply: {response.reply.summary.summary_text}\n")

        for i, result in enumerate(response.search_results, 1):
            result_data = result.document.derived_struct_data
            print(f"[{i}]")
            print(f"Link: {result_data['link']}")
            print(f"First Snippet: {result_data['snippets'][0]['snippet']}")
            print(
                "First Extractive Answer: \n"
                f"\tPage: {result_data['extractive_answers'][0]['pageNumber']}\n"
                f"\tContent: {result_data['extractive_answers'][0]['content']}\n\n"
            )
        print("\n\n")

후속 질문이 포함된 검색 필터링

후속 질문이 포함된 검색으로 쿼리를 만들 때는 응답이 파생되는 문서 풀을 제한하도록 filter 필드를 포함할 수 있습니다. 필터 표현식을 사용하여 필터를 생성합니다. 사용하는 필터 표현식은 웹사이트 데이터 또는 메타데이터가 포함된 비정형 데이터를 사용 중인지에 따라 다릅니다.

웹사이트 데이터의 필터 표현식

웹사이트 데이터가 포함된 데이터 스토어가 있으면 고급 웹사이트 색인 생성을 사용하는 필터 표현식의 필터 표현식을 사용하여 후속 질문이 포함된 검색 쿼리를 필터링할 수 있습니다. 필터 표현식을 생성한 후 대화 저장 및 응답 얻기의 2단계에서 filter 필드의 값에 사용합니다.

메타데이터가 있는 비정형 데이터의 필터 표현식

메타데이터가 있는 비정형 데이터가 포함된 데이터 스토어가 있으면 문서에 포함된 메타데이터 필드를 기반으로 문서를 반환하도록 후속 질문이 포함된 검색 쿼리를 필터링할 수 있습니다. 메타데이터를 사용해서 후속 질문이 없는 일반 검색을 필터링하는 방법은 정형 또는 비정형 데이터 검색 필터를 참조하세요. 메타데이터를 사용하여 후속 질문이 포함된 검색을 필터링할 때에도 이러한 동일한 원칙을 따르면 됩니다. 필터 표현식을 생성한 후 대화 저장 및 응답 얻기의 2단계에서 filter 필드의 값에 사용합니다.

요약 구성

후속 질문이 포함된 검색의 응답 메시지는 summaryText에 반환된 생성된 요약입니다. 생성된 요약을 구성하는 방법은 여러 가지가 있습니다. 이에 대해서는 다음 섹션에서 설명합니다.

검색 결과로 인용 가져오기

인용은 지정된 경우 검색 요약에서 인라인으로 배치되는 숫자입니다. 이러한 숫자는 요약에서 특정 문장을 가져온 검색 결과를 나타냅니다.

인용을 가져오려면 다음 안내를 따르세요.

  • 앞에서 2단계를 제외하고 대화 저장 및 채팅 응답 가져오기 절차를 수행하고 includeCitations가 true로 설정된 summarySpec 필드가 포함된 다음 명령어를 실행합니다.

    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/dataStores/DATA_STORE_ID/conversations/CONVERSATION_ID:converse" \
    -d '{
      "query": { "input": "FREE_TEXT"},
      "summarySpec": { "include_citations": true }
    }'
    

    명령 예시에서 응답 일부를 클릭합니다.

    {
    "reply": {
    "summary": {
    }
    "reply": {
    "summary": {
      "summaryText": "BigQuery is a cloud-based data warehouse that enables businesses to analyze all their data very quickly [1]. It is a fully managed service that provides a simple and cost-effective way to store and analyze large amounts of data [2, 3].",
      "safetyAttributes": {
        "categories": [
          "Finance",
          "Legal"
        ]

인용 번호는 요약 텍스트에 포함됩니다. 인용 번호는 반환된 검색 결과를 나타내며 1부터 색인이 생성됩니다. 예를 들어 [1]은 해당 문장이 첫 번째 검색 결과에 속함을 나타냅니다. [2, 3]은 해당 문장이 두 번째 및 세 번째 검색 결과에 모두 속함을 의미합니다.

악의적인 쿼리 무시

악의적인 쿼리는 부정적인 표현을 포함하거나 안전하지 않은 정책 위반 출력을 생성하도록 의도된 것입니다. 악의적인 쿼리에 대해서는 검색 요약을 반환하지 않도록 지정할 수 있습니다. 악의적인 쿼리가 무시될 경우 summaryText 속성에는 검색 요약이 반환되지 않음을 나타내는 상용구 텍스트가 포함됩니다. 악의적인 쿼리에 대해 검색 요약은 반환되지 않더라도 검색 문서는 반환됩니다.

악의적인 쿼리에 대해 검색 요약을 반환하지 않도록 지정하려면 다음 안내를 따르세요.

  • 앞에서 2단계를 제외하고 대화 저장 및 채팅 응답 가져오기 절차를 수행하고 ignoreAdversarialQuery가 true로 설정된 summarySpec 필드가 포함된 다음 명령어를 실행합니다.

    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/dataStores/DATA_STORE_ID/conversations/CONVERSATION_ID:converse" \
    -d '{
      "query": { "input": "FREE_TEXT"},
      "summarySpec": { "ignoreAdversarialQuery": true }
    }'
    

    악의적인 쿼리의 응답 일부를 클릭합니다.

    "reply": {
    "summary": {
      "summaryText": "A summary could not be generated for your search query. Here are some search results.",
      "summarySkippedReasons": [
        "ADVERSARIAL_QUERY_IGNORED"
      ]

요약을 원하지 않는 쿼리 무시

요약을 원하지 않는 쿼리는 요약에 적합하지 않은 결과를 반환합니다. 예를 들어 "하늘이 왜 파란색인가요?" 및 "세계에서 가장 뛰어난 축구 선수는 누구인가요?"는 요약을 원하는 쿼리에 해당하지만 "SFO 공항" 및 "월드컵 2026"은 그렇지 않습니다. 이러한 쿼리는 탐색적인 쿼리일 가능성이 더 높습니다. 요약을 원하지 않는 쿼리에 대해서는 검색 요약이 반환되지 않도록 지정할 수 있습니다. 요약을 원하지 않는 쿼리에 대해 검색 요약은 반환되지 않더라도 검색 문서는 반환됩니다.

요약을 원하지 않는 쿼리에 대해 검색 요약을 반환하지 않도록 지정하려면 다음 안내를 따르세요.

  • 앞에서 2단계를 제외하고 대화 저장 및 채팅 응답 가져오기 절차를 수행하고 ignoreNonSummarySeekingQuery가 true로 설정된 summarySpec 필드가 포함된 다음 명령어를 실행합니다.

    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/dataStores/DATA_STORE_ID/conversations/CONVERSATION_ID:converse" \
    -d '{
      "query": { "input": "FREE_TEXT"},
      "summarySpec": { "ignore_non_summary_seeking_query": true }
    }'
    

    악의적인 쿼리의 응답 일부를 클릭합니다.

     "reply": {
    "summary": {
      "summaryText": "A summary could not be generated for your search query. Here are some search results.",
      "summarySkippedReasons": [
        "NON_SUMMARY_SEEKING_QUERY_IGNORED"
      ]

요약에 사용할 결과 수 설정

요약 생성 중 사용할 결과 수를 지정할 수 있습니다. 기본적으로 summaryResultCount 필드가 설정되지 않았으면 반환된 모든 결과가 요약 생성을 위해 사용됩니다.

요약에 사용할 최상위 결과 수를 설정하려면 다음 안내를 따르세요.

  • 앞에서 2단계를 제외하고 대화 저장 및 채팅 응답 가져오기 절차를 수행하고 summaryResultCount를 설정하는 summarySpec 필드가 포함된 다음 명령어를 실행합니다.

    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/dataStores/DATA_STORE_ID/conversations/CONVERSATION_ID:converse" \
    -d '{
      "query": { "input": "FREE_TEXT"},
      "summarySpec": { "summary_result_count": NUMBER_OF_RESULTS }
    }'
    

    NUMBER_OF_RESULTS: 검색 요약을 생성할 최상위 결과 수입니다. 반환된 결과 수가 summaryResultCount보다 적으면 모든 결과로부터 요약이 생성됩니다. 최댓값은 5입니다.

맞춤설정된 요약 가져오기

요약을 요청할 때 modelPromptSpec.preamble 필드에 자연어 안내를 제공하여 맞춤설정된 요약을 얻을 수 있습니다.

길이, 세부정보 수준, 출력 스타일(예: '간단'), 출력 언어, 답변의 포커스, 형식(예: 테이블, 글머리기호, XML)과 같은 맞춤설정을 요청할 수 있습니다.

예를 들어 "BigQuery의 이점은 무엇인가요?"와 같은 쿼리에 대해서는 다음 예시와 비슷한 맞춤설정 안내를 입력할 수 있습니다.

  • 안내 예시: "please show the answer format in an ordered list"

    응답 예시:

    The benefits of BigQuery are:
    
    1. Increased business productivity
    2. IT staff productivity
    3. Reduced infrastructure costs
    4. Loading and exporting data are free
    
  • 안내 예시: give a very detailed answer

    응답 예시:

    BigQuery is a serverless, highly scalable, and cost-effective cloud data warehouse that enables businesses to analyze all their data very quickly. It is a fully managed service that takes care of provisioning, scaling, and managing the underlying infrastructure, so you can focus on analyzing your data. BigQuery is also integrated with other Google Cloud services, such as Google Kubernetes Engine, Cloud Data Fusion, and Cloud Dataproc, making it easy to build and deploy data pipelines.
    
    Here are some of the benefits of using BigQuery:
    
    * **Fast and scalable:** BigQuery can process petabytes of data very quickly, and it can scale to handle even the most demanding workloads. * **Cost-effective:** BigQuery is a very cost-effective way to store and analyze data. You only pay for the data that you use, and there are no upfront costs or commitments. * **Secure:** BigQuery is a secure platform that meets the needs of even the most security-conscious organizations. * **Easy to use:** BigQuery is easy to use, even for non-technical users. It has a simple and intuitive user interface, and it supports a variety of data sources. * **Integrated with other Google Cloud services:** BigQuery is integrated with other Google Cloud services, making it easy to build and deploy data pipelines.
    
    If you are looking for a fast, scalable, and cost-effective way to analyze your data, then BigQuery is a great option.
    

맞춤설정된 요약을 얻으려면 다음 안내를 따르세요.

  • 앞에서 2단계를 제외하고 대화 저장 및 채팅 응답 가져오기 절차를 수행하고 modelPromptSpec.preamble에서 맞춤설정 안내를 지정하는 summarySpec 필드가 포함된 다음 명령어를 실행합니다.

      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/dataStores/DATA_STORE_ID/conversations/CONVERSATION_ID:converse" \
      -d '{
        "query": { "input": "FREE_TEXT"},
        "summarySpec": {
          "modelPromptSpec": {
            "preamble": "CUSTOMIZATION_INSTRUCTIONS"
          }
        }
      }'
    
    • CUSTOMIZATION_INSTRUCTIONS: 맞춤설정 안내(문자열)입니다.

세이프서치를 사용하면 선정적이거나, 안전하지 않거나, 정책을 위반하는 출력 콘텐츠를 요약 응답에서 필터링할 수 있습니다. 세이프서치에 대한 자세한 내용은 Vertex AI Search의 안전 설정을 참조하세요.

채팅 응답에 세이프서치를 적용하려면 다음 안내를 따르세요.

  • 앞에서 2단계를 제외하고 대화 저장 및 채팅 응답 가져오기 절차를 수행하고 쿼리 아래에 safe_search를 지정합니다.

    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/dataStores/DATA_STORE_ID/conversations/CONVERSATION_ID:converse" \
    -d '{
      "query": { "input": "FREE_TEXT"},
      "safe_search": true
    }'
    

저장된 대화 보기 및 수정

명령줄을 사용하여 저장된 대화를 가져오고, 삭제, 업데이트, 나열할 수 있습니다.

데이터 스토어에서 대화 가져오기

데이터 스토어에서 특정 대화에 대한 모든 세부정보를 가져오려면 다음 안내를 따르세요.

  • 다음 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/dataStores/DATA_STORE_ID/conversations/CONVERSATION_ID"
    
    • PROJECT_ID: Google Cloud 프로젝트의 프로젝트 번호 또는 ID입니다.

    • DATA_STORE_ID: 앱과 연결된 데이터 스토어의 ID입니다.

    • CONVERSATION_ID: 대화의 ID입니다.

    GET 명령어의 응답 예시를 보려면 클릭하세요.

    {
    "name": "projects/12345/locations/global/collections/default_collection/dataStores/my-data-store_4321/conversations/2040473575290303058",
    "state": "IN_PROGRESS",
    "userPseudoId": "2040473575290303058",
    "messages": [
    {
      "userInput": {
        "input": "what is bigquery?"
      }
    },
    {
      "reply": {
        "summary": {
          "summaryText": "BigQuery is a cloud-based data warehouse that enables businesses to analyze all their data very quickly. It is a fully managed service that provides a simple and cost-effective way to store and analyze large amounts of data."
        }
      }
    }
    ],
    "startTime": "2023-08-15T20:11:24.046735Z"
    }

데이터 스토어에서 대화 삭제

기본적으로 60일 이상된 대화는 자동으로 삭제됩니다. 그러나 실수로 민감한 콘텐츠가 포함된 경우 등이 발생했을 때 특정 대화를 삭제하려면 이 API 호출을 사용하여 삭제하세요.

데이터 스토어에서 대화를 삭제하려면 다음 안내를 따르세요.

  • 다음 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/dataStores/DATA_STORE_ID/conversations/CONVERSATION_ID"
    
    • PROJECT_ID: Google Cloud 프로젝트의 프로젝트 번호 또는 ID입니다.

    • DATA_STORE_ID: 앱과 연결된 데이터 스토어의 ID입니다.

    • CONVERSATION_ID: 대화의 ID입니다.

    DELETE 명령어의 응답은 다음과 같습니다.

    {}
    

대화 업데이트

대화를 업데이트하려는 이유는 다양합니다. 예를 들어 다음 중 하나일 수 있습니다.

  • 대화를 완료로 표시

  • 한 대화의 메시지를 다른 대화로 병합

  • user_pseudo_id 변경

대화에서 state를 업데이트하려면 다음 안내를 따르세요.

  • 다음 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/dataStores/DATA_STORE_ID/conversations/CONVERSATION_ID?updateMask=state" \
    -d '{
      "state": "NEW_STATE"
    }'
    
    • PROJECT_ID: Google Cloud 프로젝트의 프로젝트 번호 또는 ID입니다.

    • DATA_STORE_ID: 앱과 연결된 데이터 스토어의 ID입니다.

    • CONVERSATION_ID: 업데이트하려는 대화의 ID입니다.

    • NEW_STATE: 상태의 새 값입니다(예: COMPLETED).

    PATCH 명령어의 응답 예시를 보려면 클릭하세요.

    {
    "name": "projects/12345/locations/global/collections/default_collection/dataStores/my-data-store_4321/conversations/11078281986791420687",
    "state": "COMPLETED",
    "userPseudoId": "test_id1",
    "messages": [
    {
      "userInput": {
        "input": "what is bigquery?"
      }
    },
    {
      "reply": {
        "summary": {
          "summaryText": "BigQuery is a cloud-based data warehouse that enables businesses to analyze all their data very quickly. It is a fully managed service that provides a simple and cost-effective way to store and analyze large amounts of data."
        }
      }
    }
    ],
    "startTime": "2023-08-15T20:08:12.094639Z"
    }

대화에서 user_pseudo_id를 업데이트하려면 다음 안내를 따르세요.

  • 다음 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/dataStores/DATA_STORE_ID/conversations/CONVERSATION_ID?updateMask=user_pseudo_id" \
    -d '{
      "user_pseudo_id": "NEW_USER_PSEUDO_ID"
    }'
    
    • PROJECT_ID: Google Cloud 프로젝트의 프로젝트 번호 또는 ID입니다.

    • DATA_STORE_ID: 앱과 연결된 데이터 스토어의 ID입니다.

    • CONVERSATION_ID: 업데이트하려는 대화의 ID입니다.

    • NEW_USER_PSEUDO_ID: 사용자 유사 ID의 새 값입니다.

    PATCH 명령어의 응답 예시를 보려면 클릭하세요.

    {
    "name": "projects/12345/locations/global/collections/default_collection/dataStores/my-data-store_4321/conversations/11078281986791420687",
    "state": "IN_PROGRESS",
    "userPseudoId": "test_id1",
    "messages": [
    {
      "userInput": {
        "input": "what is bigquery?"
      }
    },
    {
      "reply": {
        "summary": {
          "summaryText": "BigQuery is a cloud-based data warehouse that enables businesses to analyze all their data very quickly. It is a fully managed service that provides a simple and cost-effective way to store and analyze large amounts of data."
        }
      }
    }
    ],
    "startTime": "2023-08-15T20:08:12.094639Z"
    }

이전 명령어는 user_pseudo_id. 변경 방법을 보여줍니다. 하지만 대화 리소스에서 user_pseudo_id를 다른 필드로 바꿔서 대화의 다른 필드를 업데이트할 수 있습니다.

모든 대화 나열

데이터 스토어의 모든 대화를 나열하려면 다음 안내를 따르세요.

  • 다음 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/dataStores/DATA_STORE_ID/conversations"
    
    • PROJECT_ID: Google Cloud 프로젝트의 프로젝트 번호 또는 ID입니다.

    • DATA_STORE_ID: 앱과 연결된 데이터 스토어의 ID입니다.

    GET 명령어의 응답 예시를 보려면 클릭하세요.

    {
    "conversations": [
    {
      "name": "projects/12345/locations/global/collections/default_collection/dataStores/my-data-store_4321/conversations/11078281986791420687",
      "state": "IN_PROGRESS",
      "userPseudoId": "test_id",
      "messages": [
        {
          "userInput": {
            "input": "what is bigquery?"
          }
        },
        {
          "reply": {
            "summary": {
              "summaryText": "BigQuery is a cloud-based data warehouse that enables businesses to analyze all their data very quickly. It is a fully managed service that provides a simple and cost-effective way to store and analyze large amounts of data."
            }
          }
        }
      ],
      "startTime": "2023-08-15T20:08:12.094639Z"
    },
    {
      "name": "projects/12345/locations/global/collections/default_collection/dataStores/my-data-store_4321/conversations/2040473575290303058",
      "state": "IN_PROGRESS",
      "userPseudoId": "2040473575290303058",
      "messages": [
        {
          "userInput": {
            "input": "what is bigquery?"
          }
        },
        {
          "reply": {
            "summary": {
              "summaryText": "BigQuery is a cloud-based data warehouse that enables businesses to analyze all their data very quickly. It is a fully managed service that provides a simple and cost-effective way to store and analyze large amounts of data."
            }
          }
        }
      ]
    }
    ]
    }

응답에는 대화 목록과 next_page_token이 포함됩니다. next_page_token이 반환되지 않으면 나열할 대화가 없는 것입니다.

기본 페이지 크기는 50입니다.

필터별로 대화 나열

데이터 스토어의 모든 대화를 나열하는 대신 특정 사용자와 관련된 모든 대화 또는 모든 열려 있는 대화를 나열하도록 선택할 수 있습니다.

예를 들어 검색을 닫은 사용자에게 검색 중 하나를 다시 열 수 있는 옵션을 제공할 수 있습니다.

이렇게 하려면 user_pseudo_id 또는 state(IN_PROGRESS 또는 COMPLETED)와 같은 제공된 필터와 일치하는 대화를 나열합니다.

사용자의 대화 나열

사용자 또는 방문자와 연결된 대화를 나열하려면 다음 안내를 따르세요.

  • 다음 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/dataStores/DATA_STORE_ID/conversations?filter=user_pseudo_id=USER_PSEUDO_ID"
    
    • PROJECT_ID: Google Cloud 프로젝트의 프로젝트 번호 또는 ID입니다.

    • DATA_STORE_ID: 앱과 연결된 데이터 스토어의 ID입니다.

    • USER_PSEUDO_ID: 대화를 나열할 사용자의 유사 ID입니다.

    GET 명령어의 응답은 다음과 같이 표시됩니다.

    GET 명령어의 응답 예시를 보려면 클릭하세요.

    {
    "conversations": [
    {
      "name": "projects/12345/locations/global/collections/default_collection/dataStores/my-data-store_4321/conversations/11078281986791420687",
      "state": "IN_PROGRESS",
      "userPseudoId": "test_id",
      "messages": [
        {
          "userInput": {
            "input": "what is bigquery?"
          }
        },
        {
          "reply": {
            "summary": {
              "summaryText": "BigQuery is a cloud-based data warehouse that enables businesses to analyze all their data very quickly. It is a fully managed service that provides a simple and cost-effective way to store and analyze large amounts of data."
            }
          }
        }
      ],
      "startTime": "2023-08-15T20:08:12.094639Z"
    }
    ]
    }

사용자의 대화 및 상태 나열

특정 상태(열림 또는 닫힘)로 존재하고 그리고 사용자 또는 방문자와 연결된 대화를 나열하려면 다음 안내를 따르세요.

  • 다음 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/dataStores/DATA_STORE_ID/conversations?filter=user_pseudo_id=USER_PSEUDO_ID%20AND%20state=STATE"
    
    • PROJECT_ID: Google Cloud 프로젝트의 프로젝트 번호 또는 ID입니다.

    • DATA_STORE_ID: 앱과 연결된 데이터 스토어의 ID입니다.

    • USER_PSEUDO_ID: 대화를 나열할 사용자의 유사 ID입니다.

    • STATE: 대화가 열렸거나 닫혔는지 여부입니다(IN_PROGRESS 또는 COMPLETED).

    GET 명령어의 응답은 다음과 같이 표시됩니다.

    GET 명령어의 응답 예시를 보려면 클릭하세요.

    {
    "conversations": [
    {
      "name": "projects/12345/locations/global/collections/default_collection/dataStores/my-data-store_4321/conversations/11078281986791420687",
      "state": "IN_PROGRESS",
      "userPseudoId": "test_id",
      "messages": [
        {
          "userInput": {
            "input": "what is bigquery?"
          }
        },
        {
          "reply": {
            "summary": {
              "summaryText": "BigQuery is a cloud-based data warehouse that enables businesses to analyze all their data very quickly. It is a fully managed service that provides a simple and cost-effective way to store and analyze large amounts of data."
            }
          }
        }
      ],
      "startTime": "2023-08-15T20:08:12.094639Z"
    }
    ]
    }

필터링 구문에 대한 자세한 내용은 AIP-160 필터링을 참조하세요.

관련 질문은 검색 결과 외에도 관련 질문을 반환할 수 있는 허용 목록 기능이 포함된 미리보기 기능입니다.

예를 들어 "멕시코에서 휴가를 즐기기에 가장 좋은 시기는 언제인가요?"라고 질문하면 질문에 답하는 것 외에도 검색 기능이 "멕시코에서 휴가를 즐기기에 가장 저렴한 달은 언제인가요?", "멕시코의 관광 성수기는 언제인가요?"와 같은 다른 질문을 제안할 수 있습니다.

검색 앱이 관련 질문을 반환하도록 하려면 Google 계정팀에 연락하여 관련 질문을 사용 설정하려는 프로젝트와 앱을 알려주세요. 기본 서빙 구성을 사용하지 않을 경우에도 서빙 구성의 이름을 제공해야 합니다.

관련 질문 기능이 사용 설정되었으면 질문이 ConverseConversationResponse에 문자열로 반환됩니다.

추가 정보

  • summaryResultCount, includeCitations, ignoreAdversarialQuery, ignoreNonSummarySeekingQuery 필드에 대한 자세한 내용은 Vertex AI Agent Builder API 참고 리소스에서 SummarySpec을 참조하세요.

  • 검색 요약을 가져오는 방법의 예시는 요약 가져오기를 참조하세요.