Description
Problem Description
Currently, when invoking the Large Language Model (LLM) for Tool Calling, the system does not properly handle exceptions if the model returns an empty tool_name.
Once this occurs, the entire chat session is abnormally blocked. Users cannot send further messages or receive any responses. The only current workaround is for users to manually open the local crush.db database and delete the corrupted record, which severely damages the user experience.
Proposed Solution
It is recommended to validate the tool_name returned from the tool call at the code level. When an empty tool_name is detected, the system should:
- Trigger an automatic retry mechanism (re-send the request to the LLM) with a maximum retry limit (e.g., 2–3 times).
- If the retries still fail, elegantly display an error message like "Tool call failed, please try again" on the frontend UI, rather than letting the backend crash, create dirty database records, and freeze the app.
Steps to Reproduce
- Start a conversation that triggers Tool Calling / Function Calling.
- The LLM responds with an empty
tool_name field (possibly due to model hallucination or network truncation).
- The session freezes immediately, and all subsequent interactions become unresponsive.
- Users must manually access the
crush.db database and delete the invalid entry to restore functionality.
Expected Behavior
Even if the LLM returns an invalid or empty tool name, the system should be robust enough to handle it. It should maintain session continuity through automatic retries or graceful degradation, eliminating the need for users to manually modify the database.
Description
Problem Description
Currently, when invoking the Large Language Model (LLM) for Tool Calling, the system does not properly handle exceptions if the model returns an empty
tool_name.Once this occurs, the entire chat session is abnormally blocked. Users cannot send further messages or receive any responses. The only current workaround is for users to manually open the local
crush.dbdatabase and delete the corrupted record, which severely damages the user experience.Proposed Solution
It is recommended to validate the
tool_namereturned from the tool call at the code level. When an emptytool_nameis detected, the system should:Steps to Reproduce
tool_namefield (possibly due to model hallucination or network truncation).crush.dbdatabase and delete the invalid entry to restore functionality.Expected Behavior
Even if the LLM returns an invalid or empty tool name, the system should be robust enough to handle it. It should maintain session continuity through automatic retries or graceful degradation, eliminating the need for users to manually modify the database.