ragdemo

command
v0.54.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

README

Local LM Studio RAG evaluation

Part of tinySQL. This demo makes retrieval quality visible before asking an LLM for an answer. It chunks repository Markdown files, gets embeddings from a local OpenAI-compatible LM Studio server, stores them in tinySQL, and reports retrieved chunks, ranks, Hit@k, and MRR.

Start LM Studio on port 1234 with an embedding model, then run:

go run ./cmd/ragdemo -verbose

# Compare vector-only and hybrid retrieval
go run ./cmd/ragdemo -hybrid=false
go run ./cmd/ragdemo -hybrid=true

# Inspect one question and optionally generate a grounded answer
go run ./cmd/ragdemo \
  -query "How do I expand a vector hit with its neighboring chunks?" \
  -generate

Hybrid mode passes text and vector queries to one RAG_SEARCH call. tinySQL fuses vector and BM25 ranks with reciprocal-rank fusion, so an exact identifier can still surface when an embedding does not represent it well.

Tune and interpret results

Use -chunk-size, -overlap, -candidate-k, and -top-k to change retrieval. Run go run ./cmd/ragdemo -help for model and endpoint options.

The built-in quality gate requires each expected source and marker-bearing chunk to appear in the top-k results. Chunk labels use the complete heading path, and hash lines in fenced code blocks do not start a new section.

The demo prints loading, embedding, and retrieval timings to help inspect one local run. They include first-query index preparation and are not a controlled performance comparison. No embedding or answer cache is used.

For production schema design, ingestion, evaluation, tuning, and context expansion, see the RAG guide.

Documentation

Overview

Command ragdemo exercises a complete local RAG pipeline with LM Studio and TinySQL. It deliberately prints retrieval evidence before optionally asking an LLM to answer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL