Evaluation.predict_and_score:v0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import weave
from typing import Union
from typing import Callable
from weave.flow.model import Model
from weave.flow.model import get_infer_method
from weave.trace.op import Op
import inspect
from weave.trace.op import BoundOp
import time
import typing
from typing import Any
import asyncio
from weave.trace.errors import OpCallError
import textwrap
from rich import print
import traceback
from weave.flow.scorer import Scorer
from weave.flow.scorer import get_scorer_attributes
def async_call(
func: typing.Union[Callable, Op], *args: Any, **kwargs: Any
) -> typing.Coroutine:
is_async = False
if isinstance(func, Op):
is_async = inspect.iscoroutinefunction(func.resolve_fn)