# extract_stream_chunk_type

> **Function** in `langsmith`

📖 [View in docs](https://reference.langchain.com/python/langsmith/_streaming/extract_stream_chunk_type)

Given a type like `Stream[T]`, returns the generic type variable `T`.

This also handles the case where a concrete subclass is given, e.g.
```py
class MyStream(Stream[bytes]):
    ...

extract_stream_chunk_type(MyStream) -> bytes
```

## Signature

```python
extract_stream_chunk_type(
    stream_cls: type,
    *,
    failure_message: str | None = None,
) -> type
```

---

[View source on GitHub](https://github.com/langchain-ai/langsmith-python/blob/15dd2a789f976bbbafd803b26d0f25c08b5ed527/src/langsmith/_streaming.py#L359)