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(evals): return partial results when llm function is interrupted #1755

Merged
merged 7 commits into from
Nov 16, 2023

Conversation

mikeldking
Copy link
Contributor

@mikeldking mikeldking commented Nov 15, 2023

resolves #1748

Adds a try / catch block around the generation step of the llm functions so that the partial results can be outputted. This is important since we don't want the user to lose the progress they make - notably because it costs money.

return pd.DataFrame(
data={
"label": labels,
**({"explanation": explanations} if provide_explanation else {}),
**({"explanation": cast(List[str], explanations)} if provide_explanation else {}),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure if mypy shifted but just casting for now as it should be pretty guaranteed. Can add fallbacks above too instead

Copy link
Contributor

Choose a reason for hiding this comment

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

it worked for me without the cast (even after hatch env remove type)

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Contributor

@RogerHYang RogerHYang left a comment

Choose a reason for hiding this comment

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

LGTM

src/phoenix/experimental/evals/functions/classify.py Outdated Show resolved Hide resolved
src/phoenix/experimental/evals/functions/classify.py Outdated Show resolved Hide resolved
return pd.DataFrame(
data={
"label": labels,
**({"explanation": explanations} if provide_explanation else {}),
**({"explanation": cast(List[str], explanations)} if provide_explanation else {}),
Copy link
Contributor

Choose a reason for hiding this comment

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

it worked for me without the cast (even after hatch env remove type)

rails=["relevant", "irrelevant"],
)

assert classification_df is not None
Copy link
Contributor

Choose a reason for hiding this comment

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

could be more specific

Suggested change
assert classification_df is not None
assert classification_df.isna().sum() == 2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was foreshadowing the async submission change. Gonna leave it less specific to future proof

@mikeldking mikeldking merged commit 1fb0849 into main Nov 16, 2023
6 checks passed
@mikeldking mikeldking deleted the 1748-error-tolerence branch November 16, 2023 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] make llm_functions tolerant to errors
2 participants