Adding AI to your Python Project with the ChatGPT API


Course Description

Did you know that you can add the power of AI to your own Python application by utilising the ChatGPT API? This course is designed for Python programmers who want to learn how to add AI features like sentiment analysis and natural language processing to their applications to make them smarter and more interactive. We’ll start with the basics, such as setting up and making simple API requests, and then gradually explore more advanced topics like analysing usernames for inappropriate content, doing sentiment analysis on comments and analysing a log file for suspicious activity. Continuing on we will complete more advanced tasks like specifying how the responses will be formatted using structured data and getting our own information into the model through the use of functions. By the end of the course, participants will have a solid understanding of how to leverage the OpenAI models to create smarter and more interactive Python applications.

Duration: 2 days


Who should attend

This course assumes familiarity with the Python programming language. No experience with AI is assumed. Access to the OpenAI API is a requirement for this course.

Introduction

Introduction to AI Concepts Understanding the limitations of AI Python development environment Understanding a RESTful Web Service Making a call Understanding the response JSON and JSON processing functions in Python

Getting Started

Registering for OpenAI API Getting API key API Playground Hello World API Call in playground

Choosing a model

What models are available Monitoring Usage Specifying max_tokens Checking availability

OpenAI Requests In Python

Install OpenAI package Making a call Parts of a call - model, temperature, max_tokens, top_p, frequency_penalty, presence_penalty API Response Parsing a response

Some Practical Examples

Vetting usernames Sentiment analysis of comments Scanning a server log file for suspicious activity

Structured Outputs

JSON mode Adding a response_format Converting response to a Python dictionary

API Functions

Providing your information to the API using functions Providing a function description Understanding the "function" response Calling the function Getting a response Simple example

More on API Functions

Providing more than one function Describing multiple functions to assist API in choosing which one to call More complex example


Schedule

NameDateLocation 
Adding AI to your Python Project with the ChatGPT API 2024-05-08 Online
Adding AI to your Python Project with the ChatGPT API 2025-02-19 Online
Adding AI to your Python Project with the ChatGPT API 2025-03-10 Online

AI Artificial Intelligence Python ChatGPT ChatGPT API OpenAI API Programming Coding Prompt Engineering