# to_custom_streamed_response_wrapper

> **Function** in `langsmith`

📖 [View in docs](https://reference.langchain.com/python/langsmith/_openapi_client/_response/to_custom_streamed_response_wrapper)

Higher order function that takes one of our bound API methods and an `APIResponse` class
and wraps the method to support streaming and returning the given response class directly.

Note: the given `response_cls` *must* be concrete, e.g. `class BinaryAPIResponse(APIResponse[bytes])`

## Signature

```python
to_custom_streamed_response_wrapper(
    func: Callable[P, object],
    response_cls: type[_APIResponseT],
) -> Callable[P, ResponseContextManager[_APIResponseT]]
```

---

[View source on GitHub](https://github.com/langchain-ai/langsmith-sdk/blob/687fc8d527a28504432f52bd08c75f2894c209fe/python/langsmith/_openapi_client/_response.py#L690)