# 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
* Minio (http://localhost:9001/)
### Vector Storage
* OpenSearch (Dashboard under: http://localhost:5601/)
### RAG-Backend
* API-Docs http://localhost:8000/docs
## 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"]}
}
}
}
}
}
}
## TODO