SQL Agent + ChatGPT + PostgreSQL

I’m having issues with the SQL Agent.

  1. I create an AI Agent.
  2. I configure it to connect to Postgres, and it returns a successful connection.
  3. I connect the “OpenAI Chat Model” as the Model for the SQL Agent.
  4. Every time I run the Agent, it returns “I don’t know” to my question.

So, does anyone know how to make the SQL Agent flow work?

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Welcome to the community @Marconi_Medeiros !

Tip for sharing information

Pasting your n8n workflow


Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.

```
<your workflow>
```

That implies to any JSON output you would like to share with us.


The answer “I don’t know” comes from the default prompt which states

If the question does not seem related to the database, just return “I don’t know” as the answer.

I believe you are expected to ask questions related to the actual data stored in the database. Can you try to rephrase your question making sure you are asking about data stored in the database table(s)?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.