Some basic examples using OpenAI APIs with Python.
You need to create a virtual env and install the packages listed in requirements.txt
. You can then run Jupyter Notebooks in VS Code.
Follow these steps: How to Work with Python Virtual Environments, Jupyter Notebooks and VS Code.
You need to create a .env
file with your OPENAI_API_KEY
.
For Stable Diffusion, you need to add your STABILITY_AI_KEY
. You can find it in your DreamStudio account once it's created.
- setting up a dev environment to run Jupyter Notebooks in VS Code.
- hiding our API key.
- defining max_tokens.
- stopping sequences.
- generating N choices and echoing the prompt.
- understanding the various completion models.
- comparing model performance and pricing.
- controlling the output format.
- summarizing text.
- extracting data.
- analyzing sentiments.
- thinking step by step.
- transforming text.
- writing the color palette generator prompt.
- writing a color-swatch rendering function.
- understanding temperature and top P.
- using frequency penalty and presence penalty.
- streaming responses.
- writing a request to the Chat API.
- prompting with system, assistant, and user messages.
- rewriting a completion prompt in chat format.
- using Chat API parameters.
- asking GPT-4 to explain code.
- calculating time complexity with GPT-4.
- translating JavaScript to Python with GPT-4.
- generating code from scratch with GPT-4.
- counting tokens with TikToken.
- counting GPT-4 message tokens.
- writing the playlist generating prompt.
- generating a single embedding.
- making a DALL-E API request.
- saving DALL-E images from the generated URL and from JSON.
- requesting image variations.
- editing DALL-E images.
- generating a Python script to delete images.
- creating a CV website with HTML and CSS.
- writing a newsletter email.
- using Python and Node to encode a string.
- renaming files in a folder.
- reorganizing files.
- calculating and displaying the total size of files modified today using a Bash script.
- calculating total duration of video files in a directory.
- creating a URL shortener using Flask and SQLite.
- classifying files in different folders according to their formats.
- creating a basic website.
- recreating the bouncing DVD logo screen.
- debugging code.
- creating a Monster Slayer game.
- building a NodeJS REST API.
- recreating a simple ChatGPT clone.
- creating a text summarization tool.
- processing text from a file and creating a new file.
- understanding models, prompts, and parsers.
- managing memory to provide context.
- chaining and routing prompts.
- using embeddings to answer questions.
- evaluating the LLM app performances.
- helping the LLM with specific agents.
- loading documents.
- splitting documents.
- using a vector store with Chroma and generating embeddings.
- understanding retrieval techniques to address diversity and specificity issues.
- sending questions with the retrieved documents and getting an answer from the LLM.
- building a chat UI.
- using AI powered code suggestions to write code.
- writing a short Python script with suggestions and sidebar chat.
- generating an Express app with input validation.
- writing a Python script with Cursor AI.
- adding authentication to an Express app with Composer.
- setting up an Express app with Cursor AI.
- adding authentication with Composer.
- adding a SQLite database to the REST API.
- testing the REST API with Postman.
- protecting some routes with JWT.
- handling registration to events.
- handling image uploads with Multer.
- using OpenAI function calling capability.
- chaining operations with LangChain Expression Language (LCEL).
- calling functions with Pydantic syntax.
- tagging and extracting data.
- creating tools and handling routes.
- creating a conversational agent.
- building pipes with LangChain.js.
- loading and preparing data.
- creating embeddings and retrieving data from a vector database.
- generating answers with RAG.
- adding conversation history.
- shipping as a web API.
- working with the API.
- sending image requests and streaming responses.
- writing structured prompts.
- caching prompts.
- creating tools to query a database.
- experimenting with computer use.
- building an agent from scratch.
- creating an agent with LangGraph components.
- discovering agentic search with Tavily.
- handling persistence and streaming.
- leveraging human-in-the-loop patterns.
- building an essay writer.
- following general guidelines.
- iterating to analyze and refine prompts.
- summarizing customer reviews.
- inferring sentiment and topics.
- translating and converting texts.
- expanding texts.
- building a chatbot.
- understanding the chat format.
- classifying data.
- moderating inputs.
- using chain-of-thought prompting.
- chaining prompts.
These examples are based on four courses:
- Mastering OpenAI Python APIs: Unleash the Power of GPT4 by Colt Steele (2023).
- The Ultimate Guide To ChatGPT & Midjourney by Colt Steele (2023).
- ChatGPT - The Complete Guide to ChatGPT & OpenAI APIs by Maximilian Schwarzmüller (2023).
- AI For Developers With GitHub Copilot, Cursor AI & ChatGPT by Maximilian Schwarzmüller (2024).
We are also relying on several short courses:
- Vector Databases: from Embeddings to Applications by Sebastian Witalec (2023).
- LangChain for LLM Application Development by Harrison Chase and Andrew Ng (2023).
- LangChain: Chat with Your Data by Harrison Chase (2023).
- Functions, Tools and Agents with LangChain by Harrison Chase (2023).
- Build LLM Apps with LangChain.js by Jacob Lee (2024).
- Building Towards Computer Use with Anthropic by Colt Steele (2025).
- AI Agents in LangGraph by Harrison Chase and Rotem Weiss (2024).
- ChatGPT Prompt Engineering for Developers by Isa Fulford and Andrew Ng (2023).
- Reasoning with o1 by Colin Jarvis (2024).
- Building Systems with the ChatGPT API by Isa Fulford and Andrew Ng (2023).