# get_role_v2

> **Function** in `langchain_cohere`

📖 [View in docs](https://reference.langchain.com/python/langchain-cohere/chat_models/get_role_v2)

Get the role of the message (V2).
Args:
    message: The message.
Returns:
    The role of the message.
Raises:
    ValueError: If the message is of an unknown type.

## Signature

```python
get_role_v2(
    message: BaseMessage,
) -> str
```

---

[View source on GitHub](https://github.com/langchain-ai/langchain-cohere/blob/24cfdaefd4e3c785f477ccfe491a4226a0dbe88c/libs/cohere/langchain_cohere/chat_models.py#L375)