lib/gen_ai/result.rb in gen-ai-0.2.3 vs lib/gen_ai/result.rb in gen-ai-0.3.0

- old
+ new

@@ -9,11 +9,18 @@ @provider = provider @model = model @values = values end - def value - values.first + def value(format = :raw) + case format + when :raw + values.first + when :base64 + Base64.encode64(values.first) + else + raise "Unsupported format: #{format}" + end end def prompt_tokens usage['prompt_tokens'] end