vemonet / libre-chat

🦙 Free and Open Source Large Language Model (LLM) chatbot web UI and API. Self-hosted, offline capable and easy to setup. Powered by LangChain.
https://vemonet.github.io/libre-chat
MIT License
132 stars 17 forks source link

Uploading new documents via interface💡 #1

Open bw-Deejee opened 1 year ago

bw-Deejee commented 1 year ago

Describe the feature

It would be nice to be able to upload new documents in the web interface. Uploaded documents would have to be ingested by the model and be accessable in the current session.

An idea of implementation

No response

vemonet commented 1 year ago

Hi @bw-Deejee, thanks a lot for the nice suggestion!

I just added it to the API, it can be done easily through the OpenAPI swagger UI, with a user friendly file picker that accepts multiple files. Files will be automatically uploaded to the documents_path, if you provide .zip files they will be automatically unzipped, finally the vectorstore will be rebuild, so that the changes are directly taken into account by the running chatbot

Since it is implemented through the API it can also be done programmatically, e.g. having a script that feeds your QA chatbot with documents

It is live on the main branch and docker main tag. I'll publish soon a new release

Note that I recently made some changes to the volume setup in the docker-compose.yml, so you might want to check the docs to update your setup if you are using docker

bw-Deejee commented 1 year ago

Hi @vemonet, thanks for the quick reply and for this cool project.

I'm not sure if I misunderstood your answer. I cloned the newest version of the repo just now and ran the "hatch run dev" but I don't see an option to upload files right in the web interface yet. Is this a thing you will implement in the future or is it already there and I have to configure something differently?

vemonet commented 1 year ago

The upload UI is not directly in the "chat UI", but in the "API UI" which you can access by clicking the green icon top right

Now that you say this I am thinking I should make this more clear maybe :)

As I see it we should be able to do everything through the API, the UI is a bonus to provide a comfortable chat experience. Every feature should be first implemented through the API (to enable programmatic access), and if it is worth it we can add it to the UI (but in the end the UI just calls the API)

bw-Deejee commented 1 year ago

Ok, completely understood now. I found the document upload and tested it. Coming back to this feature request though, I think it would be really nice to have this upload feature right at the chat UI or at least on a seperate page which is as user friendly. For my purpose this is a real central feature of this tool and this is why I would love to see it being integrated as such. I do see your point though with the programmatic access approach. I might fiddle around with it a bit and integrate it on the chat UI myself but I'm sure you would do a way better job at it 😄

vemonet commented 1 year ago

Thanks for the details! I see what you mean

From my point of view uploading document is more an "admin" feature, and I would like to avoid having admin-related things in the chat UI (or it should be in a popper that is triggered by a click)

The best option I see would be to have a separate page for all admin related things: adding/checking documents, rebuilding the vectorstore, editing the LLM config directly from the UI....

To be able to serve the web UI from python, and not require any JS precompiling step, I took the approach of using vanilla JS without any framework (I am just using tailwind for the css).

This is actually really easy to do with ChatGPT ;) because building UI in vanilla JS is so well discussed and documented over the years over the web, that it will really be able to build any features you describe without much issues, just past your whole HTML file and tell what you want and it will get it almost right, almost every time! Then you will be able flex in front of all those softcore web frameworks-loving developers

That said, I am not against using a modern framework like svelte/qwik/solid, but we would need to find a way to integrate the compiled JS in the pip package properly (how do we do? Pre-compile the JS with jinja2 variables inside?). Or ditch the pip package completely and go full docker

Right now I am more focused on getting the deployment stable, and I see the API UI as a good cheap alternative to have an admin UI, so I will probably first check to add the possibility to update the config from the API, but an admin UI will be definitely be something I will look into in the future

In the meantime feel free to have a try at it! With the help of LLMs it is surprisingly fast and enjoyable :) And let me know if you want some help to get it started (e.g. setting up the new page for admin)

emojized commented 6 months ago

I like the software very much... going full docker is in my opinion not so cool. I am happy its running without docker. but still has some issues. For example I cant run the faiss vectorstore , it creates it and says "killed" out of nowehere. I already implemented a WordPress Plugin creating automatic posts thru its API