OpenAI Assistants API + Python ๐Ÿค– How to get started? (FULL Tutorial) ๐Ÿคฏ INSANE

Mervin Praison ยท Beginner ยท๐Ÿง  Large Language Models ยท2y ago

Key Takeaways

Integrates OpenAI Assistants API with Python to enable AI assistants in applications

Full Transcript

this is huge is there any way to create a custom chat GPT assistant is there any way to customize the assistant based on our requirements that's exactly what we are going to see today let's get [Music] started hi everyone I'm really excited to show you about chat GPT assistant API this is groundbreaking I'm going to take you through step by step on how to set this up I've already covered the beginner Tut tutorial in regards to chat GPT I will link that in the description below now let's start with import open AI next setting of The Client equals open. openai next we are creating assistant equals client. beta. assistant. create in that we are providing name of the tutor that is math tutor instructions you are a personal math tutor write and run code to answer math questions that is the custom chat assistant we are creating to help students to solve math problem next we are adding tools to run the code we need code interpreter after that we are defining the model name which is GPT 4 Turbo first we have initialized the assistant next we are creating a thread thread equals client. bea. threads. create then third we are going to create message equals client beta. threads. message. create this is the message the student is sending to the tutor we're providing the thread ID roll which is either user and the content I need to solve the equation 3x + 11 = 14 can you help me that is the question the student is asking the math tutor I will Mark that as student next we are running the code run equals client. beta. threads. runs. create here we are providing the thread ID the assistant ID and the instruction so thread ID is a thread which we created assistant ID is the assistant that's the math tutor which we created and we are providing instruction please address the user as mvin prais this is like initializing the chat in autogen now we need to wait for the run to complete so to do that I'm going to import time and then time do sleep for 10 seconds so first we initialize assistant that's the math tutor who is going to help in understanding math then we are creating a thread that is like a conversation between math tutor and the student thirdly you create a mage message that is a student the student is asking a question to solve the equation and then we are running all that together in this runs function now we need to check the status if the Run has been completed or not to do that run status client. beta. threads. run. retrieve this will retrieve the status of the thread inside that we are providing thread ID and run ID if the Run status do status equals completed then message is equal to client. beta. threads. messages. list thread ID equals thread ID this is the format in which you need to give this messages will contain all the list of conversation between the tutor and the student now we are going to Loop through the messages for message in message. dat rooll equals message. roll content equals message. content. text. value and then we are printing the role which will be the student and the assistant then the content so as a quick overview first we are importing open AI then we are creating a custom assistant who is the math tutor to help students and we are assigning the model gp4 turbo and defining what tool they require that is code interpreter then we are creating a thread that's like a conversation between two person in the thread the student is asking a question I need to solve the equation that is the message then we are running theod code once after the run is initiated we are waiting for 10 second for it to complete then we are retrieving the status of the thread if the status of the thread is completed we are retrieving all the messages in the thread and then finally we are printing it out I'm going to run this code in your terminal type Python app.py and click enter I'm not getting a response probably it might need more time so I'm going to increase the weight time time to sleep is 20 now I'm going to run it again Python app.py and click enter now we got a response the assistant is responding that is the math tutor the solution of the equation is here this is the complete thread between the user and assistant that's it as simple as that now you are able to create custom assistants using chat GPT and it is powerful I'm going to create more videos in regards to chat GPT assistant so stay tuned in my YouTube channel I'm continuously creating videos about artificial intelligence so please have a look I hope you like this video do like share and subscribe and thanks for watching

Original Description

