🧠

Production RAG Blueprint

Endee RAG Forge

Endee + LangChain + Mistral + AI text generation

Production-ready document QA architecture, now with an in-app AI generation demo.

This companion app includes the complete Python project structure requested and now integrates GenMB AI text generation directly in the UI so users can test answer drafting, prompt flows, and chat interactions without leaving the app.

Streamlit CloudHugging Face SpacesRender

Deployment checklist

Ready
  • Environment variables are externalized in .env.example.
  • No hardcoded local paths; uploads persist in the project data/ directory.
  • Requirements include Streamlit, LangChain, Sentence Transformers, Transformers, and Endee.
  • The web companion now uses the GenMB AI completion service via /api/ai/completion.

RAG pipeline architecture

The generated backend follows the exact retrieval flow requested for Endee-powered semantic search.

1

User Question

A user asks a document-grounded question from the Streamlit chat interface.

2

Embedding Model

The question is embedded with all-MiniLM-L6-v2 using Sentence Transformers.

3

Endee Search

Endee stores chunk vectors and runs semantic similarity search for top-k matches.

4

Retriever Context

Relevant chunks and metadata are assembled into a context package.

5

Mistral LLM

The prompt is sent to Mistral-7B-Instruct to generate a grounded answer.

6

Answer + Sources

The app returns the final answer along with cited source chunks and scores.

Included improvements

The backend package upgrades structure, usability, observability, and deployability.

Multi-document upload

Supports PDF, TXT, and DOCX uploads with chunking and metadata tracking.

Similarity visibility

Retrieved chunks and similarity scores can be shown for transparency.

Source citations

Answers include source filenames and chunk identifiers for auditing.

AI generation enabled

The browser app now integrates GenMB AI text generation with proper chat history, loading, and error states.

Integrated capability

AI text generation

Live SDK usage

This panel uses the platform AI proxy at /api/ai/completion with conversation history, loading states, disabled controls, empty states, and user-visible feedback.

Try a starter prompt

Behavior notes

  • Maintains the latest 10 conversation turns in the prompt.
  • Extracts and renders json.data.text only.
  • Shows explicit errors, loading state, and success confirmation.

AI chat playground

Use it to draft answers, summaries, or deployment guidance.

No messages yet. Start with a prompt to test the integrated AI text generation service.

Uses the deployed app's built-in AI proxy. Limit: 100 requests/hour per app.

Streamlit sidebar preview

Upload-aware

Upload documents

PDF, TXT, DOCX

Indexed files

  • security-policy.pdf
  • operations-runbook.docx
  • support-guidelines.txt

Chat and retrieval preview

Sources visible
What does the uploaded policy say about incident response timelines?
The policy states that critical incidents must be acknowledged within 15 minutes and a stakeholder update must be issued within 60 minutes. The response workflow also requires a root cause summary after containment.
The live AI playground above uses GenMB's text generation proxy to simulate conversational answer drafting and prompt refinement.

Retrieved sources

top-k chunks

security-policy.pdf

score 0.92

Critical severity incidents require immediate triage, acknowledgement within 15 minutes, and executive communication within 60 minutes.

operations-runbook.docx

score 0.87

After containment, the incident commander prepares a concise root cause summary and remediation plan for stakeholders.

Generated project files

All of these backend files are included in the response payload for direct use.

app.py

Streamlit App

Production-ready UI with upload, chat, sources, and clear session controls.

utils/document_loader.py

Ingestion

Loads PDF, TXT, and DOCX files and converts them into LangChain Documents.

utils/embeddings.py

Embeddings

Wraps SentenceTransformer all-MiniLM-L6-v2 for document and query embeddings.

utils/vector_store.py

Vector DB

Encapsulates Endee upsert, search, listing, and collection management.

utils/rag_pipeline.py

RAG

Builds prompt context, retrieves chunks, and generates answers with sources.

README.md

Documentation

Professional setup, architecture, deployment, and environment guidance.

⚡Built with GenMB
Built with GenMB