Skip to content

Commit a877b0c

Browse files
mikeldkingjjmachan
andauthored
fix(spelling): relavancy -> relevancy (#93)
Sorry if this PR is completely not needed but my spell checker corrected this as I was trying it out and I believe you meant "relevancy" for the metrics? Please close if not needed. --------- Co-authored-by: jjmachan <[email protected]>
1 parent 1cda1c7 commit a877b0c

File tree

9 files changed

+5667
-5658
lines changed

9 files changed

+5667
-5658
lines changed

README.md

+21-13
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,25 @@
4141

4242
ragas is a framework that helps you evaluate your Retrieval Augmented Generation (RAG) pipelines. RAG denotes a class of LLM applications that use external data to augment the LLM’s context. There are existing tools and frameworks that help you build these pipelines but evaluating it and quantifying your pipeline performance can be hard... This is where ragas (RAG Assessment) comes in
4343

44-
ragas provides you with the tools based on the latest research for evaluating LLM-generated text to give you insights about your RAG pipeline. ragas can be integrated with your CI/CD to provide continuous checks to ensure performance.
44+
ragas provides you with the tools based on the latest research for evaluating LLM-generated text to give you insights about your RAG pipeline. ragas can be integrated with your CI/CD to provide continuous checks to ensure performance.
4545

4646
## :shield: Installation
4747

4848
```bash
4949
pip install ragas
5050
```
51-
if you want to install from source
51+
52+
if you want to install from source
53+
5254
```bash
5355
git clone https://github.com/explodinggradients/ragas && cd ragas
5456
pip install -e .
5557
```
5658

57-
## :fire: Quickstart
59+
## :fire: Quickstart
5860

5961
This is a small example program you can run to see ragas in action!
62+
6063
```python
6164

6265
from ragas import evaluate
@@ -74,47 +77,52 @@ os.environ["OPENAI_API_KEY"] = "your-openai-key"
7477
dataset: Dataset
7578

7679
results = evaluate(dataset)
77-
# {'ragas_score': 0.860, 'context_relavency': 0.817,
80+
# {'ragas_score': 0.860, 'context_relevancy': 0.817,
7881
# 'faithfulness': 0.892, 'answer_relevancy': 0.874}
7982
```
83+
8084
If you want a more in-depth explanation of core components, check out our [quick-start notebook](./docs/quickstart.ipynb)
85+
8186
## :luggage: Metrics
8287

8388
Ragas measures your pipeline's performance against different dimensions
84-
1. **Faithfulness**: measures the information consistency of the generated answer against the given context. If any claims are made in the answer that cannot be deduced from context is penalized.
8589

86-
2. **Context Relevancy**: measures how relevant retrieved contexts are to the question. Ideally, the context should only contain information necessary to answer the question. The presence of redundant information in the context is penalized.
90+
1. **Faithfulness**: measures the information consistency of the generated answer against the given context. If any claims are made in the answer that cannot be deduced from context is penalized.
91+
92+
2. **Context Relevancy**: measures how relevant retrieved contexts are to the question. Ideally, the context should only contain information necessary to answer the question. The presence of redundant information in the context is penalized.
8793

88-
3. **Answer Relevancy**: refers to the degree to which a response directly addresses and is appropriate for a given question or context. This does not take the factuality of the answer into consideration but rather penalizes the present of redundant information or incomplete answers given a question.
94+
3. **Answer Relevancy**: refers to the degree to which a response directly addresses and is appropriate for a given question or context. This does not take the factuality of the answer into consideration but rather penalizes the present of redundant information or incomplete answers given a question.
8995

9096
4. **Aspect Critiques**: Designed to judge the submission against defined aspects like harmlessness, correctness, etc. You can also define your own aspect and validate the submission against your desired aspect. The output of aspect critiques is always binary.
9197

92-
The final `ragas_score` is the harmonic mean of individual metric scores.
98+
The final `ragas_score` is the harmonic mean of individual metric scores.
9399

94100
To read more about our metrics, check out [docs](/docs/metrics.md).
101+
95102
## 🫂 Community
103+
96104
If you want to get more involved with Ragas, check out our [discord server](https://discord.gg/5djav8GGNZ). It's a fun community where we geek out about LLM, Retrieval, Production issues, and more.
97105

98106
## 🔍 Open Analytics
107+
99108
We track very basic usage metrics to guide us to figure out what our users want, what is working, and what's not. As a young startup, we have to be brutally honest about this which is why we are tracking these metrics. But as an Open Startup, we open-source all the data we collect. You can read more about this [here](https://github.com/explodinggradients/ragas/issues/49). **Ragas does not track any information that can be used to identify you or your company**. You can take a look at exactly what we track in the [code](./src/ragas/_analytics.py)
100109

101110
To disable usage-tracking you set the `RAGAS_DO_NOT_TRACK` flag to true.
102111

103-
104112
## :raising_hand_man: FAQ
113+
105114
1. Why harmonic mean?
106115

107116
Harmonic-Mean penalizes extreme values. For example, if your generated answer is fully factually consistent with the context (faithfulness = 1) but is not relevant to the question (relevancy = 0), a simple average would give you a score of 0.5 but a harmonic mean will give you 0.0
108117

109118
2. How to use Ragas to improve your pipeline?
110119

111-
*"Measurement is the first step that leads to control and eventually to improvement" - James Harrington*
120+
_"Measurement is the first step that leads to control and eventually to improvement" - James Harrington_
112121

113122
Here we assume that you already have your RAG pipeline ready. When it comes to RAG pipelines, there are mainly two parts - Retriever and generator. A change in any of these should also impact your pipelines' quality.
114123

115-
1. First, decide on one parameter that you're interested in adjusting. for example the number of retrieved documents, K.
124+
1. First, decide on one parameter that you're interested in adjusting. for example the number of retrieved documents, K.
116125
2. Collect a set of sample prompts (min 20) to form your test set.
117126
3. Run your pipeline using the test set before and after the change. Each time record the prompts with context and generated output.
118-
4. Run ragas evaluation for each of them to generate evaluation scores.
127+
4. Run ragas evaluation for each of them to generate evaluation scores.
119128
5. Compare the scores and you will know how much the change has affected your pipelines' performance.
120-

0 commit comments

Comments
 (0)