Class: LLM::OpenAI::Format::RespondFormat

Inherits:
Object
  • Object
show all
Defined in:
lib/llm/providers/openai/format/respond_format.rb

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ RespondFormat

Returns a new instance of RespondFormat.

Parameters:



10
11
12
# File 'lib/llm/providers/openai/format/respond_format.rb', line 10

def initialize(message)
  @message = message
end

Instance Method Details

#formatObject



14
15
16
17
18
19
20
21
22
# File 'lib/llm/providers/openai/format/respond_format.rb', line 14

def format
  catch(:abort) do
    if Hash === message
      {role: message[:role], content: format_content(message[:content])}
    else
      format_message
    end
  end
end