#Adding Option of RAG with Existing Database

1 messages · Page 1 of 1 (latest)

ocean sedge
#

Hi, I am trying to figure out what is the best way to add the option to connect to an existing vector database and use RAG with that database. It would work like this:

  1. The user would add the credentials and embedding model of the database in a configuration, and maybe other parameters like the number of documents to retrieve. This configuration would be saved in the LibreChat database.
  2. Once that's configured, LibreChat use the provided information to retrieve the information and add it to the prompt

For Step 2, I can probably use the existing RAG code but without requiring filenames. I would also need to add the code for getting the credentials
For Step 1, I want need to add popup configuration in the header options, similar to the presets configuration

Need Assistance:

  • I need help figuring out what parts of the code I need to change to add these feature, so it would be great if you could help me locate the files and components that I must change.
  • I would also appreciate any recommendations or comments about how to add this feature to LibreChat.
odd delta
#

I did something similar. Set up a RAG chain using Langchain or similar. Then set up a api web server to host that RAG chain with an OpenAI API Compatible route. Go to the config file for librechat and add the api web server as a custom endpoint.

#

As long as your RAG chain is being presented with an OpenAI API standard, Librechat should be able to connect.

ocean sedge
#

That sounds like a good idea. I'll try it out

#

Thanks!

odd delta
# vital vapor Can you share it with us?

Unfortunately I can’t share the project as it is company code. But I plan on writing a medium article soon describing the process. Did you have any specific questions in the meantime? Happy to help.

vital vapor
odd delta
#

Finally got around to writing that article - it’s my first time posting on medium so go ahead and give me some feedback if u found it helpful or if there was something I can add