class HaikuGenerator(dspy.Signature): """ Generates a haiku about the latest news on the query. Also create a simple file where you save the final summary. """ query = dspy.InputField() summary = dspy.OutputField(desc="A summary of the latest news") haiku = dspy.OutputField() program = dspy.ReAct(signature=HaikuGenerator, tools=[fetch_recent_news], max_iters=2) program.set_lm(lm=dspy.LM("openai/gpt-4.1", temperature=0.7)) pred = program(query="OpenAI")