✨ Visual Editor

close

palette Canvas & Background

Gradient:arrow_forward
Text Color:
135Β°

style Card Style

40px
16px

text_fields Typography

16px
Akshay πŸš€
@akshay_pachaar
Let's build a pipeline to evaluate and monitor a RAG application, using a 100% open-source tool:
Akshay πŸš€
@akshay_pachaar
Before we start here's a quick demo what we're building:

Tech Stack:

- @Cometml's Opik for eval and observability
- @Llama_Index to build a RAG app

Track everything from, LLM calls to chunking, embedding, generation and evaluation!
Video thumbnail
VIDEO
Akshay πŸš€
@akshay_pachaar
The architecture diagram presented below illustrates some of the key components & how they interact with each other!

It will be followed by detailed descriptions & code for each component:
Thread image
Akshay πŸš€
@akshay_pachaar
1️⃣ Configuration and setup

First we configure everything to:

- Trace all LLM calls
- Trace all RAG steps

Note: You can also easily use Ollama LLMs, i have shared example in the GitHub below.

Fundamentals would still remain same.
Thread image
Akshay πŸš€
@akshay_pachaar
2️⃣ Create a simple RAG app

This is more a didactic example, but you can always make it more sophisticated.

Here's a simple RAG setup:
Thread image
Akshay πŸš€
@akshay_pachaar
3️⃣ LLM app and Evaluation task

Next we need to create an LLM application function and define an evaluation task.

Here's how we do it...πŸ‘‡
Thread image
Akshay πŸš€
@akshay_pachaar
4️⃣ Prep eval dataset

We triples of the following:

- Questions
- Their answers
- The relevant context for each QA pair

Here's our sample dataset...πŸ‘‡
Thread image
Akshay πŸš€
@akshay_pachaar
5️⃣ Load the dataset into Opik

Next we load this dataset in Opik so that everything is tracked an can be used for evaluation.

Check this outπŸ‘‡
Thread image
Akshay πŸš€
@akshay_pachaar
6️⃣ Load the dataset into Opik

Next we load this dataset in Opik so that everything is tracked an can be used for evaluation.

Check this outπŸ‘‡
Thread image
Akshay πŸš€
@akshay_pachaar
7️⃣ Define Evaluation metrics

Opik provide out of the box for all the popular LLM/RAG evaluation metrics.

Check this outπŸ‘‡
Thread image
Akshay πŸš€
@akshay_pachaar
8️⃣ Evaluate

Finally, it's time to put everything together and run evaluation.

Check this outπŸ‘‡
Thread image
Akshay πŸš€
@akshay_pachaar
You can find all the code and everything you need here!

Don't forget to star the repo: github.com/patchy631/ai-e…
Akshay πŸš€
@akshay_pachaar
If you're interested in:

- Python 🐍
- ML/AI Engineering βš™οΈ

Find me β†’Β @akshay_pachaarΒ βœ”οΈ
Everyday, I share tutorials on above topics!
Generated by Thread Navigator
100%
view_carousel Carousel Studio NEW
Press ⌘ + S to quick-export