Superfilter AI
Course Description
Learn to integrate OpenAI's powerful language models into your Node.js apps. Set up Node.js with the OpenAI API, build an AI chat interface, and then get hands-on with image generation, semantic search, and document QA systems. Dive into practical projects like creating semantic searches for movies and developing QA applications with YouTube and PDF data. Explore AI-driven function calling and learn to build real-world AI-powered Node.js applications!
This course and others like it are available as part of our Frontend Masters video subscription.
Preview
CloseWhat They're Saying
I just completed "Build AI-Powered Apps with OpenAI and Node.js" by Scott Moss on Frontend Masters! Thank you Scott, your courses are great! This course is very exciting, because you are an amazing instructor!

Margaret M Mosall
mosall_m
This recent LLM AI App Development course by Scott Moss on Frontend Masters is amazing! Always love his courses on there. This one was especially practical. no frills, advice on scaling and common pitfalls that you will face in the real-world. Cheers!

pharos
tea_and_sleep
Course Details
Published: November 27, 2023
Learn Straight from the Experts Who Shape the Modern Web
Your Path to Senior Developer and Beyond
- 200+ In-depth courses
- 18 Learning Paths
- Industry Leading Experts
- Live Interactive Workshops
Table of Contents
Introduction
Section Duration: 12 minutes
- Scott Moss introduces and provides an overview of the course notes and code repository.
- Scott talks about the current state of AI and provides an overview of the course content, including building a chat experience, semantic search, document QA, and function calling. The requirements for the course are Node.js and having an OpenAI API key. The course will mainly focus on using OpenAI but will discuss on other models and services.
Setup
Section Duration: 54 minutes
- Scott introduces Large Language Models (LLMs) and explains what they are and how they work. The role of these models in the AR world and the use cases for LLMs, such as writing, content creation, customer support, research, and education, are also discussed.
- Scott sets up the project and installs the necessary dependencies. They then explain how to set up the API key using a .env file and demonstrate how to import and use the OpenAI library. They show how to make a chat request to the AI and log the response. The instructor also discusses the concept of tokens and how they affect the cost and response of the AI. They demonstrate how to send messages to the AI and receive responses, and explain the limitations of chat models in terms of memory and non-determinism. Finally, they introduce the concept of a chatbot and explain the difference between the code they have written and a chatbot.
- Scott creates a Node command-line chat interface using the OpenAI GPT-3 model. The readline module reads input from the command line, and a recursive function continuously prompts the user for input and generates responses from the AI model.
- Scott explains the scaling issues that come with chat-based applications. Token limits, memory constraints, and the need for creative solutions to handle these limitations are discussed.
Search & Langchain
Section Duration: 52 minutes
- Scott introduces semantic search, which goes beyond simple string matching to understand the meaning and context of words. Scott shares some examples of semantic search in action, such as autocomplete suggestions and recommendation systems. Langchain is introduced, and the semantic search feature in the documentation is demonstrated.
- Scott introduces word embeddings and vectors and describes how embeddings are collections of vectors that represent the meaning behind words. Embeddings are useful for storing and comparing the meanings of words and are essential for semantic search.
- Scott provides an example of how semantic search can be used to find movies with similar themes. A movie recommendation semantic search application is created, and the initial required libraries are imported. A createStore method is written to return an in-memory vector store from a list of movie documents.
- Scott codes the search function, which converts a query into an embedding and uses cosine similarity to compare it with other embeddings. The score of each search result is displayed demonstrating the proximity of each result.
- Scott discusses the challenges and considerations when deploying and scaling semantic search. Challenges include handling large volumes of data, updating and maintaining indexes and embeddings, ensuring query accuracy, optimizing for speed and accuracy, and using caching and feedback loops.
Question Answering Systems
Section Duration: 42 minutes
- Scott introduces document QA (Question Answering) and compares it with semantic search. Document QA systems provide direct answers to questions, rather than just returning links like search engines. Use cases for document QA systems are discussed as well as benefits including efficiency, accuracy, and scalability.
- Scott begins coding a document QA application. A vector store is created and the documents providing data for the application are a YouTube podcast video and a PDF of the XBox instructions.
- Scott loads the YouTube video and PDF into the application and explains how chunking avoids exceeding the token limit and improves search accuracy.
- Scott implements the query function, which performs the similarity search and sends the query to the GPT model. The similarity search determines which source should be used for determining the answer. The context from the source along with the question are then sent to the model for an answer.
- Scott logs the results generated by the AI model and displays the sources from which the answer was derived. The possibility of having the AI model itself provide the source it used is also discussed along with scaling the document QA system.
Function Calling
Section Duration: 41 minutes
- Scott explains function calling in AI models like GPT. Function calling allows the AI to call specific user-created functions to interact with the outside world and obtain up-to-date information. Significant challenges and considerations are associated with function calling, such as latency, accuracy, reliability, and security concerns.
- Scott creates the application for demonstrating AI function calling. The advanced-math NPM package is installed and a calculate function is created which will call the math.evaluate method inside the package.
- Scott codes the getCompletion function, creating the completion with a specified GPT model. In addition to the model, temperature and messages, a functions object is included with names, descriptions, and parameters.
- Scott adds an additional function to the application, which allows the AI to generate an image based on a prompt. The function uses the DALL•E OpenAI API to generate the image and return the URL.
- Scott discusses the challenges of scaling function calling in production.
Wrapping Up
Section Duration: 11 minutes
- Scott wraps up the course by providing additional recommendations and suggestions to further explore OpenAI APIs. Topics including diffusion models and training models on GPUs are discussed. Students are encouraged to continue building on the knowledge gained in the course and to experiment with different ideas and applications.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops