This repository was archived by the owner on Jun 5, 2025. It is now read-only.
Add mux rules for match according to file and request type#968
Merged
aponcedeleonch merged 1 commit intomainfrom Feb 7, 2025
Merged
Add mux rules for match according to file and request type#968aponcedeleonch merged 1 commit intomainfrom
aponcedeleonch merged 1 commit intomainfrom
Conversation
peppescg
previously approved these changes
Feb 6, 2025
Contributor
peppescg
left a comment
There was a problem hiding this comment.
amazing 🚀
Correct me if I am wrong, this should backward compatible with the current production API right? so if we merge it, without adding the new related UI part, it should works as well.
Member
Author
|
@peppescg yes, that's correct :) |
Closes: #885 and #944 This PR introduces the necessary changes for: 1. Muxing to match on a specific filename (`main.py`) or file type (`.py`) 2. Muxing on a specific request type, i.e. chat or FIM The matching is tightly coupled with the priority of the muxing rules. A match will occur on the first possible rule. Example: Muxing rule 1 -> match all `.py` files -> go to `chat-gpt` Muxing rule 2 -> match all `.md` files -> go to `ollama` If in a request we recieve a `README.md` and a `main.py` file the request will be routed to `chat-gpt` since it's the match with the highest priority in the list. To introduce above changes there were some minor changes: 1. Separate FIM detection into its own class. Before it used to be part of `BaseProvider` 2. Detect if a request is FIM or not before calling `process_request` method. Both of them were necessary in order to re-use the logic to create the matcher for request type
339608f to
98cc17f
Compare
JAORMX
approved these changes
Feb 7, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: #885 and #944
This PR introduces the necessary changes for:
main.py) or file type (.py)The matching is tightly coupled with the priority of the muxing rules. A match will occur on the first possible rule.
Example:
.pyfiles -> go tochat-gpt.mdfiles -> go toollamaIf in a request we recieve a
README.mdand amain.pyfile the request will be routed tochat-gptsince it's the match with the highest priority in the list.To introduce above changes there were some minor changes:
BaseProviderprocess_requestmethod.Both of them were necessary in order to re-use the logic to create the matcher for request type