OpenAI Assistant Function Calling Tutorial For Beginners (App With Source Code Included)

  Рет қаралды 14,467

codewithbrandon

codewithbrandon

Күн бұрын

Пікірлер: 34
@beetz12
@beetz12 7 ай бұрын
Thanks for the fantastic tutorial Brandon. I watched 5 other videos to learn function calling and this was hands down the best explanation! And I appreciate you providing the code for testing your assistant. If I hadn't come across your video, I would have written one myself. You saved me at least 5+ hours!
@romanbolshiyanov
@romanbolshiyanov 7 ай бұрын
i thinks it is a best ai channel, thanks
@ClownCallout
@ClownCallout 11 ай бұрын
The concept I don't understand yet is, I get the coding part, but say I have a [ search_web ] Python code, where would I host that code so the Assistant can call it? Then let's say I have the code hosted, and I go over to the OpenAI assistants dashboard > under functions say I have a function with Name: [ search_web ] (3:28 in your video)and I hit the test button. How does the Assistant know where my hosted Python code is? There is no endpoint set up there? Im so confused on this part. Its the last piece of the puzzle for me. Your help would be so greatly appreciated!
@owaisjavaid8110
@owaisjavaid8110 10 ай бұрын
Really appreciate the effort you put into the box so anyone can find out the what they are looking inside if the box. Can you add more details of the usage and pricing related stuff so we can have an eagle eye overview as well, and we can actually make it useful for any business solution.
@bhancock_ai
@bhancock_ai 10 ай бұрын
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.
@60pluscrazy
@60pluscrazy 3 ай бұрын
Good one 🎉 Shouldn't you have emphasized the need for tool/functions description to match a full/part of the assistant's instruction?
@maximusmadman
@maximusmadman 8 ай бұрын
Excellent Tutorial
@captainchaos6434
@captainchaos6434 5 ай бұрын
This was an absolutely awesome explanation and just what I was looking for! Any plans for something with Vercel AI SDK to build generative UI? Started exploring the useAssistant hook they have and seems pretty awesome so far.
@MikeEnsor-su9ro
@MikeEnsor-su9ro 6 ай бұрын
Awesome content man! Have any tutorials allowing us to do this from functions from within open ai assistants directly out to sources and back, removing the need for these manual inputs? Example, Open AI, with ability to call to Dumpling AI and web scrape vs call to a native API?
@pkundr
@pkundr 10 ай бұрын
Hey, thanks for this great tutorial! One question I have is why do we need to pass the stock data back to the assistant? In your example, the objective is to show the user the stock prices he requested. Once the Assistant sends us the stock tickers, we can already do so by calling the finance API. Why is it necessary to inform the Assistant about the prices?
@bhancock_ai
@bhancock_ai 10 ай бұрын
Great question Phillip! This confused me too at first. The reason we need to pass back the stock prices to the Assistant is because we want to complete our `runs`. If we didn't pass back the results to our run, the run would eventually time out because they waited on us too long to give them the information they needed to complete. Here's what the OpenAI docs say about the requires_action state: When a run has the status: "requires_action" and required_action.type is submit_tool_outputs, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request. If you want to check out the full webpage, you can see it here: platform.openai.com/docs/api-reference/runs/submitToolOutputs I hope that helps!
@carloseduardolandeiraribei5302
@carloseduardolandeiraribei5302 9 ай бұрын
Thanks for this, just one question, what if the message is too long and exceeds URI length limit when setting a message to a thread?
@romainbacque9408
@romainbacque9408 3 ай бұрын
Hey, I don't get when the getStockInfo function is called, is it during the ai assistant creation ? And how do we pass on arguments to the function ? I'm a bit confused ^^
@siddheshwarpandhare1698
@siddheshwarpandhare1698 2 ай бұрын
Hi I am developing ai agent and using function calling. After getting data from api to by function. LLM need to do series of steps on function call response data but llm is only doing first manipulation step Can you help on this issue. Using gpt 4 model
@mingchi21
@mingchi21 9 ай бұрын
Very good explanation, I have a question, can the API remember the context? For example: User=>Hey what is the price of tesla? Resp=>The price is ... User=>How about Apple? Resp=>The price is ... User=>Google? Resp=>The price is ...
@normanhome7017
@normanhome7017 9 ай бұрын
Hi Brandon a big thanks for the video I have same questions similar to one of the comments which you did not answer can you please answer it thanks. The following is the question Can the API remember the context? For example: User=>Hey what is the price of tesla? Resp=>The price is ... User=>How about Apple? Resp=>The price is ... User=>Google? Resp=>The price is ...
@Aaron-md2eo
@Aaron-md2eo 6 ай бұрын
Great tutorial! Would you (or anyone else) have an idea how to handle sequential function calls where the 2nd function call requires the results of the first one? For example, if you integrate an assistant with a calendar API and you tell it to delete your 2 o'clock appointment. It would first need to list your events (function call 1) and then delete the event (function call 2) with the event ID retrieved from the first call.
@ericintech
@ericintech 6 ай бұрын
i need this too, did you find any solutions?
@bhancock_ai
@bhancock_ai 6 ай бұрын
I would use LangGraph to achieve what you’re trying to do. LangGraph allows you to manage state and do operations in a sequential manner like you’re trying to do! I have a video on my channel so I definitely recommend trying that out!
@bhancock_ai
@bhancock_ai 6 ай бұрын
Hey Eric! Please check out the comment I added on this thread for Eric to see my suggestion!
@Aaron-md2eo
@Aaron-md2eo 6 ай бұрын
​@@bhancock_ai @codewitheric8800 Thanks, that's an awesome approach. For my use case, however, I managed to find a simpler solution. You can actually achieve this by using prompting (ideally both in the assistant instructions and in the function call descriptions), believe it or not. I had a little problem where the EventHanlder was not correctly initialized in the submit tool outputs function. If the loop is handled correctly, it should re-enter the requires action run state after submitting the outputs from the first function call and can call the next function based on the results from the first function call outputs. You can test this first in the playground with clear instructions to call functions sequentially and then provide some mock data for the tool outputs. This is a really powerful tool, I think. I'm working an a general AI assistant which I hooked up to Google Mail, Calendar, Tasks, Contacts, Drive, and also services for sending texts and placing phone calls on the user's behalf along with some other basic stuff like google search, news and weather. If you get it right, the assistant can intelligently decide which functions to call for almost any prompt, and in any order. For example, you can tell it to make reservations at the restaurant XYZ and it will first look up the phone number of the restaurant using google search, place the call to make the reservations, and then finally, add it to your calendar, all in one response based on one simple prompt. This works for plenty of other use cases for handling emails, calendars, and so on as well. 🙃
@AlphasoundSchool
@AlphasoundSchool 11 ай бұрын
Thanks for your content bro! I wonder if there is a way to create the assistant using server actions instead of api?
@bhancock_ai
@bhancock_ai 11 ай бұрын
Hmmmm great question! You should definitely be able to create the assistant using only server actions. I think this article will show you how to start using server functions instead of the api calls in the video: auth0.com/blog/amp/using-nextjs-server-actions-to-call-external-apis/
@AlphasoundSchool
@AlphasoundSchool 11 ай бұрын
@@bhancock_ai Thank you! I will check it out 😄
@JonathanPohlner
@JonathanPohlner 11 ай бұрын
do I need to clear cookies? how do I get the new code if I already got the code from a previous video?
@bhancock_ai
@bhancock_ai 11 ай бұрын
Hey! I just shot you an email with more info!
@Ourworldbyade
@Ourworldbyade 11 ай бұрын
I signed up for your code resource but it's not sending me the email. Thanks!
@bhancock_ai
@bhancock_ai 11 ай бұрын
Hey! I apologize that it didn't get sent to you. Could you please check your spam folder because I know a few people have experienced that issue in the past. If it's not there, could you DM me your email on X or email me at brandon@brandonhancock.io and I'll be sure to get it over to you!
@marcioandre6469
@marcioandre6469 4 ай бұрын
😂😂😂 When people just give the sec code I really feel like I have to subescribe and leave a star
@eliskucevic340
@eliskucevic340 8 ай бұрын
Why cant you just share the source code? Why do i have to sign up for it? Enough with the email farming.
@DevNieriDantas
@DevNieriDantas 6 ай бұрын
ingrato
@clamhammer2463
@clamhammer2463 10 ай бұрын
Once I saw next.js I stopped watching. Not everything should be made with react/next etc...
@DevNieriDantas
@DevNieriDantas 6 ай бұрын
pense fora da caixa e replique pro seu cenário!!! voce não é o sol, o mundo nao gira ao seu redor
I Automated My YouTube Channel With CrewAI [Free Source Code Included]
58:15
GPT function calling in a nutshell
15:36
Henrik Kniberg
Рет қаралды 50 М.
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 700 М.
CrewAI Tutorial: Complete Crash Course for Beginners
1:05:43
codewithbrandon
Рет қаралды 207 М.
OpenAI Assistant API Tutorial With Code Examples
21:52
codewithbrandon
Рет қаралды 30 М.
OpenAI Function Calling - Full Beginner Tutorial
28:24
Dave Ebbelaar
Рет қаралды 86 М.
How I Made AI Assistants Do My Work For Me: CrewAI
19:21
Maya Akim
Рет қаралды 923 М.
Learn Function calls in OpenAI Assistants API (NodeJS tutorial)
23:56
Function Calling with OpenAI APIs | A Crash Course
18:29
Elvis Saravia
Рет қаралды 13 М.
CrewAI Tutorial for Beginners: Learn How To Use Latest CrewAI Features
35:06
GPTs vs Assistants API - which one is best for you?
13:09