omniai-google 2.6.3 → 2.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f578af1eb17aad95c7d8d95241481ea6fa606f9dbdca2bfb098e664874cbfe1
4
- data.tar.gz: 8ffb8c563e0e1464aeaecd38d7b764227b3a13302a130c43d5a1989f9abb6cfc
3
+ metadata.gz: 9b4a06d7346381cd281088f6e95cb85cf0142f286ff16a26e6681447ba5a0401
4
+ data.tar.gz: 5ada4e7eb1e51bbbb01e1981917ccc3331500a847e45586b4a3618b51d26992a
5
5
  SHA512:
6
- metadata.gz: 8db2a30f2424c265690d6d9d7910c1de1774ddc452405c64a37a323fcaa1a9f0571128ceb03d47dda98ba5c943708b26a127f881c954d533977d2ca81c377401
7
- data.tar.gz: 3a6245e97f79785079a3490eed18cdc32f5da909863959fbef281f40df7a5da2dff4416725dd56b173c73a7dd0c06b945a52143d37a229c539e4a4eed9ea5d3d
6
+ metadata.gz: 9d929c63f5008bc8c23261d2cdde88f56aca8b17ce1524443915b4181d590fa6b6778b02719ed03f6342eec94c406e64c5b76b411900884e3dae5349a0eb1edf
7
+ data.tar.gz: 1f68746ee88d7c17804a125b4d48c49b0309438408e555172889e28b7e408b9823bd63226d091d2c5159046a973a8d8e932f1ae4dcc64a3a62ebe68c979c2834
@@ -44,8 +44,8 @@ module OmniAI
44
44
  @data[key] = value unless key.eql?("candidates")
45
45
  end
46
46
 
47
- data["candidates"].each do |candidate|
48
- process_candidate!(candidate:, &block)
47
+ data["candidates"].each_with_index do |candidate, index|
48
+ process_candidate!(candidate:, index:, &block)
49
49
  end
50
50
  end
51
51
 
@@ -53,19 +53,17 @@ module OmniAI
53
53
  # @yieldparam delta [OmniAI::Chat::Delta]
54
54
  #
55
55
  # @param candidate [Hash]
56
- def process_candidate!(candidate:, &block)
56
+ def process_candidate!(candidate:, index:, &block)
57
57
  candidate["content"]["parts"].each do |part|
58
58
  block&.call(OmniAI::Chat::Delta.new(text: part["text"])) if part["text"]
59
59
  end
60
60
 
61
- merge_candidate!(candidate:)
61
+ merge_candidate!(candidate:, index:)
62
62
  end
63
63
 
64
64
  # @param candidate [Hash]
65
- def merge_candidate!(candidate:)
66
- index = candidate["index"]
67
- raise candidate.inspect if index.nil?
68
-
65
+ # @param index [Integer]
66
+ def merge_candidate!(candidate:, index:)
69
67
  if @data["candidates"][index].nil?
70
68
  @data["candidates"][index] = candidate
71
69
  else
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAI
4
4
  module Google
5
- VERSION = "2.6.3"
5
+ VERSION = "2.6.4"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniai-google
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.3
4
+ version: 2.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre