Files
elixirAI/lib/elixir_ai/ai_tools/tool_testing.ex
Alex Mickelson 0041c25f19
Some checks failed
CI/CD Pipeline / build (push) Failing after 8s
refactoring folders
2026-03-25 12:05:56 -06:00

68 lines
1.3 KiB
Elixir

defmodule ElixirAi.ToolTesting do
use GenServer
def hold_thing(thing) do
GenServer.cast(__MODULE__, {:hold_thing, thing})
end
def hold_thing_params do
%{
"type" => "object",
"properties" => %{
"name" => %{"type" => "string"},
"value" => %{"type" => "string"}
},
"required" => ["name", "value"]
}
end
def get_thing(_) do
GenServer.call(__MODULE__, :get_thing)
end
def get_thing_params do
%{
"type" => "object",
"properties" => %{},
"required" => []
}
end
def store_thing_params do
%{
"type" => "object",
"properties" => %{
"name" => %{"type" => "string"},
"value" => %{"type" => "string"}
},
"required" => ["name", "value"]
}
end
def read_thing_definition(name) do
%{
"type" => "function",
"function" => %{
"name" => name,
"description" => "read key value pair that was previously stored with store_thing"
}
}
end
def start_link(_) do
GenServer.start_link(__MODULE__, %{}, name: __MODULE__)
end
def init(args) do
{:ok, args}
end
def handle_cast({:hold_thing, thing}, _state) do
{:noreply, thing}
end
def handle_call(:get_thing, _from, state) do
{:reply, state, state}
end
end