huggingface / huggingface/transformers.js-examples
Please add a demo of Retrieval-Augmented Generation with embedding and text-generation model.
- Dominant language
- JavaScript
- Stars
- 2.1k
- Forks
- 251
- PR merge metrics
- No merged PRs in 30d
Description
RAG Data Not Following System Prompt / Not Restricting to Retrieved Context
Would you add a demo/example of a Retrieval-Augmented Generation (RAG) pipeline that:
Uses Markdown content as knowledge base
Converts it into embeddings via an Embedding Model
Retrieves relevant chunks
Sends them to a Text Generation Model
Ensures the model strictly answers ONLY from retrieved context
Currently, the model:
❌ Does not follow the system prompt strictly
❌ Generates answers outside of retrieved (RAG) data
❌ Hallucinates or adds extra knowledge
✅ Expected Behavior
The Text Generation Model should:
Only answer using retrieved RAG context
Refuse to answer if context is insufficient
Follow system prompt strictly?
❌ Current Behavior
Model ignores restriction instructions
Uses general knowledge instead of retrieved chunks
Responses are not grounded in RAG data.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.