Skip to content
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
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

ryanhoangt
Copy link
Contributor

@ryanhoangt ryanhoangt commented Jan 10, 2025

End-user friendly description of the problem this fixes or functionality that this introduces

  • Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below

Give a summary of what the PR does, explaining any non-trivial design decisions

This PR is to:

  • Setup config for model routing-related features.
  • Implement a prototype for routing to reasoning models if appropriate. The criteria are based on this paper.
Screenshot 2025-01-10 at 17 22 40

Link of any specific issues this addresses

Copy link
Collaborator

@xingyaoww xingyaoww left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! This is a great start for model routing and LGTM!

Router that routes the prompt that is judged by a LLM as complex and requires a step-by-step plan.
"""

JUDGE_MODEL = 'gpt-4o'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be interesting to see if we can experiment with cheaper model for that 🤔

* Translating high-level requirements into detailed implementation steps and ensuring consistency.

=== BEGIN USER MESSAGE ===
{message}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also experiment sending O1 with the last 5/10 action/observation 🤔 in case there's some deep reasoning required to figure out the error, etc.

)

# Replace the model with the reasoning model
kwargs['model'] = self.model_routing_config.reasoning_model
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is model enough, or also: custom provider, base URL?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could design the reasoning model not as a part of an LLM instance, but as a second LLM instance in the agent?

[model_routing]

# The reasoning model to use for plan generation
reasoning_model = "o1-preview-2024-09-12"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
reasoning_model = "o1-preview-2024-09-12"
[llm.reasoning_model]
model = "o1-preview-2024-09-12"
...

Copy link
Collaborator

@enyst enyst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm so happy to see this, thank you! I do think we are missing some minimal framework to experiment with reasoning models.

About the way to choose another model:
We already have the ability to choose, configure, and use a random model, for example in evals: we can write the model configuration in toml, in a custom named LLM config section, [llm.o1], load it with an utility function, and instantiate an LLM from it.

We can use that here. Names are user-defined, and we can, if we want, set in stone a particular name for the reasoning model, e.g. [llm.reasoning_model], or [llm.oh_reasoning_model], or [llm.blueberry] (or strawberry for that matter), whatever name.

@@ -0,0 +1,42 @@
ANALYZE_PROMPT = """Analyze this prompt to see if it requires a detailed plan generation.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit curious, is this prompt handmade, is it llm-generated, or what is the source of this prompt?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants