Beginner-friendly chatbot that talks via the OpenAI API and keeps short-term memory in-session (a simple message buffer). No databases and no RAG.
-
Python 3.10+ recommended. Create a venv: python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
-
Install deps: pip install -r requirements.txt
-
Copy
.env.exampleto.envand set your key: OPENAI_API_KEY=sk-... -
Launch Jupyter: python -m ipykernel install --user --name chatbot-minimal jupyter notebook # or VS Code / JupyterLab
-
Open
notebooks/chatbot_memory.ipynband run the cells.
- This demo uses the Responses API with a small, cost-effective model suited to learning and prototyping.
- Memory is kept in a Python list (last N turns). Close the notebook and it’s gone.
- Keep your API key safe; never commit
.env.
- If you see “API key missing”, ensure your
.envis loaded or your environment hasOPENAI_API_KEYset. - Network/proxy issues can prevent calls from completing; try again or check connectivity.