
Repo: https://github.com/developersdigest/OpenAI_Function_Toolkit_And_Library/ In this video, I introduce a new open source toolkit and library I started to make interacting with OpenAI's new function calling feature as easy as possible.
--- type: transcript date: 2023-06-28 youtube_id: OMIuh2Xicg0 --- # Transcript: OpenAI Function Toolkit and Library in this video I'm going to be showing you the new opening AI function toolkit that I've been working on to make it really simple to integrate and use functions within your openai applications so in this video as you see I'm going to be using node.js but this sort of structure can be used and replicated in Python if you go ahead and you know take this code and you know manipulate it as you see fit so the first thing I'm going to show you is actually how it works so if I just invoke this file you'll see all I have is One Import and one function So within the function I'm passing in what I want it to do and then open AI is going to go ahead parse that for a payload to send to my function and then my function is going to execute and then it's going to send me a response here so if you see within the terminal you can just click for the response and you see that it's generated a screenshot of amazon.com so these are just sort of a couple sort of you know Silly examples but you can really scaffold this out to be whatever server functions that you need within your application so in this next one there's a couple things here so it's going to be using two different functions so I'm telling it to both scrape google.com but then take a screenshot and then the other thing with this is I just wanted to demonstrate that you don't necessarily need to use all the functions like it's set up out of the gate so the way that it's set up is it's going to look in this directory for all the different functions here so say you have 50 functions it's going to attempt to pass in and use all those 50 functions so if you run into limits where if you have like an absolute ton of these functions in here and there's a you know an API limited error that you get or if you just want to specify and you know for certain certain methods are only going to need certain methods you can just limit them explicitly within the function array here so I'll just demonstrate this one as well you see the first thing that I've returned is the HTML for google.com and then we also have the screenshot as well foreign So within the next function um So within this one this is just sort of just sort of to get the gears turning in terms of how you can use this so if you are using this locally and you're tinkering around with it one of the things that you can also do is interact with your computer itself so you can interact with uh you know any sort of CLI command that you like so within this one for example it's uh opening an app on the computer and this is sort of the description but then the actual invocation of how it's working through node you can see an example of that so it's going to open a and then app name so just to demonstrate this if I go ahead and call this open the calculator and there you have it there open the calculator so the other thing that you can do with this is you can have these concurrent so you can invoke them at the same time and if it's something you know you want to have like multiple of these invoked at once you can do that so I'll just demonstrate it here where I'm asking it okay I want a calculator app to open and my activity monitor on my computer and you see just quickly it just takes a moment you'll see okay there's my activity monitor and there's the calculator so just to briefly go into this but it's pretty straightforward so the one piece to concern yourself with hopefully is just the function directory here so if you go in here and you specify your function each of these will have an example and you'll see if you just look through these simple examples the similarities so I'm just going to touch on them and fold the code briefly to show you how I decided to set this up so first you have your function that you declare as you typically would now the one unique part is each of them will be called execute So within the open app so the one thing to note with the way that it's set up here there has to be continuity between the name the function object and then the file name itself so just to make sure you don't run into any issues but over time I might look at a way to simplify this a little bit further so you'll see there's the execute method that's being passed in this will be what openai actually invokes if it sees fit then there are the details which this is at the initial payload that gets sent to open AI to really explain what your function is and the payload that you need to make it work so if there's arguments that you need you need to describe them in natural language as well as specify what type they might be so if they're a string or a number or an object so there's a few examples here that you can look at on how to do that and then finally I just thought as a nice convention is just to include an example of how to actually invoke it so over the coming days and weeks I'll add a handful of other methods within here my thoughts initially with this are to maybe you know set up and instantiate like a Pinecone instance or upsert certain data and sort of maybe build out helper functions that are just helpful to the you know the llm app developer ecosystem and then from there you know I encourage you if you have function ideas or things you use all the time include them here I'll try and build out this uh repository to both be a library but also be a rapper around on how you can really you know make it easy to incorporate using these functions with this similar syntax here so if you see any uh you know things that you suggest improving please open an issue or open up request I'll try and get to them as quick as I can but I'll have this repo up later tonight but if you found this video useful please like comment share and subscribe and until the next one
Technical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.
Weekly deep dives on AI agents, coding tools, and building with LLMs - delivered to your inbox.
Free forever. No spam.
Subscribe FreeNew tutorials, open-source projects, and deep dives on coding agents - delivered weekly.