Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 6.8 — Build: Hybrid Retrieval for AskDocs
RAG and Vector Search · Example 1 of 2

AskDocs v6: hybrid, re-rank, copies, evidence bar

TOY pair scorer and toy vectors. The structure is the product: stage one, stage two, filter, evidence bar, refusal in code.

AskDocs version 6: keyword and vector search fused with RRF, a re-rank stage behind the same retrieve interface, a near-copy filter and an evidence bar on the re-ranker's score. A small harness compares it with versions 1 and 3.

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 5 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Write refuses(scores, bar) that returns True when no score in the list reaches the bar. Print it for [0.4, 0.3] and [0.4, 0.9] with bar 0.5, using the words refuse and answer.

02

Write version_table(rows) that takes a list of (name, hit1, total) and prints one line per version in the form name hit@1 x/y. Print it for [("v1", 4, 8), ("v6", 8, 8)].

Explain it without notes

01

Describe the flow of a question through AskDocs v6.

02

Why is the evidence bar applied to the re-ranker's score and not to the fused RRF score?

03

What did the lost-items question show about the evidence bar?

04

Why keep the retrieve interface unchanged?

AskDocs v6: hybrid, re-rank, copies, evidence bar
Sign in to run this example in your browser.

Expected output

Q: I forgot my login, how do I get back in?
   hybrid top 3: D3 D1 D10
   sources: D3 (0.90)
   answer:  To reset your password, open the app, tap Forgot password and follow the link we email you. [D3]
Q: What happens if someone steals the bike?
   hybrid top 3: D10 D7 D5
   sources: D12 (0.90), D10 (0.50), D7 (0.50)
   answer:  Always lock the bike to a rack with the built-in chain. [D12]
Q: What is the age limit for helmets?
   hybrid top 3: D5 D1 D3
   sources: D4 (0.87)
   answer:  A helmet is included free with every rental. [D4]
Q: Do you rent scooters?
   hybrid top 3: D3 D5 D11
   sources: none
   answer:  I can't find that in the handbook.
Q: Where do lost items go?
   hybrid top 3: D9 D1 D2
   sources: none
   answer:  I can't find that in the handbook.