generator_state_logger#
Classes
|
Log the generator states especially the prompt states update history to a file. |
|
- class GeneratorStatesRecord(prompt_states: Dict[str, Any] = <factory>, time_stamp: str = <factory>)[source]#
Bases:
DataClass
- prompt_states: Dict[str, Any]#
- time_stamp: str#
- class GeneratorStateLogger(save_dir: str | None = None, project_name: str | None = None, filename: str | None = None)[source]#
Bases:
object
Log the generator states especially the prompt states update history to a file.
Each generator should has its unique and identifiable name to be logged. One file can log multiple generators’ states.
We use _trace_map to store the states and track any changes and updates and save it to a file.
- Parameters:
save_dir (str, optional) – The directory to save the trace file. Default is “./traces/”
project_name (str, optional) – The project name. Default is None.
filename (str, optional) – The file path to save the trace. Default is “generator_state_trace.json”
- property generator_names#