opto.optimizers.textgrad
#
Module Contents#
Classes#
Functions#
Data#
API#
- GLOSSARY_TEXT = <Multiline-String>#
- OPTIMIZER_SYSTEM_PROMPT = None#
- TGD_PROMPT_PREFIX = <Multiline-String>#
- TGD_MULTIPART_PROMPT_INIT = <Multiline-String>#
- TGD_MULTIPART_PROMPT_PREFIX = 'Improve the variable ({variable_desc}) using the feedback provided in <FEEDBACK> tags.\n'#
- TGD_PROMPT_SUFFIX = <Multiline-String>#
- MOMENTUM_PROMPT_ADDITION = <Multiline-String>#
- CONSTRAINT_PROMPT_ADDITION = <Multiline-String>#
- IN_CONTEXT_EXAMPLE_PROMPT_ADDITION = <Multiline-String>#
- construct_tgd_prompt(do_momentum: bool = False, do_constrained: bool = False, do_in_context_examples: bool = False, **optimizer_kwargs)[source]#
- GRADIENT_TEMPLATE = <Multiline-String>#
- GRADIENT_MULTIPART_TEMPLATE = <Multiline-String>#
- GLOSSARY_TEXT_BACKWARD = <Multiline-String>#
- BACKWARD_SYSTEM_PROMPT = None#
- CONVERSATION_TEMPLATE = <Multiline-String>#
- CONVERSATION_START_INSTRUCTION_CHAIN = <Multiline-String>#
- OBJECTIVE_INSTRUCTION_CHAIN = <Multiline-String>#
- CONVERSATION_START_INSTRUCTION_BASE = <Multiline-String>#
- OBJECTIVE_INSTRUCTION_BASE = <Multiline-String>#
- EVALUATE_VARIABLE_INSTRUCTION = <Multiline-String>#
- SEARCH_QUERY_BACKWARD_INSTRUCTION = <Multiline-String>#
- GRADIENT_OF_RESULTS_INSTRUCTION = <Multiline-String>#
- REDUCE_MEAN_SYSTEM_PROMPT = 'You are part of an optimization system that improves a given text (i.e. the variable). Your only res...'#
- class GradientInfo[source]#
- gradient: str = None#
- gradient_context: Optional[Dict[str, str]] = None#
- construct_reduce_prompt(gradients: List[opto.optimizers.textgrad.GradientInfo])[source]#
- class TextGrad(parameters: List[opto.trace.nodes.ParameterNode], config_list: List = None, *args, propagator: opto.trace.propagators.Propagator = None, objective: Union[None, str] = None, max_tokens=4096, log=False, **kwargs)[source]#