OphirCloud Academy

Ground it, or refuse

AI and retrieval

A retrieval system earns trust by answering from supplied documents and saying 'no matching context' when there is none. Everything else — chunking, embeddings, prompts — serves those two behaviours.

commitbuildtestdeploy→→→A red stage stops the next one — without anyone remembering to check.
The pipeline lives in the repository, so it is reviewed and versioned with the code it ships.

Retrieval before generation

Index the corpus, then retrieve the passages that match the question, then answer only from those passages. The model's general knowledge is exactly what you do not want when the question is about your refund policy.

Chunking decides what can be retrieved. Too large and the answer is buried; too small and the passage lacks the context that makes it true.

Citations and refusal

Ask for the source file in brackets beside each claim, and make 'no matching context' an acceptable answer. A system that cannot refuse will invent, and an invented policy is worse than no answer.

Evaluate with cases, not impressions: one question the corpus answers, one it does not. If the second returns a confident guess, the prompt is wrong, not the model.

Commands in this lesson

Every one of these runs in the sandbox — no real account, no real bill.

CommandWhy
rag index docsBuild the retrievable corpus before any question is asked.
rag query "refund window" > answer.txtOne question, one answer file — evidence you can inspect.
rag query "warranty" > no-answer.txtThe out-of-scope case. This is the test most projects skip.
echo 'You are a support assistant. Use only the supplied context. Cite the source file in brackets.' > prompt.mdGrounding and citation stated as rules, not hopes.

Now do it

Reading the model makes the first attempt faster. Only the lab makes you able to do it.

  • AI: Index a Knowledge Base for RAG

    Beginner · 20 min · members

    Open the lab
  • AI: Evaluate a Retrieval Answer

    Intermediate · 25 min · members

    Open the lab
  • AI: Define an MCP Tool Contract

    Intermediate · 25 min · members

    Open the lab

AI and retrieval · OphirCloud Academy · all lessons