huggingface / huggingface/transformers.js-examples

Please add a demo of Retrieval-Augmented Generation with embedding and text-generation model.

Open
#79 0 comments 0 reactions 0 assignees View on GitHub
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.