No description
Find a file
2024-08-10 14:06:27 +02:00
rag-chat-backend chunk size + chunk overlap in settings 2024-07-04 18:01:44 +02:00
.env chunk size + chunk overlap in settings 2024-07-04 18:01:44 +02:00
.gitignore basic backend 2024-06-23 12:57:53 +02:00
docker-compose.yaml added API-Endpoints for files 2024-06-18 20:21:04 +02:00
LICENSE Initial commit 2024-06-15 10:56:18 +00:00
README.md Added Chat Example message to README 2024-08-10 14:06:27 +02:00

RAG-Chat

Chat with your Documents/Knowledgebase

Usage

Clone the repo, enter it and run:

podman-compose -f docker-compose.yaml up

Structure

Object Storage

Vector Storage

RAG-Backend

Development

nodemon --ext '*' --exec "podman stop rag-chat-backend; podman rm rag-chat-backend; podman-compose -f docker-compose.yaml up --build"

Ollama (CLI)

Show Models from Ollama
curl http://localhost:11434/api/tags | jq
Run Chat Completion
curl http://localhost:11434/v1/chat/completions \
    -H "Content-Type: application/json" \
    -d '{
        "model": "phi3:latest",
        "messages": [
            {
                "role": "system",
                "content": "You are a helpful assistant."
            },
            {
                "role": "user",
                "content": "Hello!"
            }
        ]
    }'

VectorDB (CLI)

Quere Verctoriezed content
curl -X 'POST' \
    'http://localhost:8000/api/search-engine?query=HTML%20of%20your%20question' \
    -H 'accept: application/json' | jq

VectorDB (Opensearch Dashboard)

Run these at http://localhost:5601/app/dev_tools#/console

View Chunked Vectors
GET /my-project-name/_search
{
    "query": {
        "match_all": {}
    }
}
Get the three best documents with theire embeddings
GET /my-project-name/_search
{
    "size": 0,
    "query": {
        "bool": {"must": [{"match": {"content": "Enter your Question here..."}}]}
    },
    "aggs": {
        "group_by_source": {
            "terms": {
                "field": "metadata.source.keyword",
                "size": 100000
                
            },
            "aggs": {
                "top_entries": {
                    "top_hits": {
                        "size": 3,
                        "sort": [{"_score": {"order": "desc"}}],
                        "_source": {"excludes": ["embedding_vector"]}
                    }
                }
            }
        }
    }
}

Chat

Example Chat Message
[{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Hello!"}]

TODO