Hello,
I am looking for advice on how to build a feature where users can retrieve their data using natural language.
For example, a user might type a prompt like: "Give me the todos from yesterday with the tag Foo."
Once the database processes this and returns the relevant records, I plan to use the data in one of two ways depending on the specific use case:
Since I am relatively new to this specific workflow, I am looking for the best way to architect this, particularly regarding security and ensuring that Row Level Security (RLS) is strictly enforced so users only see their own data.
I am looking for:
Any guidance or pointers to relevant documentation would be greatly appreciated. Thank you.
The user seeks advice on building a feature that allows users to retrieve data using natural language queries. They are interested in ensuring security through Row Level Security (RLS) and are looking for examples, tools, or architectural advice to implement this feature safely. Another user suggests using edge functions to convert queries into SQL while enforcing RLS.
I wouldn't call it reccomeneded but one thing to consider is using an edge function to take the users query and convert ito SQL and also place the user credentials from the incoming request as the credentials for the SQL query you make. THis would allow you to ensure RLS is enforced for all users queries
I'm not too familiar with the exact code for this but i'm sure you can find it online somewhere