Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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)
- Host: GitHub
- URL: https://github.com/jenspapenhagen/raglette
- Owner: jenspapenhagen
- Created: 2024-03-05T17:53:09.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2024-07-13T13:57:37.000Z (4 months ago)
- Last Synced: 2024-07-14T06:40:01.872Z (4 months ago)
- Topics: diy, embedded, rag
- Language: Python
- Homepage:
- Size: 123 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.shBy 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 payloadRequest
```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)
-
-
-