mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-08 22:38:05 -05:00
[Refactor]: Add LLMRegistry for llm services (#9589)
Co-authored-by: openhands <openhands@all-hands.dev> Co-authored-by: Graham Neubig <neubig@gmail.com> Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
This commit is contained in:
@@ -157,13 +157,16 @@ class OpenHandsConfig(BaseModel):
|
||||
"""Get a map of agent names to llm configs."""
|
||||
return {name: self.get_llm_config_from_agent(name) for name in self.agents}
|
||||
|
||||
def get_llm_config_from_agent(self, name: str = 'agent') -> LLMConfig:
|
||||
agent_config: AgentConfig = self.get_agent_config(name)
|
||||
def get_llm_config_from_agent_config(self, agent_config: AgentConfig):
|
||||
llm_config_name = (
|
||||
agent_config.llm_config if agent_config.llm_config is not None else 'llm'
|
||||
)
|
||||
return self.get_llm_config(llm_config_name)
|
||||
|
||||
def get_llm_config_from_agent(self, name: str = 'agent') -> LLMConfig:
|
||||
agent_config: AgentConfig = self.get_agent_config(name)
|
||||
return self.get_llm_config_from_agent_config(agent_config)
|
||||
|
||||
def get_agent_configs(self) -> dict[str, AgentConfig]:
|
||||
return self.agents
|
||||
|
||||
|
||||
Reference in New Issue
Block a user