Skip to main content

messagesToTurns(messages)

Converts common chat messages into the format sent to Era.
The function:
  • Keeps user and assistant messages.
  • 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_index values starting at 1.

Example

turnContext() calls this function for you. Use it directly only to inspect normalization or build a custom HTTP integration.

VERSION

Contains the SDK version: