opto.optimizers.opro_v2¶
OPROPromptSymbolSet ¶
Bases: OptimizerPromptSymbolSet
problem_context_section_title
class-attribute
instance-attribute
¶
ProblemInstance
dataclass
¶
ProblemInstance(
instruction: str,
variables: str,
feedback: str,
optimizer_prompt_symbol_set: OPROPromptSymbolSet,
)
problem_template
class-attribute
instance-attribute
¶
problem_template = dedent(
"\n # Problem Context\n {instruction}\n\n # Solution\n {variables}\n\n # Feedback\n {feedback}\n "
)
OPROv2 ¶
OPROv2(
*args,
optimizer_prompt_symbol_set: OptimizerPromptSymbolSet = None,
include_example=False,
memory_size=5,
**kwargs
)
Bases: OptoPrimeV2
representation_prompt
class-attribute
instance-attribute
¶
representation_prompt = dedent(
"\n You're tasked to change the proposed solution according to feedback.\n\n Specifically, a problem will be composed of the following parts:\n - {instruction_section_title}: the instruction which describes the things you need to do or the question you should answer.\n - {variables_section_title}: the proposed solution that you can change/tweak (trainable).\n - {feedback_section_title}: the feedback about the solution.\n\n If `data_type` is `code`, it means `{value_tag}` is the source code of a python code, which may include docstring and definitions.\n "
)
output_format_prompt_template
class-attribute
instance-attribute
¶
output_format_prompt_template = dedent(
"\n Output_format: Your output should be in the following XML/HTML format:\n\n ```\n {output_format}\n ```\n\n In <{reasoning_tag}>, explain the problem: 1. what the {instruction_section_title} means 2. what the {feedback_section_title} means to {variables_section_title} considering how {variables_section_title} follow {instruction_section_title}. 3. Reasoning about the suggested changes in {variables_section_title} (if needed) and the expected result.\n\n If you need to suggest a change in the values of {variables_section_title}, write down the suggested values in <{improved_variable_tag}>. Remember you can change only the values in {variables_section_title}, not others. When `type` of a variable is `code`, you should write the new definition in the format of python code without syntax errors, and you should not change the function name or the function signature.\n\n If no changes are needed, just output TERMINATE.\n "
)
user_prompt_template
class-attribute
instance-attribute
¶
user_prompt_template = dedent(
"\n Now you see problem instance:\n\n ================================\n {problem_instance}\n ================================\n\n "
)