Začněte nyníZačněte zdarma

Don't Forget: Keeping Memory Between Calls

You're planning a graduation trip and using a smolagents travel assistant to keep track of important dates and information.

However, the agent forgets unless you explicitly preserve its memory. Your goal is to prevent the agent from resetting between questions so it can remember key travel details across multiple interactions.

You have access to the travel_agent, already set up with a model and no tools.

Toto cvičení je součástí kurzu

AI Agents with Hugging Face smolagents

Zobrazit kurz

Pokyny k cvičení

  • Modify the second .run() method so the agent retains memory using the reset parameter.
  • Set the value of reset to False to prevent the agent from resetting its state.

Interaktivní cvičení na vyzkoušení si v praxi

Vyzkoušejte si toto cvičení dokončením tohoto ukázkového kódu.

# Step 1: Tell the agent your flight date
travel_agent.run("My Tokyo flight confirmation code is ZX9Q2L.")

# Step 2: Confirm the agent remember when passing the correct reset parameter
follow_up = "What’s my Tokyo flight confirmation code?"
response = travel_agent.run(follow_up, ____=____)

print(response)
Upravit a spustit kód