function normalizeClaude3Messages(messages) {
  const result = []
  for (const message of messages ?? []) {
    if (message == null) {
      continue
    }
    if (typeof message.content === 'string') {
      // Messages can be specified with plain string content
      result.push({ role: message.role, content: message.content })
    } else if (Array.isArray(message.content)) {
      // Or in a "chunked" format for multi-modal support
      result.push({
        role: message.role,
        content: stringifyClaudeChunkedMessage(message.content)
      })
    }
  }
  return result
}
Claude v3 requests in Bedrock can have two different "chat" flavors. This function normalizes them into a consistent
format per the AIM agent spec

@param messages - The raw array of messages passed to the invoke API
@returns {number|undefined} - The normalized messages