Complete the code to initialize an empty episodic memory list.
episodic_memory = [1]We use an empty list [] to store episodic memory entries in order.
Complete the code to add a new interaction record to episodic memory.
episodic_memory.[1]({'user': user_input, 'response': agent_reply})
The append method adds a single new item to the end of the list.
Fix the error in retrieving the last interaction from episodic memory.
last_interaction = episodic_memory[1]Using [-1] accesses the last item in the list, which is the most recent interaction.
Fill both blanks to filter episodic memory for interactions where user said 'hello'.
hello_interactions = [entry for entry in episodic_memory if entry[1] 'user' [2] 'hello']
We access the 'user' key with ['user'] and check equality with == to 'hello'.
Fill all three blanks to create a summary dictionary of user inputs and agent responses.
summary = [1]: [2] for [3] in episodic_memory
The dictionary comprehension uses {entry['user']: entry['response'] for entry in episodic_memory} to map user inputs to responses.