Module: Ace::LLM::Molecules::FormatHandlers

Defined in:
lib/ace/llm/molecules/format_handlers.rb

Overview

Format handlers for different output formats

Defined Under Namespace

Classes: Base, JSON, Markdown, Text

Class Method Summary collapse

Class Method Details

.get_handler(format) ⇒ Base

Factory method to get format handler

Parameters:

  • format (String)

    Format type (json, markdown, text)

Returns:

  • (Base)

    Format handler instance



162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/ace/llm/molecules/format_handlers.rb', line 162

def self.get_handler(format)
  case format.to_s.downcase
  when "json"
    JSON.new
  when "markdown", "md"
    Markdown.new
  when "text", "txt"
    Text.new
  else
    raise Ace::LLM::Error, "Unsupported format: #{format}"
  end
end

.supported_formatsArray<String>

Get list of supported formats

Returns:

  • (Array<String>)

    List of supported formats



177
178
179
# File 'lib/ace/llm/molecules/format_handlers.rb', line 177

def self.supported_formats
  ["json", "markdown", "text"]
end