Skip to content

Commit

Permalink
chore: add llm friendly resources.
Browse files Browse the repository at this point in the history
  • Loading branch information
parambharat committed Oct 7, 2024
1 parent eff2f68 commit ca94346
Show file tree
Hide file tree
Showing 81 changed files with 9,644 additions and 0 deletions.
65 changes: 65 additions & 0 deletions rag-advanced/resources/Chapter 0 - extras/Chapter00.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
## Chapter 0: Setup

<a target="_blank" href="https://colab.research.google.com/github/wandb/edu/blob/main/rag-advanced/notebooks/Chapter00.ipynb">
<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/>
</a>

<!--- @wandbcode{rag-course-00} -->

Let's install the required packages and check our setup for this course.

### 🎉 Free Cohere API key

Before you run this colab notebook, head over to this [link to redeem a free Cohere API key](https://docs.google.com/forms/d/e/1FAIpQLSc9x4nV8_nSQvJnaINO1j9NIa2IUbAJqrKeSllNNCCbMFmCxw/viewform?usp=sf_link).

Alternatively if you have a Cohere API key feel free to proceed. :)


```
!pip install -qq weave cohere
```

## 1. Setup Weave


The code cell below will prompt you to put in a W&B API key. You can get your API key by heading over to https://wandb.ai/authorize.


```
# import weave
import weave
# initialize weave client
weave_client = weave.init("rag-course")
```

## 2. Setup Cohere

The code cell below will prompt you to put in a Cohere API key.


```
import getpass
import cohere
cohere_client = cohere.ClientV2(
api_key=getpass.getpass("Please enter your COHERE_API_KEY")
)
```

## A simple-turn chat with Cohere's command-r-plus


```
response = cohere_client.chat(
messages=[
{"role": "user", "content": "What is retrieval augmented generation (RAG)?"}
],
model="command-r-plus",
temperature=0.1,
max_tokens=2000,
)
```

Let's head over to the weave URL to check out the generated response.
100 changes: 100 additions & 0 deletions rag-advanced/resources/Chapter 0 - extras/RAG-0.1-course intro.srt
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
1
00:00:00,000 --> 00:00:03,000
Hi, we are happy to welcome you to take our RAG++ course.

2
00:00:03,000 --> 00:00:08,000
If you have built a RAG-powered system or have developed a proof of concept

3
00:00:08,000 --> 00:00:10,000
but lack the confidence to deploy it into production,

4
00:00:10,000 --> 00:00:12,000
this course will help bridge that gap.

5
00:00:13,000 --> 00:00:16,000
Over the last 21 months, we have been running wandbot,

6
00:00:16,000 --> 00:00:19,000
a live customer support bot for weights and biases,

7
00:00:19,000 --> 00:00:23,000
and we're excited to share what we have learned from the experience.

8
00:00:23,000 --> 00:00:27,000
We will highlight what separates a good RAG system from a great one

9
00:00:27,000 --> 00:00:29,000
by focusing on evaluation-driven development,

10
00:00:29,000 --> 00:00:32,000
emphasizing the importance of an effective evaluation pipeline.

11
00:00:33,000 --> 00:00:36,000
We will explore different metrics for evaluation,

12
00:00:36,000 --> 00:00:39,000
like MRR, NDCG, and LLM evaluators.

13
00:00:39,000 --> 00:00:44,000
We will also see how we can align an LLM evaluator with human feedback.

14
00:00:44,000 --> 00:00:50,000
Next, we will dive into advanced RAG components for sophisticated data ingestion strategies,

15
00:00:50,000 --> 00:00:55,000
effective metadata utilization, and query enhancement techniques like query decomposition.

16
00:00:55,000 --> 00:00:59,000
We will improve retrieval quality using methods like metadata filtering,

17
00:00:59,000 --> 00:01:00,000
routing, and re-ranking.

18
00:01:01,000 --> 00:01:03,000
We also have two guest lecturers.

19
00:01:03,000 --> 00:01:07,000
Charles from Weaviate will cover production-grade hybrid retrieval systems,

