Skip to main content

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


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 hashes)

Uploaded Source

Built Distribution

bisheng_ragas-1.0.0-py3-none-any.whl (71.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page