OpenAI GPT-4o mini vision capabilities using API - Multimodal Development with OpenAI API
Skills:
Multimodal LLMs90%
Key Takeaways
The video demonstrates how to utilize the vision capabilities of GPT-4o and GPT-4o mini using the OpenAI API and Python, allowing these models to analyze and interpret images.
Full Transcript
welcome to the fifth video of the multimodel development with open course GPT 40 and recently announced GPT 4 mini have Vision capabilities which means that these models can take image as input and answer questions about them in this particular video we'll learn how to use these Vision capabilities using Python and open AI API if you have missed the previous videos I've posted the links to the entire course in the description below so let's get started to start with I've activated my virtual environment and typed in Jupiter lab to open my Jupiter ID it opens up in the browser here where in the projects directory I've created a new python notebook now there are two ways to send an image to open a let's look at them one by one in the first method we send an image to open a via an image URL my messages object is a list here which contains one dictionary this dictionary has two keys role and content we've already seen the role as system and user in this particular case we are passing in the role as user the value for content is interesting it is a list which contains two dictionaries the first dictionary has two keys type and text the second dictionary again has two keys type and image URL so we can understand type is of text and text contains our input question and in the second dictionary type is an image URL and the actual image URL again contains a key value pair where key is URL and the value is an URL which contains an image here is that image it is a receipt and we are asking it the question what items are present in this receipt based on this we get a response from openi which matches my image another way of sending an image to open a is by converting that image to base 64 format I've written a small function here which takes in an image as input reads it and converts it into base 64 format the messages list is almost the same as is the first method the only change here is the value of the URL in this particular case instead of the image URL we are specifying that image is of type PNG and it is in base 64 format and then we append the base 64 encoded image that we received from this particular method I'll show you the image that we are using here this is a different image and hence when we ask the question what items are present in this receipt we get a different response which is total of $77 which matches this particular receipt so these were the two ways in which you can use the vision capabilities in the new model in the next video we'll learn how to use function calling to enhance our project please like the video and subscribe to the channel thanks for tuning in see you in the next one
Original Description
In this video, we'll explore the vision capabilities of GPT-4o and GPT-4o mini, which enable these models to analyze and interpret images. Learn how to leverage these features using Python and the OpenAI API. If you missed the previous videos, links to the entire course are in the description below.
Key topics covered:
Sending Images via URL: Learn how to send an image to OpenAI by providing an image URL. We'll break down the structure of the messages object, including the roles and content types.
Sending Images in Base64 Format: Discover how to convert an image to Base64 format and send it to OpenAI. We'll provide a function that reads an image and converts it to Base64, followed by updating the messages object accordingly.
Practical Implementation: Walk through examples of how to implement both methods in your Python code, ensuring successful interaction with the API.
Handling Responses: Understand how to process and handle responses from the OpenAI API to get meaningful insights from your images.
This tutorial is designed for developers at all levels, aiming to enhance your AI development skills with OpenAI's multimodal capabilities.
If you missed the previous videos, below are the complete course links -
1. What does Multimodal mean - https://youtu.be/oReqF6l4AXc?si=rpEyztR6RbmoQ4BU
2. How to get OpenAPI API Key - https://youtu.be/Xoie05_XvIw?si=gpq7rhuzY-rhADZd
3. Install Python library for OpenAI API - https://www.youtube.com/watch?v=HXgVEjVEaik
4. How to use OpenAI API key in python with GPT-4o mini using Chat Completions API - https://www.youtube.com/watch?v=Xbc-W6-x2qw
5. OpenAI GPT-4o mini vision capabilities using API - https://www.youtube.com/watch?v=3RCRUEhsfUU
6. Why do we need Function Calling with LLM's? Practical Example with OpenAI GPT-4o - https://www.youtube.com/watch?v=jMVyidkNQrA
Code for Reference - https://github.com/ajgupta23/Multimodal-Development-with-OpenAI
Connect with me on LinkedIn - https://www.linkedin.com/in/ajaygupta200/
P
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
More on: Multimodal LLMs
View skill →Related Reads
📰
📰
📰
📰
How AI and ChatGPT are Upgrading Data
Medium · ChatGPT
Semantic Caching for LLMs: What’s Draining Your AI Budget
Medium · Machine Learning
Running Hugging Face Inference with Kiro: From Prompt to Working Summarizer
Dev.to AI
BizNode's semantic memory (Qdrant) makes your bot smarter over time — it remembers past conversations and answers...
Dev.to AI
🎓
Tutor Explanation
DeepCamp AI