Skip to content

Commit

Permalink
Merge pull request kubeagi#656 from Lanture1064/dev
Browse files Browse the repository at this point in the history
chore: fix ragas-once readme typo & bug
  • Loading branch information
bjwswang authored Jan 26, 2024
2 parents 0fbd6cf + ec14529 commit b047b43
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions pypi/ragas_once/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ pip install ragas_once

- `--model`: Specifies the model to use for evaluation.
- Default value is "gpt-3.5-turbo". Langchain compatible.
- `--api_base`: Specifies the base URL for the API.
- `--apibase`: Specifies the base URL for the API.
- Default value is "https://api.openai.com/v1".
- `--api_key`: Specifies the API key to authenticate requests.
- `--apikey`: Specifies the API key to authenticate requests.
- Not required if using psuedo-openai API server, e.g. vLLM, Fastchat, etc.
- `--embeddings`: Specifies the Huggingface embeddings model to use for evaluation.
- Embeddings will run **locally**.
Expand All @@ -39,7 +39,7 @@ pip install ragas_once
### Fiqa dataset demo:

```bash
python3 -m ragas_once.cli --api_key "YOUR_OPENAI_API_KEY"
python3 -m ragas_once.cli --apikey "YOUR_OPENAI_API_KEY"
```

### Evaluate with GPT-4 and `BAAI/bge-small-en` embeddings
Expand All @@ -52,7 +52,7 @@ pip install sentence-transformers
Then run:

```bash
python3 -m ragas_once.cli --model "gpt-4" --api_key "YOUR_OPENAI_API_KEY" --embeddings "BAAI/bge-small-en" --dataset "path/to/dataset.csv"
python3 -m ragas_once.cli --model "gpt-4" --apikey "YOUR_OPENAI_API_KEY" --embeddings "BAAI/bge-small-en" --dataset "path/to/dataset.csv"
```

### Prepare Dataset
Expand Down
6 changes: 4 additions & 2 deletions pypi/ragas_once/ragas_once/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ def main():

if dataset:
data = pd.read_csv(dataset)
data["ground_truths"] = data["ground_truths"].apply(lambda x: x.split(";"))
data["contexts"] = data["contexts"].apply(lambda x: x.split(";"))
if "ground_truths" in data.columns & data["ground_truths"].dtype == 'string':
data["ground_truths"] = data["ground_truths"].apply(lambda x: x.split(";"))
if "contexts" in data.columns & data["contexts"].dtype == 'string':
data["contexts"] = data["contexts"].apply(lambda x: x.split(";"))
test_set = Dataset.from_pandas(data)
else:
print("test_set not provided, using fiqa dataset")
Expand Down

0 comments on commit b047b43

Please sign in to comment.