zou-group / textgrad

TextGrad: Automatic ''Differentiation'' via Text -- using large language models to backpropagate textual gradients.
http://textgrad.com/
MIT License
1.57k stars 125 forks source link

Issue + fix for readme code sample #88

Open nm-openai opened 2 months ago

nm-openai commented 2 months ago

Prompt optimization example doesn't run as-is

Current

import textgrad as tg
llm_engine = tg.get_engine("gpt-3.5-turbo")
tg.set_backward_engine("gpt-4o")

_, val_set, _, eval_fn = load_task("BBH_object_counting", llm_engine)
question_str, answer_str = val_set[0]
question = tg.Variable(question_str, role_description="question to the LLM", requires_grad=False)
answer = tg.Variable(answer_str, role_description="answer to the question", requires_grad=False)

Need to add from textgrad.tasks import load_task for it to run

I also needed to brew install wget for it to work

mertyg commented 2 months ago

Thank you for catching this! Will be solved in #89