Elenca i datastore
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Elenca datastore
Esempio di codice
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
[[["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"]],[],[[["\u003cp\u003eThis page provides a code sample in Python for listing data stores within the Vertex AI Agent Builder.\u003c/p\u003e\n"],["\u003cp\u003eThe code demonstrates how to use the \u003ccode\u003ediscoveryengine\u003c/code\u003e library to interact with the Vertex AI Agent Builder API, specifying a project ID and location.\u003c/p\u003e\n"],["\u003cp\u003eAuthentication is required, and instructions are provided to set up Application Default Credentials (ADC) for local development.\u003c/p\u003e\n"],["\u003cp\u003eThe provided sample uses the \u003ccode\u003eListDataStoresRequest\u003c/code\u003e to list the current data stores.\u003c/p\u003e\n"],["\u003cp\u003eThe provided reference documentation for the Vertex AI Agent Builder Python API, and a code samples browser are provided.\u003c/p\u003e\n"]]],[],null,["# List data stores\n\nCode sample\n-----------\n\n### Python\n\n\nFor more information, see the\n[AI Applications Python API\nreference documentation](/python/docs/reference/discoveryengine/latest).\n\n\nTo authenticate to AI Applications, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n\n from google.api_core.client_options import ClientOptions\n from google.cloud import discoveryengine\n\n # TODO(developer): Uncomment these variables before running the sample.\n # project_id = \"YOUR_PROJECT_ID\"\n # location = \"YOUR_LOCATION\" # Values: \"global\"\n\n\n def list_data_stores_sample(\n project_id: str,\n location: str,\n ) -\u003e discoveryengine.ListDataStoresResponse:\n # For more information, refer to:\n # https://cloud.google.com/generative-ai-app-builder/docs/locations#specify_a_multi-region_for_your_data_store\n client_options = (\n ClientOptions(api_endpoint=f\"{location}-discoveryengine.googleapis.com\")\n if location != \"global\"\n else None\n )\n\n # Create a client\n client = discoveryengine.https://cloud.google.com/python/docs/reference/discoveryengine/latest/google.cloud.discoveryengine_v1.services.data_store_service.DataStoreServiceClient.html(client_options=client_options)\n\n request = discoveryengine.https://cloud.google.com/python/docs/reference/discoveryengine/latest/google.cloud.discoveryengine_v1.types.ListDataStoresRequest.html(\n # The full resource name of the data store\n parent=client.https://cloud.google.com/python/docs/reference/discoveryengine/latest/google.cloud.discoveryengine_v1.services.data_store_service.DataStoreServiceClient.html#google_cloud_discoveryengine_v1_services_data_store_service_DataStoreServiceClient_collection_path(\n project_id, location, collection=\"default_collection\"\n )\n )\n\n # Make the request\n response = client.https://cloud.google.com/python/docs/reference/discoveryengine/latest/google.cloud.discoveryengine_v1.services.data_store_service.DataStoreServiceClient.html#google_cloud_discoveryengine_v1_services_data_store_service_DataStoreServiceClient_list_data_stores(request=request)\n\n for data_store in response:\n print(data_store)\n\n return response\n\nWhat's next\n-----------\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=genappbuilder)."]]