Skip to content
Courses/AI for small businesses and freelancers/Minimal local RAG with SQLite and Ollama

Minimal local RAG with SQLite and Ollama

A first knowledge base does not need a huge platform: it needs small documents, traceable sources, and an answer that abstains when it finds no evidence.

What you will achieve now

A decision or applied practice for «Minimal local RAG with SQLite and Ollama».

  • 1 Understand the criterion
  • 2 Do a small practice exercise
  • 3 Save evidence

A short note on what you did, what went well, what failed, and what you would review later.

  • Separate documents, index, retrieval, and generation.
  • Set up a local experiment with SQLite and Ollama.
  • Evaluate citations, out-of-scope answers, and hardware cost.

Minimal architecture

Store fictional or anonymized documents in a folder, keep their name, version, and date, and create a SQLite table with text and metadata. For a first test you can retrieve by words or FTS5; add embeddings only when an evaluation shows that literal search is not enough. Ollama runs the model locally, but the result still needs citations and review.

Flow of a question

  • Normalize the question and apply the user's permission.
  • Retrieve a few relevant fragments.
  • Include `source`, title, version, and date in the context.
  • Ask for a brief answer or «not found» if evidence is missing.
  • Return citations and log the query, model, and latency.

Contract example

The model must not invent policies. If the fragments do not contain the answer, it must say so and propose which document is missing. The application must never turn recovered text into instructions with permissions.

Technical sources

  • Official Ollama API .
  • SQLite FTS5 .
  • SQLite security .
Terminal
documentos/ -> SQLite (texto + fuente + versión)
pregunta -> recuperación limitada -> contexto con citas
                         -> Ollama (localhost)
                         -> respuesta / abstención / log

If you have saved the evidence from this lesson, continue with «First secure MCP for the office». If not, repeat the check before moving on.

Learn with a verifiable reference

Aulafy distinguishes stable concepts from data that changes —versions, prices, models, and commands—. Check the course sheet for the review date, the verified scope, and the primary sources.

«Editorial review» means that structure, claims, and sources have been reviewed. It does not mean that every command has been executed: when a technical test exists, it will be indicated as such.

Complete Aulafy mapSee how this lesson fits without leaving your path.

Complete Aulafy map

How all courses connect

This is not a checklist. Start with the foundation, choose an outcome, and go deeper only when your project needs more control.

  1. 1Understand
  2. 2Apply or build
  3. 3Operate with confidence
01

Choose an application

Turn the foundation into a visible outcome: a website, a business improvement, media, or an interactive experience.

Continue into the technical branch when you need to maintain code, data, or infrastructure.

02

Build with code

Prepare your environment, work with coding agents, and run models while keeping control of your projects.

This branch prepares you to design and operate reliable AI systems.

03

Take systems to production

Combine retrieval, agents, evaluation, security, deployment, and model adaptation when the problem requires it.

You do not need every course: choose the component your system needs and return as it grows.

View full catalogue