toOpenAIMessageParam

Converts a core Message to the appropriate OpenAIMessageParam subtype.

Mapping:

Return

The corresponding OpenAIMessageParam.

Throws

if the content type doesn't match the role.