Slide 1

Slide 1 text

Improve LLM-based Applications with Fallback Mechanisms Bilge Yücel Berlin Buzzwords 2024

Slide 2

Slide 2 text

About me •🥑 Developer Relations Engineer at deepset •🏗 Open source LLM Framework: Haystack •📍 Istanbul, Turkey Bilge Yücel @bilgeycl Bilge Yücel bilgeyucel

Slide 3

Slide 3 text

Agenda Introduction to Haystack LLMs/RAG Fallback Mechanisms Q&A

Slide 4

Slide 4 text

Large Language Models (LLMs)

Slide 5

Slide 5 text

Retrieval Augmented Generation

Slide 6

Slide 6 text

Retrieval Augmented Generation

Slide 7

Slide 7 text

Retrieval Augmented Generation

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

● Haystack is an open source Python framework for building production-ready LLM applications

Slide 10

Slide 10 text

● Haystack is an open source Python framework for building production-ready LLM applications ● Prototyping, evaluation, deployment, monitoring…

Slide 11

Slide 11 text

● Haystack is an open source Python framework for building production-ready LLM applications ● Prototyping, evaluation, deployment, monitoring… ● Building blocks: Components & Pipelines

Slide 12

Slide 12 text

Haystack

Slide 13

Slide 13 text

Haystack

Slide 14

Slide 14 text

RAG PIPELINE

Slide 15

Slide 15 text

RAG PIPELINE

Slide 16

Slide 16 text

RAG PIPELINE

Slide 17

Slide 17 text

RAG PIPELINE

Slide 18

Slide 18 text

RAG PIPELINE

Slide 19

Slide 19 text

RAG PIPELINE

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Fallback Mechanisms

Slide 22

Slide 22 text

Use Cases Extracting Structured Data Early Routing with Fallback RAG with Web Fallback

Slide 23

Slide 23 text

RAG PIPELINE When is Taylor Swift’s next concert?

Slide 24

Slide 24 text

RAG PIPELINE When is Taylor Swift’s next concert? The documents do not provide any information about Taylor Swift's upcoming concert.

Slide 25

Slide 25 text

Mechanism: Routing

Slide 26

Slide 26 text

Routing - Prompt Template

Slide 27

Slide 27 text

Routing - Conditional Router

Slide 28

Slide 28 text

Fallback to Web

Slide 29

Slide 29 text

Fallback to Web When is Taylor Swift’s next concert?

Slide 30

Slide 30 text

Fallback to Web When is Taylor Swift’s next concert? Taylor Swift's next concert is on June 13, 2024, in Liverpool.

Slide 31

Slide 31 text

Fallback to Other Sources

Slide 32

Slide 32 text

Early Routing

Slide 33

Slide 33 text

Early Routing

Slide 34

Slide 34 text

Early Routing

Slide 35

Slide 35 text

Early Routing (Tools)

Slide 36

Slide 36 text

Early Routing (Tools)

Slide 37

Slide 37 text

Early Routing (Tools)

Slide 38

Slide 38 text

Early Routing (Tools)

Slide 39

Slide 39 text

Early Routing (Tools)

Slide 40

Slide 40 text

Early Routing (Tools)

Slide 41

Slide 41 text

Early Routing - Conditional Router

Slide 42

Slide 42 text

Early Routing (Tools)

Slide 43

Slide 43 text

Early Routing (Tools) "How should I use the OpenAIChatGenerator?"

Slide 44

Slide 44 text

Early Routing (Tools) '{"response": "search_haystack"}' "How should I use the OpenAIChatGenerator?"

Slide 45

Slide 45 text

Early Routing (Tools) "When is Berlin Buzzwords 2024?"

Slide 46

Slide 46 text

Early Routing (Tools) '{"response": "search_web"}' "When is Berlin Buzzwords 2024?"

Slide 47

Slide 47 text

Early Routing (Tools) "What's the first name of Einstein?"

Slide 48

Slide 48 text

Early Routing (Tools) '{"response": "none"}' "What's the first name of Einstein?"

Slide 49

Slide 49 text

Early Routing (Tools)

Slide 50

Slide 50 text

Extracting Structured Data

Slide 51

Slide 51 text

Extracting Structured Data Berlin is the capital of Germany. It has a population of 3,850,809. Paris, France's capital, has 2.161 million residents. Lisbon is the capital and the largest city of Portugal with the population of 504,718.

Slide 52

Slide 52 text

Extracting Structured Data Berlin is the capital of Germany. It has a population of 3,850,809. Paris, France's capital, has 2.161 million residents. Lisbon is the capital and the largest city of Portugal with the population of 504,718.

Slide 53

Slide 53 text

Extracting Structured Data Berlin is the capital of Germany. It has a population of 3,850,809. Paris, France's capital, has 2.161 million residents. Lisbon is the capital and the largest city of Portugal with the population of 504,718.

Slide 54

Slide 54 text

Extracting Structured Data Berlin is the capital of Germany. It has a population of 3,850,809. Paris, France's capital, has 2.161 million residents. Lisbon is the capital and the largest city of Portugal with the population of 504,718.

Slide 55

Slide 55 text

Mechanism: Looping

Slide 56

Slide 56 text

OutputValidator

Slide 57

Slide 57 text

OutputValidator

Slide 58

Slide 58 text

Prompt Template

Slide 59

Slide 59 text

Pipeline code

Slide 60

Slide 60 text

Pipeline code

Slide 61

Slide 61 text

Pipeline code

Slide 62

Slide 62 text

Pipeline code

Slide 63

Slide 63 text

Pipeline code

Slide 64

Slide 64 text

Looping Berlin is the capital of Germany. It has a population of 3,850,809. Paris, France's capital, has 2.161 million residents. Lisbon is the capital and the largest city of Portugal with the population of 504,718.

Slide 65

Slide 65 text

Looping Berlin is the capital of Germany. It has a population of 3,850,809. Paris, France's capital, has 2.161 million residents. Lisbon is the capital and the largest city of Portugal with the population of 504,718.

Slide 66

Slide 66 text

Recap ● Fallbacks are handy to make a search in alternative sources ● Fallback branches can be action triggers ● Early routing is also possible if you have defined options ● Loops are great for validation and auto-correction

Slide 67

Slide 67 text

Sources 🌐 Fallback to Web 🔄 Generating Structured Output 🌳 Early Routing

Slide 68

Slide 68 text

Thank you @bilgeycl Bilge Yücel bilgeyucel haystack.deepset.ai Haystack is open source! ⭐ 📖 Documentation 📚 Tutorials 󰳏 Cookbooks 📘 Articles 👾 Join the Community