ChatGPT API Function Calling with Python: JSON Output Example

preview_player
Показать описание
How to use the ChatGPT Function Calling feature in Python, so you can get a JSON object as the output from the API response in your programs.

Note this is a developer tutorial and assumes you already know how to use the ChatGPT API.

Get the source code here:

00:00 Introduction
00:44 Handling the OpenAI API key
02:21 Preparing the input
03:10 Defining the function call
06:50 Creating the API request
10:55 Handling the ChatGPT JSON output response

#Python #programming #ChatGPT #JSON
Рекомендации по теме
Комментарии
Автор

Very clear explanation, much appreciated

Anonymous
Автор

I am 5 minutes in and already wanted to thank you for doing this step by step example. Really appreciate it. Subscribed and turned on notifs for your channel :)

Dasein
Автор

Thank you! Seriously, the only tutorial on YouTube on functions worth watching.

Couple things:
1) Especially with 3.5, its better to put your command first from my experience.
2) System messages are everything, although 3.5 isn't great with them.

Have you run into any recurring issues? Im planning to go back and refactor my code to use functions instead of the garbage work arounds I've been using for months 😅

jaysonp
Автор

Great clean straight forward tutorial! Thank you!

michaelgrubhofer
Автор

Thank you! Loved everything about this tutorial. Easy to follow, great example, and the pace! ❤

lilan
Автор

Thank you very much for this very informative video. I love that you explain everything you do while typing. Great!

profdrkatharinazweig
Автор

I love the name of your channel :D Also, nice video, thanks!

TeamUpWithAI
Автор

I wish I'd knew about this before I wrote my program. I've been having the AI structure data that I scanned the response for then ran the appropriate function. This seems a lot easier.

CyborgPrime
Автор

thank you for your step by step explanation..

yodhakei
Автор

I got an error saying 'article' is not defined. should the variable article been defined beforehand?

wryltxw
Автор

I wish I'd knew about this before I wrote my program. I've been having the AI structure data that I scanned the response for then ran the appropriate function. This seems a lot easier.

CyborgPrime