Talking to your database #6918
-
Hello, naive question here, but when I read the documentation, I get the impression that it's assumed the knowledge base is in unstructured documents, whereas in my case, the data is in a structured form in a database. In this case, what is the best way to ingest the data? Should I convert my tables into JSON documents? Should I create an unstructured document for each row? I'm wondering if Haystack is ultimately the right tool for "talking" to my database. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
Hello, @underthesand! Based on your description, I assume you have a SQL database containing data. This is an interesting feature, but it is not currently provided by Haystack. We would like to support this use case in the future. Related |
Beta Was this translation helpful? Give feedback.
-
Hello @anakin87 Actually, I can use either an SQL or a NoSQL database; that's not the issue. I'm wondering if creating a pipeline that transforms each row/document into a JSON document and feeding Haystack with all these JSONs could lead to good results, or if it's a terrible idea and there's a much better way to do this with another tool. |
Beta Was this translation helpful? Give feedback.
-
What you propose should be feasible, but I cannot guarantee that it will work and be worthwhile. As you can tell from the experimental blog post I linked above, You can try it, following the approach proposed in that blog post and using Haystack, but it is not something readily available. |
Beta Was this translation helpful? Give feedback.
-
Hey, @underthesand! I just became aware of this blog post that shows an approach similar to what you wanted to try: |
Beta Was this translation helpful? Give feedback.
-
Seconding this feature. I really think talking to your sql-database would be a great Haystack addition. I would be especially interested in an efficient way to split the relational data before ingesting it into the datastore and if there is a way to signal the embedder which text/data is part of the the same row in the database and thus belongs to the same id. |
Beta Was this translation helpful? Give feedback.
-
We have recently published a post with a demo of how to chat with a single table. Depending on the size of your database, you might be able to use this approach. The other consideration is: how will your users interact with the database? At some point, I imagine you need to convert some natural language to SQL, unless you're planning to return the whole table (in which case you could index table description and return that)? |
Beta Was this translation helpful? Give feedback.
Hello, @underthesand!
Based on your description, I assume you have a SQL database containing data.
To talk to your database, you probably need a LLM that converts natural language to SQL queries.
This is an interesting feature, but it is not currently provided by Haystack. We would like to support this use case in the future.
Related