Text Embeddings/Text Vectors
to be or not to be
● Manageable by computers
● Different techniques:
○ Sparse: TF-IDF, BM25...
○ Dense: Trained models (Sentence Transformers, Cohere, OpenAI...)
● Come in different dimensions
Slide 10
Slide 10 text
Text Embeddings - 2 dimensional
Slide 11
Slide 11 text
Text Embeddings - Semantic Similarity
Slide 12
Slide 12 text
02
Vector Databases
Slide 13
Slide 13 text
● Databases that store high-dimensional
vectors
● Optimized for vectors:
○ Vector search
○ CRUD operations
○ Metadata filtering
Vector Databases
Retrieval
Query
● Getting the most relevant
information to the query
● Used for semantic search, question
answering and more
Slide 17
Slide 17 text
04
LLMs
Slide 18
Slide 18 text
Large Language Models (LLMs)
Slide 19
Slide 19 text
Large Language Models (LLMs)
● Big language models
● More data & more parameter
● Prompt → Human-like output
● Text generation: summarization, generative QA, writing code, chat…
Slide 20
Slide 20 text
Model Providers - Which one?
Slide 21
Slide 21 text
LLMs being LLMs
● Not conscious
● Use carefully
https://x.com/hrrcnes/status/1793335665117044990
Slide 22
Slide 22 text
LLMs know everything?
Slide 23
Slide 23 text
LLM: Limitations
● LLMs do not know the answer to everything
● But they are good at following instructions
● We can help them in their task by giving them the
relevant context + instruction
Slide 24
Slide 24 text
05
Retrieval Augmented Generation
Slide 25
Slide 25 text
Retrieval Augmented Generation
Slide 26
Slide 26 text
Retrieval Augmented Generation
Slide 27
Slide 27 text
● Haystack is an open source Python framework for building
production-ready LLM applications
● Prototyping, evaluation, deployment, monitoring…
● Building blocks: Components & Pipelines
Haystack
Slide 28
Slide 28 text
Haystack
Slide 29
Slide 29 text
Indexing Pipeline
Slide 30
Slide 30 text
Indexing Pipeline
Slide 31
Slide 31 text
Indexing Pipeline
Slide 32
Slide 32 text
Indexing Pipeline
Slide 33
Slide 33 text
RAG Pipeline
Slide 34
Slide 34 text
RAG Pipeline
Slide 35
Slide 35 text
RAG Pipeline
Slide 36
Slide 36 text
RAG Pipeline
Slide 37
Slide 37 text
RAG Pipeline
Slide 38
Slide 38 text
RAG Pipeline
Slide 39
Slide 39 text
No content
Slide 40
Slide 40 text
06
Agents
Slide 41
Slide 41 text
Agents
● Complex systems (multiple LLMs)
● Prompting: Chain of Thought/ReAct
● Generate accurate responses to complex queries
● Might use tools for answers
● Use cases: chat bot, personal assistants
Slide 42
Slide 42 text
Agents - CoT
Chain-of-Thought Prompting Elicits Reasoning in Large Language Models - https://arxiv.org/pdf/2201.11903
Slide 43
Slide 43 text
Agents - CoT
Chain-of-Thought Prompting Elicits Reasoning in Large Language Models - https://arxiv.org/pdf/2201.11903
Slide 44
Slide 44 text
REACT: SYNERGIZING REASONING AND ACTING IN LANGUAGE MODELS - https://arxiv.org/pdf/2210.03629
Agents - CoT
Slide 45
Slide 45 text
Agents - Reason + Act (ReAct)
REACT: SYNERGIZING REASONING AND ACTING IN LANGUAGE MODELS - https://arxiv.org/pdf/2210.03629
Slide 46
Slide 46 text
Agents - ReAct Prompt
Slide 47
Slide 47 text
06.5
Function Calling
Slide 48
Slide 48 text
Function Calling
● Passing prompt + functions/tools (name, description, parameters)
● User query -> function name + JSON object for arguments
● Use arguments to call the function
● Voila! 🎉
Slide 49
Slide 49 text
Function Calling - Tools
https://arxiv.org/pdf/2205.00445
Slide 50
Slide 50 text
Function Calling - Tool definition
Slide 51
Slide 51 text
Function Calling
Slide 52
Slide 52 text
Agents
Search Google and
answer: why did Elon
Musk sue OpenAI?
Slide 53
Slide 53 text
Agents
Search Google and
answer: why did Elon
Musk sue OpenAI?
Slide 54
Slide 54 text
Agents
Search Google and
answer: why did Elon
Musk sue OpenAI?
Slide 55
Slide 55 text
Agents
Search Google and
answer: why did Elon
Musk sue OpenAI?
Elon Musk sued OpenAI
for breaching its
founding agreement and
diverging from its original
nonprofit mission….
Slide 56
Slide 56 text
Agents
Using TinyURL create
a shortened URL
from this long URL
https://haystack.deep
set.ai/blog/haystack-
2-release
https://tinyurl.com/hjr6yttr