MCPcopy Create free account
hub / github.com/Eladlev/AutoPrompt / sample_to_text

Method sample_to_text

eval/evaluator.py:91–102  ·  view source on GitHub ↗

Return a string that organize the information of from the step run for the meta-prompt :param sample: The eval information for specific step :param num_errors_per_label: The max number of large errors per class that will appear in the meta-prompt :param is_score: If

(self, sample: dict, num_errors_per_label: int = 0, is_score: bool = True)

Source from the content-addressed store, hash-verified

89 return txt_res
90
91 def sample_to_text(self, sample: dict, num_errors_per_label: int = 0, is_score: bool = True) -> str:
92 """
93 Return a string that organize the information of from the step run for the meta-prompt
94 :param sample: The eval information for specific step
95 :param num_errors_per_label: The max number of large errors per class that will appear in the meta-prompt
96 :param is_score: If True, add the score information to the meta-prompt
97 :return: A string that contains the information of the step run
98 """
99 if is_score:
100 return f"####\n##Prompt Score: {sample['score']:.2f}\n##Prompt:\n{sample['prompt']}\n#################\n"
101 else:
102 return f"####\n##Prompt:\n{sample['prompt']}\n{self.large_error_to_str(sample['errors'], num_errors_per_label)}####\n "
103
104 def add_history(self, prompt: str, task_description: str):
105 """

Callers 1

run_step_promptMethod · 0.80

Calls 1

large_error_to_strMethod · 0.95

Tested by

no test coverage detected