アプリを取得する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],[],[[["\u003cp\u003eThis page provides a Python code sample for interacting with the Vertex AI Agent Builder API, specifically for retrieving engine details.\u003c/p\u003e\n"],["\u003cp\u003eAuthentication for the Vertex AI Agent Builder API requires setting up Application Default Credentials, as detailed in the provided link.\u003c/p\u003e\n"],["\u003cp\u003eThe code sample utilizes the \u003ccode\u003ediscoveryengine\u003c/code\u003e library from the \u003ccode\u003egoogle-cloud\u003c/code\u003e package and demonstrates how to create a client and use it to retrieve an engine resource.\u003c/p\u003e\n"],["\u003cp\u003eThe sample is set up to function with different locations, supporting both global and regional Vertex AI Agent Builder deployments, determined by providing specific locations in the \u003ccode\u003eClientOptions\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThere is a link to a sample browser where you can search and filter for other code samples for other Google Cloud products.\u003c/p\u003e\n"]]],[],null,["# Get an app\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 from google.api_core.client_options import ClientOptions\n from google.cloud import discoveryengine_v1 as 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 # engine_id = \"YOUR_ENGINE_ID\"\n\n\n def get_engine_sample(\n project_id: str,\n location: str,\n engine_id: str,\n ) -\u003e discoveryengine.Engine:\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.EngineServiceClient(client_options=client_options)\n\n # The full resource name of the engine\n # e.g. projects/{project}/locations/{location}/collections/default_collection/engines/{engine_id}\n name = client.engine_path(\n project=project_id,\n location=location,\n collection=\"default_collection\",\n engine=engine_id,\n )\n\n # Make the request\n response = client.get_engine(name=name)\n\n # Handle response\n print(response)\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)."]]