omniai-google 2.6.2 → 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 +13 -13
- data/lib/omniai/google/version.rb +1 -1
- metadata +2 -2
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
|
@@ -53,11 +53,7 @@ module OmniAI
|
|
53
53
|
# @yieldparam delta [OmniAI::Chat::Delta]
|
54
54
|
#
|
55
55
|
# @param candidate [Hash]
|
56
|
-
# @param index [Integer]
|
57
56
|
def process_candidate!(candidate:, index:, &block)
|
58
|
-
parts = candidate["content"]["parts"]
|
59
|
-
return unless parts
|
60
|
-
|
61
57
|
candidate["content"]["parts"].each do |part|
|
62
58
|
block&.call(OmniAI::Chat::Delta.new(text: part["text"])) if part["text"]
|
63
59
|
end
|
@@ -71,19 +67,23 @@ module OmniAI
|
|
71
67
|
if @data["candidates"][index].nil?
|
72
68
|
@data["candidates"][index] = candidate
|
73
69
|
else
|
74
|
-
merge_parts!(
|
70
|
+
merge_parts!(parts: candidate["content"]["parts"], candidate: @data["candidates"][index])
|
75
71
|
end
|
76
72
|
end
|
77
73
|
|
78
|
-
# @param content [Hash]
|
79
74
|
# @param parts [Array<Hash>]
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
75
|
+
# @param candidate [Hash]
|
76
|
+
def merge_parts!(parts:, candidate:)
|
77
|
+
parts.each { |part| merge_part!(part:, candidate:) }
|
78
|
+
end
|
79
|
+
|
80
|
+
# @param part [Hash]
|
81
|
+
# @param into [Hash]
|
82
|
+
def merge_part!(part:, candidate:)
|
83
|
+
if candidate["content"]["parts"][-1]&.key?("text") && part["text"]
|
84
|
+
candidate["content"]["parts"][-1]["text"] += part["text"]
|
85
|
+
else
|
86
|
+
candidate["content"]["parts"] << part
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniai-google
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Sylvestre
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-05-
|
10
|
+
date: 2025-05-13 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: event_stream_parser
|