Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtruong committed Jan 14, 2025
1 parent 0c46cab commit 2ec88f3
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion weave/flow/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@
get_scorer_attributes,
transpose,
)
from weave.trace.context import weave_client_context
from weave.trace.env import get_weave_parallelism
from weave.trace.errors import OpCallError
from weave.trace.isinstance import weave_isinstance
from weave.trace.op import CallDisplayNameFunc, Op, as_op, is_op
from weave.trace.vals import WeaveObject
from weave.trace.weave_client import Call, get_ref
from weave.trace.weave_client import Call, CallsIter, get_ref
from weave.trace_server.trace_server_interface import CallsFilter

console = Console()
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -302,6 +304,24 @@ async def evaluate(self, model: Union[Op, Model]) -> dict:

return summary

def get_evaluation_results(self) -> dict[str, CallsIter]:
# TODO: When refs are available on the Eval object, narrow to just the current
# version of evaluation, not all as currently implemented

if not self.evaluate.ref:
raise ValueError(
"Evaluation must be run or published before calling get_evaluation_results"
)

eval_calls = self.evaluate.calls()
wc = weave_client_context.require_weave_client()
return {
cast(str, call.display_name): wc.get_calls(
CallsFilter(parent_ids=[call.id])
)
for call in eval_calls
}


def evaluate(
dataset: Union[Dataset, list],
Expand Down

0 comments on commit 2ec88f3

Please sign in to comment.