CoolFace
Apppublic

sarfraj89/self-rag

sourceHugging Faceupdated 3mo agoView on Hugging Face
1likes
App README

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_KEY
  • —HUGGINGFACEHUB_API_TOKEN
  • —LANGSMITH_TRACING set to true to enable tracing
  • —LANGSMITH_API_KEY for sending traces to LangSmith
  • —LANGSMITH_PROJECT optional, defaults to self-rag-assistant

The app entrypoint is:

bash
frontend/app.py

The 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:

bash
LANGSMITH_TRACING=true
LANGSMITH_API_KEY=your-langsmith-api-key
LANGSMITH_PROJECT=self-rag-assistant

When tracing is disabled or no LangSmith API key is configured, the app still runs normally without sending traces.