-
Notifications
You must be signed in to change notification settings - Fork 73
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(weave): Allow Dataset to be constructed from Calls #3382
Conversation
Preview this PR with FeatureBee: https://beta.wandb.ai/?betaVersion=a883b76529b75e01aa4b851c912f7f02f7d1c3f5 |
weave/trace/weave_client.py
Outdated
@@ -534,6 +534,13 @@ class ApplyScorerSuccess: | |||
wc._send_score_call(self, score_call, scorer_ref_uri) | |||
return apply_scorer_result | |||
|
|||
def to_dict(self) -> dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would more concretely type this so that the dict coming out has strongly typed fields
weave/trace/weave_client.py
Outdated
d["op_name"] = self.op_name | ||
d["display_name"] = self.display_name | ||
|
||
return cast(CallDict, d) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this cast is not guaranteed. I would do something to at least validate the keys
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What case do you see missing here?
58a9c22
to
69f7b89
Compare
@@ -54,6 +55,11 @@ def from_obj(cls, obj: WeaveObject) -> Self: | |||
rows=obj.rows, | |||
) | |||
|
|||
@classmethod | |||
def from_calls(cls, calls: Iterable[Call]) -> Self: | |||
rows = [call.to_dict() for call in calls] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so much network traffic here. Hopefully in the future we can do something serverside
Resolves: https://wandb.atlassian.net/browse/WB-22700