Skip to content

This is a simple code to interact with ChatGPT API using Python

License

Notifications You must be signed in to change notification settings

Itay-Sharoni/ChatGPT-API-Example-Code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

ChatGPT-API-Example-Code

A Simple python code for interacting with ChatGPT API using 2 modes:

  1. Interactive continuous chat
  2. Passing argrument for a single result

Example 1:

itay@Itay-PC:~$ python3 chatgpt.py

You: write a birth certificate for a unicorn new born in code box

Chatbot: I'm sorry, but as an AI language model, I cannot create official documents such as birth certificates. However, here is an example of what a birth certificate for a unicorn newborn might look like:


=====================================================================
               BIRTH CERTIFICATE OF A UNICORN NEWBORN
=====================================================================

This is to certify that a beautiful unicorn was born on (DATE OF BIRTH) in the magical land of (THE PLACE OF BIRTH), to proud parents (FATHER'S NAME) and (MOTHER'S NAME).

Name of Unicorn Newborn:
(PLEASE ENTER NAME)

Features of Unicorn Newborn:
(PLEASE ENTER A DESCRIPTION OF THE UNICORN NEWBORN'S APPEARANCE)

Witnessed By:
(PLEASE ENTER NAME OF WITNESS)

Registrar Signature: _______________________________________________

Issuer: The Magical Council of Unicorn Births

Date Issued: (DATE OF ISSUE)

=====================================================================


Please note that this is just an example and not an official document.

Example 2:

itay@Itay-PC:~$ python3 chatgpt.py "explain how insects breath"

Insects have a system of internal tubes that transport air throughout their bodies called tracheae. These tracheae open to the outside through small holes called spiracles that are located along the insect's body. Oxygen enters the spiracles and travels through the tracheae to reach the insect's cells. Carbon dioxide, which is created during respiration, is removed from the insect's body in the same way, through the spiracles and tracheae. This system is very efficient and allows insects to easily breathe without the need for lungs.

About

This is a simple code to interact with ChatGPT API using Python

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages