Farzad-R / LLM-Zero-to-Hundred

This repository contains different LLM chatbot projects (RAG, LLM agents, etc.) and well-known techniques for training and fine tuning LLMs.
189 stars 104 forks source link

Two Sessions not working independently #13

Closed itzkunalsatpute closed 2 months ago

itzkunalsatpute commented 2 months ago

Hi All,

I tried to open RAG-GPT in 2 browser window one in normal chrome and other on incognito mode. Uploaded 2 different files on two window 1st document was about PYMC MMM 2nd was regrading conjoint

And then I query "summarize this document" in gpt and both the window got same output instead of independent output.

Please find below

Based on the retrieved content, the document "Lab 93 - Bayesian MMM in Python Special Guests_ PyMC Labs.pdf" seems to be a tutorial or presentation on Bayesian Marketing Mix Modelling (MMM) in Python. It includes sections on making an exploratory report and creating line plots, which are likely part of the data analysis process in MMM.

The document "Conjoint tutorial I.pdf" appears to be a guide on conjoint analysis, a popular market research technique. It provides tips for planning ahead, including entering profiles, reproducing examples, reading appendices on deriving insights, computing WTPs (Willingness To Pay), and using the profit simulation spreadsheet. It also advises reading about the good and bad practices of conjoint analysis before optimization.

Please specify which document you want to know more about.

Why it is showing me both the document even they are open in 2 separate tabs?

FYI I only ran raggpt_app.py file

Farzad-R commented 2 months ago

Hi, I assume you are testing it to see the behavior in case multiple users use the chatbot. However, the chatbot needs some adjustments to serve multiple users. Let me first explain why that happened with the current version of the chatbot.

Let's say you uploaded document (a) 2 minutes ago and now you are planning to upload a new document, (b). When you upload a document the name of the folder containing the vectordb is generated using the UNIX timestamp. And as soon as you upload the new document, the chatbot starts to look for the most recently created vectordb (according to the time). Therefore, since you are running the chatbot locally, regardless of the number of instances and browsers, as soon as you uploaded the new document (b), a new vectordb with a more recent UNIX timestamp name was generated, and therefore both browsers started to point at the new vector database.

Fix for multiple users: If you are planning to prepare the chatbot to serve multiple users, a few adjustments are required.

  1. I recommend assigning a proper storage system instead of saving the vectordbs locally. (But that is optional)
  2. I recommend setting up a proper user authentication procedure and using that to create new sessions for each user separately. using the usernames, you can also assign different paths for creating the vector databases, and therefore, multiple users will be able to use the chatbot and chat with their documents without any interruption (This is one way that you can fix that problem). The bottom line is, that you need to implement a proper naming convention that not only separates vector databases but also separates different sessions (users).

I hope this explanation helps.

Farzad-R commented 2 months ago

Since I haven't heard back, I assume you no longer need this issue. So, I'll close it.

itzkunalsatpute commented 2 months ago

Hi Farzad,

Got the explanation and thank you. do you have any references to implement this changes? Also in our code do I need to make this changes in prepare_vectordb.py?

Farzad-R commented 2 months ago

I don't have an explicit explanation or code showing those changes. These changes can be defined and adjusted based on the available resources of the project. For instance, is the project being developed on-prem or on the cloud? if on the cloud, which one? and so on. The changes should be applied to the whole data preparation pipeline and not just the prepare_vecotrdb.py module. However, through that module, you can easily track the pipeline and apply all the necessary changes.

itzkunalsatpute commented 2 months ago

I'm currently using VS Code and Docker for development, and as part of my learning process, I've pushed my project to the Azure cloud, utilizing Azure Container Registry for image storage. I've also deployed the application using Azure Web App. I still have my $200 free credit available, and I plan to use it to expand this project into a comprehensive end-to-end solution, effectively turning it into a full-fledged project.

If I use Azure authentication then will this problem be resolved?

Farzad-R commented 2 months ago

You have done a great job so far. The challenging part of this project for your plan is handling storages.

  1. Vectordbs
  2. documents storage
  3. Storage for memory, feedback, etc. For these, you need to upgrade the project. For example: For 1, if you are just pushing the project to learn, you can leave the vectordb to be created on the container itself. But make sure the each user will be pointed to its own vectordb by following the suggestions that I mentioned earlier. For 2, you can treat it as one, or for a proper deployment scenario, you can use blob storage. For 3, you can ignore it if you are just learning. but for a proper deployment scenario you can use Azure tables to collect these information. (This part has not been implemented on that project since that was not a crucial part.)