diff --git a/src/agents/FluidAgent.jl b/src/agents/FluidAgent.jl index a9e817d..0a41bf8 100644 --- a/src/agents/FluidAgent.jl +++ b/src/agents/FluidAgent.jl @@ -144,7 +144,6 @@ function work(agent::FluidAgent, conv; cache, io=stdout, tool_kwargs=Dict() ) - # Collect unique stop sequences from tools stop_sequences = unique(String[stop_sequence(tool) for tool in agent.tools if has_stop_sequence(tool)]) @@ -171,7 +170,6 @@ function work(agent::FluidAgent, conv; cache, cb = create(StreamCallbackTYPE(; io, on_start, on_error, highlight_enabled, process_enabled, on_done = () -> begin - # Extracts tools in case anything is unclosed process_enabled && extract_tool_calls("\n", extractor, io; kwargs=tool_kwargs, is_flush=true) on_done() end, @@ -211,9 +209,10 @@ function work(agent::FluidAgent, conv; cache, catch e e isa InterruptException && rethrow(e) # display(catch_backtrace()) - @error "Error executing code block:" exception=(e, catch_backtrace()) + @error "Error in fluidagent work" exception=(e, catch_backtrace()) on_error(e) - content = "Error: $(sprint(showerror, e))\n\nStacktrace: $(sprint(show, catch_backtrace(e)))" + + content = "Error: $(sprint(showerror, e))\n\nStacktrace:\n$(join(string.(stacktrace(catch_backtrace())), "\n"))" push_message!(conv, create_AI_message(content)) return (; content, diff --git a/src/tools/ToolInterface.jl b/src/tools/ToolInterface.jl index afe91c3..6c558bf 100644 --- a/src/tools/ToolInterface.jl +++ b/src/tools/ToolInterface.jl @@ -58,7 +58,7 @@ is_cancelled(tool::AbstractTool) = false """ Usually stop_sequence and toolname are static for type """ -toolname(tool::Type{<:AbstractTool})::String = (@warn "Unimplemented \"toolname\" for $(tool)"; return "") +toolname(tool::Type{<:AbstractTool})::String = (@warn "Unimplemented \"toolname\" for $(tool) $(stacktrace())"; return "") toolname(tool::AbstractTool)::String = toolname(typeof(tool)) stop_sequence(::Type{<:AbstractTool})::String = (@warn "Unimplemented \"stop_sequence\" for $(typeof(tool))"; return "") stop_sequence(tool::AbstractTool)::String = stop_sequence(typeof(tool))