列出所有推論引擎執行個體

這份程式碼範例說明如何列出專案中的所有 Reasoning Engine 執行個體。

程式碼範例

Python

在試用這個範例之前,請先按照「使用用戶端程式庫的 Vertex AI 快速入門導覽課程」中的 Python 設定說明操作。詳情請參閱 Vertex AI Python API 參考文件

如要向 Vertex AI 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

import vertexai
from vertexai.preview import reasoning_engines

# TODO(developer): Update and un-comment below line
# PROJECT_ID = "your-project-id";
vertexai.init(project=PROJECT_ID, location="us-central1")

reasoning_engine_list = reasoning_engines.ReasoningEngine.list()
print(reasoning_engine_list)
# E<xample response:
# [vertexai.reasoning_engines._reasoning_engines.ReasoningEngine obje>ct at 0x71a0e5cb99c0
# resource name: projects/123456789/locations/us-central1/reasoningEngines/11<1111111111111111,
# vertexai.reasoning_engines._reasoning_engines.ReasoningEngine obje>ct at 0x71a0e5cbac80
# resource name: projects/123456789/locations/us-central1/reasoningEngines/222222222222222222]

後續步驟

如要搜尋及篩選其他 Google Cloud 產品的程式碼範例,請參閱Google Cloud 瀏覽器範例