in 3_optimization-design-ptn/03_prompt-optimization/promptwizard/glue/paramlogger/__init__.py [0:0]
def log_io_params_for_method(self, method_obj):
"""
Execute the method referenced by method_obj. After executing, log the inputs and outputs of that method to
log file. Name of log file would be the method name
:param method_obj: Method reference, that can be executed
:return: None
"""
def wrap(*argv, **kwargs):
args_to_log = run_method_get_io_dict(method_obj, self.DEL_SELF_ARG, *argv, **kwargs)
if not self.SAMPLE_UNQ_ID:
self.SAMPLE_UNQ_ID = uuid4()
args_to_log[LogLiterals.ID] = self.SAMPLE_UNQ_ID
file_path = join(self.BASE_PATH, method_obj.__name__+".jsonl")
futil.append_as_jsonl(file_path=file_path, args_to_log=args_to_log)
self.SAMPLE_UNQ_ID = None
return args_to_log[LogLiterals.OUTPUTS]
return wrap