contextvars_utils
Adapted from the Griptape AI Framework documentation.
Source Code in griptape/utils/contextvars_utils.py
def with_contextvars(wrapped: Callable) -> Callable: ctx = contextvars.copy_context() def wrapper(*args, **kwargs) -> Any: return ctx.run(wrapped, *args, **kwargs) return wrapper
Could this page be better? Report a problem or suggest an addition!