Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve prompt #210

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Improve prompt #210

wants to merge 6 commits into from

Conversation

kracekumar
Copy link
Contributor

Description

  • When the LLM response returns multiple SQL queries, all the SQL queries are clubbed inside the single code fence. Improve the prompt to return a SQL per code fence.
  • Fixes Default LLM prompt can contain multiple SQL queries in SQL fence. #209
  • Note: ensure_litecli_template(replace=False) is called with False, that means it's hard to change the prompt in the future. Updating the template requires the editor. May be suffixing the version of the installation in the template name can help. I'm happy to modify the code if needed.

Checklist

  • I've added this contribution to the CHANGELOG.md file.

@amjith
Copy link
Member

amjith commented Feb 17, 2025

Regarding the current PR, the code as it stands today will only parse the first sql code fence. Providing both queries in a single fence at least gave the user a choice to edit the query and choose the one they wanted. Isn't that better than only capturing the first?

Note: ensure_litecli_template(replace=False) is called with False, that means it's hard to change the prompt in the future. Updating the template requires the editor. May be suffixing the version of the installation in the template name can help. I'm happy to modify the code if needed.

This is to ensure we don't overwrite the template with the default one if the user has modified it to fit their needs.

For example, a user could run \llm templates edit litecli to modify the default prompt and add or remove some information from the context. If we overwrite the prompt then we're stomping on the user's changes. So it was an intentional choice. I can see that it makes it hard to upgrade in the future. But we can introduce a new new subcommand such as llm reset or something similar to overwrite the template prompt. I haven't done that yet but I plan to add that when the need arises.

@kracekumar
Copy link
Contributor Author

kracekumar commented Feb 17, 2025

Regarding the current PR, the code as it stands today will only parse the first sql code fence. Providing both queries in a single fence at least gave the user a choice to edit the query and choose the one they wanted. Isn't that better than only capturing the first?

I see the idea and makes sense. I can see it can see usefulness(though subjective) when there are multiple SQLs returned.

I haven't done that yet but I plan to add that when the need arises.

Ack!

Thanks for the response.

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.

Default LLM prompt can contain multiple SQL queries in SQL fence.
2 participants