async tool results

This commit is contained in:
2026-03-06 11:01:57 -07:00
parent 713b3a2ff0
commit aee7aa7b16
6 changed files with 126 additions and 55 deletions

View File

@@ -6,7 +6,8 @@ defmodule ElixirAi.ChatUtils do
name: name,
description: description,
function: function,
parameters: parameters
parameters: parameters,
server: server
) do
schema = %{
"type" => "function",
@@ -25,10 +26,18 @@ defmodule ElixirAi.ChatUtils do
}
}
run_function = fn current_message_id, tool_call_id, args ->
Task.start(fn ->
result = function.(args)
send(server, {:tool_response, current_message_id, tool_call_id, result})
end)
end
%{
name: name,
definition: schema,
function: function
# function: function,
run_function: run_function
}
end