# asyncify

> **Function** in `langsmith`

📖 [View in docs](https://reference.langchain.com/python/langsmith/_openapi_client/_utils/_sync/asyncify)

Take a blocking function and create an async one that receives the same
positional and keyword arguments.

Usage:

```python
def blocking_func(arg1, arg2, kwarg1=None):
    # blocking code
    return result

result = asyncify(blocking_function)(arg1, arg2, kwarg1=value1)
```

## Arguments

`function`: a blocking regular callable (e.g. a function)

## Return

An async function that takes the same positional and keyword arguments as the
original one, that when called runs the same original function in a thread worker
and returns the result.

## Signature

```python
asyncify(
    function: Callable[T_ParamSpec, T_Retval],
) -> Callable[T_ParamSpec, Awaitable[T_Retval]]
```

---

[View source on GitHub](https://github.com/langchain-ai/langsmith-sdk/blob/d6cd6082f09e7826a2d6afe444ae6119e61b82a6/python/langsmith/_openapi_client/_utils/_sync.py#L28)