class RubyLLM::Providers::Gemini::Chat::MessageFormatter
formats a message
Public Class Methods
# File lib/ruby_llm/providers/gemini/chat.rb, line 264 def initialize(messages, format_role:, format_parts:, format_tool_result:) @messages = messages @index = 0 @tool_call_names = {} @format_role = format_role @format_parts = format_parts @format_tool_result = format_tool_result end
Public Instance Methods
Source
# File lib/ruby_llm/providers/gemini/chat.rb, line 273 def format formatted = [] while current_message if tool_message?(current_message) tool_parts, next_index = collect_tool_parts formatted << build_tool_response(tool_parts) @index = next_index else remember_tool_calls if current_message.tool_call? formatted << build_standard_message(current_message) @index += 1 end end formatted end