OpenAI Assistant API Tutorial With Code Examples

  Рет қаралды 16,405

codewithbrandon

codewithbrandon

Күн бұрын

Welcome to our tutorial on the OpenAI Assistant API. If you're interested in AI and web development, this video is for you.
Source Code For Project:
brandonhancock.io/assistant-a...
Don't forget to Like and Subscribe if you're a fan of free source code 😉
What We Cover:
- Introduction: A quick overview of the OpenAI Assistant API.
- Understanding the Basics: Learn about assistants, threads, messages, runs, and run steps.
- Real Examples: See how these concepts work in practice with concrete examples.
Key Points:
- Assistants: AI entities that perform tasks based on instructions and files.
- Threads: Conversations between you and the AI, containing messages.
- Messages: Can be text, images, or files exchanged in a thread.
- Runs and Run Steps: How assistants process conversations and perform tasks.
Helpful Links:
- platform.openai.com/docs/assi...
- platform.openai.com/docs/assi...
- platform.openai.com/docs/api-...
- platform.openai.com/docs/api-...
Timeline:
00:00 Introduction
00:34 What are Assistants
01:26 How Assistants Work
03:36 Assistant Application Preview
06:27 Assistant API - Assistant CRUD
09:51 Assistant API - Files CRUD
13:07 Assistant API - Threads
14:23 Assistant API - Messages
15:50 Assistant API - Runs
21:22 Outro

