Skip to main content

API Overview


function call

call(
    op: 'Op',
    *args: 'Any',
    __weave: 'WeaveKwargs | None' = None,
    __should_raise: 'bool' = False,
    __require_explicit_finish: 'bool' = False,
    **kwargs: 'Any'
) → tuple[Any, Call] | Coroutine[Any, Any, tuple[Any, Call]]
Executes the op and returns both the result and a Call representing the execution. This function will never raise. Any errors are captured in the Call object. This method is automatically bound to any function decorated with @weave.op, allowing for usage like:
@weave.op
def add(a: int, b: int) -> int:
     return a + b

result, call = add.call(1, 2)

function calls

calls(op: 'Op') → CallsIter
Get an iterator over all calls to this op. This method is automatically bound to any function decorated with @weave.op, allowing for usage like:
@weave.op
def add(a: int, b: int) -> int:
     return a + b

calls = add.calls()
for call in calls:
     print(call)
I