# 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/0e86adc8d140bf6e3da49836173bd5a50a194b63/libs/cohere/langchain_cohere/chat_models.py#L388)