From 7fcb7489401bd3f4d2fb84b758388d06a703b5be Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Wed, 24 Apr 2024 23:21:42 +0200 Subject: Update README --- README.md | 58 +++++++++++++++++++++++++++------------------------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 6bd6475..31ff987 100644 --- a/README.md +++ b/README.md @@ -12,30 +12,36 @@ RAG with ollama (and optionally cohere) and qdrant. This is basically a glorifie Create a .env file or set the following parameters: ```.env -CHUNK_SIZE = 4096 -CHUNK_OVERLAP = 256 +CHUNK_SIZE=4096 +CHUNK_OVERLAP=256 -ENCODER_MODEL = "nomic-embed-text" -EMBEDDING_DIM = 768 -RETRIEVER_TOP_K = 15 -RETRIEVER_SCORE_THRESHOLD = 0.5 +ENCODER_MODEL=nomic-embed-text +EMBEDDING_DIM=768 +RETRIEVER_TOP_K=15 +RETRIEVER_SCORE_THRESHOLD=0.5 -RERANK_MODEL = "mixedbread-ai/mxbai-rerank-large-v1" -RERANK_TOP_K = 5 +RERANK_MODEL=mixedbread-ai/mxbai-rerank-large-v1 +RERANK_TOP_K=5 -GENERATOR_MODEL = "llama3" +GENERATOR_MODEL=llama3 -DOCUMENT_DB_NAME = "rag" -DOCUMENT_DB_USER = "aktersnurra" +DOCUMENT_DB_NAME=rag +DOCUMENT_DB_USER=aktersnurra -QDRANT_URL = "http://localhost:6333" -QDRANT_COLLECTION_NAME = "knowledge-base" +QDRANT_URL=http://localhost:6333 +QDRANT_COLLECTION_NAME=knowledge-base COHERE_API_KEY = # OPTIONAL COHERE_RERANK_MODEL = "rerank-english-v3.0" ``` -### 2. Ollama +#### 2. Install Python Dependencies + +``` +poetry install +``` + +#### 3. Ollama Make sure ollama is running: @@ -50,30 +56,24 @@ ollama pull $GENERATOR_MODEL ollama pull $ENCODER_MODEL ``` -### 3. Qdrant +#### 4. Qdrant Qdrant is used to store the embeddings of the chunks from the documents. Download and run qdrant. -### 4. Postgres +#### 5. Postgres Postgres is used to save hashes of the document to prevent documents from being added to the vector db more than ones. Download and run qdrant. -### 5. Cohere - -Get an API from their website. +#### 6. Cohere -### 6. Running +Get an API from their website, but is optional. -#### 6.1 Prerequisites - -Both databases needs to be running as well as ollama. - -##### 6.1.1 Python Environment +### Running Activate the poetry shell: @@ -81,17 +81,13 @@ Activate the poetry shell: poetry shell ``` -#### 6.3 CLI - -Run the cli with: +Use the cli: ```sh python rag/cli.py ``` -#### 6.4 UI - -Run the web app with streamlit: +or the ui using a browser: ```sh streamlit run rag/ui.py -- cgit v1.2.3-70-g09d2