From 30d596bf75ded6695c2dbb1781682b68d464a2f6 Mon Sep 17 00:00:00 2001 From: Marc Partensky Date: Mon, 23 Nov 2020 01:16:01 +0100 Subject: [PATCH] dont have open ai api token --- GPT3/q&a.py | 25 +++++++++++++++++++++++++ GPT3/textgeneration.py | 8 ++++++++ 2 files changed, 33 insertions(+) create mode 100755 GPT3/q&a.py create mode 100755 GPT3/textgeneration.py diff --git a/GPT3/q&a.py b/GPT3/q&a.py new file mode 100755 index 0000000..4f1c70b --- /dev/null +++ b/GPT3/q&a.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +import openai +stop = "\n" + +prompt = """Q: What is human life expectancy in the United States? +A: Human life expectancy in the United States is 78 years. + +Q: Who was president of the United States in 1955? +A: Dwight D. Eisenhower was president of the United States in 1955. + +Q: What party did he belong to? +A: He belonged to the Republican Party. + +Q: Who was president of the United States before George W. Bush? +A: Bill Clinton was president of the United States before George W. Bush. + +Q: Who won the World Series in 1995? +A: The Atlanta Braves won the World Series in 1995. + +Q: What year was the first fax sent? +A:""" + +response = openai.Completion.create(model="davinci", prompt=prompt, stop=stop, temperature=0) + +print(response) diff --git a/GPT3/textgeneration.py b/GPT3/textgeneration.py new file mode 100755 index 0000000..73e1d02 --- /dev/null +++ b/GPT3/textgeneration.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python +import openai + +prompt = """We’re releasing an API for accessing new AI models developed by OpenAI. Unlike most AI systems which are designed for one use-case, the API today provides a general-purpose “text in, text out” interface, allowing users to try it on virtually any English language task. You can now request access in order to integrate the API into your product, develop an entirely new application, or help us explore the strengths and limits of this technology.""" + +response = openai.Completion.create(model="davinci", prompt=prompt, stop="\n", temperature=0.9, max_tokens=100) + +print(response)