Thinking like an LLM for a day
agent = create_react_agent(model, tools, prompt)
agent_executor = AgentExecutor(agent=agent, tools=tools)
Begin!
Observation: I need breakfast. There is no more yoghurt in the fridge. Thought: I need to get more yoghurt. I will invoke the
create_shopping_list
tool to add yoghurt to the shopping list.Action: Add yoghurt to shopping list.
{"item": "yoghurt"}
Observation: I am still hungry. The fridge is completely empty.
Thought: I will invoke thecheck_freezer
tool to check what’s in the freezer. Action: Check freezer.{"duration_of_starting_mindlessly": 10 seconds}
Observation: There is only Chunky Monkey ice-cream in the freezer.
Final Answer: It’s ice-cream for breakfast! 🍨
Question: someone was rude to me. How should I respond?
Thought: I need to invoke the
past_memories
tool to see how I have dealt with similar situations in the past.
Action: calling memory database{"tag": "rude encounter"}
Observation: I can see in the past I ruminated over the encounter for the entire day, finally going to sleep and waking up in the middle of the night still bothered.
Thought: As an LLM I have no capacity for rumination or repetitive thoughts. I also have no body and cannot feel where emotions are making my chest contract. There are no tools available for handling this situation. I should abort the react loop and let the incident slide.
Final Answer: Stop circular react loop and let things slide.
Question: I’m going hiking. What’s the weather like and how should I prepare?
Thought: I need to invoke the
check_weather
API tool
Action: checking weather{"city": my_city"}
Observation: According to the weather API, it will rain this afternoon. Thought: I should bring an umbrella.
Observation: As an LLM, I have no skin. I do not know the pleasure of soft raindrops falling through the tree canopy leaves onto my head. I also don’t know that being muddy feels more gross than being wet.
Final Answer: I should bring wellies. Maybe I don’t need an umbrella after all?
Question: How can I unpack a tuple in Python:
Thought: Finally a question for an LLM!
Final Answer:
my_tuple = (1, 2, 3)
x, y, z = my_tuple