Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jenspapenhagen/raglette

RAGlette (pun intended mostly 6 or 8)
https://github.com/jenspapenhagen/raglette

diy embedded rag

Last synced: 1 day ago
JSON representation

RAGlette (pun intended mostly 6 or 8)

Awesome Lists containing this project

README

        

# RAGlette (pun intended mostly 6 or 8)

DIY RAG (Retrieval-Augmented Generation)

Idea:
use Apache Tika Server() as a Service in Docker-Compose\
for text extration from files (pdf/office docs)\
(send file by HTTP PUT and get JSON back)

than send to Ollama()\
Tutotial()\
More Info()

build a JSON payload and upload into qdrant:\

### Start Qdrant and create collection

- mv .env.example .env
- docker-compose up
- ./createCollection.sh

By splitting text extration and text embedding in seperate parts.
this can be scaled.

1. File upload by HTTP PUT to Tika Server
2. JSON response from Tika Server send to Ollama Endpoint
3. JSON response from Ollama Endpoint send to Qdrand Endpoint

#### extract text from test.pdf ####

Request

```shell
curl http://localhost:9998/tika --upload-file document/test.pdf
```

Response

```txt
hier steht der text
```

#### upload text to ollama ####

Request

```shell
curl http://localhost:11434/api/embeddings -d '{
"model": "nomic-embed-text",
"prompt": "XXXXX"
}'
```

Response

```json
{
"embedding": [
0.5670403838157654, 0.009260174818336964, 0.23178744316101074, -0.2916173040866852, -0.8924556970596313,
0.8785552978515625, -0.34576427936553955, 0.5742510557174683, -0.04222835972905159, -0.137906014919281
]
}
```

#### upload emdedding to qdrant ####

hints:

- count id up by hand
- custommice the payload

Request

```shell
curl -L -X PUT 'http://localhost:6333/collections/test_collection/points?wait=true' \ -H 'Content-Type: application/json' \ --data-raw '{
"points": [
{"id": 1, "vector": [0.05, 0.61, 0.76, 0.74], "payload": {"filename": "test.pdf"}},
]
}'
```

Response

```json
{
"time": 1.1,
"status": "status",
"result": {
"status": "acknowledged",
"operation_id": 1
}
}
```

### test client ###

added a small endpoint \
in python flask for the ollama service glued together with the qdrant upload

- go to "endpoint"
- build the Dockerfile (build.sh)
- remove comments from docker-compose.yaml
- restart docker-compose
- now you can use this endpoint:

Request

```shell
curl http://localhost:5000/embeddings -d '{
"input": "XXXXX",
}'
```

Response

```json
{
"status": "completed"
}
```

### links ###

- vector db [Qdrant](https://github.com/qdrant/qdrant)
- [all-MiniLM-L6-v2](https://huggingface.co/Xenova/all-MiniLM-L6-v2)
- [langchain4j](https://github.com/langchain4j/langchain4j)
-
-
-