Class: OmniAI::Google::Chat::Chunk
- Inherits:
-
Chat::Chunk
- Object
- Chat::Chunk
- OmniAI::Google::Chat::Chunk
- Defined in:
- lib/omniai/google/chat/chunk.rb
Overview
A chunk given when streaming.
Instance Method Summary collapse
Instance Method Details
#choices ⇒ Array<OmniAI::Chat::Choice>
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/omniai/google/chat/chunk.rb', line 9 def choices @choices ||= [].tap do |choices| @data['candidates'].each do |candidate| candidate['content']['parts'].each do |part| choices << OmniAI::Chat::Choice.new(data: { 'index' => candidate['index'], 'delta' => { 'role' => candidate['content']['role'], 'content' => part['text'] }, }) end end end end |