OpenAI Assistants API ๐คฏ Function Calling + Node.js ๐ How to get started? AMAZING!! (Full Tutorial)
Skills:
Tool Use & Function Calling90%
Key Takeaways
Enhances OpenAI Assistants API with Node.js function calling to integrate real-time stock data from Yahoo Finance into the application
Full Transcript
this is huge what if you can add function calling to your assistant's API what if you can integrate that in your nodejs 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 assistance API with function calling in a node.js application I'm going to take you through step by step on how to run this and code yourself before going into that I regularly create videos in regards to artificial intellig so do subscribe and stay tuned coming to assistant API the first step is create your assistant that is data analyst next you're creating a thread third you're creating a message finally you're running the code with custom instructions I have already covered this in the previous video which I will link that in the description below so it basically contains assistant thread and then we create a message then we run it message is when the user asks question to the data analyst now we're going to run this code without fun function calling the question we going to ask the data analyst is what is the stock price of Apple that is the message now we're going to run this code in your terminal note function calling. JS you can see the status is queued now now the status got completed and we got the answer here assistant I'm sorry mvin praison but I don't have the capability to provide a real-time stock market data or updates Chad GPT doesn't have the capability to get the realtime stock price this is when the function calling comes in function calling is nothing but a function or a software or a tool which can be integrated with assistant API imagine you have a function which gets the stocks price in real time now we are going to see how we are going to integrate that with this application I'm going to use Yahoo finance to get the realtime stock price so it's npm install yaho iPhone Finance 2 and click enter going back to the code you are importing Yahoo finance from Yahoo finance 2 we going to create Asing function with get stock price and pausing the symbol as the parameter and it Returns the real-time stock price now we're going to integrate this function in assistant API using function calling to do that first we going to create tools list constant tools equals and then you're adding the list here you're mentioning type is function and the function name is get stock price that's what we defined previously then we are providing the parameters that is the symbol and symbol is the only required parameter now we're going to pause this tool when weate create an assistant so tools equals tools we have done two things one is creating a function called get stock price and then we created a tools list and added that to the assistants create function if you see the list of steps without function calling there are four steps but when you add function calling you're adding one more step which is requires action now we're going to add this in the code in the code while checking the status of the run here we mention completed there is one more status called required action I'm going to add that else if run status. status equals requires action then console.log requires action just for our reference then constant required actions equals run status. required action do submit tool outputs. tool calls this is where you retrieve your required actions and now we're going to print the required actions and now we're going to run the code in your terminal note function calling. Js first it get cued the status then here the status becomes requires action and you can see there's a Json called required action and we are printing the required action here the required action constant contains a function get stock price and the symbol AAPL so this symbol need to go into get stock price and we need to return that back to assistant API this Loop will keep on continuing until we return the stock price so I'm going to cancel this one and going back to the code I'm going to Define let tools output equals to a list then I'm going to Loop through this required action for constant action of required action opening the bracket constant function name equals action do function. name which you can see here the action. function. name next we going to get action. function. arguments that's where you'll have the symbol AAPL function arguments equals action do function. arguments now we're going to pass this Json because that is a Json output IF function name equals get stock price constant output equals await get stock price and passing the symbol next Tool output. Push tool call id action. id comma output colon json. stringify output now closing the brackets else console.log unknown function and closing the overall bracket now we got the tools output with the required stock price now we need to return that back to assistant API that is the final step the way we do it is await open ai. beta. threads. runs do submit tool outputs you're passing the thread ID run ID and the tools output this we can consider as the final fifth step that's it we checked if the status is requires action then we par the required action output check if the function is get stock price run the function and then we finally return the tools output back to submit tools output now we're going to run this code in your terminal node function calling. JS now the status got cued now we can see the status requires action then we are parsing this Json which contains this function and the parameter now our function is running which is yahooo finance and finally the status completed and we got a response here as a user we asked what is the stock price of Apple and the assistant replied the stock price of Apple is 1 8744 USD that's it as simple as that now you are able to integrate any function in your assistant API using function calling there is one more thing I want to tell you if you want me to present your work or your code like this do submit your code in the URL shown in the screen m.v n/s submit work I'm going to create more videos in regards to assistant API so stay tuned I hope you like this video do like share and subscribe and thanks for watching
Original Description
๐ Learn how to enhance your assistant's API using Node.js function calling!
๐ Discover the steps to integrate real-time stock data from Yahoo Finance into your application.
๐จโ๐ป Step-by-step guide to creating functions, managing tool lists, and handling API statuses.
๐ Example: Querying Apple's stock price with your assistant.
โ๏ธ Troubleshooting tips and in-depth code walkthrough.
๐ Subscribe for more AI and Node.js tutorials!
Timestamps:
0:00 - Function Calling in Assistant API with Node.js
1:00 - Example Query: Apple Stock Price
1:31 - Integrating Yahoo Finance for Real-Time Data
2:06 - Coding Tutorial: Adding Function to Assistant API
3:00 - Handling 'Requires Action' Status in API
4:01 - Outputting Stock Price and Final Integration Steps
5:33 - Final Run: Getting Real-Time Stock Price
๐ Previous Video Link:
ChatGPT Tutorials Playlist: https://www.youtube.com/playlist?list=PLYQsp-tXX9w62Lgpvx2JMBvKAAi7rfb_t
ChatGPT Beginners Guide: https://www.youtube.com/watch?v=_E9rqrnPzWI
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
OpenAI Assistants API + Retrieval: https://www.youtube.com/watch?v=Wh727dL-Ql4
OpenAI Assistants API Function Calling: https://www.youtube.com/watch?v=UkLUSjOneXc
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
Code: https://mer.vin/2023/11/assistants-api-function-calling-in-node-js/
Submit Work: https://mer.vin/submitwork/
#OpenAIAssistantsAPI, #AssistantsAPI, #NodejsAssistantsAPI, #Nodejs, #NodeJ
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
Related Reads
๐ฐ
๐ฐ
๐ฐ
๐ฐ
I Added Observability to My AI PR Agent and It Was Silently Failing the Whole Time
Medium ยท Python
Anthropic Academy: Free AI Courses With a Certificate, Straight From the Maker of Claude
Medium ยท AI
The Machine Accent Travels: AI Text Is Rhythmically Monotone in 70/70 Cells Across 3 Languages
Dev.to AI
SynapseAI: What Happened When I Stopped Trusting Just One LLM
Medium ยท LLM
Chapters (7)
Function Calling in Assistant API with Node.js
1:00
Example Query: Apple Stock Price
1:31
Integrating Yahoo Finance for Real-Time Data
2:06
Coding Tutorial: Adding Function to Assistant API
3:00
Handling 'Requires Action' Status in API
4:01
Outputting Stock Price and Final Integration Steps
5:33
Final Run: Getting Real-Time Stock Price
๐
Tutor Explanation
DeepCamp AI