Dive deeper into the innovative world of AI with our comprehensive tutorial on the ChatGPT Assistants API Beta. This game-changer guide will teach you how to integrate powerful AI assistants directly into your applications. From enabling tools like Code Interpreter to leveraging advanced models, we cover it all! Code: https://mer.vin/2023/11/chatgpt-assistants-api/ ChatGPT Tutorials Playlist: https://www.youtube.com/playlist?list=PLYQsp-tXX9w62Lgpvx2JMBvKAAi7rfb_t ChatGPT Beginners Guide: https://www.youtube.com/watch?v=_E9rqrnPzWI GPT-4 Turbo: https://www.youtube.com/watch?v=Fo0KEPP7Nt4 GPT-4 Seed: https://www.youtube.com/watch?v=q5o8n1_jQb4 GPT-4 JSON: https://www.youtube.com/watch?v=9FZSA2UzXL0 ChatGPT Text to Speech API: https://www.youtube.com/watch?v=LWfE-j_V2J0 Dall-e 3 API: https://www.youtube.com/watch?v=eKCLFY5_NZI Whisper API: https://www.youtube.com/watch?v=B9AuQ3jpwrA GPT-4 Vision API Image: https://www.youtube.com/watch?v=xtdQb7-bv7E GPT-4 Vision API Video: https://www.youtube.com/watch?v=QyqnR3bBMDs GPT-4 Assistants API: https://www.youtube.com/watch?v=pZUDEQs89zc ๐Ÿ‘จโ€๐Ÿซ Benefits of Watching: Grasp how to build AI assistants with the Assistants API Beta. Discover how to utilize tools like Code Interpreter, Retrieval, and Function calling. Learn to create threads, add messages, and run assistants for dynamic responses. Gain insights on optimizing conversations with the API's latest techniques. Watch real-time examples of an Assistant aiding with math problems. โฑ Timestamps: 0:00 - Intro to ChatGPT Assistants API Beta 0:20 - How to Create a Custom AI Assistant 1:09 - Enabling Tools and Picking Models 2:00 - Managing Threads and User Conversations 3:02 - Understanding Messages and Runs 4:13 - Seeing the Assistant in Action #chatgpt, #assistants, #api, #ai, #artificial, #intelligence, #artificialintelligence, #ChatGPT, #AI, #AssistantsAPI, #OpenAI, #GPT-4, #Beta, #CustomAssistant, #CodeInterpreter, #Retrieval, #FunctionCalling, #Python, #APIIntegra
Watch on YouTube โ†— (saves to browser)
Sign in to unlock AI tutor explanation ยท โšก30

Playlist

Uploads from Mervin Praison ยท Mervin Praison ยท 58 of 60

