From ea36361d692f8c40b1303f8669bb2658776b6d96 Mon Sep 17 00:00:00 2001 From: JohnM Date: Sat, 1 Nov 2025 13:51:19 +0000 Subject: [PATCH] Add day4-illusion_of_memory.py contribution --- .../day4-illusion_of_memory.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 week1/community-contributions/day4-illusion_of_memory.py diff --git a/week1/community-contributions/day4-illusion_of_memory.py b/week1/community-contributions/day4-illusion_of_memory.py new file mode 100644 index 0000000..0a57e10 --- /dev/null +++ b/week1/community-contributions/day4-illusion_of_memory.py @@ -0,0 +1,12 @@ +#python newbie, just playing around with creating the illusion of memory +from openai import OpenAI +openai=OpenAI() + +message=[{"role":"system","content":"you are a sarcastic assistant"}] + +while True: + userinput=input("Enter msg: ") + message.append({"role":"user","content":userinput}) + response=openai.chat.completions.create(model="gpt-4.1-mini", messages=message) + print(response.choices[0].message.content) + message.append({"role":"assistant","content":response.choices[0].message.content})