Rustyrag
This project implements a simple semantic search and RAG use-case with rust (mistral.rs/fastembed-rs) + pgvector and serves a frontend and rest-api for book recommendation.
Install / Use
/learn @domWinter/RustyragREADME
Rusty RAG - LLM-powered Book Recommendation
This project implements a simple semantic search and RAG use-case with rust (mistral.rs/fastembed-rs) + pgvector and serves a frontend and rest-api to recommend books based on the CMU Book Summary Dataset.
<img src="img/setup.excalidraw.png" width="500">Setup
Start database and ollama instance
First run:
docker-compose up
to start the postgres database.
Generate book summary embeddings
Then download the dataset from Kaggle and start the embedding generation:
cargo run --release --bin embedding-generator -- --num-summaries 16384 --num-chunks 2048 --summaries-file ./booksummaries.txt
Set Hugging Face Token
This project uses hugging face to remotely load models from the internet. To authenticate your account, save the hugging face api token from token-settings to <i>~/.cache/huggingface/token</i>.
Run the web application
cargo run --release --bin rustyrag
Features
You can accelerate embedding generation and chat completion via metal (Apple SNE) or cuda. Simply run the above command with
cargo run --release --features cuda ...
or
cargo run --release --features metal ...
Troubleshooting
Request Error 401
If you are facing this error:
thread 'main' panicked at /Users/z0011bjk/.cargo/git/checkouts/mistral.rs-0a2607fe9768eac5/5c3e9f1/mistralrs-core/src/pipeline/gguf.rs:282:58:
RequestError(Status(401, Response[status: 401, status_text: Unauthorized, url:
https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2/resolve/main/tokenizer.json]))
You need to save your hugging face token first to: <i>~/.cache/huggingface/token</i>
Request Error 403
If you are facing the following error:
thread 'main' panicked at /Users/z0011bjk/.cargo/git/checkouts/mistral.rs-0a2607fe9768eac5/5c3e9f1/mistralrs-core/src/pipeline/gguf.rs:282:58:
RequestError(Status(403, Response[status: 403, status_text: Forbidden, url:
https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2/resolve/main/tokenizer.json]))
If you are using the default mistralai/Mistral-7B-Instruct-v0.2 model, you have to be accepted the license at huggingface first.
Related Skills
node-connect
345.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
106.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
