textgrad.optimizer.optimizer_prompts

textgrad.optimizer.optimizer_prompts#

Functions

construct_tgd_prompt([do_momentum, ...])

Construct the textual gradient descent prompt.

textgrad.optimizer.optimizer_prompts.construct_tgd_prompt(do_momentum=False, do_constrained=False, do_in_context_examples=False, **optimizer_kwargs)#

Construct the textual gradient descent prompt.

Parameters:
  • do_momentum (bool, optional) – Whether to include momentum in the prompt.

  • do_constrained (bool, optional) – Whether to include constraints in the prompt.

  • do_in_context_examples (bool, optional) – Whether to include in-context examples in the prompt.

  • optimizer_kwargs – Additional keyword arguments for formatting the prompt. These will be things like the variable description, gradient, past values, constraints, and in-context examples.

Returns:

The TGD update prompt.

Return type:

str