Skip to content

opto.optimizers.opro

OPRO

OPRO(*args, **kwargs)

Bases: OptoPrime

user_prompt_template class-attribute instance-attribute

user_prompt_template = dedent(
    "\n        Below are some example variables and their feedbacks.\n\n        {examples}\n\n        ================================\n\n        {instruction}\n        "
)

output_format_prompt class-attribute instance-attribute

output_format_prompt = dedent(
    '\n        Output_format: Your output should be in the following json format, satisfying\n        the json syntax:\n\n        {{\n        "suggestion": {{\n            <variable_1>: <suggested_value_1>,\n            <variable_2>: <suggested_value_2>,\n        }}\n        }}\n\n        When suggestion variables, write down the suggested values in "suggestion".\n        When <type> of a variable is (code), you should write the new definition in the\n        format of python code without syntax errors, and you should not change the\n        function name or the function signature.\n\n        If no changes or answer are needed, just output TERMINATE.\n        '
)

default_objective class-attribute instance-attribute

default_objective = (
    "Come up with a new variable in accordance to feedback."
)

buffer instance-attribute

buffer = []

construct_prompt

construct_prompt(summary, mask=None, *args, **kwargs)

Construct the system and user prompt.