Resolve the value function

This function is used to resolve the value function (value_fn) to an object of type IT. If the value function is asynchronous, it will be awaited. If the value function is synchronous, it will be called.

While always using an async method within an output transform function is not appropriate, this method may be safely used to avoid boilerplate.

Replace this:

if is_async_callable(_fn):
    x = await _fn()
    x = cast(ValueFnSync[IT], _fn)()

With this:

x = await resolve_value_fn(_fn)


value_fn: ValueFn[IT]

App-supplied output value function which returns type IT. This function can be synchronous or asynchronous.


Type Description
IT The resolved value from value_fn.