AI Chat
Note
This feature is available in Lite, Enterprise, Ultimate and Team editions only.
DBeaver provides AI Chat for working with databases in natural language. You can enter requests in plain text to generate SQL queries, get explanations, or ask questions about your databases.
Using AI Chat¶
To use the AI Chat:
-
Click on the AI Chat icon
located in the DBeaver toolbar.
- Alternatively, open the SQL Editor and click on the AI Assistant icon
located in the left toolbar.
Note
The toolbar is customizable. For further information, refer to Toolbar Customization article.
- Alternatively, open the SQL Editor and click on the AI Assistant icon
-
In the chat window that opens, select a connection and, optionally, a scope.
- Enter your request in natural language.
-
Press the Send button to get the SQL translation. You can then choose from the following options:
- Execute to run the generated SQL query
-
Editor to open the query in the SQL Editor and continue working with it directly
Tip
If the cursor is on a query, clicking Editor will replace it. Move to a new line to keep the old query.
-
Copy to copy the query to your clipboard
AI Chat configuration¶
Connection field¶
To use a specific connection in AI Chat, select the connection from the toolbar at the top of the chat panel. The selected connection defines which database the AI will use when generating SQL queries.
Multiple conversations¶
You can create multiple chats for different connections.
The first chat is created automatically when you open AI Chat. Each chat is named based on your first prompt. Messages related to the same query or object in the same connection are kept together in one conversation.
Action | Button/icon | How to do it |
---|---|---|
Add a new chat | ![]() |
Click the button to start a new conversation |
Switch chats | (Dropdown menu) | Use the dropdown menu to switch between existing chats |
Delete a chat | ![]() |
Select the chat from the dropdown, then click the delete button |
Important
Deleted conversations can’t be restored.
Resetting query context¶
AI Chat keeps the history of your questions so you can build on them. Sometimes you may want to start fresh. To reset
the context or clear history up to a certain message, click the reset button ()
next to that message.
Example
You asked about the “orders” table and then want to switch to “customers”. Reset before your new question so AI doesn’t mix both topics.
Defining the scope¶
To improve accuracy, especially in databases with large schemas, you can use the Scope field to limit the context to specific database objects.
- In the AI Chat toolbar, click the Change scope button
to open the context menu.
-
Choose the desired context level:
Scope option Description Current schema AI focuses only on the schema you’re currently using Current database AI is limited to the currently selected database This connection AI considers all schemas within the current database connection This conversation AI uses only the context and metadata gathered in the current chat All objects AI can access metadata for all available connections, databases, and schemas Custom Lets you define a more specific scope, such as a particular table or set of objects
AI Chat settings¶
You can adjust a few key options to make AI Chat work the way you prefer. Go to Window -> Preferences -> General -> AI -> AI Chat.
Setting | Description |
---|---|
Send previous answers | Passes earlier replies back to the AI to improve context, but uses more tokens |
Days to keep chats | Sets how long your chat history is stored locally |
Use experimental renderer | Switches to a faster web-based view of AI Chat (still in development) |
Tip
See the full list of AI settings.