-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setup model routing config and plan routing to o1 #6189
Open
ryanhoangt
wants to merge
25
commits into
All-Hands-AI:main
Choose a base branch
from
ryanhoangt:o1-routing
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+519
−22
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
cec10a1
prototype
ryanhoangt fd1b4ec
Merge branch 'main' into o1-routing
ryanhoangt c33ba45
add routing config
ryanhoangt 7b08724
wire up with codeact and llm
ryanhoangt 910ba8c
fix bug
ryanhoangt b73f3ec
working cli
ryanhoangt 54d4401
update config template
ryanhoangt 06db2d6
use via ui
ryanhoangt b5973cd
remove dotenv
ryanhoangt e3c8a9e
update judge prompt
ryanhoangt 27a83db
update prompt
ryanhoangt 6f86ad9
update prompt
ryanhoangt ec2d162
adjust rule-based router
ryanhoangt 9bf5a7f
fix indentation
ryanhoangt 8e05f3f
use full trajectory
ryanhoangt ddc3248
refactor traj formatter and add tests
ryanhoangt 472d95c
add o1 to fn calling models
ryanhoangt fc5040c
Merge branch 'main' into o1-routing
ryanhoangt b8e58fd
Merge branch 'main' into o1-routing
ryanhoangt dbc2412
refactor to use llm objects
ryanhoangt ea4474d
fix bug
ryanhoangt b7a0c95
update config template
ryanhoangt 7d0132f
add gap control
ryanhoangt a70e979
working eval
ryanhoangt 6f729de
Merge branch 'main' into o1-routing
ryanhoangt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from pydantic import BaseModel, Field | ||
|
||
|
||
class ModelRoutingConfig(BaseModel): | ||
reasoning_llm_config_name: str = Field(default='reasoning_model') | ||
judge_llm_config_name: str = Field(default='judge_model') |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,7 @@ | |
'gpt-4o-mini', | ||
'gpt-4o', | ||
'o1-2024-12-17', | ||
'o1', | ||
'o3-mini-2025-01-31', | ||
'o3-mini', | ||
] | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from openhands.router.base import BaseRouter | ||
from openhands.router.plan.llm_based import LLMBasedPlanRouter | ||
|
||
__all__ = ['BaseRouter', 'LLMBasedPlanRouter'] |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might have here a little too much configurability 😅
It's perfectly fine if we reserve some names for our own features. So the names (of the llm configs) don't need to be configurable themselves, they mean what we say they mean.
We did that with
draft_llm
:We can reserve the names
reasoning_model
andreasoning_judge_model
for the reasoning model routing feature, and use them freely as necessary in the code. So we don't need these lines:That will also simplify the code below, starting from reading these configs in
llm_config.py
: I think we don't need to do anything there? They'll be read like any other named configs. And it will save us quite a bit of code complexity elsewhere too?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'm also feeling this, I'm implementing this and also think a bit about how to support the Notdiamond router one, where we can train a custom router on a set of selected LLMs and hence the llm config names are not fixed like the two above. But in this case indeed choosing a reserved name would make more sense, we probably don't need it to be configurable. I'll try to change that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I hear you, I'm thinking about Notdiamond too, and about the litellm option - there's a routing feature in litellm which we have tried twice in the past to use, and it proved too much complexity when it doesn't actually support one of the most important things we wanted from it (fallbacks/retries by reading the providers' retry-after headers). Maybe we will look again at it (3rd time's the charm?) or not.
Anyway, there seem to be two ways we can take on the idea of future routing:
max_size
, whatever, for some specialized condensers which really need a config of their own). Again, cross that last bridge when we come to it.OK, I started by saying there are two ways, but idk, maybe they're almost the same today. 😅
This routing feature, in this PR, does need to be enabled, so as long as it's enabled, it can do its thing IMHO.