No, You DON'T NEED OpenAI Function Calling!!!!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this is the first time we have got a good open llm to do function calling this has been one of the biggest mod for open Ai and now we have got an open source model that can do function calling for any language model and any APA that you want and in this video we're going to cover that extensively and if you're not familiar with what the heck am I talking about about function calling I'm going to quickly start this video by explaining what is function calling what who a I did then we are going to jump right into the new llm that is called gorilla open functions and we're going to see a couple of examples on Google collab notebook and if you get to the deep end please let me know in the comment section so the bigger question is what is function calling so let's take a scenario this is this is my crazy art so you have got a human being just like me or you and the human being talks to an llm which is what everybody popularly calls AI so there is a human and then there is an AI and typically the response is like this the human asks a question the AI comes back with an answer so the human asks a question and the AI is coming back with an answer here so when the AI comes back with an answer the answer could be of multiple different types one the answer could be a simple normal text for example you asking a question what is the capital of India then the answer could be normally new Del is the capital of India so this is a very normal text that is a response one the second thing is maybe the human is asking a question what is uh how write me a python code to import CSV in pandas now the a is going to answer with a computer code like a program that you could probably copy paste in your python Ripple and then execute and then the third type that is quite interesting not a lot of people are paying attention to is something called a code a code it could be a code it could be a Jon but something that can be used to call a function the example is let's say the human has gone ahead and then told the AI write an email to my wife that I'm going to be late 20 minutes to home home this is a text so let me say that write an email to my wife that I'm going to be late 20 minutes so if this is the message that somebody has told the AI for example now you need to know the AI needs to know that first of all this is an email writing task and have an access to the API so I need to just create some kind of a structured response for example where the response goes like this it say send email and two should be my wife's email ID and the body should be I'm going to be late for 20 minutes so how do you make a large language model do this and that is where open a function calling has been one of their biggest modes I didn't see any of the open language models have a really good function calling and I personally know a lot of people who use opena function calling primarily because they didn't have any other good option for example opena launched function calling sometime back and this is a really good opportunity for a lot of developers to connect large language models with the apas that they have got so that means you can go ahead and then ask any question what is the weather so the a AI in this case can generate a function call like for for example something like this and then it can call a weather API and then get the API response back and give it to you or you can say who are my top customers the AI can convert this into an APA call which could call your internal APA or you can extract structured information for example you can say Define a function saying extract data something something or it could be like a SQL query so overall function calling is one of the biggest modes of open Ai and a lot of people I personally knew like developers who develop SAS applications used opena function calling primarily because they didn't have any other good option and opena has been building on this mode with you know formatted Json and all the other things but today if you're in that position I've got a very very happy news for you and that is Gorilla open functions this is coming from almost the similar team that developed gorilla a large language model that can make APA calls but this is not specifically focused on function calling which they are calling as open functions before I show you everything I want to quickly show you an example of how it works so we have got the Google collab notebook kindly from the gorilla team so let's say you have got a you have got a query that says I want to order Five Burgers and six chicken wings from Uber eat McDonald's once this is a user query you design something something something and at the end of the user query you are going to get this one now this as you know if you worked in computer science or you know software development you know this is a function called so you've got a function probably that says Uber e order and you're calling that function with these arguments these parameters restaurants items and all these things and how did this come up to so it takes this natural language and uses this gorilla function call to translate this into a function call and later into the video we're going to see two types of function call but at least at this point you know what is happening here and this is what gorilla functions open functions is letting you do that gorilla open functions is a large language model that is designed to extend any large language models chat completion feature to formulate executable that's the most important thing right anybody can make um function calls but it has has to be executable executable API is called given natural language instructions and APA context you have to give natural language instructions and API context and that's exactly what is happening here so if you see here for gorilla response you give the natural language as an input and also you give the function documentation or in some cases you give the function in itself so the AI understand what is a function and it takes the natural language converts a query into actually like a function call and that's what gorilla llm is doing so open functions is an llm that they trained using a curated set of APA documentation question and answer pirs for from APA documentations and this is what the open gorilla gorilla open functions is and uh open functions from Gorilla by default supports a lot of python libraries and it supports a lot of um sdks but it is also easily extendable to any other documentation that we have got one of the examples that we'll see shortly and uh the other important thing is like I say like when we talk about function calling you need to keep one thing in mind there could be like two types of function calling so one is uh when you have a you have something let's say you have something and it is a function call for a python package or let's say something within the coordinate itself it's not a HTTP request the second one is HTTP request you go do here and you make a get call call or a post call so you have a get call or a post call get or a post so what happens in this Cas is when you want like weather report then this is the function call that has to be used when you want to for example go ahead and then say um something like I want to import CSV in pandas then this is the function that has to be given so this gorilla functions open functions support both these categories like both these types of function calling but typically when you talk about function calling most people would mean this type this particular type they would not just necessarily mean this one they would mostly mean this one whenever you talk about function calling in the open world the good thing with open functions gorilla open functions is it is also aphi 2.0 licensed model that means you can do anything with the model that you want it's completely open source unlike you know some proprietary license that people have got and uh I want to directly jump into the code but before I do that quickly show you how good this is so if you see the function calling performance across different models I've got gbd4 turbo you've got GPT 3.5 functions you've got gp4 gp4 function GP gorilla open functions so for all these things this is the only open source models that you can see I mean like it's it's actually open source you've got the gorilla open functions it has C 8 87% accuracy across all these things like gbd4 turbo gbd 3.5 function gb4 G beautiful function now when you see this thing it might look like it's a it's a least in the in the bar chart that you have got but necessarily this is a huge breakthrough in what people could do without open AI this is like one step further where you don't have to one rely on open AI for everything that you do in a SAS business especially when it is related to AI so even though the score is like lesser than the top GPD uh gp4 function or gpt3 3.5 function doesn't necessarily mean a bad thing this is like a huge breakthrough for open source or open model so I highly appreciate the team for being also open in putting out this benchmarks like not overselling their solution but really really really being honest and have that Integrity to put out this solution and uh this doesn't mean this model is bad this actually means this model is one of the best that is available in the open world so you can go ahead and then read more about uh you know what went well what did not go well all the kind of details and you can also see the comparison between code function calling apis and the rest apis like how how does it differ like the example that we discuss code function calling APS and rest APS you can learn more about this thing if you have any question let me know in the comment section I'm very happy to dive deeper into it all the code is available for you here like if you want to use it how to use it it is all available in the GitHub repository but they've also kindly shared a Google collab notebook which they're using from a model that is been hosted by uh you know us UC Bly Skylab for free so use this only for prototyping do not use this for commercial purposes that's something for you to keep in mind I link the Google collab notebook and also the GitHub repositor in the YouTube description for you to directly click and get started so all you have to do is go to this Google collab notebook click get started the first step you can install open aai and U you can use this they're going to use open AI formatted um API call so that's why you're using it you're not necessarily using open a APA key you don't need APA key so you have got the gorilla server and that's where you can see that um the open AI AP key is empty and the API base is uh from uh the U Bly the hosted server and you have got the code completion the the model is used is Gorilla open functions V1 now what is this open functions V1 now they've got two types of models one is a v0 the one second one is V1 the v0 given a function under user intern it returns properly formatted Json with right arguments which is what we kind of correctly did the V1 also does parallel functions and you can choose between different functions this is also one of the modes of open AI there you can see they've got parallel function calling so you've got like the example how the parallel function calling works so gorilla open functions also helps you in supporting parallel functions I'm not sure I didn't test it how efficient it is but the V1 model also helps you with that now that is the V1 model temperature is set to zero and you've got you know the basic open a chat completion format now after you set this function which is get Gorilla response and uh you know you're using the model the gorilla open functions we one model the next thing for you to do is for you to go and specify like a function documentation how would the model know what function documentation is like what are the arguments what is the what is the function name and what should it return and all all these things that's where you define in a function documentation so youve got the name of the function like B descriptive the APA call what should it call the description of it and the parameters like what kind of parameters it takes so that is basically your function documentation once you define the function documentation then you can have like the conversation and get the function call directly as an output for example for a given input here like get Gorilla response with I want to order the Five Burgers and six chicken wings from McDonald's with the function documentation you get this proper python kind of like a function called output I want to show you the demo and uh the query says call me an Uber ride plus type Plus in Berkeley at zip code blah blah blah in 10 minutes so it has the function details the carpool Uber do ride the description and uh all the parameters that go into it so the function itself is defined functions you give it inside functions and you call it so it it tells this is the location what is the type and the time in 10 minutes so let me change this and then see call me a uber ride um type let's say pool in uh Bengaluru and then the ZIP code is 560 61 in 3 minute 4 minutes maybe and call this let's see if it works actually so yeah Uber right location pool and U it doesn't tell me the city because we have not added City so what you can probably do is you can probably go ahead and then add one more type of the parameter here so it knows okay city is something that I have to call separately for example right now it says name time description amount of time somebody is willing to wait it has got the description what the um person is ordering the type is available so you can go ahead and add one more um parameter here saying City then it would actually have the city also as part of it so that's something that you can do it for it to understand it better but right now it doesn't have City and that is exactly how you extend the existing function calls using this particular U llm which is the gorilla open functions V2 and extended to other documentations now you can go further in detail you can have like the function documentation in itself with a lot more items if you see this this is quite simple here the parameters but you can have like more detail here and then ask the same question and it can answer the good thing with open functions like so so far what did we discuss we discussed that gorilla open function is a really good um like a second layer that you can have for opena function calling if you were to use open a if you don't want to use open a gorilla open functions it's really good for you to use there are two types of models the v0 the V1 the V 0 uh given a query and given the user in it it can return you a proper Json for you to use and V1 can help you support parallel function calling and we learned about function calling we learned U what is is function calling what is code calling what is r APA calling the good thing the other good thing with Gorilla open functions is because this has been trained on existing documentations existing apis um whatever that is available gorilla open functions already have got knowledge like extensive knowledge about AWS Google Cloud uh rapid API if you have like ever used rapid API it's like a Marketplace for API Azure and GitHub so this can also help you like this can be helpful without you having to fine tune or extend the documentation itself so that's the example that they've given here so you can say I want to list the exports for my bot with the bot ID this and Bot version this and you just specify the function like you specify all the details here so this is like if you have got like your custom um let's say bought like legs running on AWS so now you can like literally use this and it is going to give you the function call and now you can call your AWS bot uh just using this um open functions from gorilla and there are a lot more other details in it and uh I believe uh that I would definitely make like another separate video detailing like extensively detailing how to use open functions for different cases this is not necessarily a handon tutorial about open functions but I wanted to like let you know that this has been one of the biggest modes of opena I was so excited to see open functions from gorilla because gorilla has already a good name in the market for being like the API llm and now you know they they are the first one or at least like the one that I'm aware of the good one to have a function calling within open LM and this is like from a team shisher G Patel was already there in the gorilla team and then you have got the rest of the team I'm really glad that this exists with open license huge huge Kudos and thanks to the team the UC Berkeley team for putting it out putting it with clear documentation and everything else that they've done to accelerate the open community and let me know like if you do function calling if you're not familiar with function calling this is a very big deal you should definitely start using it because this can transform how you build AI application it's U it's hugely collaborative you can like connect to the any ecosystem that you want and let me know in the comment section what do you feel about this open functions that could probably um I'm not sure like how much it could impact opena but definitely for a lot of people who are out there building out AI SAS you should definitely try out gorilla open functions see you in another video Happy prompting
Info
Channel: 1littlecoder
Views: 13,659
Rating: undefined out of 5
Keywords: ai, machine learning, artificial intelligence
Id: CwF-n36sB0c
Channel Id: undefined
Length: 17min 28sec (1048 seconds)
Published: Fri Nov 17 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.