mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-31 17:27:42 +00:00
6b626eb56d
* Commit init framework * Co-authored-by: Yuante Li (FESCO Adecco Human Resources) <v-yuanteli@microsoft.com> Co-authored-by: XianBW <XianBW@users.noreply.github.com> * add an import * refine the whole framework * benchmark related framework * fix black and isort errors * move requirements to folder * fix black again --------- Co-authored-by: Young <afe.young@gmail.com> Co-authored-by: xuyang1 <xuyang1@microsoft.com>
20 lines
557 B
Python
20 lines
557 B
Python
from pathlib import Path
|
|
from typing import Dict
|
|
|
|
import yaml
|
|
|
|
from rdagent.core.utils import SingletonBaseClass
|
|
|
|
|
|
class Prompts(SingletonBaseClass, Dict[str, str]):
|
|
def __init__(self, file_path: Path) -> None:
|
|
with file_path.open(encoding="utf8") as file:
|
|
prompt_yaml_dict = yaml.safe_load(file)
|
|
|
|
if prompt_yaml_dict is None:
|
|
error_message = f"Failed to load prompts from {file_path}"
|
|
raise ValueError(error_message)
|
|
|
|
for key, value in prompt_yaml_dict.items():
|
|
self[key] = value
|