OpenAI Assistant API, getting started

Ғылым және технология

We're going to make our own AI assistant. OpenAI has put out a new API that lets us do exactly that. They even hinted that we could make some money off it further down the line, but that's not our main concern right now. Let's just start making one and see how it goes. We'll start with the basics. The OpenAI Assistance API really smooths over lots of the rough patches you might run into when you're using OpenAI with any other machine learning or AI model. The context size is too small, so we need to cut things up and then pick pieces of documents and sort by the relevance of vectors to see which documents match. Also, what are the basic instructions the AI should follow in giving answers? To get better results, we use a technique... What was it called again? Right, prompting. I thought it would have a fancier name. It's prompt engineering, typically a sequence of inputs and outputs. You ask a question and get an answer, and repeating that process can yield better results. The Assistance API also lets us introduce some custom functions that the AI will ask us to invoke. Keeping things simple is our goal today as we build our first AI assistant. I'm ready to create our first AI, our own custom assistant using OpenAI's new Assistance API. They've made it really intuitive to use their interface to make your own custom AI. Let's dive in. I'm going to create my first assistant. To keep things uncomplicated, it'll only be really good at one specific task. Let's make it an expert in PubNub MQTT. It'll be engineered to act like a software engineer. We'll program it to write code that we can paste into a Python script file that we can run locally on our own computer. We'll select the preview model, and also add a simple function for file retrieval. Now, we'll upload a text-based file which provides extra instructions to help it accomplish its objective. From our documentation page, I'll print and save a file. Now I just need to upload our PDF file. The file is uploaded and it has all the knowledge it needs. We're ready to roll. After saving and waiting for a bit, we have an AI assistant. Let's explore it. We are given an assistant ID that we can use to create new interactions with the assistant. Conveniently, we can instantly test the assistant using their inbuilt testing tool. OpenAI's tool made setting up our own assistant easy, and now let's test it out. They have a handy little "test" button that takes us to a playground with a standard user interface. I'd like to test out the MQTT function. The assistant gives two options: add or run. In this case, I don't need to add any more information, so I'm just going to hit "add and run". The assistant doesn't provide the typing effect we're used to seeing but they're working on adding that feature. The response was accurate and used instructions from the PDF file I provided. I can easily check this in the log input. The assistant used a retrieval tool and provided instructions on how to run the code on my local system. Once the install is complete and the file is copied, I can run the Python script. With a successful connection to the MQTT server, the assistant has performed its first task. This basic assistant helps answer questions and performs a task, writing Python code, very effectively. Additionally, it guided me to find my API keys in the dashboard for an easier MQTT broker connection. It's exciting to think of all the different potential applications for this approach. Various other features and capabilities like code interpretation and custom functions to retrieve more data or execute task-specific commands are available through the API. We can even pull data from other systems to create whole workflows. This really shows the power of the Assistance API and how it's making AI development more accessible.

