Class: RubyLLM::Protocols::Gemini::Chat::MessageFormatter
- Inherits:
-
Object
- Object
- RubyLLM::Protocols::Gemini::Chat::MessageFormatter
- Defined in:
- lib/ruby_llm/protocols/gemini/chat.rb
Overview
formats a message
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(provider, messages) ⇒ MessageFormatter
constructor
A new instance of MessageFormatter.
Constructor Details
#initialize(provider, messages) ⇒ MessageFormatter
Returns a new instance of MessageFormatter.
368 369 370 371 372 373 |
# File 'lib/ruby_llm/protocols/gemini/chat.rb', line 368 def initialize(provider, ) @provider = provider = @index = 0 @tool_call_names = {} end |
Instance Method Details
#format ⇒ Object
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 |
# File 'lib/ruby_llm/protocols/gemini/chat.rb', line 375 def format formatted = [] while if () tool_parts, next_index = collect_tool_parts formatted << build_tool_response(tool_parts) @index = next_index else remember_tool_calls if .tool_call? formatted << () @index += 1 end end formatted end |