Query a Reasoning Engine
Stay organized with collections
Save and categorize content based on your preferences.
This sample demonstrates how to send a query to a Reasoning Engine instance.
Code sample
Python
Before trying this sample, follow the Python setup instructions in the Vertex AI quickstart using client libraries. For more information, see the Vertex AI Python API reference documentation.
To authenticate to Vertex AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
importvertexai
fromvertexai.previewimport reasoning_engines
# TODO(developer): Update and un-comment below lines
# PROJECT_ID = "your-project-id"
# reasoning_engine_id = "1234567890123456"
vertexai .init(project=PROJECT_ID, location="us-central1")
reasoning_engine = reasoning_engines .ReasoningEngine (reasoning_engine_id)
# Replace with kwargs for `.query()` method.
response = reasoning_engine.query(a=1, b=2)
print(response)
# Example response:
# 1 + 2 is 3
What's next
To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.