Let’s make our first recipe that calls out to an agent:
qa_simple.py
from fvalues import Ffrom ice.recipe import recipedefmake_qa_prompt(question:str)->str:returnF(f"""Answer the following question:Question: "{question}"Answer: """").strip()asyncdefanswer(question:str="What is happening on 9/9/2022?"): prompt =make_qa_prompt(question) answer =await recipe.agent().complete(prompt=prompt,stop='"')return answerrecipe.main(answer)
Looking at the trace, we see two nodes—one for the answer function we implemented, and one for the agent method call. If we click on the agent method, we see the exact prompt that was passed to the agent: