Module: LiterLlm::ResponseFormat

Extended by:
T::Helpers, T::Sig
Included in:
ResponseFormatJsonObject, ResponseFormatJsonSchema, ResponseFormatText
Defined in:
lib/liter_llm/native.rb

Overview

Response format constraint.

Class Method Summary collapse

Class Method Details

.from_hash(hash) ⇒ Object



402
403
404
405
406
407
408
409
410
# File 'lib/liter_llm/native.rb', line 402

def self.from_hash(hash)
  discriminator = hash[:type] || hash["type"]
  case discriminator
  when "text" then ResponseFormatText.from_hash(hash)
  when "json_object" then ResponseFormatJsonObject.from_hash(hash)
  when "json_schema" then ResponseFormatJsonSchema.from_hash(hash)
  else raise "Unknown discriminator: #{discriminator}"
  end
end