example that ran for 30 seconds

This commit is contained in:
Jeff Carr 2022-12-03 20:00:57 -06:00
parent 3ec14cc65f
commit dd8e15c087
1 changed files with 18 additions and 2 deletions

20
example-gpt-3/curl-college.sh Normal file → Executable file
View File

@ -1,12 +1,28 @@
#!/bin/bash -x
#
curl https://api.openai.com/v1/completions \ curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{ -d '{
"model": "text-davinci-003", "model": "text-davinci-003",
"prompt": "Summarize this for a second-grade student:\n\nJupiter is the fifth planet from the Sun and the largest in the Solar System. It is a gas giant with a mass one-thousandth that of the Sun, but two-and-a-half times that of all the other planets in the Solar System combined. Jupiter is one of the brightest objects visible to the naked eye in the night sky, and has been known to ancient civilizations since before recorded history. It is named after the Roman god Jupiter.[19] When viewed from Earth, Jupiter can be bright enough for its reflected light to cast visible shadows,[20] and is on average the third-brightest natural object in the night sky after the Moon and Venus.", "prompt": "Write up a 3000 word article about DiVinci",
"temperature": 0.7, "temperature": 0.7,
"max_tokens": 64, "max_tokens": 640,
"top_p": 1.0, "top_p": 1.0,
"frequency_penalty": 0.0, "frequency_penalty": 0.0,
"presence_penalty": 0.0 "presence_penalty": 0.0
}' }'
# took about 30 seconds to run:
# jcarr@hpdevone:~/go/src/git.wit.org/jcarr/golang-examples/example-gpt-3$ ./curl-college.sh
# + curl https://api.openai.com/v1/completions -H 'Content-Type: application/json' -H 'Authorization: Bearer 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' -d '{
# "model": "text-davinci-003",
# "prompt": "Write up a 3000 word article about DiVinci",
# "temperature": 0.7,
# "max_tokens": 640,
# "top_p": 1.0,
# "frequency_penalty": 0.0,
# "presence_penalty": 0.0
# }'
# {"id":"cmpl-6JYZK47pj7tweSSNsXGOH6WcDBKo7","object":"text_completion","created":1670119134,"model":"text-davinci-003","choices":[{"text":"\n\nLeonardo da Vinci, often referred to as “The Renaissance Man”, is widely regarded as one of the most influential people in history. His contributions to the world of art, science, engineering and architecture have had a lasting impact on the modern world. From his iconic paintings, such as the Mona Lisa and The Last Supper, to his groundbreaking inventions and designs, Leonardo da Vinci has made a lasting impression on the world.\n\nBorn in the 15th century, Leonardo da Vinci was an Italian polymath, meaning he was a master of many different disciplines. He was a painter, sculptor, architect, engineer, scientist, anatomist, inventor, geologist, botanist, and musician. His contributions to the world of science and art were vast and varied, and his influence on the future of human civilization is undeniable.\n\nLeonardo da Vinci is most renowned for his paintings. His two most famous works, The Mona Lisa and The Last Supper, are considered masterpieces of the Renaissance period. The Mona Lisa is often cited as the most famous painting in the world, and is known for its enigmatic expression and subtle use of light and color. The Last Supper, meanwhile, is an iconic depiction of the final meal shared by Jesus and his disciples.\n\nAside from his paintings, Leonardo da Vinci was also a prolific inventor. He created designs for a wide array of machines, including flying machines, a tank, a helicopter, and a diving suit. He also made innovative improvements to existing machines, such as the use of double hulls in ships. He developed the first rudimentary plans for what would eventually become the modern parachute, and he made early designs for a paddleboat.\n\nIn addition to his inventions, Leonardo da Vinci was also a passionate scientist and anatomist. He made detailed anatomical drawings of the human body, as well as drawings of plants and animals. His studies of anatomy led him to make groundbreaking discoveries about the human body, such as the role of the heart in pumping blood. He was also known for his observations of nature, which he documented in his notebooks.\n\nLeonardo da Vincis influence on the world of architecture is also significant. He designed buildings and bridges, and he made detailed drawings of fortifications, castles, and other structures. His writings on the subject of architecture, such as his treatise on the subject, are still studied today.\n\nLeonardo da Vincis impact on the world is undeniable. His contributions to the world of art, science, engineering, and architecture have had a lasting and profound effect on the modern world. His works continue to inspire and influence people all over the world, and his legacy will no doubt remain for many generations to come.","index":0,"logprobs":null,"finish_reason":"stop"}],"usage":{"prompt_tokens":11,"completion_tokens":573,"total_tokens":584}}