Module: LLM::OpenAI::Format

Included in:
LLM::OpenAI, Responses
Defined in:
lib/llm/shell/internal/llm.rb/lib/llm/providers/openai/format.rb,
lib/llm/shell/internal/llm.rb/lib/llm/providers/openai/format/respond_format.rb,
lib/llm/shell/internal/llm.rb/lib/llm/providers/openai/format/completion_format.rb,
lib/llm/shell/internal/llm.rb/lib/llm/providers/openai/format/moderation_format.rb

Defined Under Namespace

Classes: CompletionFormat, ModerationFormat, RespondFormat

Instance Method Summary collapse

Instance Method Details

#format(messages, mode) ⇒ Array<Hash>



17
18
19
20
21
22
23
24
25
# File 'lib/llm/shell/internal/llm.rb/lib/llm/providers/openai/format.rb', line 17

def format(messages, mode)
  messages.filter_map do |message|
    if mode == :complete
      CompletionFormat.new(message).format
    else
      RespondFormat.new(message).format
    end
  end
end