File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 77# Suppress Pydantic serialization warnings from litellm
88warnings .filterwarnings ("ignore" , message = "Pydantic serializer warnings" )
99
10- from easyagent .config .base import is_debug
10+ from easyagent .config .base import ModelConfig , is_debug
1111from easyagent .debug .log import Color , Logger
1212from easyagent .model .base import BaseLLM
1313from easyagent .model .schema import LLMResponse , ToolCall
1717
1818class LiteLLMModel (BaseLLM ):
1919 def __init__ (self , model : str , ** kwargs ):
20- self ._model = model
21- self ._kwargs = kwargs
20+ model_cfg = self ._load_model_config (model )
21+ self ._model = model_cfg .pop ("model" )
22+ self ._kwargs = {** model_cfg , ** kwargs }
23+
24+ @staticmethod
25+ def _load_model_config (model : str ) -> dict [str , Any ]:
26+ try :
27+ return ModelConfig .load ().get_model (model )
28+ except (FileNotFoundError , KeyError ):
29+ # config 不存在或模型未配置,直接使用原始模型名
30+ return {"model" : model }
2231
2332 async def call (
2433 self ,
You can’t perform that action at this time.
0 commit comments