mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-08 15:05:17 +02:00
add with_model to BaseLLM
This commit is contained in:
parent
e783e5b208
commit
e40fc66f98
1 changed files with 6 additions and 1 deletions
|
|
@ -39,7 +39,7 @@ class BaseLLM(ABC):
|
|||
# OpenAI / Azure / Others
|
||||
aclient: Optional[Union[AsyncOpenAI]] = None
|
||||
cost_manager: Optional[CostManager] = None
|
||||
model: Optional[str] = None
|
||||
model: Optional[str] = None # deprecated
|
||||
pricing_plan: Optional[str] = None
|
||||
|
||||
@abstractmethod
|
||||
|
|
@ -231,3 +231,8 @@ class BaseLLM(ABC):
|
|||
def messages_to_dict(self, messages):
|
||||
"""objects to [{"role": "user", "content": msg}] etc."""
|
||||
return [i.to_dict() for i in messages]
|
||||
|
||||
def with_model(self, model: str):
|
||||
"""Set model and return self. For example, `with_model("gpt-3.5-turbo")`."""
|
||||
self.config.model = model
|
||||
return self
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue