OpenAI Assistants API + Node.js ๐ How to get Started? (FULL Tutorial) AMAZING! ๐คฏ
Skills:
LLM Foundations80%
Key Takeaways
Integrates OpenAI Assistants API with Node.js
Full Transcript
this is huge is there any way to create chat GPT assistant using API is there any way to customize your chat GPT assistant in your node.js application that's exactly what we're going to see today let's get [Music] started hi everyone I'm really excited to show you about chat GPT assistant API and we are going to integrate this in a node application I'm going to take you through step by-step guide on how to set this up as a prerequisite you need node and npm package manager which you can download and install it from nodejs website to create an assistance API in nodejs these are the steps first you are creating an assistant and then next you're creating thread next you're creating a message and then you're running it assistant is your chat GPT bot and I'm going to configure this as math tutor in this application next you're creating a thread this is like initiating a chat next message could be anyone it could be any user in our use case I'm using student so the student is going to ask question to the math tutor finally we're going to run this now let's dive into the code first in your terminal npm install open Ai and click enter next export your open AI API key like this and click enter next if you open the package.json make sure you mention the typus module because we are going to create it as egas script next we are going to create a file called assistant. JS and we are going to open the file inside the file import open AI from open AI next create a cont in open a equals new open AI this will automatically use your open AI key for our further interaction with open AI API as we can see in the image the first step is creating assistant then thread then message and then run let's create assistant assistant equals await open ai. beta. assistant. create then we are closing the bracket then we are giving a name for our assistant that is math tutor next we providing an instructions you are a personal math tutor write and run code to answer math questions next we are are adding tools to include I'm using Code interpreter this is used to solve any complicated math problems next I'm going to define the model which is gp4 Turbo step one assistant is created now next we going to create a thread constant thread equals await open a. beta. threads. create now we have created the thread thirdly we going to create message constant message equals await open. beta. threads. messages. create in this you are providing the thread ID this will create a message using this message the student is going to ask a question to the tutor now we are defining the role that is user next we are giving the content content is I need to solve a equation 3x + 11 equal 14 can you help me that is a question student is asking the math tutor finally we are going to run this so we're going to create constant run and then await open ai. beta. threads. runs. create then we are providing the thread ID and then we are closing the bracket here we are providing our assistant ID next we are providing instructions please address the user as mvin pris that's it we have now completed assistant thread message and run now we going to print out this run and then see what's happening let's go to your terminal and type node assistant. js and click enter now we got a response it is created at the assistant ID the thread ID it expires at and we got the model name and please address the user as M and pron the code interpreter mainly we can see the status is cued it will take few seconds for it to process the request so now next step is to check if the status is completed if the status is completed then print all the messages from the thread to check the status we are creating constant check status and print messages it's a acing message here we are providing the thread ID and the Run ID these both are required to check the status of the message next we are opening the flower bracket and then closing it then let Run state is equals await open ai. beta. threads. runs and then we are retrieving do retrieve thread idid and run ID this will retrieve the run from that we can check the status if run status do status equals completed next we are opening the bracket we need to get all the messages let messages equals await open ai. beta. thre . messages. list this will automatically retrieve all the list of messages sent by the student and the tutor now we're going to run this messages in the for each Loop messages. dat. for each message then we are closing the bracket and closing the outer bracket now we're going to add the RO which is message. roll then we are retrieving the content message. content 0. text. that's where the content is next we are logging in the console the console.log will print all the messages so we're going to add L statement if the status is not completed console.log run is not completed so in this step we are checking the status if it's completed print all the messages one by one by passing it to the 4 each Loop or else log run is not completed then we going to set time out this is because we sometime it might take 10 seconds or 20 seconds to complete the request so for now I'm going to make it wait for 10 seconds so set time out check status and print message here I'm going to pause the thread ID and the run. idid and we closing the bracket comma now we need to tell how much time to wait I'm going to make that wait for 10 seconds I'm closing the bracket and Co that's it so this set time out will check the status every 10 seconds as a quick overview we first we created assistant and set the model name the name and provide the instruction that the assistant is a math tutor next we create a thread to initiate the chat next we are creating a message that that is the student asking the question to the math tutor next we are running the thread after that we are waiting for 10 seconds and then checking the status of the run if the status is completed then we are printing all the messages within the thread now we going to run this code in your terminal type node assistant. js and click enter I'm waiting for the response I got error here roll equals if it go and I missed the constant C NST I'm going to run that again assistant. JS I'm getting one more error again the constant Define that going to run that again Aon ID thread ID the state is cued now I got the response here you can see as a user that's a student ask a question 3x + 11 is equal 14 and we got answer from the assistant that's the math tutor the solution of the equation is that's it as simple as that I'm going to make more advanced tutorial as a extension of this one so stay tuned I will regularly create videos in regards to AI in my YouTube channel so please go and have a look I hope you like this video do like share and subscribe and thanks for watching
Original Description
Learn how to create a ChatGPT assistant with OpenAI API and Node.js! ๐๐ค
๐ What you'll learn:
Integrating ChatGPT API into Node.js
Setting up a math tutor bot
Using Code Interpreter, Retrieval, and Function calling tools
Managing conversation threads and messages
Real-time bot response handling
ChatGPT Tutorials Playlist: https://www.youtube.com/playlist?list=PLYQsp-tXX9w62Lgpvx2JMBvKAAi7rfb_t
ChatGPT Beginners Guide: https://www.youtube.com/watch?v=_E9rqrnPzWI
GPT-4 Turbo: https://www.youtube.com/watch?v=Fo0KEPP7Nt4
GPT-4 Seed: https://www.youtube.com/watch?v=q5o8n1_jQb4
GPT-4 JSON: https://www.youtube.com/watch?v=9FZSA2UzXL0
ChatGPT Text to Speech API: https://www.youtube.com/watch?v=LWfE-j_V2J0
Dall-e 3 API: https://www.youtube.com/watch?v=eKCLFY5_NZI
Whisper API: https://www.youtube.com/watch?v=B9AuQ3jpwrA
GPT-4 Vision API Image: https://www.youtube.com/watch?v=xtdQb7-bv7E
GPT-4 Vision API Video: https://www.youtube.com/watch?v=QyqnR3bBMDs
GPT-4 Assistants API + Python: https://www.youtube.com/watch?v=pZUDEQs89zc
GPT-4 Assistants API +Node: https://www.youtube.com/watch?v=CPlwcY5mQ_4
๐ง Prerequisites:
Node.js and npm installed
Basic knowledge of JavaScript and Node.js
โฐ Timestamps:
0:00 - Introduction to ChatGPT API
0:17 - Setting up Node.js environment
1:08 - Installing OpenAI package
1:50 - Configuring the Assistant as a Math Tutor
2:15 - Creating Threads and Messages
3:01 - Running the Assistant and Handling Responses
๐ Remember to Like, Share, and Subscribe for more AI tutorials!
๐ Assistants API Beta: Build AI assistants in your apps using our tools: Code Interpreter, Retrieval, Function calling. More tools coming!
๐ง Explore with the Assistants playground or follow our step-by-step guide:
Create an Assistant: Custom instructions + AI model choice. Enable tools like Code Interpreter.
Start a Thread: Initiate user conversations.
Add Messages: Input user questions.
Trigger Responses: Assistant runs, calls relevant tools.
Beta Feedback: Join ou
Watch on YouTube โ
(saves to browser)
Sign in to unlock AI tutor explanation ยท โก30
Playlist
Uploads from Mervin Praison ยท Mervin Praison ยท 0 of 60
โ Previous
Next โ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Build GCP Infra using Pulumi in YAML format
Mervin Praison
How to Convert a Pulumi YAML File to Python Format
Mervin Praison
Speed Up AWS EKS: A Complete Guide to Performance Tuning & Debugging!
Mervin Praison
Learn GCP GKE to AWS EKS Migration in Just 5 Minutes: Quick Guide
Mervin Praison
AWS & Kubernetes: The Definitive Guide to Data Persistence with PV and PVC
Mervin Praison
ChatGPT Voice Conversation RELEASED! It's AMAZING!! (Demo)
Mervin Praison
How to Install Mistral 7B in Minutes: Quick & Easy Guide! โ
Mervin Praison
Code Llama Install Locally: ๐๐ป Elevate Your Python Skills!
Mervin Praison
Orca Mini: Your Ultimate Guide to Install and Test on Mac & Linux ๐ป
Mervin Praison
Quick & Easy Vicuna Setup on Mac and Linux ๐ป
Mervin Praison
Quick Guide: Llama2 Local Installation and ChatGPT with pip! Python๐ ๏ธ
Mervin Praison
Query PDFs Like a Pro with Local GPT: Full Setup Guide! ๐
Mervin Praison
LM Studio: EASIEST way to Run Large Language Models Locally!
Mervin Praison
AMAZING ChatGPT Vision is OUT! ๐คฏ 14+ Examples (Step-by-Step) FULL Tutorial
Mervin Praison
Unbelievable! Build ANY App Instantly with Smol AI! ๐ฒ๐ฅ
Mervin Praison
Amazing! AutoGen Made Easy: A Step-by-Step Beginners Guide ๐
Mervin Praison
How to Set Up LoLLMS and Run LLMs Locally! ๐ Step-by-Step Tutorial
Mervin Praison
GPT4All: INSANE Way to Run Large Language Models Locally! ๐ฒ Step-By-Step Tutorial
Mervin Praison
Incredible AI-Powered NPCs in Unity Game Engine: Step by Step Tutorial!๐คฏ
Mervin Praison
MemGPT ๐ง LLM as Operating System. It's INSANE! Step-by-Step Tutorial ๐คฏ
Mervin Praison
Text Generation Web UI: MIND-BLOWING Way to Run LLM Locally! ๐คฏ
Mervin Praison
Unlock the INSANE Power of OpenAI GPT-4 with C#/.NET! ๐ฒ
Mervin Praison
Integrate Langchain and Ollama for Local AI Power ๐คฏ Indeed POWERFUL!
Mervin Praison
ChatDev: INSANE Virtual AI Agents! Future of Software Development ๐ฒ
Mervin Praison
Query PDFs Using Mistral: Unlock INSANE Power! ๐คฏ
Mervin Praison
AutoGen + Open-Source LLMs: UNBELIEVABLE! Step-by-Step Tutorial You Can't Miss! ๐คฏ
Mervin Praison
AutoGen + Text Generation WebUI: Unbelievable 100% Local Private Setup ๐คฏ
Mervin Praison
MemGPT: Amazing! External Context for LLM #ai #llm #memgpt #generativeai #mem #gpt #openai #chatgpt
Mervin Praison
GeniA: Kubernetes + AI for MIND-BLOWING Operational Efficiency! ๐คฏ FULL Tutorial
Mervin Praison
VertexAI Meets LangChain for Mind-Blowing AI Conversations! ๐ฒ Step by Step Tutorial
Mervin Praison
Simplified ChatGPT API Setup on Node.js for Newbies! ๐ Step by Step Tutorial
Mervin Praison
Autogen: Ollama integration ๐คฏ Step by Step Tutorial. Mind-blowing!
Mervin Praison
LiteLLM: One-Function Call to ANY Large Language Model! ๐คฏ UNBELIEVABLE!
Mervin Praison
ChatGPT Chatbot in Less Time Than You Think! ๐๐ Step-by-Step Tutorial
Mervin Praison
LiteLLM Chatbot: Build Your Own in MINUTES! INSANE! ๐ค๐ฅ
Mervin Praison
Create Chatbot: Turn ANY Open-Source LLM into a Conversation Pro! ๐ค
Mervin Praison
Create Chatbot: Ollama Integration Made UNBELIEVABLY Easy! ๐
Mervin Praison
LlamaIndex + ChatGPT: Ingest Data and Experience UNBELIEVABLE Query Results! ๐
Mervin Praison
INSANE! OpenAgents: Automated Data Analysis with Kaggle ๐คฏ
Mervin Praison
React.js LLM Agent for Next-Gen Coding using ChatGPT ๐ Mind-Blowing ๐คฏ
Mervin Praison
MemGPT + Any LLM ๐ 100% Local & Private Integration Unveiled! Unlimited Memory
Mervin Praison
MemGPT + AutoGen ๐ง ๐ค Unlimited Memory & Autonomous AI Agents! INSANE๐คฏ
Mervin Praison
AutoGen + Google's Palm LLM & More! Revolutionary AI Integration ๐
Mervin Praison
MemGPT & LM Studio Integration Revealed! ๐ฅ Next-Level AI
Mervin Praison
๐ AutoLLM: Unlock the Power of 100+ Language Models! Step-by-Step Tutorial
Mervin Praison
AutoLLM & Gradio Integration You Won't Believe! ๐คฏ Mind-Blowing
Mervin Praison
AutoLLM & FastAPI Tutorial: Query 100+ Language Models! ๐ฑ
Mervin Praison
Quivr: LLM's Second Brain - Transforming Data Management & Advanced Query with AI! ๐คฏ
Mervin Praison
AutoGen & MemGPT with Local LLM: A Complete Setup Tutorial! ๐ง AMAZING ๐คฏ
Mervin Praison
LocalAI: Free, Open Source OpenAI Alternative ๐ INSANE ๐คฏ Step-by-Step Tutorial
Mervin Praison
Yarn Mistral 7B 128k LARGE context window, Small size ๐คฏ INSANE ๐ Setup Tutorial!
Mervin Praison
Zephyr-7B: The Small and Mighty LLM ๐คฏ Step by Step Tutorial! ๐
Mervin Praison
Promptfoo: How to Test Your LLM ? ๐ VERY EASY!
Mervin Praison
Pydantic: How to Validate LLM Responses? ๐ Quality Response. VERY EASY!!!!
Mervin Praison
Pydantic: FORCE Your AI to Respond Back in UPPERCASE! ๐คฏ Step-by-Step Tutorial ๐ฅ
Mervin Praison
Pydantic: How to use LLM to convert unstructured data to structured data?
Mervin Praison
AutoGen Function Calling: INSANE ๐ Custom Integrations! Step-by-Step Tutorial ๐คฏ
Mervin Praison
OpenAI Assistants API + Python ๐ค How to get started? (FULL Tutorial) ๐คฏ INSANE
Mervin Praison
GPT-4 Vision API ๐คฏ INSANE Video Recognition Powers! Step-by-Step Tutorial ๐
Mervin Praison
GPT-4 Vision API ๐ The Future of Image Recognition! ๐คฏ Step-by-Step Tutorial
Mervin Praison
More on: LLM Foundations
View skill โRelated Reads
๐ฐ
๐ฐ
๐ฐ
๐ฐ
What If Your LLM Could Never Make Up a Fake Source Again?
Dev.to AI
What secretly eats your local LLMs' speed as your context fills up - Part 3
Dev.to AI
9 Best Open-Source LLMs in 2026 (Compared)
Dev.to ยท smakosh
How to Use Kimi K3 with Claude Code, Cursor, and Cline
Dev.to ยท smakosh
Chapters (6)
Introduction to ChatGPT API
0:17
Setting up Node.js environment
1:08
Installing OpenAI package
1:50
Configuring the Assistant as a Math Tutor
2:15
Creating Threads and Messages
3:01
Running the Assistant and Handling Responses
๐
Tutor Explanation
DeepCamp AI