Find answers from the community

Home
Members
jdcaballerov
j
jdcaballerov
Offline, last seen 2 weeks ago
Joined September 25, 2024
Is there any way to get tracebacks/detail logs on tool execution errors for an agent?


Plain Text
async def acall_tool(tool: BaseTool, arguments: dict) -> ToolOutput:
    """Call a tool with arguments asynchronously."""
    async_tool = adapt_to_async_tool(tool)
    try:
        if (
            len(tool.metadata.get_parameters_dict()["properties"]) == 1
            and len(arguments) == 1
        ):
            try:
                single_arg = arguments[next(iter(arguments))]
                return await async_tool.acall(single_arg)
            except Exception:
                # some tools will REQUIRE kwargs, so try it
                return await async_tool.acall(**arguments)
        else:
            return await async_tool.acall(**arguments)
    except Exception as e:
        return ToolOutput(
            content="Encountered error: " + str(e),
            tool_name=tool.metadata.name,
            raw_input=arguments,
            raw_output=str(e),
            is_error=True,
        )


Not raising might be handy when the agent can recover using the Exceptions as a mechanism to inform the LLM, but when real bugs strike, in more complex tools, this is super hard to debug.
I always end up monkeypatching to raise.
Does anybody know why (and how to turn it off) the FunctionCallingAgentWorker is returning the AgentChatResponse with the role assistan attached ? AgentChatResponse(response='assistant: Your agenda for I am properly finalizing the response. I used the OpenAIAgent and wanted to test direct response
2 comments
L
Hi there, what's the recommeded way to serialize ChatMessage . If a tool is called by an agent and a message is added to the memory a .json() wont work triggering TypeError: Object of type 'ChatCompletionMessageToolCall' is not JSON serializable I want to write subclass of BaseMemory backed with redis
24 comments
j
L
Hi, is it possible to use insert_nodes in VectorStoreIndex async it seems async is only possible using build_index_from_nodes is that correct?
4 comments
L
j
AFAIK what is needed from that dict is a mapping from the Vector Store chunk retrieved id to a BaseNode concretely in the example, an IndexNode
15 comments
L
j
s