1 Build GCP Infra using Pulumi in YAML format
Build GCP Infra using Pulumi in YAML format
Mervin Praison
2 How to Convert a Pulumi YAML File to Python Format
How to Convert a Pulumi YAML File to Python Format
Mervin Praison
3 Speed Up AWS EKS: A Complete Guide to Performance Tuning & Debugging!
Speed Up AWS EKS: A Complete Guide to Performance Tuning & Debugging!
Mervin Praison
4 Learn GCP GKE to AWS EKS Migration in Just 5 Minutes: Quick Guide
Learn GCP GKE to AWS EKS Migration in Just 5 Minutes: Quick Guide
Mervin Praison
5 AWS & Kubernetes: The Definitive Guide to Data Persistence with PV and PVC
AWS & Kubernetes: The Definitive Guide to Data Persistence with PV and PVC
Mervin Praison
6 ChatGPT Voice Conversation RELEASED! It's AMAZING!! (Demo)
ChatGPT Voice Conversation RELEASED! It's AMAZING!! (Demo)
Mervin Praison
7 How to Install Mistral 7B in Minutes: Quick & Easy Guide! โœ…
How to Install Mistral 7B in Minutes: Quick & Easy Guide! โœ…
Mervin Praison
8 Code Llama Install Locally: ๐Ÿ๐Ÿ’ป Elevate Your Python Skills!
Code Llama Install Locally: ๐Ÿ๐Ÿ’ป Elevate Your Python Skills!
Mervin Praison
9 Orca Mini: Your Ultimate Guide to Install and Test on Mac & Linux ๐Ÿ’ป
Orca Mini: Your Ultimate Guide to Install and Test on Mac & Linux ๐Ÿ’ป
Mervin Praison
10 Quick & Easy Vicuna Setup on Mac and Linux ๐Ÿ’ป
Quick & Easy Vicuna Setup on Mac and Linux ๐Ÿ’ป
Mervin Praison
11 Quick Guide: Llama2 Local Installation and ChatGPT with pip! Python๐Ÿ› ๏ธ
Quick Guide: Llama2 Local Installation and ChatGPT with pip! Python๐Ÿ› ๏ธ
Mervin Praison
12 Query PDFs Like a Pro with Local GPT: Full Setup Guide! ๐Ÿ“œ
Query PDFs Like a Pro with Local GPT: Full Setup Guide! ๐Ÿ“œ
Mervin Praison
13 LM Studio: EASIEST way to Run Large Language Models Locally!
LM Studio: EASIEST way to Run Large Language Models Locally!
Mervin Praison
14 AMAZING ChatGPT Vision is OUT! ๐Ÿคฏ 14+ Examples (Step-by-Step) FULL Tutorial
AMAZING ChatGPT Vision is OUT! ๐Ÿคฏ 14+ Examples (Step-by-Step) FULL Tutorial
Mervin Praison
15 Unbelievable! Build ANY App Instantly with Smol AI! ๐Ÿ˜ฒ๐Ÿ”ฅ
Unbelievable! Build ANY App Instantly with Smol AI! ๐Ÿ˜ฒ๐Ÿ”ฅ
Mervin Praison
16 Amazing! AutoGen Made Easy: A Step-by-Step Beginners Guide ๐Ÿ“š
Amazing! AutoGen Made Easy: A Step-by-Step Beginners Guide ๐Ÿ“š
Mervin Praison
17 How to Set Up LoLLMS and Run LLMs Locally! ๐Ÿš€ Step-by-Step Tutorial
How to Set Up LoLLMS and Run LLMs Locally! ๐Ÿš€ Step-by-Step Tutorial
Mervin Praison
18 GPT4All: INSANE Way to Run Large Language Models Locally! ๐Ÿ˜ฒ Step-By-Step Tutorial
GPT4All: INSANE Way to Run Large Language Models Locally! ๐Ÿ˜ฒ Step-By-Step Tutorial
Mervin Praison
19 Incredible AI-Powered NPCs in Unity Game Engine: Step by Step Tutorial!๐Ÿคฏ
Incredible AI-Powered NPCs in Unity Game Engine: Step by Step Tutorial!๐Ÿคฏ
Mervin Praison
20 MemGPT ๐Ÿง  LLM as Operating System. It's INSANE! Step-by-Step Tutorial ๐Ÿคฏ
MemGPT ๐Ÿง  LLM as Operating System. It's INSANE! Step-by-Step Tutorial ๐Ÿคฏ
Mervin Praison
21 Text Generation Web UI: MIND-BLOWING Way to Run LLM Locally! ๐Ÿคฏ
Text Generation Web UI: MIND-BLOWING Way to Run LLM Locally! ๐Ÿคฏ
Mervin Praison
22 Unlock the INSANE Power of OpenAI GPT-4 with C#/.NET! ๐Ÿ˜ฒ
Unlock the INSANE Power of OpenAI GPT-4 with C#/.NET! ๐Ÿ˜ฒ
Mervin Praison
23 Integrate Langchain and Ollama for Local AI Power ๐Ÿคฏ Indeed POWERFUL!
Integrate Langchain and Ollama for Local AI Power ๐Ÿคฏ Indeed POWERFUL!
Mervin Praison
24 ChatDev: INSANE Virtual AI Agents! Future of Software Development ๐Ÿ˜ฒ
ChatDev: INSANE Virtual AI Agents! Future of Software Development ๐Ÿ˜ฒ
Mervin Praison
25 Query PDFs Using Mistral: Unlock INSANE Power! ๐Ÿคฏ
Query PDFs Using Mistral: Unlock INSANE Power! ๐Ÿคฏ
Mervin Praison
26 AutoGen + Open-Source LLMs: UNBELIEVABLE! Step-by-Step Tutorial You Can't Miss! ๐Ÿคฏ
AutoGen + Open-Source LLMs: UNBELIEVABLE! Step-by-Step Tutorial You Can't Miss! ๐Ÿคฏ
Mervin Praison
27 AutoGen + Text Generation WebUI: Unbelievable 100% Local Private Setup ๐Ÿคฏ
AutoGen + Text Generation WebUI: Unbelievable 100% Local Private Setup ๐Ÿคฏ
Mervin Praison
28 MemGPT: Amazing! External Context for LLM #ai #llm #memgpt  #generativeai #mem #gpt #openai #chatgpt
MemGPT: Amazing! External Context for LLM #ai #llm #memgpt #generativeai #mem #gpt #openai #chatgpt
Mervin Praison
29 GeniA: Kubernetes + AI for MIND-BLOWING Operational Efficiency! ๐Ÿคฏ FULL Tutorial
GeniA: Kubernetes + AI for MIND-BLOWING Operational Efficiency! ๐Ÿคฏ FULL Tutorial
Mervin Praison
30 VertexAI Meets LangChain for Mind-Blowing AI Conversations! ๐Ÿ˜ฒ Step by Step Tutorial
VertexAI Meets LangChain for Mind-Blowing AI Conversations! ๐Ÿ˜ฒ Step by Step Tutorial
Mervin Praison
31 Simplified ChatGPT API Setup on Node.js for Newbies! ๐Ÿ˜ Step by Step Tutorial
Simplified ChatGPT API Setup on Node.js for Newbies! ๐Ÿ˜ Step by Step Tutorial
Mervin Praison
32 Autogen: Ollama integration ๐Ÿคฏ Step by Step Tutorial. Mind-blowing!
Autogen: Ollama integration ๐Ÿคฏ Step by Step Tutorial. Mind-blowing!
Mervin Praison
33 LiteLLM: One-Function Call to ANY Large Language Model! ๐Ÿคฏ UNBELIEVABLE!
LiteLLM: One-Function Call to ANY Large Language Model! ๐Ÿคฏ UNBELIEVABLE!
Mervin Praison
34 ChatGPT Chatbot in Less Time Than You Think! ๐Ÿš€๐Ÿ˜Ž Step-by-Step Tutorial
ChatGPT Chatbot in Less Time Than You Think! ๐Ÿš€๐Ÿ˜Ž Step-by-Step Tutorial
Mervin Praison
35 LiteLLM Chatbot: Build Your Own in MINUTES! INSANE! ๐Ÿค–๐Ÿ”ฅ
LiteLLM Chatbot: Build Your Own in MINUTES! INSANE! ๐Ÿค–๐Ÿ”ฅ
Mervin Praison
36 Create Chatbot: Turn ANY Open-Source LLM into a Conversation Pro! ๐Ÿค–
Create Chatbot: Turn ANY Open-Source LLM into a Conversation Pro! ๐Ÿค–
Mervin Praison
37 Create Chatbot: Ollama Integration Made UNBELIEVABLY Easy! ๐ŸŽ‰
Create Chatbot: Ollama Integration Made UNBELIEVABLY Easy! ๐ŸŽ‰
Mervin Praison
38 LlamaIndex + ChatGPT: Ingest Data and Experience UNBELIEVABLE Query Results! ๐ŸŒŸ
LlamaIndex + ChatGPT: Ingest Data and Experience UNBELIEVABLE Query Results! ๐ŸŒŸ
Mervin Praison
39 INSANE! OpenAgents: Automated Data Analysis with Kaggle ๐Ÿคฏ
INSANE! OpenAgents: Automated Data Analysis with Kaggle ๐Ÿคฏ
Mervin Praison
40 React.js LLM Agent for Next-Gen Coding using ChatGPT ๐Ÿš€ Mind-Blowing ๐Ÿคฏ
React.js LLM Agent for Next-Gen Coding using ChatGPT ๐Ÿš€ Mind-Blowing ๐Ÿคฏ
Mervin Praison
41 MemGPT + Any LLM ๐Ÿš€ 100% Local & Private Integration Unveiled! Unlimited Memory
MemGPT + Any LLM ๐Ÿš€ 100% Local & Private Integration Unveiled! Unlimited Memory
Mervin Praison
42 MemGPT  + AutoGen ๐Ÿง ๐Ÿค– Unlimited Memory & Autonomous AI Agents! INSANE๐Ÿคฏ
MemGPT + AutoGen ๐Ÿง ๐Ÿค– Unlimited Memory & Autonomous AI Agents! INSANE๐Ÿคฏ
Mervin Praison
43 AutoGen + Google's Palm LLM & More! Revolutionary AI Integration ๐Ÿš€
AutoGen + Google's Palm LLM & More! Revolutionary AI Integration ๐Ÿš€
Mervin Praison
44 MemGPT & LM Studio Integration Revealed! ๐Ÿ”ฅ Next-Level AI
MemGPT & LM Studio Integration Revealed! ๐Ÿ”ฅ Next-Level AI
Mervin Praison
45 ๐Ÿš€ AutoLLM: Unlock the Power of 100+ Language Models! Step-by-Step Tutorial
๐Ÿš€ AutoLLM: Unlock the Power of 100+ Language Models! Step-by-Step Tutorial
Mervin Praison
46 AutoLLM & Gradio Integration You Won't Believe! ๐Ÿคฏ Mind-Blowing
AutoLLM & Gradio Integration You Won't Believe! ๐Ÿคฏ Mind-Blowing
Mervin Praison
47 AutoLLM & FastAPI Tutorial: Query 100+ Language Models! ๐Ÿ˜ฑ
AutoLLM & FastAPI Tutorial: Query 100+ Language Models! ๐Ÿ˜ฑ
Mervin Praison
48 Quivr: LLM's Second Brain - Transforming Data Management & Advanced Query with AI! ๐Ÿคฏ
Quivr: LLM's Second Brain - Transforming Data Management & Advanced Query with AI! ๐Ÿคฏ
Mervin Praison
49 AutoGen & MemGPT with Local LLM: A Complete Setup Tutorial! ๐Ÿง  AMAZING ๐Ÿคฏ
AutoGen & MemGPT with Local LLM: A Complete Setup Tutorial! ๐Ÿง  AMAZING ๐Ÿคฏ
Mervin Praison
50 LocalAI: Free, Open Source OpenAI Alternative ๐Ÿš€ INSANE ๐Ÿคฏ Step-by-Step Tutorial
LocalAI: Free, Open Source OpenAI Alternative ๐Ÿš€ INSANE ๐Ÿคฏ Step-by-Step Tutorial
Mervin Praison
51 Yarn Mistral 7B 128k LARGE context window, Small size ๐Ÿคฏ INSANE ๐Ÿš€ Setup Tutorial!
Yarn Mistral 7B 128k LARGE context window, Small size ๐Ÿคฏ INSANE ๐Ÿš€ Setup Tutorial!
Mervin Praison
52 Zephyr-7B: The Small and Mighty LLM ๐Ÿคฏ Step by Step Tutorial! ๐Ÿ“˜
Zephyr-7B: The Small and Mighty LLM ๐Ÿคฏ Step by Step Tutorial! ๐Ÿ“˜
Mervin Praison
53 Promptfoo: How to Test Your LLM ? ๐Ÿš€  VERY EASY!
Promptfoo: How to Test Your LLM ? ๐Ÿš€ VERY EASY!
Mervin Praison
54 Pydantic: How to Validate LLM Responses? ๐Ÿš€ Quality Response. VERY EASY!!!!
Pydantic: How to Validate LLM Responses? ๐Ÿš€ Quality Response. VERY EASY!!!!
Mervin Praison
55 Pydantic: FORCE Your AI to Respond Back in UPPERCASE! ๐Ÿคฏ Step-by-Step Tutorial ๐Ÿ”ฅ
Pydantic: FORCE Your AI to Respond Back in UPPERCASE! ๐Ÿคฏ Step-by-Step Tutorial ๐Ÿ”ฅ
Mervin Praison
56 Pydantic: How to use LLM to convert unstructured data to structured data?
Pydantic: How to use LLM to convert unstructured data to structured data?
Mervin Praison
57 AutoGen Function Calling: INSANE ๐Ÿš€ Custom Integrations! Step-by-Step Tutorial ๐Ÿคฏ
AutoGen Function Calling: INSANE ๐Ÿš€ Custom Integrations! Step-by-Step Tutorial ๐Ÿคฏ
Mervin Praison
โ–ถ OpenAI Assistants API + Python ๐Ÿค– How to get started? (FULL Tutorial) ๐Ÿคฏ INSANE
OpenAI Assistants API + Python ๐Ÿค– How to get started? (FULL Tutorial) ๐Ÿคฏ INSANE
Mervin Praison
59 GPT-4 Vision API ๐Ÿคฏ INSANE Video Recognition Powers! Step-by-Step Tutorial ๐Ÿš€
GPT-4 Vision API ๐Ÿคฏ INSANE Video Recognition Powers! Step-by-Step Tutorial ๐Ÿš€
Mervin Praison
60 GPT-4 Vision API ๐Ÿš€ The Future of Image Recognition! ๐Ÿคฏ Step-by-Step Tutorial
GPT-4 Vision API ๐Ÿš€ The Future of Image Recognition! ๐Ÿคฏ Step-by-Step Tutorial
Mervin Praison

Related Reads

๐Ÿ“ฐ
Unlocking the LLMโ€™s Hidden Knowledge Engine: The 3X Matrix Expansion in FFN and SwiGLU
Learn how Large Language Models inflate and shrink matrix dimensions and the hardware math behind it, to unlock their hidden knowledge engine
Medium ยท LLM
๐Ÿ“ฐ
A Brief History of Artificial Intelligence and Machine Learning
Learn the history of AI and ML to understand their evolution and current impact
Medium ยท Machine Learning
๐Ÿ“ฐ
A Brief History of Artificial Intelligence and Machine Learning
Learn the history of AI and ML to understand their evolution and current impact
Medium ยท Deep Learning
๐Ÿ“ฐ
Sonnet 5 vs GLM-5.2 vs everyone: how to pick the cheapest LLM API in 2026
Learn how to choose the cheapest LLM API in 2026 by comparing pricing models of Sonnet 5 and GLM-5.2
Dev.to AI

Chapters (6)

Intro to ChatGPT Assistants API Beta
0:20 How to Create a Custom AI Assistant
1:09 Enabling Tools and Picking Models
2:00 Managing Threads and User Conversations
3:02 Understanding Messages and Runs
4:13 Seeing the Assistant in Action
Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch โ†’