MCPcopy Create free account
hub / github.com/modelscope/ms-agent / load_base_config

Function load_base_config

ms_agent/tools/search_engine.py:50–74  ·  view source on GitHub ↗

Load the base configuration from a YAML file. Args: file_path (str): Path to the YAML configuration file. Returns: Dict[str, Any]: The loaded configuration as a dictionary.

(file_path: str)

Source from the content-addressed store, hash-verified

48
49
50def load_base_config(file_path: str) -> Dict[str, Any]:
51 """
52 Load the base configuration from a YAML file.
53
54 Args:
55 file_path (str): Path to the YAML configuration file.
56
57 Returns:
58 Dict[str, Any]: The loaded configuration as a dictionary.
59 """
60 # Load environment variables from .env file if it exists
61 if not load_dotenv(os.path.join(os.getcwd(), '.env')):
62 Env.load_env()
63
64 if not os.path.exists(file_path):
65 logger.warning(
66 f'Config file {file_path} does not exist. Using default config (ArxivSearch).'
67 )
68 return {}
69
70 import yaml
71 with open(file_path, 'r') as file:
72 config = yaml.safe_load(file)
73
74 return process_dict(config)
75
76
77def process_dict(config: Dict[str, Any]) -> Dict[str, Any]:

Callers 1

get_search_configFunction · 0.85

Calls 2

process_dictFunction · 0.85
load_envMethod · 0.80

Tested by

no test coverage detected