Session 11 / 15๐Ÿ”Žืขื‘

The bottom line (TL;DR)

  • RAG = retrieving relevant passages โ†’ the AI answers from them with sources.
  • Knowledge files for a few fixed documents; a full RAG for scope and updates.
  • Embeddings = meaning as numbers; the same model for storing and querying.
  • Ingestion: Drive โ†’ chunks โ†’ embeddings โ†’ upsert with an ID and metadata.
  • We built a knowledge bot that cites sources, and connected it to Noa.

The key points โ€” in depth

1. RAG

Retrieval + generation; fewer hallucinations; sources.

2. Knowledge vs. RAG

Simplicity vs. scope and control.

3. Embeddings

Vectors, cosine, top K, dimensions.

4. Ingestion

Chunks with overlap, a fixed ID, metadata, Credits.

5. Query

A similarity threshold, context with sources, "I didn't find it".

6. RAG as a tool

Scenario inputs/outputs; permissions; updates.

Concept cards (click or press Enter to flip)

RAG
Retrieving relevant knowledge before an AI answer.
Embedding
A vector that represents a text's meaning.
Vector store
A store that searches by vector similarity.
Chunk
A passage of a document stored separately.
Overlap
Overlap between chunks.
Top K
The number of similar passages retrieved.
Metadata
Information attached to a passage: source, department.
Cosine similarity
A similarity measure between vectors.

Spaced repetition โ€” the session concepts

Mark "I knew it" or "Not yet" โ€” the cards you did not know come back more often. Cards from all the sessions are in the arcade.

Quick cheat sheet

WhatDetails
Google Drive โ†’ Watch files / Search filesThe document source
substring(text; (i-1)*700; (i-1)*700+800)A chunk with overlap
OpenAI โ†’ Create embeddingsA vector
Pinecone โ†’ Upsert vectorsStoring
Pinecone โ†’ Query (topK, filter)Retrieval
ID = {{fileId}}-{{i}}Updating without duplicates
score โ‰ฅ 0.75A threshold
"Answer only from the passagesโ€ฆ otherwise: I didn't find it"The prompt

Common mistakes to avoid

  • A different embeddings model for storing and querying.
  • Random IDs โ€” duplicates on every run.
  • No metadata โ€” no sources.
  • Ingesting the whole folder on every run โ€” Credits.
  • Permissions only in the instructions to the LLM.

Self-review questions

  1. What's the difference between knowledge files and RAG?
  2. Why overlap?
  3. What happens when no passage is above the threshold?
  4. How do you update a document that changed?
  5. How do you enforce permissions?

Homework and preparing for the next session

  1. A working knowledge bot with 15 test questions.
  2. Preparing for session 12: make sure the Telegram bot works, and download WhatsApp Business (optional).