Module: LiterLlm::ContentPart
- Extended by:
- T::Helpers, T::Sig
- Included in:
- ContentPartDocument, ContentPartImageUrl, ContentPartInputAudio, ContentPartText
- Defined in:
- lib/liter_llm/native.rb
Overview
A single content part in a user message — text, image, document, or audio.
Class Method Summary collapse
Class Method Details
.from_hash(hash) ⇒ Object
211 212 213 214 215 216 217 218 219 220 |
# File 'lib/liter_llm/native.rb', line 211 def self.from_hash(hash) discriminator = hash[:type] || hash["type"] case discriminator when "text" then ContentPartText.from_hash(hash) when "image_url" then ContentPartImageUrl.from_hash(hash) when "document" then ContentPartDocument.from_hash(hash) when "input_audio" then ContentPartInputAudio.from_hash(hash) else raise "Unknown discriminator: #{discriminator}" end end |