How to chat with DB and PDF and have the Ai follow your rules

I would like to know what the best platform is for being able to chat with a SQL / SQLite DB, some PDFs, and make sure the Ai follows the training rules. I have an app running on Chainlit right now, and everything is working except the Ai, despite reminding me it knows the rules, does not follow them. How can I accomplish this?

I usually used the pipeline to make queries from a PDF. Here’s an example of how you can do it. I’m using the “Document Analysis” pipeline on their marketplace.

It is free and you can be customized based on your needs.

thanks for your response. did you find that the Ai followed your rules? that’s the big problem i’m having.

if you mean that “rules” is a prompt to LLM how to answer a query, then yes. At least so far I’m using it, and it works well.

Here’s the rule I’m setting up for the LLM:

1 Like

hey thanks again. the thing is - i have pages of rules, and i’ve tried them in the system message and also as PDF’s in the training docs, but eventhough it knows the rules, it doesn’t follow them! crazy. have you tried anything with more rules? have you noticed it ignoring your rules?

mind to share your work? a repo or file in gdrive might help.

Thanks for your continued help, Ekki. This is an app built in Chainlit. Will that help? I will have to figure out how to do a repo. NEWBIE!!!

Oh, I forgot you mentioned chainlit, no worries. Maybe you can send me a message with your system files attached. Or you can share the chainlit pipeline, if it share-able

While I look into that, do you know if this is even the right approach i should take? Im pretty good at finding stuff on Google, but have not yet found anything about this. And clearly, it is being done all over the place.

Can I privately share this Google Drive with you?

I’ve dm’ed you my email. you can send there

Hey Ekki, it’s sent and thank you very much!

Well received, gonna take a look at the files that you’ve shared

Rockin’. Thank you. If you can figure this out, I might just have a bunch of work for you if you’re interested!

1 Like