Module: RubyLLM::Providers::GPUStack::Media
- Extended by:
- OpenAI::Media
- Included in:
- RubyLLM::Providers::GPUStack
- Defined in:
- lib/ruby_llm/providers/gpustack/media.rb
Overview
Handles formatting of media content (images, audio) for GPUStack APIs
Class Method Summary collapse
Methods included from OpenAI::Media
format_audio, format_pdf, format_text, format_text_file
Class Method Details
.format_content(content) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ruby_llm/providers/gpustack/media.rb', line 12 def format_content(content) return content.value if content.is_a?(RubyLLM::Content::Raw) return content.to_json if content.is_a?(Hash) || content.is_a?(Array) return content unless content.is_a?(Content) parts = [] parts << format_text(content.text) if content.text content..each do || case .type when :image parts << GPUStack::Media.format_image() when :text parts << format_text_file() else raise UnsupportedAttachmentError, .mime_type end end parts end |
.format_image(image) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/ruby_llm/providers/gpustack/media.rb', line 34 def format_image(image) { type: 'image_url', image_url: { url: image.for_llm, detail: 'auto' } } end |