Program a Python ChatGPT client with the help of ChatGPT (openai.Completion.create + davinci engine)

Опубликовано: 12 Октябрь 2024
на канале: Rafael Queiroz
1,424
31

" The beautiful thing about learning is nobody can take it away from you. " -
B.B. King

Welcome to ‪@queiroz-rafael‬ !
Lets explore the ChatGPT API. Here we are going to explore how to send requests and deal with responses from this AI API.

Use chatGPT Python API for performing questions and retriving the results. You can integrate chatGPT content generation directly from your application.

Hope you enjoy the video and can utilize this content for helping you in the achievement of you personal and professional goals.

Knowledge is one of few things we can share without reducing or subtracting it. This channel is an attempt to bring education about technology, without costs, to all corners of the planet. We believe technology knowledge in good hands, like yours, can assist to build a better world.

Do you want to support this channel? Please just subscribe.

import openai
api_key = "your api key"
mensagem = 'Is @Talking about Computer Science a nice channel on youtube?'
openai.api_key = api_key
response = openai.Completion.create(
engine='text-davinci-003',
prompt=mensagem,
max_tokens=500,
n=1,
stop=None,
)
print(response.choices[0].text.strip())

0:00 "Hello world" with chatGPT API
0:50 - Generating the chatGPT API key
2:14 Playing with examples of interating with chatGPT API
2:38 Time to subscribe to ‪@queiroz-rafael‬ and thumbs up!