# Goldfish Memory of GPT-3 --- >[!Abstract] What can you do to increase the memory of GPT-3 such that you can interact with it as though it was like your coach? > > > *Please note that ChatGPT is not able to access past conversations to inform its responses.* - Things that you want the bot to remember needs to end up in `USER_log` ```python if __name__ == '__main__': openai.api_key = open_file('openaiapikey.txt') while True: #### get user input, save it, vectorize it, etc a = input('\n\nUSER: ') timestamp = time() vector = gpt3_embedding(a) timestring = timestamp_to_datetime(timestamp) message = '%s: %s - %s' % ('USER', timestring, a) info = {'speaker': 'USER', 'time': timestamp, 'vector': vector, 'message': message, 'uuid': str(uuid4()), 'timestring': timestring} filename = 'log_%s_USER.json' % timestamp save_json('chat_logs/%s' % filename, info) #### load conversation conversation = load_convo() #### compose corpus (fetch memories, etc) memories = fetch_memories(vector, conversation, 10) # pull episodic memories # TODO - fetch declarative memories (facts, wikis, KB, company data, internet, etc) notes = summarize_memories(memories) # TODO - search existing notes first recent = get_last_messages(conversation, 4) prompt = open_file('prompt_response.txt').replace('<<NOTES>>', notes).replace('<<CONVERSATION>>', recent) #### generate response, vectorize, save, etc output = gpt3_completion(prompt) timestamp = time() vector = gpt3_embedding(output) timestring = timestamp_to_datetime(timestamp) message = '%s: %s - %s' % ('RAVEN', timestring, output) info = {'speaker': 'RAVEN', 'time': timestamp, 'vector': vector, 'message': message, 'uuid': str(uuid4()), 'timestring': timestring} filename = 'log_%s_RAVEN.json' % time() save_json('chat_logs/%s' % filename, info) #### print output print('\n\nRAVEN: %s' % output) ``` ## Sources - [Fixing "goldfish memory" with GPT-3 and external sources of information in a chatbot](https://www.youtube.com/watch?v=-3WpqPZgWAk)