Skip to content

Commit

Permalink
Fix bug in tool call list
Browse files Browse the repository at this point in the history
  • Loading branch information
ksylvest committed Jul 12, 2024
1 parent 2609e34 commit f5270f9
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
omniai (1.5.1)
omniai (1.5.2)
event_stream_parser
http
zeitwerk
Expand Down
2 changes: 1 addition & 1 deletion lib/omniai/chat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def parse!(response:)
def complete!(response:)
completion = self.class::Response::Completion.new(data: response.parse)

if @tools && completion.tool_call_required?
if @tools && completion.tool_call_list.any?
@messages = [
*@messages,
*completion.choices.map(&:message).map(&:data),
Expand Down
5 changes: 0 additions & 5 deletions lib/omniai/chat/response/choice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ def tool_call_list
part.tool_call_list
end

# @return [Boolean]
def tool_call_list?
tool_call_list.any?
end

# @return [String, nil]
def content
part.content
Expand Down
5 changes: 0 additions & 5 deletions lib/omniai/chat/response/payload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ def content?
def tool_call_list
choice.tool_call_list
end

# @return [Boolean]
def tool_call_list?
choice.tool_call_list?
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/omniai/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module OmniAI
VERSION = '1.5.1'
VERSION = '1.5.2'
end

0 comments on commit f5270f9

Please sign in to comment.