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 +4 -4
- data/lib/omniai/google/chat/stream.rb +6 -8
- data/lib/omniai/google/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b4a06d7346381cd281088f6e95cb85cf0142f286ff16a26e6681447ba5a0401
|
4
|
+
data.tar.gz: 5ada4e7eb1e51bbbb01e1981917ccc3331500a847e45586b4a3618b51d26992a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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"].
|
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
|
-
|
66
|
-
|
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
|