class RubyLLM::Providers::Anthropic
def format_messages(messages)
def format_messages(messages) messages.map do |msg| if msg.tool_call? { role: 'assistant', content: [ { type: 'text', text: msg.content }, { type: 'tool_use', id: msg.tool_calls.values.first.id, name: msg.tool_calls.values.first.name, input: msg.tool_calls.values.first.arguments } ] } elsif msg.tool_result? { role: 'user', content: [ { type: 'tool_result', tool_use_id: msg.tool_call_id, content: msg.content } ] } else { role: convert_role(msg.role), content: msg.content } end end end