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

chore(weave): Extract common functions in eval.py into re-usable common modules. #3328

Conversation

tssweeney
Copy link
Collaborator

@tssweeney tssweeney commented Jan 6, 2025

This is another refactor PR to decouple Scoring and model prediction mechanics from the eval api itself. This builds off of #3325. There should be no functional changes to the user. Specifically:

  • weave/trace/op_caller.py now contains the helper functions for async_call and async_call_op which unifies op calling for async and sync calls under the same API.
  • Extracts apply_scorer_async into weave/scorers/base_scorer.py prepping for re-use elsewhere
  • Extracts apply_model_async into weave/flow/model.py for similar reasons.

@tssweeney tssweeney requested a review from a team as a code owner January 6, 2025 22:10
@circle-job-mirror
Copy link

@tssweeney tssweeney changed the title Tim/extract scoring mechanics into module new files chore(weave): Extract common functions in eval.py into re-usable common modules. Jan 6, 2025
@@ -57,3 +68,110 @@ def get_infer_method(model: Model) -> Op:
raise MissingInferenceMethodError(
f"Missing a method with name in ({INFER_METHOD_NAMES})"
)


# Using `dataclass` because pydantic does not like `Call` as a property
Copy link
Collaborator

Choose a reason for hiding this comment

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

That's odd -- why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it doesn't like the future

score_call: Call


ApplyScorerResult = ApplyScorerSuccess
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's no error case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not yet (:

Copy link
Collaborator

@andrewtruong andrewtruong left a comment

Choose a reason for hiding this comment

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

lgtm

@tssweeney tssweeney merged commit db9f4da into tim/extract_scoring_mechanics_into_module Jan 7, 2025
120 of 122 checks passed
@tssweeney tssweeney deleted the tim/extract_scoring_mechanics_into_module_new_files branch January 7, 2025 04:15
@github-actions github-actions bot locked and limited conversation to collaborators Jan 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants