Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Rework --llm-config CLI arg (#2957)

Boxuan Lie3e437fcc221
diff --git a/opendevin/core/config.py b/opendevin/core/config.py
index 73532cac4d..7b65a04725 100644
--- a/opendevin/core/config.py
+++ b/opendevin/core/config.py
@@ -656,7 +656,7 @@ def get_parser() -> argparse.ArgumentParser:
'--llm-config',
default=None,
type=str,
- help='The group of llm settings, e.g. "llama3" for [llm.llama3] section in the toml file. Overrides model if both are provided.',
+ help='Replace default LLM ([llm] section in config.toml) config with the specified LLM config, e.g. "llama3" for [llm.llama3] section in config.toml',
)
return parser
diff --git a/opendevin/core/main.py b/opendevin/core/main.py
index 76f5276082..4d6177b85e 100644
--- a/opendevin/core/main.py
+++ b/opendevin/core/main.py
@@ -157,14 +157,13 @@ if __name__ == '__main__':
else:
raise ValueError('No task provided. Please specify a task through -t, -f.')
- # Figure out the LLM config
+ # Override default LLM configs ([llm] section in config.toml)
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is None:
raise ValueError(f'Invalid toml file, cannot read {args.llm_config}')
- llm = LLM(llm_config=llm_config)
- else:
- llm = LLM(llm_config=config.get_llm_config_from_agent(args.agent_cls))
+ config.set_llm_config(llm_config)
+ llm = LLM(llm_config=config.get_llm_config_from_agent(args.agent_cls))
# Create the agent
AgentCls: Type[Agent] = Agent.get_cls(args.agent_cls)
diff --git a/tests/unit/test_arg_parser.py b/tests/unit/test_arg_parser.py
index a56f89921a..2e2aed38c8 100644
--- a/tests/unit/test_arg_parser.py
+++ b/tests/unit/test_arg_parser.py
@@ -41,9 +41,9 @@ options:
--eval-note EVAL_NOTE
The note to add to the evaluation directory
-l LLM_CONFIG, --llm-config LLM_CONFIG
- The group of llm settings, e.g. "llama3" for
- [llm.llama3] section in the toml file. Overrides model
- if both are provided.
+ Replace default LLM ([llm] section in config.toml)
+ config with the specified LLM config, e.g. "llama3"
+ for [llm.llama3] section in config.toml
"""
actual_lines = captured.out.strip().split('\n')