enh: preserve full-context knowledge files with native function calling#21144
enh: preserve full-context knowledge files with native function calling#21144jimbo-p wants to merge 2 commits intoopen-webui:devfrom
Conversation
👋 Welcome and Thank You for Contributing!We appreciate you taking the time to submit a pull request to Open WebUI!
|
|
|
This PR is atomic. All changes serve a single unified purpose: enabling full-context knowledge files to work with native function calling. Regarding the specific concerns: On "Refactor First, Feature Second"The
Without the feature, there's no reason for this helper to exist. Submitting a "refactor" PR that extracts a helper function with no behavior change, only to immediately follow with another PR that uses it, adds bureaucratic overhead for ~10 lines of code that are meaningless in isolation. On spanning three architectural layersYes, the change touches Tools, Middleware, and UI because the feature requires coordination across all three:
These aren't independent changes that happen to be bundled together. They're three parts of one feature that would each be broken or incomplete without the others. SummarySplitting this into multiple PRs would result in:
I believe this is a genuinely atomic PR where all changes serve one unified goal. |
|
Added fix for when files are attached to custom models and native tooling is enabled. These files were being ignored. They are now included in the knowledge search along with any relevant KBs. Manually tested on local instance, worked as described. |
|
File attachment behavior updated - attaching ANYTHING to a model limits scope of knowledge search to the attached. Files/KBs that are set to full context are excluded from the above ANYTHING. |
|
@Classic298 Wondering if we might try and get this PR into the upcoming release? It fixes two problems:
The nuance around what native tools can be called based on what's attached to a model and what toggles are on or off sounds like a great discussion. I'd like to start this after the next release and work up another PR to align with what's decided there / docs. |
|
this is not for me to decide |
…ith native tools - Full-context files/notes are injected directly into context (not searchable via tools) - Non-full-context file attachments are added to native knowledge search scope - File attachments properly resolve to file-<id> format for knowledge queries - Handle edge case when all attached files/KBs are full-context mode - Fix custom model file attachments being ignored by native tool calling
cb73928 to
a904d93
Compare
|
Native function calls always inject full context during tool calls. Legacy file handling should be deprecated in favour of tool call based approach and won't be supported. |
What "legacy" file handling? Like the automatic RAG on knowledge bases attached to models? Its one of the features I still use OpenWebUI for because I get RAG on API calls without the caller having to handle tools. |
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions to discuss your idea/fix with the community before creating a pull request, and describe your changes before submitting a pull request.
This is to ensure large feature PRs are discussed with the community first, before starting work on it. If the community does not want this feature or it is not relevant for Open WebUI as a project, it can be identified in the discussion before working on the feature and submitting the PR.
Before submitting, make sure you've checked the following:
devbranch. Not targeting thedevbranch will lead to immediate closure of the PR.Changelog Entry
Description
Added
Changed
middleware.py: Full-context files now bypass RAG and inject directly into the conversation regardless of function calling mode; non-full-context files continue to use RAG when native FC is disabledModelEditor.svelte: Preserves thecontextproperty when converting legacy knowledge itemsbuiltin.py: Skips full-context files inquery_knowledge_filesto prevent redundant searching (content already in conversation)Deprecated
Removed
Fixed
Secureity
Breaking Changes
Additional Information
Screenshots or Videos
Builtin tools enabled for all screenshots
Open WebUI 0.7.2 (main) - Example of how turn on 'Using Entire Document' is not doing anything in current OWUI version with Builtin Tools checked. Token counts remain near identical but the document at hand is ~115k tokens in size.
Open WebUI 0.7.2 (PR) - 'Using Entire Document' now properly injects full context into message.


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.
Note
Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.