messagesToTurns(messages)
Converts common chat messages into the format sent to Era.
- Keeps
userandassistantmessages. - Drops system, tool, and other roles.
- Keeps plain text and text parts from multimodal content.
- Drops images, tool results, and empty messages.
- Adds consecutive
turn_indexvalues starting at 1.
Example
turnContext() calls this function for you. Use it directly only to inspect
normalization or build a custom HTTP integration.