Files
NexQuant/rdagent/core/prompts.py
T
Xu Yang 1e77557293 factor extraction pipeline ready (#16)
* run the code

* update code

* remove some redundant code

---------

Co-authored-by: xuyang1 <xuyang1@microsoft.com>
2024-06-05 15:36:15 +08:00

23 lines
567 B
Python

from pathlib import Path
from typing import Dict
import yaml
from rdagent.core.utils import SingletonBaseClass
class Prompts(Dict, SingletonBaseClass):
def __init__(self, file_path: Path):
prompt_yaml_dict = yaml.load(
open(
file_path,
encoding="utf8",
),
Loader=yaml.FullLoader,
)
if prompt_yaml_dict is None:
raise ValueError(f"Failed to load prompts from {file_path}")
for key, value in prompt_yaml_dict.items():
self[key] = value