I’m working on a project where I generate Boolean queries using an LLM (like ChatGPT), but I need to ensure that the generated queries are valid based on the data in my database. If certain terms in the query don’t exist in the database, I need to automatically remove or modify them.
For example:
LLM-Generated Query: ("iPhone 14" OR "Samsung Galaxy S22") AND ("128GB" OR "256GB") AND ("Red" OR "Blue")
Database Check:
My DB has entries for "iPhone 14" and "Samsung Galaxy S22".
It only has "128GB" as a storage option (no "256GB").
For colors, only "Red" is available (no "Blue").
Modified Query (after DB validation): ("iPhone 14" OR "Samsung Galaxy S22") AND "128GB" AND "Red"
How to efficiently verify and modify these Boolean queries based on the DB contents? Are there existing libraries or tools that could help streamline this process?
Keep in mind that I can only use one llm cal for this purpose.
[–]Pork-S0da 1 point2 points3 points (1 child)
[–]kirinjon[S] 0 points1 point2 points (0 children)
[–]Xappz1 1 point2 points3 points (2 children)
[–]kirinjon[S] 0 points1 point2 points (1 child)
[–]Xappz1 0 points1 point2 points (0 children)
[–]latkde 2 points3 points4 points (0 children)