mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 11:28:35 -05:00
[PR #20705] [MERGED] fix: coerce LLM tool call parameters to correct types in knowledge query #48787
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/20705
Author: @Classic298
Created: 1/15/2026
Status: ✅ Merged
Merged: 1/15/2026
Merged by: @tjbck
Base:
dev← Head:fix-int📝 Commits (1)
1e0ab1dUpdate builtin.py📊 Changes
1 file changed (+19 additions, -0 deletions)
View changed files
📝
backend/open_webui/tools/builtin.py(+19 -0)📄 Description
fix: coerce LLM tool call parameters to correct types in knowledge query
Description
Fixes an issue where knowledge base queries would intermittently fail with "slice indices must be integers" errors.
Root Cause: When the LLM makes tool calls to query_knowledge_files, it sometimes formats parameters as strings instead of their proper types:
This caused the slice operation in merge_and_sort_query_results to fail since you cannot slice a list with a string index.
Fix: Added type coercion at the start of query_knowledge_files to:
Closes #20704
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.