Skip to content

Conversation

azmy60
Copy link
Collaborator

@azmy60 azmy60 commented Jul 22, 2025

Plan

When the AI wants to run query, it should show three buttons (yes/no/edit). If you click edit, it should reject the AI suggested query (like clicking no), and pop up a new editor with the exact query using an editable query editor.

After the user finished editing the query, we should create 4 new messages

  1. "User rejected tool call"
  2. The modified query
  3. AI message that initiates tool call
  4. The result of the query

The full conversation would probably look like this:

User: "Select all users sorted by age"
AI: run_query(select * from users order by age limit 100)
Function*: error("User rejected tool call")
User*: "User has modified the query of toolu_abcd123 <query>select * from users order by age limit 5</query>. Use the modified query instead."
AI*: run_query(select * from users order by age limit 5)
Function*: <result of query here>
AI: "I ran the modified query as requested"

*Messages generated by AI Shell after the user edited the query, a.k.a. hardcoded

Why not just modify the AI query directly instead? Depending on the context and the model, the AI can be confused if we modify it directly. This is a bad example, but suppose this is the conversation:

User: "Select all users sorted by age"
AI: run_query(select * from users order by age limit 100)

And then we hardcode the limit to 5:

User: "Select all users sorted by age"
AI: run_query(select * from users order by age limit 5)

If we send the hardcoded message without further context, the AI can get confused and might send this response:

AI: "The query returned 5 users. However, we might need to select more data to be more accurate. Let me do that for you. (I'll take the liberty to be stubborn and use limit 100 and you can't stop me :D)"

issue: beekeeper-studio/beekeeper-studio#3352

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant