mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-19 15:55:20 +00:00
fix(prompt): preserve non-ASCII characters in tool specs serialization (#19942)
Use json.dumps with ensure_ascii=False to avoid converting Chinese descriptions into Unicode escape sequences. This makes logs easier to read and significantly improves LLM tool selection accuracy (from ~48% to ~67%) by preserving the original natural language context.
This commit is contained in:
parent
1c62be4406
commit
a1bde74e97
1 changed files with 1 additions and 1 deletions
|
|
@ -345,7 +345,7 @@ async def chat_completion_tools_handler(
|
|||
sources = []
|
||||
|
||||
specs = [tool["spec"] for tool in tools.values()]
|
||||
tools_specs = json.dumps(specs)
|
||||
tools_specs = json.dumps(specs, ensure_ascii=False)
|
||||
|
||||
if request.app.state.config.TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE != "":
|
||||
template = request.app.state.config.TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE
|
||||
|
|
|
|||
Loading…
Reference in a new issue