omniai 3.1.2 → 3.2.0

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: d4564620d223dc2b398e45479742eb8e2ab9873716a946af44a069b1df84ec96
4
- data.tar.gz: d03aae31d15a19f1f14b0bf9643f79e85ac9f31aa4d8c0fa5b0d2ad0b959e982
3
+ metadata.gz: 8d7dc6f3dc47d5f0385f1f3cc26c509364c55c42bd6290a40a4616c16e69eb66
4
+ data.tar.gz: 6b6bb6cddbcdcb699495d23137127e3f90fedd2ef179db0a504b2290ff09f1f8
5
5
  SHA512:
6
- metadata.gz: e09fcf9083efd4b6de9bd6e8658f04f4b6a6a92f27a935d30e345fed635609d0dd1b21bb0c32e78c25f3fd2e9b7a8f6728b367db6190fa4f69bf7dc47a717f42
7
- data.tar.gz: 026e7f2fbddab552fc2635cd11856d652e06f2a3a3a9e30990612da223fe979aee105495be6d39a163dc8040c7bca927e16a6cddec63efe761570ab7eabc30ab
6
+ metadata.gz: 3c0a4f6a44bb5d205cda589cb1c85be12921ba1ff8fa9ef0c056b9071af05555db2cd872116597197805a43ac731afeee50925d9643546b9f77150a3465f2d06
7
+ data.tar.gz: ccb72e06a11d9eb6b2f4059b95130afea945aaddacd1f90bc357670a5f052ff93d4b3fbf48612caf5e6c228ad5b9802384913f888558b8a6df3167f0d08db6b1
@@ -165,6 +165,11 @@ module OmniAI
165
165
  else "input"
166
166
  end
167
167
  end
168
+
169
+ # @return [Boolean]
170
+ def tool_call_list?
171
+ @tool_call_list&.any?
172
+ end
168
173
  end
169
174
  end
170
175
  end
@@ -81,7 +81,7 @@ module OmniAI
81
81
 
82
82
  # @return [ToolCallList, nil]
83
83
  def tool_call_list
84
- tool_call_lists = messages.map(&:tool_call_list).compact
84
+ tool_call_lists = messages.filter(&:tool_call_list?).map(&:tool_call_list)
85
85
  return if tool_call_lists.empty?
86
86
 
87
87
  tool_call_lists.reduce(&:+)
@@ -42,6 +42,11 @@ module OmniAI
42
42
  "#<#{self.class.name} entries=#{@entries.inspect}>"
43
43
  end
44
44
 
45
+ # @return [Boolean]
46
+ def any?
47
+ @entries.any?
48
+ end
49
+
45
50
  # @yield toolcall
46
51
  # @yieldparam toolcall [ToolCall]
47
52
  def each(&)
data/lib/omniai/chat.rb CHANGED
@@ -112,7 +112,7 @@ module OmniAI
112
112
  raise SSLError, e.message, cause: e
113
113
  end
114
114
 
115
- if @tools && completion.tool_call_list?
115
+ if tools? && completion.tool_call_list?
116
116
  spawn!(
117
117
  @prompt.dup.tap do |prompt|
118
118
  prompt.messages += completion.messages
@@ -126,6 +126,11 @@ module OmniAI
126
126
 
127
127
  protected
128
128
 
129
+ # @return [Boolean]
130
+ def tools?
131
+ @tools&.any?
132
+ end
133
+
129
134
  # @return [Boolean]
130
135
  def stream?
131
136
  !@stream.nil?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OmniAI
4
- VERSION = "3.1.2"
4
+ VERSION = "3.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniai
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.2
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre