File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 11# Copyright (c) Alibaba, Inc. and its affiliates.
22import importlib
33import inspect
4+ import os
45import sys
56from abc import abstractmethod
67from typing import Dict , List , Optional , Union
1011from ms_agent .llm import Message
1112from omegaconf import DictConfig
1213
14+ DEFAULT_YAML = os .path .join (
15+ os .path .dirname (os .path .abspath (__file__ )), 'agent.yaml' )
16+
1317
1418class Agent :
1519 """
@@ -37,10 +41,13 @@ def __init__(self,
3741 env : Optional [Dict [str , str ]] = None ,
3842 tag : Optional [str ] = None ,
3943 trust_remote_code : bool = False ):
40- if config_dir_or_id is None :
44+ if config_dir_or_id is not None :
45+ self .config : DictConfig = Config .from_task (config_dir_or_id , env )
46+ elif config is not None :
4147 self .config : DictConfig = config
4248 else :
43- self .config : DictConfig = Config .from_task (config_dir_or_id , env )
49+ self .config : DictConfig = Config .from_task (DEFAULT_YAML )
50+
4451 if tag is None :
4552 self .tag = getattr (config , 'tag' , None ) or self .DEFAULT_TAG
4653 else :
Original file line number Diff line number Diff line change 2424from .plan .utils import planer_mapping
2525from .runtime import Runtime
2626
27- DEFAULT_YAML = os .path .join (
28- os .path .dirname (os .path .abspath (__file__ )), 'agent.yaml' )
29-
3027
3128class LLMAgent (Agent ):
3229 """
@@ -51,7 +48,7 @@ class LLMAgent(Agent):
5148 DEFAULT_SYSTEM = 'You are a helpful assistant.'
5249
5350 def __init__ (self ,
54- config_dir_or_id : Optional [str ] = DEFAULT_YAML ,
51+ config_dir_or_id : Optional [str ] = None ,
5552 config : Optional [DictConfig ] = None ,
5653 env : Optional [Dict [str , str ]] = None ,
5754 ** kwargs ):
You can’t perform that action at this time.
0 commit comments