A Simple python code for interacting with ChatGPT API using 2 modes:
- Interactive continuous chat
- 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.