Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ragas_once pip package #513

Merged
merged 1 commit into from
Jan 19, 2024
Merged

feat: add ragas_once pip package #513

merged 1 commit into from
Jan 19, 2024

Conversation

Lanture1064
Copy link
Collaborator

What type of PR is this?

What this PR does / why we need it

Which issue(s) this PR fixes

Fixes #

Special notes for your reviewer

@Lanture1064 Lanture1064 force-pushed the dev branch 4 times, most recently from d6ff9ff to 43e9bac Compare January 12, 2024 03:00
@bjwswang
Copy link
Collaborator

@Lanture1064 We should make this python code as a python project and publish package to pypl.

Please refer to https://packaging.python.org/en/latest/tutorials/packaging-projects/

@Lanture1064 Lanture1064 force-pushed the dev branch 2 times, most recently from 7a5f542 to 34de7d8 Compare January 12, 2024 09:06
@Lanture1064 Lanture1064 changed the title feat: add ragas-sample.py feat: add ragacli pip package Jan 12, 2024
@Lanture1064 Lanture1064 force-pushed the dev branch 4 times, most recently from db70444 to d195808 Compare January 15, 2024 07:00
@Lanture1064 Lanture1064 force-pushed the dev branch 6 times, most recently from aa0fb94 to 4d22133 Compare January 17, 2024 07:31
import pandas as pd

# Initialize an empty dataset
dataset = pd.DataFrame(columns=['question', 'answer', 'ground_truths'])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lanture1064 How about the contexts?

Copy link
Collaborator Author

@Lanture1064 Lanture1064 Jan 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function has been replaced by

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(';'))
test_set = Dataset.from_pandas(data)

in cli.py.

dataset.at[index, 'ground_truths'] = [row['ground_truths']] # Convert single string to list

# Print the dataset
print(dataset)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not need to print

@Lanture1064 Lanture1064 force-pushed the dev branch 3 times, most recently from 8f9a2a5 to 2774b5e Compare January 18, 2024 05:44
Copy link
Collaborator

@bjwswang bjwswang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my comments .

long_description = f.read()

setup(
name="raga_once",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good name ! maybe ragas_once

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep the direcotyr name save as your project name

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the raga-once has been uploaded, I'm not sure if pypi supports changing the name of it

os.environ["OPENAI_API_KEY"] = api_key
os.environ["OPENAI_API_BASE"] = api_base
base = ChatOpenAI(
model_name=model,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you already have this name configured in ChatOpenAI, can we remove `os.environ'

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ragas lib reaches out to os.environ as default, so this is rather like an 'insurance'? We can remove it tho

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's give this file another name.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe wrapper.py?

evaluation/ragacli_pyproject/pyproject.toml Outdated Show resolved Hide resolved
@Lanture1064 Lanture1064 force-pushed the dev branch 2 times, most recently from bb8fe69 to 1b9740e Compare January 18, 2024 06:17
@Lanture1064 Lanture1064 force-pushed the dev branch 2 times, most recently from 93f00c7 to e83e1ef Compare January 18, 2024 07:53
@Lanture1064 Lanture1064 force-pushed the dev branch 2 times, most recently from a328a59 to ad39162 Compare January 18, 2024 09:33
@Lanture1064 Lanture1064 changed the title feat: add ragacli pip package feat: add raga-once pip package Jan 18, 2024
@Lanture1064 Lanture1064 force-pushed the dev branch 2 times, most recently from d3d90d1 to 0be9eb1 Compare January 19, 2024 02:06
long_description = f.read()

setup(
name="raga-once",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ragas-once or ragas_once

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pypi package name is raga-once, while python subdir name is ragas_once since python requires it. (e.g. python can only read import ragas_once.cli as pkg, but not import ragas-once.cli as pkg

@Lanture1064 Lanture1064 force-pushed the dev branch 2 times, most recently from a0ef8a7 to 768d80c Compare January 19, 2024 07:54
@Lanture1064 Lanture1064 marked this pull request as ready for review January 19, 2024 07:54

```bash
pip install ragas langchain==0.0.354
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this dependency???


```bash
python3 -m ragasonce --api_key "YOUR_OPENAI_API_KEY"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ragasonce ???? maybe regas_once or ragas-once? please keep consistent .

@Lanture1064 Lanture1064 force-pushed the dev branch 3 times, most recently from d824d4e to aecdd52 Compare January 19, 2024 09:17
@bjwswang bjwswang merged commit 1475201 into kubeagi:main Jan 19, 2024
9 checks passed
@Lanture1064 Lanture1064 changed the title feat: add raga-once pip package feat: add ragas_once pip package Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants