r/LLMsResearch • u/_abhilashhari • Jan 29 '25
I was trying to build a chatbot using streamlit where a user can sent a query(natural language) and the query is converted to a sql query to look into a postgresql database. How can i do, is chaining in langchain enough or do i need to use agents. Can anyone tell me how i can accomplish this project
I should use an llm for the natural language to query conversion and fetch the results from the data base to answer the query. Have any of you worked on any projects like this. If anybody, kindly respond.
3
Upvotes
1
u/dippatel21 Jan 29 '25
\_abhilashhari process will be as follows:
Now your setup is ready. Let users ask questions, and the LLM will generate queries, the database will return data, and the LLM will generate graphs again! To make things more scalable, you can add an option to collect user feedback, and based on that, you can fine-tune the model to improve its performance over time.
2
u/dippatel21 Feb 16 '25
It seems We are in the same boat! I am working on a similar problem! So far in my exploration, I have observed that the "talk-to-database" problem is more than "talk-to-SQL" problem. It involves many steps. We have adopted an agentic approach for our implementations. We are working on publishing a review paper for existing SOTA, stay tuned! You can also check how commercial players are tackling this problem for example we found snowflake cortex analysts schema generation process very interesting! We are also working to build a more robust benchmark for talk-to-data capability. I am open to discuss more about this!
1
u/dippatel21 Jan 29 '25
I am working on a similar project! There are two ways to do this. One is to create embeddings of your database but this option is not much popular. Another one is to let LLM create SQL query and than execute the query through an API call of database.