How to make Multi User Role Based Access Chatbot which generate different answers for each user depending on their knowledge base?

I need help with some work for my website : I need to create a RAG (Retrieval Augmentation Generation) model for making one chatbot like you. But the trick is I have multiple users, and each user has access to a different knowledge base; one user can’t see the other user’s content. I want one chatbot using any good models API, I have about 5 users, and I have some user-specific PDF Files I want to store them in a server not in a local machine, and access data from the server.

Details about documents:
- I want to store all the documents in a single folder/location of that specific user. Such as User1/user1_Doc1, user1_doc2…etc, User2/user2_Doc1,user2_doc2….etc……

Details about users:
The users are employees of the company, not customers. For a specific user: there are some sets of documents each in their folder. so like that there are several folders as many as several users. One user’s knowledge base is different from another user’s. Assume there are no common documents. Now for this user’s data when he logs in to the portal - he should not navigate through the whole website instead ask the chatbot what document he needs and the model should output the document or the contents from the document like summarising the content and link for the that document to download.

  • Examples of documents are Form 16, Degree of education certificates, Tax invoices, Salary Slips…etc
  • Should be first able to create an account for each user [up to 5 accounts] and then log in.
  • Define user roles like admin, user 1, user 2, …etc.
  • How can I Map user roles to permissions that control features and data access that that user can only access, as every user has a different set of documents to access data from?

Help me achieve this by giving a detailed solution. give a very detailed solution to achieve this first. Let’s think about the tech stack later after I decide on a solution. Delve deep into how I can have user-based chatbot system as this is the important part.

How can i achieve this?

For the frontend use “Streamlit” For the backend use “FastAPI”
use the “LangChain” library for Chatbot modeling
For storing data use - GCP
For access control use - Firebase

I’d use the Assistants endpoint with unique threads for each user, and then host it through unique GCP endpoints (or paths).

1 Like

Hey hrithiksagar2000 - Welcome to the community,

I would also use assistant’s API and maintain session states across user logins and that should solve the problem for access. You can have tools like file search and also have functions defined which embeds the user documents during run time and vector DBs can be used for RAG (or have it setup when the user logs in).
Cheers!