Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Con Vertex AI Search, puoi cercare immagini utilizzando un'app con dati di siti web. Fornisci una query sotto forma di stringa di testo o immagine e
il metodo default_config.search restituisce le immagini per quella query.
Prima di iniziare
Assicurati di soddisfare i seguenti prerequisiti. I requisiti variano a seconda che la ricerca venga eseguita utilizzando una query di testo o una query di immagini.
Se esegui una ricerca utilizzando una query di testo nell'app di ricerca di siti web, assicurati che
siano attive le funzionalità della versione Enterprise.
Se esegui una ricerca utilizzando una query di immagini nell'app di ricerca di siti web, assicurati che
siano attive le seguenti impostazioni:
Per utilizzare la riga di comando per visualizzare l'anteprima dei risultati delle immagini per un sito web,
utilizza il metodo engines.servingConfigs.search:
Trova l'ID app. Se hai già l'ID app, vai al passaggio successivo.
Nella Google Cloud console, vai alla pagina AI Applications.
Nella pagina App, trova il nome della tua app e recupera il relativo ID dalla colonna ID.
Chiama il metodo
engines.servingConfigs.search
specificando 1 per search_type. Scegli la sintassi del metodo
a seconda che la query sia
testo o byte di immagine.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-05 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:"]]