Function Calling: How to get structured data from Chat-GPT?

preview_player
Показать описание
Do you want to call the Chat-GPT API and get back structure data? In that case you have to use Function Calling. This will allow you to get back Chat-GPT's response in JSON format, so you can use it in your application.

In this video I'll show you the easiest way to use function calling in order to get structured data from the API response.

⭐️ Libraries to install ⭐
pip install openai
pip install dotenv

⭐️Your API Key ⭐
In .env type the following:
OPENAI_API_KEY= 'sk-[YOUR API KEY]'

⭐️ Download the source code ⭐

⭐️ Follow me ⭐

❗ Some of my videos contain affiliate links. When you click on these kind of links, I get a small percentage in case you make a purchase via the website. Be aware that this doesn't cost you anything - you never pay more than the standard retail price.

#chatgpt #chatgptapi #openai #python #pythonprogramming
Рекомендации по теме
Комментарии
Автор

No yadda, yadda – just straight to the point, including code. Amazing! Subscribed.

Horizont.
Автор

Wonderful! Thank you for sharing this valuable information.

ahassan
Автор

So what I understand from this is that you aren't specifically interested in the output of the function. Rather you are defining the function in such a way that it expects the parameters to be key value pairs of country and population. You then extract the arguments passed by the LLM to this function and this is essentially structured as a dict with the two parameters as keys.

SiddharthMishraLastOne