20
00:01:07,000 --> 00:01:13,000
and Meor from Cohere will show how to incorporate tool-use capabilities into your RAG system.

21
00:01:13,000 --> 00:01:18,000
The course is packed with practical insights to enhance response synthesis

22
00:01:18,000 --> 00:01:21,000
and methods to optimize your RAG pipeline's latency.

23
00:01:22,000 --> 00:01:26,000
By the end of this course, you will have the tools and confidence to take your RAG systems

24
00:01:26,000 --> 00:01:29,000
from POC to production-led deployments.

25
00:01:29,000 --> 00:01:34,000
We hope you enjoyed the course as much as we enjoyed creating it.

84 changes: 84 additions & 0 deletions rag-advanced/resources/Chapter 0 - extras/RAG-0.2-setup.srt
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
1
00:00:00,000 --> 00:00:04,000
Before you get started, let us set you up to get the most out of this course.

2
00:00:04,000 --> 00:00:07,000
Throughout the course we will be recommending useful tools.

3
00:00:07,000 --> 00:00:12,000
However we will mainly be using Weave, Cohere and Weaviate.

4
00:00:12,000 --> 00:00:17,000
Weave is a lightweight toolkit for tracking and evaluating your LLM applications.

5
00:00:17,000 --> 00:00:24,000
We will be using Cohere family of models for text generation, re-ranking and embedding.

6
00:00:24,000 --> 00:00:27,000
Cohere is also providing with free credits for this course.

7
00:00:27,000 --> 00:00:32,000
Check out the instructions under this lesson to redeem your free Cohere API key for this

8
00:00:32,000 --> 00:00:33,000
course.

9
00:00:33,000 --> 00:00:37,000
Once you have the API keys, head over to the Colab notebook for this lesson.

10
00:00:37,000 --> 00:00:40,000
We first install the required packages.

11
00:00:40,000 --> 00:00:42,000
We then initialise our Weave client.

12
00:00:42,000 --> 00:00:45,000
This is where you will put in your wandb API key.

13
00:00:45,000 --> 00:00:48,000
We then set up our Cohere client.

14
00:00:48,000 --> 00:00:52,000
We will then use the Cohere model to ask about retrieval augmented generation.

15
00:00:52,000 --> 00:00:56,000
If everything works fine, you will have a Weave URL.

16
00:00:56,000 --> 00:00:59,000
Let's head over to it.

17
00:00:59,000 --> 00:01:03,000
This is a single trace of the Cohere client chat method.

18
00:01:03,000 --> 00:01:08,000
We will automatically capture the inputs to the client as well as the generated response.

19
00:01:08,000 --> 00:01:15,000
We also keep track of the used tokens and the time taken to complete the generation.

20
00:01:15,000 --> 00:01:17,000
Now let's get started with the course.

21
00:01:17,000 --> 00:01:18,000
Enjoy!

52 changes: 52 additions & 0 deletions rag-advanced/resources/Chapter 0 - extras/RAG-0.3-course outro.srt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
1
00:00:00,000 --> 00:00:02,000
That concludes our RAG++ course.

2
00:00:02,000 --> 00:00:04,000
Thank you for joining us and taking the time

3
00:00:04,000 --> 00:00:05,000
to enhance your skills

4
00:00:05,000 --> 00:00:08,000
in building production-ready RAG systems.

5
00:00:08,000 --> 00:00:09,000
We appreciate your commitment

6
00:00:09,000 --> 00:00:12,000
and hope you found the course valuable.

7
00:00:12,000 --> 00:00:14,000
Your feedback is important to us.

8
00:00:14,000 --> 00:00:16,000
Please take a moment to leave a review

9
00:00:16,000 --> 00:00:18,000
and share your thoughts.

10
00:00:18,000 --> 00:00:19,000
Thank you once again,

11
00:00:19,000 --> 00:00:21,000
and we look forward to seeing the innovative solutions

12
00:00:21,000 --> 00:00:23,000
you will be creating.

13
00:00:23,000 --> 00:00:25,000
Best of luck and happy building.

Loading

0 comments on commit ca94346

Please sign in to comment.