Пікірлер: 41

  • @p.c.336
    @p.c.3362 ай бұрын

    Great video, I appreciate your effort. I'm also impressed by how you take the time to respond to comments. You truly have a kind heart 🙏

  • @StephenBlum

    @StephenBlum

    2 ай бұрын

    Absolutely happy to do it! 😄 Looking forward to more 🙌

  • @IppolitoEDU
    @IppolitoEDU3 сағат бұрын

    Great video, thanks. I am not a developer (STEM educator). I want to build an assistant like you did here, but connect it to other platforms for input/output (like D-ID). Do you have any videos about that? Thanks!

  • @StephenBlum

    @StephenBlum

    2 сағат бұрын

    Nice! Your idea is fantastic. That sounds like a great way to add knowledge and have a digital avatar speak it aloud. D-ID can be enhanced with your own custom data. This sounds really neat! I'll look into this to see what it would take. I think we'd need to build something to make it work. We need to leverage the function calling capability of ChatGPT to invoke the AI to provide knowledge from your PDF files and then invoke the D-ID avatar to speak the response. I've added this to my list of video idea planning. Thank you!

  • @antdx316
    @antdx316Ай бұрын

    I’ve been using the PC since Windows 95 and just realized you should Print Sites as a PDF then upload it into AI. 👍

  • @StephenBlum

    @StephenBlum

    Ай бұрын

    Absolutely! 😊 This is a good way to provide context for your Assistant API. The PDF format is uniform and easy to capture the important text data without the formatting form the HTML and CSS.

  • @felixseitz3411
    @felixseitz34116 ай бұрын

    I want to build something with the Assistants API for my website. Is there also a word limitation for it like in GPT-4? When Im using GPT-4 in the chatbot, i need to write „continue“ after roughly 1200 words. What I need for my website is, that it generates 3000 words in one response (needs to be an analysis of something). Is this possible with the assistants api? If the answer is no, is there any workarounds?

  • @StephenBlum

    @StephenBlum

    6 ай бұрын

    @felixseitz3411 hi! good question. Is there a word limit: Yes The new API word limit is 4095 tokens. This is close to 3,000 words in one response.

  • @multishorts-bu5dg
    @multishorts-bu5dgАй бұрын

    Hello, great video, but, I'm yet to understand, do i get a personal api for my assistant that i can link to my application?

  • @StephenBlum

    @StephenBlum

    Ай бұрын

    Yes you do. You can make API calls directly to your custom assistant. It's referenced by Assistant ID and Thread ID. Both Assistant and Thread are independent. You've already created the Assistant in the GUI. Next you'll create a Thread ( series of chat messages ) and then issue a "create Run" using both Assistant and Thread IDs. platform.openai.com/docs/assistants/overview

  • @DWSP101
    @DWSP1013 ай бұрын

    OK I’m looking to create an AI assistant using this exact method for at least the first few minutes and I’m just using a Apple tablet directly through a browser to do this. Where do I start?

  • @StephenBlum

    @StephenBlum

    3 ай бұрын

    Using your Apple tablet in Safari, you'll want to create a new "Assistant". platform.openai.com/assistants there is a button [+ Create]. Click the button and fill in the form. This will create the default Assistant. You can start customizing from here! 😄

  • @ricardotaipe
    @ricardotaipe6 ай бұрын

    So does the assistant API let you "bring" ChatGPT (or more specifically CustomGPTs) to "other places" (via the API)? I was having a bit of trouble understanding what assistant API is hehe

  • @StephenBlum

    @StephenBlum

    6 ай бұрын

    @ricardotaipe good question, The Assistant API is the most advanced and customizable framework that OpenAI is currently offering. The Assistant API allows you to define a custom GPT based on the rules you provide it. You can add custom knowledge in large quantities, add custom rules to follow, and also provide access to custom code and data fetch capabilities. This means you can create completely integrated assistants like a "calendar assistant" that can fully manage your calendar the way a human assistant would. You can create a "booking" Assistant API service that fully automates a doctors office customer schedule. Using natural language, customers can verbally speak to OpenAI's Whisper API, and the Assistant API can determine actions using custom-defined functions like "calendar slot available" and "schedule appointments at specific times."

  • @Canna_Science_and_Technology
    @Canna_Science_and_Technology6 ай бұрын

    CAUTION! FYI there is a failure of direct retrieval with GPT-4 using the new OpenAI Assistant API. GPT tokenizes text and creates its own vector embeddings based on its specific training data. The new terms and sequences may not connect well to the pretrained knowledge in GPT's weight tensors. There was no semantic similarity between the new API terms and GPT's existing vector space. This is a fundamental issue with retrieval augmentation systems like Rag - external knowledge is not truly integrated into the model's learned weights. Adding more vector stores cannot solve this core problem. The solution is to have multiple learned "knowledge planes" with trained weight tensors for specific tasks that can be switched in. This is better than just retrieving separate vector representations.

  • @StephenBlum

    @StephenBlum

    6 ай бұрын

    @Canna_Science_and_Technology Yes this is a good point! You make an important note about the limitations of OpenAI's RAG approach. They take your text document, vercotrize into tokens using their token lookup. They may be splitting your documents into segments, and creating snippets before creating an embedding that can be indexed for similarity search. This will be used to compare with the user-input prompt. Any vector similarities will be included as reference text along with the user-input prompt. While this provides general level of context for the GPT model, it won't have a deep knowledgeable understanding of your custom document data.

  • @TobiasHam
    @TobiasHam3 ай бұрын

    trying to figure out how to use those assistants in php instead of python. cant find tutorials, any help?

  • @StephenBlum

    @StephenBlum

    3 ай бұрын

    Yes here is how to do that in PHP: community.openai.com/t/looking-for-a-simple-procedural-php-function-for-openai-use/215914/3 Also, the AI itself will write the code with the prompt: "Write me a PHP Curl example using the OpenAI API Assistant API.

  • @utk1000
    @utk10006 ай бұрын

    where is the file link that u uploaded to the assistant for file retreival? how can i make or find such files for developing various other assistants

  • @StephenBlum

    @StephenBlum

    6 ай бұрын

    That's the great part about the assistant API, it lets you upload PDFs and other text-based documents directly. Simply add a file using the UI. When you list the assistants, The upload form should be available near the bottom when editing and assistant.

  • @utk1000

    @utk1000

    6 ай бұрын

    @@StephenBlum I mean where do I get the file itself

  • @StephenBlum

    @StephenBlum

    6 ай бұрын

    Around 2:10 the example PDF file is uploaded on the video

  • @utk1000

    @utk1000

    6 ай бұрын

    @@StephenBlum thanks a lot man 🤝. I'm a beginner in AI, appreciate the help.

  • @StephenBlum

    @StephenBlum

    6 ай бұрын

    @@utk1000 any text-based file works. The AI will gain the knowledge that you give it and prioritize that knowledge above its existing knowledge. In the video we upload a PDF, which is a text file. We got the PDF from a web page. We printed as PDF. And saved the file to our computer. Then we uploaded the file to the assistant API

  • @MannyBernabe
    @MannyBernabe6 ай бұрын

    Thanks!

  • @StephenBlum

    @StephenBlum

    6 ай бұрын

    Happy to help! This is a quick start guide. The video covers simple document retrieval. Now you can inform a GPT with your proprietary data and create powerful applications. You can also create an internal business tool that knows specific details from your company wiki and more.

  • @youri655
    @youri6556 ай бұрын

    really cool!

  • @StephenBlum

    @StephenBlum

    6 ай бұрын

    Thank you! It's really powerful. I also heard about AWS quietly launched their own version: aws.amazon.com/bedrock/agents/ - which is key if your corporation requires data firewalls. Though OpenAI Assistant API looks much simpler to use, at least there is still an option for use cases requiring data remain on AWS.

  • @mr.tycoon7246
    @mr.tycoon72464 ай бұрын

    I can create 10 assistants based on consciousness and thoughts and some of them on interpretation and retrieval then use a/a lot of python scripts to get an autonomous AI, this is nice, If I mix this with Lang chain it will be OP

  • @StephenBlum

    @StephenBlum

    4 ай бұрын

    This is a great idea!! You'll basically be creating a workflow of human logic. You can create a system that would closely resemble human thought. Nice! 😄🚀

  • @shivamkumar-qp1jm
    @shivamkumar-qp1jm6 ай бұрын

    Is it free to use I have a GPT Plus Subscription

  • @Jakyblacky

    @Jakyblacky

    6 ай бұрын

    I think is free for now, until November 17th

  • @StephenBlum

    @StephenBlum

    6 ай бұрын

    Nice! Happy to see it's free. I was using it a lot, and expecting a charge. This is great news 🎉

  • @elrecreoadan878

    @elrecreoadan878

    6 ай бұрын

    Hi! What differences is there between GPTs and Assistants ?

  • @StephenBlum

    @StephenBlum

    6 ай бұрын

    @@elrecreoadan878 GPTs vs Assistants are the same system. There is a difference. The advanced features are only available in the Assistants API. While GPTs lets you prepare a specialized GPT, the Assistants API allows you to integration into any system programatically. Building via GPTs states you don't need to know any code to build. So it will be limited in capability, at least initially.

  • @tbcdemos6297
    @tbcdemos62976 ай бұрын

    cant help but notice you sound like Sheldon from Big bang theory, an influence for you or both of you belong to perticular place with this accent/tone ..? just curious and completely non-techincal .. thanks

  • @StephenBlum

    @StephenBlum

    6 ай бұрын

    Haha thank you, that is coincidental 😄♥️ I've heard this comment before, some years ago

  • @becchitequesta
    @becchitequesta4 ай бұрын

    hi, how can i export my gpt? i can only run it on test playground. Thanks a lot!

  • @StephenBlum

    @StephenBlum

    4 ай бұрын

    Using the API platform.openai.com/docs/api-reference/runs/createThreadAndRun the quick and easy option is to use the createThreadAndRun approach. This approach allows you to submit the prompt to your pre-created Assistant referenced by the `assistant_id`. createThreadAndRun will return a thread_id which you use to check the "status" of the run. You can poll for "complete" status platform.openai.com/docs/api-reference/runs/getRun every few seconds. Finally you'll fetch the messages for the thread which is the output platform.openai.com/docs/api-reference/messages/listMessages - it's a three step process 😄 at least, that is the fewest steps currently possible I could find

  • @jameylynch2709
    @jameylynch27096 ай бұрын

    Let’s build an agent together!

  • @StephenBlum

    @StephenBlum

    6 ай бұрын

    Totally! There's huge potential here. The ability to leverage custom functions to pull data from external systems. An Assistant can generate reports from your database, it'll know your schema and how to aggregate data. Next-gen data research

Келесі