Reads the yaml file and enrich it with more vales. :param yaml_path: The path to the yaml file :param as_edict: If True, returns an EasyDict configuration :return: An EasyDict configuration
(yaml_path: str, as_edict: bool = True)
| 67 | |
| 68 | |
| 69 | def load_yaml(yaml_path: str, as_edict: bool = True) -> edict: |
| 70 | """ |
| 71 | Reads the yaml file and enrich it with more vales. |
| 72 | :param yaml_path: The path to the yaml file |
| 73 | :param as_edict: If True, returns an EasyDict configuration |
| 74 | :return: An EasyDict configuration |
| 75 | """ |
| 76 | with open(yaml_path, 'r') as file: |
| 77 | yaml_data = yaml.safe_load(file) |
| 78 | if 'meta_prompts' in yaml_data.keys() and 'folder' in yaml_data['meta_prompts']: |
| 79 | yaml_data['meta_prompts']['folder'] = Path(yaml_data['meta_prompts']['folder']) |
| 80 | if as_edict: |
| 81 | yaml_data = edict(yaml_data) |
| 82 | return yaml_data |
| 83 | |
| 84 | |
| 85 | def load_prompt(prompt_path: str) -> PromptTemplate: |
no outgoing calls
no test coverage detected