Пікірлер: 61
@user-jg4ci4mf8w
@user-jg4ci4mf8w 5 ай бұрын
This was probably one of the BEST explanations on OpenAI Assistant API.
@MiguelDiganchi
@MiguelDiganchi 5 ай бұрын
AMAZING WAY OF EXPLAIN IT! THANK YOU VERY MUCH!
@nathankasa6220
@nathankasa6220 5 ай бұрын
I never really comment on videos but just wanted to say you do a great job at explaining things and keeping it stupid simple. On top of that the extra time put into the editing to make it visually easier to comprehend. And the source file included in the description. 🙌
@bhancock_ai
@bhancock_ai 5 ай бұрын
Hey Nathan! Thank you so much for saying that! I really appreciate it because I've been putting a lot of work into these videos. I have a lot more content coming out for you guys!
@nathankasa6220
@nathankasa6220 5 ай бұрын
I can tell! This is the type of content I was thinking to make if nobody else did because it’s always content consisting of code heavy videos without real life examples or anything actually done in the whole video. Sometimes it’s like “what could’ve been done better” if views don’t blow up. But trust, this video was perfect. I think I followed a little while ago based off one of your other videos, probably because you explain things well. And now this one popped up on my feed when I opened the app. Keep at it 🙌
@osagiezogie
@osagiezogie 4 күн бұрын
This is an awesome tutorial!! Thanks so much.
@rccnw
@rccnw 2 ай бұрын
I love how fast the narration is. I often bump up playback speed in settings. No need this time :) great tutorial, thanks.
@imcarto
@imcarto 13 күн бұрын
This is super clear, thankyou so much!
@leonvanzyl
@leonvanzyl 5 ай бұрын
Really cool video. Kudos for building a UI to visualise the process. People underestimate the amount of work that goes into videos like this. Keep it up bud.
@bhancock_ai
@bhancock_ai 5 ай бұрын
Thanks Leon! and so true! I have a small team helping me out to make it more manageable. I have some more videos coming out for you guys soon!
@dhrubajyotirakshit
@dhrubajyotirakshit 3 ай бұрын
Dude..Of all the AI videos that I have read till now, this one is probably one of the best. I know it is focused on Assistance, and u killed it. So, straight forward and well explained...
@bhancock_ai
@bhancock_ai 3 ай бұрын
Thank you so much Dhrubajyoti! I really appreciate that!
@dhrubajyotirakshit
@dhrubajyotirakshit 3 ай бұрын
@@bhancock_ai Now you have got a responsibility to create the video on Function calling and other tools...Waiting Waiting....
@sonny5497
@sonny5497 7 күн бұрын
thanks! this was very helpful
@maxidigital
@maxidigital 2 ай бұрын
Excellent explanation
@joaquinpadron7010
@joaquinpadron7010 20 күн бұрын
Thanks a lot, this is amazing
@tunceryuce3631
@tunceryuce3631 5 ай бұрын
Thank you. You are my hero
@sealandland3959
@sealandland3959 5 ай бұрын
Thanks alot indeed for the video! I am eagerly waiting for the new videos you kindly promised
@bhancock_ai
@bhancock_ai 5 ай бұрын
Thanks! I've had to take a quick break but I will start churning out more videos this week! Anything in particular that you'd like to see more of?
@ObservingBeauty
@ObservingBeauty 4 ай бұрын
Many thanks!
@DamCipolat
@DamCipolat 2 ай бұрын
Excelent!" greath video thanks for sharing
@bhancock_ai
@bhancock_ai 2 ай бұрын
Thanks Damian!
@mrumer4793
@mrumer4793 5 ай бұрын
love you Brandon 💕 w8ing for uR next videos . I am interested to learn Ai so I think you are best option for me
@bhancock_ai
@bhancock_ai 5 ай бұрын
Thanks Mr umer! I have a lot more videos coming out soon!
@drewsky-oz
@drewsky-oz 5 ай бұрын
Brandon, you are so helpful and clear. Thank you. Quick question: using the Tesla example you shared, can the assistant respond utilising both the file and the openai LLM as source mixing content for the response?
@bhancock_ai
@bhancock_ai 5 ай бұрын
Great questions! So all you have to do is adjust the instructions you provide to the assistant and instruct it to provide a hybrid response, 50% from the file & 50% from general knowledge within the LLM. Please let me know if you have any other questions! Happy to help!
@Nick__X
@Nick__X 5 ай бұрын
great video - one think I was hoping to find out though was more info around actions. The custom GPT actions seem a lot more intuitive with supplying a path and auth token. The assistant actions seem a bit more confusing and less documentation and discussion around them. Info or a video about those would be amamazing. I think a lot of people are making custom gpts and then find out out you cant call those through the API.
@lenztherapy6122
@lenztherapy6122 5 ай бұрын
Thank you, Brandon!!!! This information is priceless!!!!! I could not find where the website that you created is located, was that something there was a link for?
@bhancock_ai
@bhancock_ai 5 ай бұрын
Thank you 😁 and the source code link in the description will direct you to the code for the website. Please let me know if you have any other issues!
@omerkhan7664
@omerkhan7664 2 ай бұрын
Im trying to do this for my expressJs server, when I create the createRun function, it's saying thread_Id not found, is it supposed to be stored somewhere? I am making API calls to each function and passing it via an API client like insomnia but I cannot find the thread_Id anywhere.
@RyanneGraff
@RyanneGraff 4 ай бұрын
BANGIN'!
@bhancock_ai
@bhancock_ai 4 ай бұрын
Thank you so much! I really appreciate the donation! This made my day! If you have any other recommendations for future videos you’d like to see, I’d love to hear them!
@antdx316
@antdx316 29 күн бұрын
Can you make a new one for the one that was recently released with Vector Storage?
@pedrojulio7539
@pedrojulio7539 5 ай бұрын
Great explantion. Thanks a bunch. I've tried to get the source code by filling in the form with my first name and e-mail address but have had no luck in getting access. I am in Portugal; may that be an issue?
@bhancock_ai
@bhancock_ai 5 ай бұрын
Hey Pedro! I just checked out ConvertKit and it says the the email was delivered to you at 1:06 PM EST. Maybe it’s in your spam or something? If not, shoot me a DM on X @bhancock_ai and I can shoot you the links manually!
@SJT-jb9gz
@SJT-jb9gz 3 ай бұрын
great video, Thanks Brandon. Just one question: we passed user entered question to message object, and triggered a Run with assistant_id and thread_id. If this Rum was completed, how do I get assistant's response? Is there any code like this: response.choices[0].message.content ?
@bhancock_ai
@bhancock_ai 3 ай бұрын
Great question! You actually have to go back and refetch the thread once the run completes successfully. It would be nice if the run had that final generated message for us but they OpenAI is more focused on separating out the logic to make it super scalable for us. I hope that helps! Let me know if you have any other questions!
@SJT-jb9gz
@SJT-jb9gz 3 ай бұрын
@@bhancock_ai Thanks mate. I have worked out the solution, see sample code below: run = openai.beta.threads.runs.retrieve( thread_id = threadID, run_id = runID ) thread_messages = openai.beta.threads.messages.list(threadID) for msg in thread_messages.data: return JsonResponse({"message": msg.content[0].text.value})
@raphaeldecarvalhoflorencio4018
@raphaeldecarvalhoflorencio4018 3 ай бұрын
I also found out that it's necessary to have credits to use GPT-4, because when I clicked the 'create' button, it did nothing, and it only started working after I added credits to my account.
@andresdiazlopez5365
@andresdiazlopez5365 4 ай бұрын
thankyou
@bhancock_ai
@bhancock_ai 3 ай бұрын
You're welcome!
@forhappy4286
@forhappy4286 13 күн бұрын
Hi where is the homepage link?
@mikekallet6218
@mikekallet6218 5 ай бұрын
Hey Brandon .. Thanks for this. I entered my info but didn't receive the source? Is the source to the tool you were using. It looks like the perfect tool for me as I'm not a coder, but have created a very sophisticated assistant and now want to create a chatbot to us it. Hope you're tool will help. Let me know how to get it, or re-enter my info. thx
@bhancock_ai
@bhancock_ai 5 ай бұрын
Hey Mike! When you head over to my website brandonhancock.io/ you should be able to enter in your email address and then it will automatically send you an email with links to the source code. If it is still giving you trouble, please shoot me a DM!
@ollieq5259
@ollieq5259 2 ай бұрын
If I'm coding an app with multiple different users who can all individually interact with this bot (which has the same instruction for each user), would I use an assistant per user, or the same "master" assistant for all users?
@bhancock_ai
@bhancock_ai 2 ай бұрын
Great question! You would have one master assistant. However, you would create an individual thread for each user. If you want to see this in action, I definitely recommend checking out this full stack tutorial I released a few weeks ago! kzfaq.info/get/bejne/mJeDY5eBq9Ctf40.html Hope that helps!
@ollieq5259
@ollieq5259 2 ай бұрын
@@bhancock_ai With this architecture is it possible to have multiple threads per user, whereby each subsequent thread is aware of the context of all previous threads (for that user)? Basically I'm thinking of an app where a user can individually talk to the AI robot (master assistant), but has a chat log per day. Intuitively this means a thread per day, but when a user starts a new chat for a new day (and so a new thread is created), the AI robot they're talking to has to be aware of all previous messages sent on previous days in the other threads? Is this possible? So basically what I'm asking is, is it possible to create a new thread with an assistant, whereby the assistant responding in this new thread is responding based off context from a set of other previous threads?
@Basirafeef
@Basirafeef Ай бұрын
thanks for sharing great knowledge sir, can we have a video about new OpenAI assistant api implementation using php
@bhancock_ai
@bhancock_ai Ай бұрын
I'm not really a PHP guy but I think ChatGPT 4 could help you convert the code in the video into PHP code for you!
@loCal-sh2if
@loCal-sh2if 29 күн бұрын
I don't understand...I cannot seem to Assistant File "List" or "create" with your project. it uploads because I can see it in the "Storage" section of platform openai. For whatever reason I keep getting Error creating assistant file: TypeError: Cannot read properties of undefined (reading 'id')
@szymondzumak4927
@szymondzumak4927 19 күн бұрын
There has been update to assistant API lately. Check if your Open one has v2
@sealandland3959
@sealandland3959 5 ай бұрын
PYTHON...any comments regarding doing this on Python? I mean I know I can do the translation from Node JS ...
@bhancock_ai
@bhancock_ai 5 ай бұрын
Great question! The reason I'm not the biggest fan of doing web projects in Python is because they are more difficult to deploy for others to use. For example, if you make a NextJS project like I did in the tutorial, you can easily deploy the project to Vercel so that thousands of people can use your project instantly. Please let me know if you have any other questions! Happy to help!
@owaisjavaid8110
@owaisjavaid8110 3 ай бұрын
Well, having said that i don't have any prior knowledge of how does this new open ai (API) world is connects, works, I can say now I have an idea in some case after watching this. So, Can you create one more video which can explain a unit and average cost to perform all of these functions?, take any business that needs this assistant and they want to implement this, but they don't have any ideas of how does the pricing model works, and if they do so, they maybe don't know how to optimized it. It will be very helpful if you crate any short video that give use an overview of pricing too. TIA.
@bhancock_ai
@bhancock_ai 3 ай бұрын
Hey Owais! Great question! If I were you, I'd checkout this page here: openai.com/pricing The short answer to your question is that OpenAI is going to charge your everything. Every time you use ChatGPT 4, it costs you a few pennies.When you use the code interpreter, it costs a few more pennies. When you use the retrieval functionality, it costs a few more pennies.
@Samuel-zx9dw
@Samuel-zx9dw 2 ай бұрын
Hi is using the assitant API free?
@bhancock_ai
@bhancock_ai 2 ай бұрын
You can use the Assistant for free but you can only make a few request per hour. If you are going to create a project or do a lot of testing, you'll probably want to upgrade out of the free tier.
@JTedam
@JTedam 5 ай бұрын
You sound just like Bucky of the new Boston
@bhancock_ai
@bhancock_ai 5 ай бұрын
Bucky is the GOAT!
5 AI SaaS Ideas You Can Build in 2024
10:00
codewithbrandon
Рет қаралды 4,8 М.
How did CatNap end up in Luca cartoon?🙀
00:16
LOL
Рет қаралды 7 МЛН
Can You Draw The PERFECT Circle?
00:57
Stokes Twins
Рет қаралды 66 МЛН
I PEELED OFF THE CARDBOARD WATERMELON!#asmr
00:56
HAYATAKU はやたく
Рет қаралды 33 МЛН
Getting Started with OpenAI Assistants - Retrieval
25:05
Empowerment AI
Рет қаралды 10 М.
How to use Assistants API and the best way to do it
24:37
echohive
Рет қаралды 1,7 М.
CrewAI Tutorial: Complete Crash Course for Beginners
1:05:43
codewithbrandon
Рет қаралды 122 М.
All About OpenAI Assistant API [code + no-code] in 15 min
13:42
Maya Akim
Рет қаралды 4,7 М.
Every CSS Animation property
9:26
chunkydotdev
Рет қаралды 48 М.
Laravel's secret weapon: macros (watch me code)
23:46
Aaron Francis
Рет қаралды 13 М.
GPTs vs Assistants API - which one is best for you?
13:09
OpenAI Assistants API Tutorial - Playground & NodeJS
17:47
Leon van Zyl
Рет қаралды 26 М.
Fiber kablo
0:15
Elektrik-Elektronik
Рет қаралды 6 МЛН
Any Sound & Call Recording Option Amazing Keypad Mobile 📱
0:48
Tech Official
Рет қаралды 325 М.
Обманет ли МЕНЯ компьютерный мастер?
20:48
Харчевников
Рет қаралды 134 М.
Вы поможете украсть ваш iPhone
0:56
Romancev768
Рет қаралды 602 М.