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
26
27
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 is_op
from weave.trace.op import as_op
import inspect
import time
import typing
from weave.trace.op import Op
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 is_op(func):
func = as_op(func)
is_async = inspect.iscoroutinefunction(func.resolve_fn)