Skip to content

Commit fc5cfa8

Browse files
Implement configuration loading for YAML files
This module provides functions to load YAML configuration files for models, prompts, and logging. Signed-off-by: Fabiana ⚡️ Campanari <113218619+FabianaCampanari@users.noreply.github.com>
1 parent cf61acc commit fc5cfa8

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

config/__init__.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"""Configuration package for LLM Tabular Preprocessing.
2+
3+
Loads YAML configuration files for models, prompts, and logging.
4+
"""
5+
6+
import yaml
7+
from pathlib import Path
8+
from typing import Dict, Any
9+
10+
CONFIG_DIR = Path(__file__).parent
11+
12+
def load_yaml(filename: str) -> Dict[str, Any]:
13+
"""Load YAML configuration file.
14+
15+
Args:
16+
filename: Name of YAML file (e.g., 'model_config.yaml')
17+
18+
Returns:
19+
Dictionary with configuration
20+
"""
21+
filepath = CONFIG_DIR / filename
22+
if not filepath.exists():
23+
raise FileNotFoundError(f"Configuration file not found: {filepath}")
24+
25+
with open(filepath, 'r') as f:
26+
return yaml.safe_load(f)
27+
28+
def get_model_config() -> Dict[str, Any]:
29+
"""Load model configuration"""
30+
return load_yaml('model_config.yaml')
31+
32+
def get_prompt_templates() -> Dict[str, Any]:
33+
"""Load prompt templates"""
34+
return load_yaml('prompt_templates.yaml')
35+
36+
def get_logging_config() -> Dict[str, Any]:
37+
"""Load logging configuration"""
38+
return load_yaml('logging_config.yaml')
39+
40+
__all__ = ['load_yaml', 'get_model_config', 'get_prompt_templates', 'get_logging_config']

0 commit comments

Comments
 (0)