Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Com a Vertex AI para Pesquisa, é possível pesquisar imagens usando um app com dados de sites. Você fornece uma consulta na forma de uma string de texto ou uma imagem, e o método default_config.search retorna imagens para essa consulta.
Antes de começar
Verifique se você atende aos seguintes pré-requisitos. Os requisitos variam dependendo
de você usar uma consulta de texto ou de imagem.
Se você pesquisar usando uma consulta de texto no app de pesquisa em sites, verifique se a opção
Recursos da edição Enterprise está ativada.
Se você pesquisar usando uma consulta de imagem no app de pesquisa em sites, verifique se as
seguintes opções estão ativadas:
Na página Apps, encontre o nome do app e confira o ID dele na
coluna ID.
Chame o método
engines.servingConfigs.search
e especifique 1 para o search_type. Escolha a sintaxe do método
dependendo se a consulta é
texto ou bytes de imagem.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-19 UTC."],[[["\u003cp\u003eVertex AI Search enables searching for images within website data using either a text string or an image as the query input.\u003c/p\u003e\n"],["\u003cp\u003eTo utilize image search, Enterprise edition features and advanced website indexing must be enabled within your app's settings.\u003c/p\u003e\n"],["\u003cp\u003eImage search functionality is initiated using the \u003ccode\u003eengines.servingConfigs.search\u003c/code\u003e method via command line, which is preferred over the datastore search method, and specifying \u003ccode\u003e1\u003c/code\u003e for the \u003ccode\u003esearch_type\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eWhen using the command line, you will need to use your project ID and app ID, as well as a text query or base64-encoded image bytes.\u003c/p\u003e\n"],["\u003cp\u003eThe search results provide detailed information about the matching images, including the title of the webpage containing the image, the image URL, the context link, size, and dimensions.\u003c/p\u003e\n"]]],[],null,["# Search for images on websites\n\nWith Vertex AI Search, you can search for images using a app with\nwebsite data. You supply a query in the form of a text string or an image, and\nthe `default_config.search` method returns images for that query.\n| **Note:** Image search is not available using the Google Cloud console.\n\nBefore you begin\n----------------\n\nMake sure you satisfy the following prerequisites. Requirements vary depending\non whether you search using a text query or an image query.\n\n- If you search using a text query in your website search app, make sure the\n following is turned on: [Enterprise edition features](/generative-ai-app-builder/docs/about-advanced-features#enterprise-features)\n\n- If you search using an image query in your website search app, make sure the\n following are turned on:\n\n - [Enterprise edition features](/generative-ai-app-builder/docs/about-advanced-features#enterprise-features)\n\n - [Advanced website indexing](/generative-ai-app-builder/docs/about-advanced-features#advanced-website-indexing)\n\nPreview image search\n--------------------\n\nTo use the command line to preview image results for a website,\nuse the [`engines.servingConfigs.search`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines.servingConfigs/search) method:\n| **Note:** You can search over an app using the [`engines.servingConfigs.search`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines.servingConfigs/search) method and you can search over a data store using the [`dataStores.servingConfigs.search`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.dataStores.servingConfigs/search) method. For the following procedure, Google recommends searching using the `engines.servingConfigs.search` method.\n\n1. Find your app ID. If you already have your app ID, skip to the next step.\n\n 1. In the Google Cloud console, go to the **AI Applications** page.\n\n [Go to Apps](https://console.cloud.google.com/gen-app-builder/engines)\n 2. On the **Apps** page, find the name of your app and get the app's ID from\n the **ID** column.\n\n2. Call the\n [`engines.servingConfigs.search`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines.servingConfigs/search)\n method, specifying `1` for the `search_type`. Choose the method syntax\n depending on whether your query is\n text or image bytes.\n\n **Key Term:** In Vertex AI Search, the term *app* can be used interchangeably with the term *engine* in the context of APIs. \n\n ### Query is a text string\n\n curl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json\" \\\n -H \"X-Goog-User-Project: \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\" \\\n \"https://discoveryengine.googleapis.com/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/global/collections/default_collection/engines/\u003cvar translate=\"no\"\u003eAPP_ID\u003c/var\u003e/servingConfigs/default_config:search\" \\\n -d '{\n \"servingConfig\": \"projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/global/collections/default_collection/engines/\u003cvar translate=\"no\"\u003eAPP_ID\u003c/var\u003e/servingConfigs/default_search\",\n \"query\": \"\u003cvar translate=\"no\"\u003eQUERY\u003c/var\u003e\",\n \"pageSize\": \"\u003cvar translate=\"no\"\u003ePAGE_SIZE\u003c/var\u003e\",\n \"offset\": \"\u003cvar translate=\"no\"\u003eOFFSET\u003c/var\u003e\",\n \"params\": {\"search_type\": 1}\n }'\n\n ### Query is an image\n\n curl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json\" \\\n -H \"X-Goog-User-Project: \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\" \\\n \"https://discoveryengine.googleapis.com/v1beta/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/global/collections/default_collection/engines/\u003cvar translate=\"no\"\u003eAPP_ID\u003c/var\u003e/servingConfigs/default_search:search\" \\\n -d '{\n \"servingConfig\": \"projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/global/collections/default_collection/engines/\u003cvar translate=\"no\"\u003eAPP_ID\u003c/var\u003e/servingConfigs/default_search\",\n \"imageQuery\": {\"imageBytes\":\"\u003cvar translate=\"no\"\u003eIMAGE_BYTES\u003c/var\u003e\"},\n \"pageSize\": \"\u003cvar translate=\"no\"\u003ePAGE_SIZE\u003c/var\u003e\",\n \"offset\": \"\u003cvar translate=\"no\"\u003eOFFSET\u003c/var\u003e\",\n \"params\": {\"search_type\": 1}\n }'\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of your project.\n\n - \u003cvar translate=\"no\"\u003eAPP_ID\u003c/var\u003e: the ID of your app.\n\n - \u003cvar translate=\"no\"\u003eQUERY\u003c/var\u003e: the search query text. For example, \"Round headlight\n cars\" or \"show me dress with stripes.\"\n\n - \u003cvar translate=\"no\"\u003eIMAGE_BYTES\u003c/var\u003e: the image in Base64 encoded bytes. Supported\n formats are JPEG, PNG, and BMP.\n\n - \u003cvar translate=\"no\"\u003ePAGE_SIZE\u003c/var\u003e: optional. The number of results returned by the\n search. The default value is 10 for website search.\n\n - Values below 0 cause an error.\n - Values above 100 cause the value to be set to 100.\n - \u003cvar translate=\"no\"\u003eOFFSET\u003c/var\u003e: optional. The starting index of the results.\n The default value is 0.\n\n For example, if the offset is 2 and the page size is 10, results 2\n through 11 are returned.\n3. Review the response. See the following table for field descriptions:"]]