Commit 1061f33
lib/elelem/net/claude.rb
@@ -84,7 +84,7 @@ module Elelem
tool_calls.each do |tool_call|
args = tool_call.delete(:args)
tool_call[:arguments] = args.empty? ? {} : JSON.parse(args)
- block.call(type: "tool_call", id: tool_call[:id], name: tool_call[:name], arguments: tool_call[:arguments])
+ block.call(type: "doing", id: tool_call[:id], name: tool_call[:name], arguments: tool_call[:arguments])
end
tool_calls
end
lib/elelem/net/ollama.rb
@@ -41,7 +41,7 @@ module Elelem
if message["tool_calls"]
parsed = parse_tool_calls(message["tool_calls"])
- parsed.each { |tc| block.call(type: "tool_call", **tc) }
+ parsed.each { |tc| block.call(type: "doing", **tc) }
tool_calls.concat(parsed)
end
end
lib/elelem/net/openai.rb
@@ -74,13 +74,11 @@ module Elelem
def finalize_tool_calls(tool_calls, &block)
tool_calls.values.map do |tool_call|
- result = {
+ {
id: tool_call[:id],
name: tool_call[:name],
arguments: JSON.parse(tool_call[:args])
- }
- block.call(type: "tool_call", **result)
- result
+ }.tap { |result| block.call(result.merge(type: "doing")) }
end
end
end
lib/elelem/agent.rb
@@ -78,7 +78,7 @@ module Elelem
content << event[:text].to_s
when "thinking"
terminal.print(terminal.think(event[:text]))
- when "tool_call"
+ when "doing"
tool_calls << { id: event[:id], name: event[:name], arguments: event[:arguments] }
end
end