No project description provided
Project description
# bisheng-ragas: Evaluation framework for your Retrieval Augmented Generation (RAG) pipelines
## 快速开始
安装包
```bash
pip install -e .
```
评分
```python
import httpx
from datasets import Dataset
from langchain_openai import ChatOpenAI
from bisheng_ragas import evaluate
from bisheng_ragas.llms.langchain import LangchainLLM
from bisheng_ragas.metrics import AnswerCorrectnessBisheng
data_samples = {
'question': ['When was the first super bowl?', 'Who won the most super bowls?'],
'answer': [
'The first superbowl was held on Jan 15, 1967',
'The most super bowls have been won by The New England Patriots',
],
'ground_truths': [
['The first superbowl was held on January 15, 1967.'],
['The New England Patriots have won the Super Bowl a record six times'],
],
}
_llm = ChatOpenAI(model="gpt-4-turbo-2024-04-09",
http_client=httpx.Client(proxies=os.getenv('OPENAI_PROXY')),
http_async_client=httpx.AsyncClient(proxies=os.getenv('OPENAI_PROXY')),
temperature=temperature,
)
llm = LangchainLLM(_llm)
answer_correctness_bisheng = AnswerCorrectnessBisheng(llm=llm)
dataset = Dataset.from_dict(data_samples)
score = evaluate(dataset, metrics=[answer_correctness_bisheng])
print(score.to_pandas())
```
## 特别感谢
bisheng-ragas主要借鉴了以下仓库:
- https://github.com/explodinggradients/ragas 同步至v0.0.22(commit 41e9e54)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bisheng_ragas-1.0.0.tar.gz
(13.4 MB
view details)
Built Distribution
File details
Details for the file bisheng_ragas-1.0.0.tar.gz
.
File metadata
- Download URL: bisheng_ragas-1.0.0.tar.gz
- Upload date:
- Size: 13.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.13 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7aa7de41bbc26b598cc39deedf80d72da37ad433ab973365b44ec7b0b6ac3226 |
|
MD5 | 8f7b08e2db907cbe5e83ad6c2f3b8d81 |
|
BLAKE2b-256 | a2aeeb010cd06bde2d5e024e7c1c961c98978a241ae587f830a81af10ca0b2a1 |
File details
Details for the file bisheng_ragas-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: bisheng_ragas-1.0.0-py3-none-any.whl
- Upload date:
- Size: 71.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.13 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f1166693974f0c13d9eb080e634e38449790fe38a720fae4093eccc5928536d |
|
MD5 | bdcd17d9b4cdb2469656455a1d3a7e19 |
|
BLAKE2b-256 | 082ac356170a1fd27a4e64bd8be0a51fadca8fa0f474884581edc6cc1781a8b9 |