I’m using Postgres Toolkit and would like to add a response schema. The agent is running the right query but the response is empty.
Are there specific schemas or workaround to get the output table in some kind of format?
class QueryResult(BaseModel):
# str if the response is not a table
# otherwise a list of dict
result: Union[List[Dict[str, Any]], str]
database_agent = Agent(
name="DatabaseAgent",
model=OpenAIChat(id="o3-mini"),
description="some description",
role="some role",
instructions="some instructions",
tools=[
PostgresTools(
host=os.getenv("DB_HOST"),
port=os.getenv("DB_PORT"),
db_name=os.getenv("DB_NAME"),
user=os.getenv("DB_USER"),
password=os.getenv("DB_PASSWORD"),
run_queries=True,
inspect_queries=True,
summarize_tables=True,
export_tables=False,
)
],
read_chat_history=True,
add_history_to_messages=True,
response_model=QueryResult,
telemetry=False,
monitoring=False,
)```