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

Customize LLM config per agent #2756

Merged
merged 39 commits into from
Jul 10, 2024

Conversation

li-boxuan
Copy link
Collaborator

@li-boxuan li-boxuan commented Jul 3, 2024

Intro

Currently, OpenDevin uses a global singleton LLM config and a global singleton agent config. This PR allows customers to configure an LLM config for each agent. A hypothetically useful scenario is to use a cheaper LLM for repo exploration / code search, and a more powerful LLM to actually do the problem solving (CodeActAgent).

Partially solves #2075 (web GUI improvement is not the goal of this PR)

Breaking changes

Documented in changelog.md

Demo

How the new config.yaml looks like can be found in config.template.toml or test_config.py in this PR

Task: "Use browser to find out how many stars OpenDevin has on GitHub", default agent: "CodeActAgent", default model: "gpt-4-turbo"

Screenshot 2024-07-06 at 9 50 01 PM

From the backend log we can see:

21:48:41 - opendevin:INFO: agent.py:96 - Creating agent CodeActAgent using LLM gpt-4-turbo
21:48:41 - opendevin:INFO: llm.py:137 - Initializing LLM with model: gpt-4-turbo
...
AgentDelegateAction(agent='BrowsingAgent', inputs={'task': 'Sure! Let me browse GitHub to find out how many stars the OpenDevin repository has.. I should start with: Tell me how many stars OpenDevin has on GitHub using google search'}, thought='', action='delegate')
21:49:03 - opendevin:INFO: llm.py:137 - Initializing LLM with model: gpt-4o
21:49:03 - opendevin:INFO: agent_controller.py:239 - [Agent Controller d271d157-ae0b-4420-a55d-d5330d6fd8b6]: start delegate, creating agent BrowsingAgent using LLM LLM(model=gpt-4o)

opendevin/core/config.py Outdated Show resolved Hide resolved
@enyst
Copy link
Collaborator

enyst commented Jul 3, 2024

Great to see this! goes back under a rock

@li-boxuan li-boxuan changed the title (WIP) Customize LLM config per agent Customize LLM config per agent Jul 6, 2024
@li-boxuan
Copy link
Collaborator Author

I am still polishing this PR but it's basically ready for review.

@li-boxuan li-boxuan marked this pull request as ready for review July 6, 2024 23:27
Copy link
Contributor

@neubig neubig left a comment

Choose a reason for hiding this comment

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

Basically LGTM, thanks for doing this! Just a few comments about printing/logging, but happy to merge this in after that.

config.template.toml Outdated Show resolved Hide resolved
opendevin/controller/agent_controller.py Outdated Show resolved Hide resolved
opendevin/core/config.py Outdated Show resolved Hide resolved
@li-boxuan li-boxuan requested a review from enyst July 7, 2024 07:32
config.template.toml Outdated Show resolved Hide resolved
@enyst
Copy link
Collaborator

enyst commented Jul 8, 2024

I didn't get to play with it yet, and it's not fully clear to me, about breaking changes, what exactly are the old options that no longer work. llm_configs with random names, right?

I'd appreciate a list of not working stuff 🤔, because I saw you added compatibility code, and it seems to me that older compatibility code will also continue to work.

If you have only been using OpenDevin via frontend (web GUI), nothing needs
to be taken care of.

Here's a list of breaking changes in configs. They only apply to customers who
Copy link
Collaborator

Choose a reason for hiding this comment

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

s/customers/users

@enyst
Copy link
Collaborator

enyst commented Jul 9, 2024

Thanks for adding documentation on the breaking changes. I admit I'm heavily in favor of keeping compatibility as much as possible here, but this looks very good to me: most continue to be compatible, docker app not affected, and I think the couple of cli vars remaining will be okay in exchange. This PR is adding a flexibility that was long due and long requested.

Thank you for this. ❤️

@tobitege
Copy link
Collaborator

tobitege commented Jul 9, 2024

Awesome job! Long overdue, brings a lot of flexibility! Thanks! 🏅

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.

4 participants