generator_call_logger¶
Classes
|
Log the generator calls. |
|
- class GeneratorCallRecord(prompt_kwargs: Dict[str, Any] = <factory>, model_kwargs: Dict[str, Any] = <factory>, input: Dict[str, Any] = <factory>, output: adalflow.core.types.GeneratorOutput = <factory>, metadata: Dict[str, Any] = <factory>, time_stamp: str = <factory>)[source]¶
Bases:
DataClass
- prompt_kwargs: Dict[str, Any]¶
- model_kwargs: Dict[str, Any]¶
- input: Dict[str, Any]¶
- output: GeneratorOutput¶
- metadata: Dict[str, Any]¶
- time_stamp: str¶
- class GeneratorCallLogger(save_dir: str | None = None, project_name: str | None = None)[source]¶
Bases:
object
Log the generator calls.
Allow multiple generators to be logged, and each with its own jsonl file.
The log files are stored in the ./traces/ directory. If a project_name is provided, it will be stored in ./traces/{project_name}.
- Parameters:
save_dir (str, optional) – The directory to save the log files. Defaults to “./traces/”.
project_name (str, optional) – The project name. Defaults to None.
- property generator_names_to_files: Dict[str, str]¶
- get_calls(name: str) List[GeneratorCallRecord] [source]¶
Get the generator call records for generator with name.
- register_generator(name: str, filename: str | None = None)[source]¶
Register a generator with a name and a jsonl file to log its calls.
- Parameters:
name (str) – The name of the generator.
filename (str, optional) – The jsonl filename to log the calls. Defaults to {name}_call.jsonl.
- load(name: str) List[GeneratorCallRecord] [source]¶
Load the generator call records.