sarfraj89/self-rag
1
Self-RAG Assistant
A Streamlit Self-RAG assistant that answers questions over the included company profile, policy, and pricing documents.
Hugging Face Space Setup
Create a Streamlit Space and add these repository secrets:
MISTRAL_API_KEYHUGGINGFACEHUB_API_TOKENLANGSMITH_TRACINGset totrueto enable tracingLANGSMITH_API_KEYfor sending traces to LangSmithLANGSMITH_PROJECToptional, defaults toself-rag-assistant
The app entrypoint is:
frontend/app.pyThe PDF documents in documents/ must be committed with the Space repository.
LangSmith Tracing
This app instruments the Self-RAG workflow with LangSmith run names, tags, and metadata for retrieval, routing, generation, support checking, answer revision, usefulness checking, query rewriting, and prompt-injection security checks.
For local development, copy .env.example to .env and set:
LANGSMITH_TRACING=true
LANGSMITH_API_KEY=your-langsmith-api-key
LANGSMITH_PROJECT=self-rag-assistantWhen tracing is disabled or no LangSmith API key is configured, the app still runs normally without sending traces.
