Adding AI to your JavaScript Web Application with the ChatGPT API


Course Description

Did you know that you can add the power of AI to your own JavaScript application by utilising the ChatGPT API? This course is designed for JavaScript Developers 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 do 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 JavaScript applications.

Duration: 2 days


Who should attend

This course is for Web Application Developers and will use JavaScript RESTful API calls to interact with the OpenAI API. The course can be customised for various technology stacks including Angular, React, Node.js and ASP.NET. 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 Web Application development environment Understanding a RESTful Web Service Making a call Understanding the JSON response

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 JavaScript

Install OpenAI dependencies 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 Utilising responses

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


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