update
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
"""
|
||||
Execute the get_time tool.
|
||||
|
||||
# Arguments
|
||||
- `toolCallId::String`: Unique identifier for this tool call
|
||||
- `args::Dict{String,Any}`: Parsed arguments from the LLM
|
||||
- `signal::Union{Nothing,abortSignal}`: Optional abort signal
|
||||
- `onPartialResult::Function`: Callback for streaming partial results
|
||||
|
||||
# Returns
|
||||
- `agentToolResult`: Result content with current time
|
||||
"""
|
||||
function executeTool(toolCallId::String, args::Dict{String,Any}, signal::Union{Nothing,abortSignal}, onPartialResult::Function)::agentToolResult
|
||||
tz = get(args, "timezone", "local")
|
||||
|
||||
t = now()
|
||||
|
||||
if tz == "local"
|
||||
timeStr = string(t)
|
||||
else
|
||||
timeStr = string(t)
|
||||
end
|
||||
|
||||
return agentToolResult(
|
||||
[textContent("Current time: $(timeStr)")],
|
||||
Dict{Any,Any}(), nothing, false
|
||||
)
|
||||
end
|
||||
|
||||
"""
|
||||
Define and return the get_time agentTool.
|
||||
"""
|
||||
function getTool()::agentTool
|
||||
return agentTool(
|
||||
name = "get_time",
|
||||
label = "Get Current Time",
|
||||
description = "Get the current date and time.",
|
||||
inputSchema = Dict{String,Any}(
|
||||
"type" => "object",
|
||||
"properties" => Dict(
|
||||
"timezone" => Dict("type" => "string", "description" => "Timezone (currently only 'local' is supported)")
|
||||
),
|
||||
"required" => []
|
||||
),
|
||||
execute = executeTool,
|
||||
prepareArguments = nothing,
|
||||
parallelToolExecute = false
|
||||
)
|
||||
end
|
||||
Reference in New Issue
Block a user