Skip to content
Courses/Advanced and secure RAG/Structured responses with citations

Structured responses with citations

To use RAG in an SMB or serious project, "pretty text" is not enough. You need a contract: answer, evidence, confidence, missing fields, and a clear output when the context is insufficient.

  • Design a validatable response contract.
  • Enforce citations linked to retrieved chunks.
  • Prevent hallucinations with "I don't have sufficient evidence".
Terminal
{
  "answer": "You can return the product within 14 calendar days.",
  "confidence": "high",
  "citations": [
    {
      "document_id": "politica-devoluciones",
      "section": "Returns",
      "page": 3,
      "quote": "14 calendar day period"
    }
  ],
  "missing_fields": [],
  "cannot_answer": false
}

Generation rules

  • Answer only with retrieved context.
  • Every important claim must have a citation.
  • If data is missing, populate `missing_fields`.
  • If there is no evidence, set `cannot_answer`.
  • Validate JSON before displaying it.
Terminal
regla_no_se:
  si:
    retrieved_chunks < 2
    or there is no direct citation
    or sources contradict each other
  entonces:
    cannot_answer: true
    answer: "I don't have sufficient evidence in the retrieved documents."
    missing_fields: ["verifiable source"]

Official sources

  • Qdrant documentation
  • Qdrant hybrid queries
  • Open WebUI documentation
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