From 16e554e050d6291f9cc57f7087f7180474d8f942 Mon Sep 17 00:00:00 2001 From: Falko Habel Date: Sat, 18 May 2024 21:06:04 +0200 Subject: [PATCH] readme file added with roughly 700 words --- README.md | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 92 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0f673a4..d04ac78 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,92 @@ -# Fabelous-Ai-Chat - -This is my CS50p Final Project! A Chat Bot with GUI and Terminal Interface with Ollama and Chroma DB. \ No newline at end of file +# Fabelous-Ai-Chat +#### Video Demo: +#### Description: + +This is my Final Project for CS50P. A implementation of a RAG System using Chroma DB and Ollama for the backend, along with customtkinter for the frontend. + + +## Features +1. Custom GUI built with customtkinter and standard tkinter user interface. + - optional `terminal` mode, with nice colors provided by the `termcolor` libary +2. RAG system to retrieve and process files from various sources (CSV, HTML, JSON, MD, PDF) using ChromaDB. +3. Seamless integration with Ollama API for generating responses based on the input text. +4. Supports both context-based and context-free conversations. +5. Code Highlighting: Either highlighted in red within the `terminal` or displayed in a separate widget using the `GUI`, this improves the readability and understanding of code snippets + +## Installation +1. Clone the repository or download the project files. +2. Install required dependencies by running: +```bash +pip install -r requirements.txt +``` + + +## Configuration + +Please note that you need access to an Ollama instance with both embeddings model and chat model to use this interface effectively. Ensure that you have set up your instance accordingly before configuring this application. + +To configure the Fabelous-Ai-Chat, run the following command and answer the prompts accordingly: + +```bash +python project.py --config +``` +If you just want to switch for example from `GUI` to `terminal` version type: +```bash +python project.py -m terminal +``` + +During configuration, you'll be prompted to enter the following information: + +- Mode: `gui` or `terminal` +- Base Ollama URL for the LLM e.g.: `http://localhost:11434` +- Base Ollama URL for embeddings e.g.: `http://localhost:11434` +- The base model name e.g: `mistral` +- The base embeddings model name e.g: `mxbai-embed-large` +- Authentication headers for base and embeddings models (if required) + - a Authentication could look like this: `{"Authorization": "Token xzy"}` + +After providing this information, your configuration file will be saved in the `config` folder as `config.json`. + + + +## Usage in Terminal Mode +To use the Fabelous-Ai-Chat in terminal mode, run the following command and provide a prompt: +```bash +python project.py -p "Your prompt here" +``` +You can also provide an input file/link using the -f option: +```bash +python project.py -p "Your prompt here" -f "path/to/yourfile.csv" +``` + +## Usage in GUI Mode +To use the Fabelous-Ai-Chat in GUI mode, simply run the following command: +```bash +python project.py +``` + +## Supported files +You can provide the following files / links as context to Ollama: +- .csv +- .html +- .json +- .md +- .pdf +- links to websites + +## How the Rag is working in the GUI: + +The RAG is designed to create conversational agents that leverage external sources for more accurate responses. The `Rag` class in `Rag.py` plays a crucial role in this process. When a user submits a message through the chat interface, the `get_response_from_ollama` method comes into play. This method checks for any context associated with the message and processes it if required. + + +If necessary, it calls the `receive_data` method of the `Rag` instance to handle new context and fetch relevant data using the `get_file` method. The fetched content is then added to a database, which is not persistent. If you close it, you will lose the data. Following that, the `get_request` method of the Rag instance is called with the user's message as input. It generates a response, utilizing the contents of the Chroma DB for better accuracy, with the selected model from the Ollama instance. +For better results, the last five responses are featured in the context, if no other context is provided. + +## Difference to terminal mode: +In `terminal` mode, context is provided through command-line arguments as a single file. This approach has its limitations, as it only allows for a single context file during a conversation, restricting versatility when dealing with diverse contexts. + +## License +`Fabelous-Ai-Chat` is made available under the [MIT license](.../.././LICENSE). For more details, please refer to the LICENSE file included in the distribution. + +This project includes as standard models, models from [Mistral AI](https://mistral.ai/) and [Mixedbread.ai](https://www.mixedbread.ai/), which are made available under the Apache 2.0 license. For more details, check out there model pages on Ollama: +[Mistral](https://ollama.com/library/mistral) and [mxbai-embed-large](https://ollama.com/library/mxbai-embed-large)