Add day4-illusion_of_memory.py contribution

This commit is contained in:
JohnM
2025-11-01 13:51:19 +00:00
parent 80ae1df886
commit ea36361d69

View File

@@ -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})