Skip to main content

RAG Observability Platform - Trace, debug and understand your RAG pipelines

Project description

SourceMapR

See what your RAG system actually saw.

SourceMapR provides evidence observability for RAG pipelines. Trace every LLM answer back to the exact document evidence that produced it, with complete evidence lineage.


Why SourceMapR?

Problem SourceMapR Solution
"Which chunks did the retriever return?" See every retrieved chunk with similarity scores
"What prompt was sent to the LLM?" Full prompt/response capture with token counts
"Why did the model hallucinate?" Click any chunk to view it in the original PDF
"Is my chunking strategy working?" Compare experiments side by side

Add RAG observability in two lines of code.


Document Support

Format Status Notes
PDF ✅ Supported Full support with chunk highlighting and source viewing
HTML 🧪 Experimental Basic rendering, chunk highlighting may not work
Other formats 🧪 Experimental Under development

Current Focus: SourceMapR is optimized for PDF documents. Support for HTML and other file types is experimental and under active development.


Quick Start

# Clone and install
git clone https://github.com/kamathhrishi/sourcemapr.git
cd sourcemapr && pip install -e .

# Start dashboard
sourcemapr server

LlamaIndex

from sourcemapr import init_tracing, stop_tracing
init_tracing(endpoint="http://localhost:5000")

# Your existing LlamaIndex code — unchanged
from llama_index.core import SimpleDirectoryReader, VectorStoreIndex

documents = SimpleDirectoryReader("./papers").load_data()
index = VectorStoreIndex.from_documents(documents)

response = index.as_query_engine().query("What is attention?")
print(response)

stop_tracing()

LangChain

from sourcemapr import init_tracing, stop_tracing
init_tracing(endpoint="http://localhost:5000")

# Your existing LangChain code — unchanged
from langchain_community.document_loaders import PyPDFLoader
from langchain_text_splitters import RecursiveCharacterTextSplitter
from langchain_community.vectorstores import FAISS

loader = PyPDFLoader("./papers/attention.pdf")
documents = loader.load()

splitter = RecursiveCharacterTextSplitter(chunk_size=512)
chunks = splitter.split_documents(documents)

vectorstore = FAISS.from_documents(chunks, embeddings)
results = vectorstore.similarity_search("What is attention?")

stop_tracing()

Open http://localhost:5000 to see the full evidence lineage.


Supported Frameworks

Framework Documents Chunks Retrieval LLM Calls
LlamaIndex
LangChain
OpenAI

Pipeline Support

⚠️ Experimental: Pipeline tracing (e.g., langchain_pipeline_demo.py) is currently experimental and does not have stable support. Basic functionality works but may have limitations.

See Supported Features for details.


Features

  • Trace LLM Answers to Sources — Trace responses to exact chunks with similarity scores and rankings
  • PDF Chunk Viewer — Click any chunk to see it highlighted in the original PDF
  • Full LLM Tracing — Prompts, responses, tokens, latency for every query
  • Experiment Tracking — Organize runs and compare chunking strategies
  • Evidence Lineage — Complete trace from document load → parse → chunk → embed → retrieve → answer
  • Debug RAG Hallucinations — Verify grounding without guessing

CLI Commands

# Server management
sourcemapr server            # Start server (foreground)
sourcemapr server -b         # Start server in background
sourcemapr server -p 8080    # Start on custom port
sourcemapr stop              # Stop running server
sourcemapr restart           # Restart server
sourcemapr status            # Check if server is running

# Data management
sourcemapr clear             # Clear all trace data (with confirmation)
sourcemapr clear -y          # Clear without confirmation
sourcemapr init              # Initialize database
sourcemapr init --reset      # Delete and recreate database

# Info
sourcemapr version           # Show version

Examples

# LlamaIndex with PDFs
python examples/llamaindex_pdf_demo.py

# LangChain with PDFs
python examples/langchain_pdf_demo.py

See Examples for more.


Installation

From Source (Current)

git clone https://github.com/kamathhrishi/sourcemapr.git
cd sourcemapr && pip install -e .

From PyPI (Coming Soon)

pip install sourcemapr

Documentation


License

MIT


Built for developers who are tired of print-debugging RAG pipelines.

Website · GitHub

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sourcemapr-0.1.0.tar.gz (700.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sourcemapr-0.1.0-py3-none-any.whl (709.4 kB view details)

Uploaded Python 3

File details

Details for the file sourcemapr-0.1.0.tar.gz.

File metadata

  • Download URL: sourcemapr-0.1.0.tar.gz
  • Upload date:
  • Size: 700.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for sourcemapr-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b6d6a37c1cc931b4c8973ce7ce11b0fc706c39ba06ddec6946af997937c187c5
MD5 0f4d8cf576dab1e707ee7f06ea4a5770
BLAKE2b-256 17fd7afedb1e7f30b7f3ba605aa971590205ba3d40e05830b135abb53120cd33

See more details on using hashes here.

File details

Details for the file sourcemapr-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sourcemapr-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 709.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for sourcemapr-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f76a7349fb0c3cf94546b9bf7afeec7271fa5358ef16e1b108b38e223198cbe
MD5 ad1f4c3e5440a677c4ce55945db96986
BLAKE2b-256 62478f112117f0758d65a3543cafa4fc74c6fe04482332acff4046044710522f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page