asAssistantMessageOrNull

Attempts to cast a Message.Response instance to a Message.Assistant type.

This method checks if the first element in the response is of type Message.Assistant and, if so, returns it; otherwise, it returns null.

Return

The Message.Assistant instance if the cast is successful, or null if the cast fails.