opto.optimizers.optoprime
#
Module Contents#
Classes#
Feedback container used by FunctionPropagator. |
|
Functions#
Convert a TraceGraph to a FunctionFeedback. roots, others, outputs are dict of variable name and its data and constraints. |
API#
- get_fun_name(node: opto.trace.nodes.MessageNode)[source]#
- repr_function_call(child: opto.trace.nodes.MessageNode)[source]#
- node_to_function_feedback(node_feedback: opto.trace.propagators.TraceGraph)[source]#
Convert a TraceGraph to a FunctionFeedback. roots, others, outputs are dict of variable name and its data and constraints.
- class FunctionFeedback[source]#
Feedback container used by FunctionPropagator.
- graph: List[Tuple[int, str]] = None#
- documentation: Dict[str, str] = None#
- others: Dict[str, Any] = None#
- roots: Dict[str, Any] = None#
- output: Dict[str, Any] = None#
- user_feedback: str = None#
- class ProblemInstance[source]#
- instruction: str = None#
- code: str = None#
- documentation: str = None#
- variables: str = None#
- inputs: str = None#
- others: str = None#
- outputs: str = None#
- feedback: str = None#
- constraints: str = None#
- problem_template = 'dedent(...)'#
- class OptoPrime(parameters: List[opto.trace.nodes.ParameterNode], config_list: List = None, *args, propagator: opto.trace.propagators.propagators.Propagator = None, objective: Union[None, str] = None, ignore_extraction_error: bool = True, include_example=False, memory_size=0, max_tokens=4096, log=True, **kwargs)[source]#
Bases:
opto.optimizers.optimizer.Optimizer
- representation_prompt = 'dedent(...)'#
- default_objective = 'You need to change the <value> of the variables in #Variables to improve the output in accordance to...'#
- output_format_prompt = 'dedent(...)'#
- example_problem_template = 'dedent(...)'#
- user_prompt_template = 'dedent(...)'#
- example_prompt = 'dedent(...)'#
- final_prompt = 'dedent(...)'#
- construct_prompt(summary, mask=None, *args, **kwargs)[source]#
Construct the system and user prompt.
- construct_update_dict(suggestion: Dict[str, Any]) Dict[opto.trace.nodes.ParameterNode, Any] [source]#
Convert the suggestion in text into the right data type.