mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-29 08:27:43 +00:00
276b462f40
* fix_ruff_error1 * fix_ruff_error * fix ruff error * fix ruff error * pass model.py * rename exception class * rename exception class * rename func name generate_feedback * remove prepare args * optimize code * optimize code * fix code error
19 lines
556 B
Python
19 lines
556 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
|