Module: RubyLLM

Defined in:
lib/ruby_llm/tester.rb,
lib/ruby_llm/providers/test.rb,
lib/ruby_llm/providers/test/echo.rb

Defined Under Namespace

Modules: Providers, Tester

Class Method Summary collapse

Class Method Details

.concat_content(*parts) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/ruby_llm/providers/test/echo.rb', line 34

def self.concat_content *parts
  strings, contents = parts
      .flatten
      .partition { it.is_a? String }

  Content.new(
    [*strings, *contents.map(&:text)]
        .reject(&:empty?)
        .join("\n\n"),
    contents.sum([], &:attachments)
        .map(&:source)
  )
end