滴雨科技
代码自动生成、分析、纠错
自然语言到OpenAI API
Engine text-davinci-003
自然语言到Stripe API
Engine text-davinci-003
SQL翻译
Engine text-davinci-003
Python到自然语言
Engine text-davinci-003
计算时间复杂度
Engine text-davinci-003
翻译编程语言
Engine text-davinci-003
解释代码
Engine text-davinci-003
Python错误修复器
Engine text-davinci-003
JavaScript 助手聊天机器人
Engine text-davinci-003
JavaScript到Python
Engine text-davinci-003
编写Python文档字符串
Engine text-davinci-003
JavaScript单行函数
Engine text-davinci-003
提高开发效率,降低错误,生成高质量代码,标准的编码风格,提高了代码的可读性和可维护性。
 返回
自然语言到OpenAI API
创建代码以使用自然语言指令调用 OpenAI API。
 环境
Prompt
"""
Util exposes the following:
util.openai() -> authenticates & returns the openai module, which has the following functions:
openai.Completion.create(
prompt=">my prompt<", # The prompt to start completing from
max_tokens=123, # The max number of tokens to generate
temperature=1.0 # A measure of randomness
echo=True, # Whether to return the prompt in addition to the generated completion
)
"""
import util
"""
Create an OpenAI completion starting from the prompt "Once upon an AI", no more than 5 tokens. Does not include the prompt.
"""
API request
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "\"\"\"\nUtil exposes the following:\nutil.openai() -> authenticates & returns the openai module, which has the following functions:\nopenai.Completion.create(\n prompt=\">my prompt<\", # The prompt to start completing from\n max_tokens=123, # The max number of tokens to generate\n temperature=1.0 # A measure of randomness\n echo=True, # Whether to return the prompt in addition to the generated completion\n)\n\"\"\"\nimport util\n\"\"\"\nCreate an OpenAI completion starting from the prompt \"Once upon an AI\", no more than 5 tokens. Does not include the prompt.\n\"\"\"\n",
"temperature": 0,
"max_tokens": 64,
"top_p": 1.0,
"frequency_penalty": 0.0,
"presence_penalty": 0.0,
"stop": ["\"\"\""]
}'
Enter 发送
自然语言到Stripe API
创建代码以使用自然语言调用 Stripe API。
 环境
Prompt
"""
Util exposes the following:
util.stripe() -> authenticates & returns the stripe module; usable as stripe.Charge.create etc
"""
import util
"""
Create a Stripe token using the users credit card: 5555-4444-3333-2222, expiration date 12 / 28, cvc 521
"""
API request
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "\"\"\"\nUtil exposes the following:\n\nutil.stripe() -> authenticates & returns the stripe module; usable as stripe.Charge.create etc\n\"\"\"\nimport util\n\"\"\"\nCreate a Stripe token using the users credit card: 5555-4444-3333-2222, expiration date 12 / 28, cvc 521\n\"\"\"",
"temperature": 0,
"max_tokens": 100,
"top_p": 1.0,
"frequency_penalty": 0.0,
"presence_penalty": 0.0,
"stop": ["\"\"\""]
}
Enter 发送
SQL 翻译
将自然语言转换为 SQL 查询。
 环境
Prompt
### Postgres SQL tables, with their properties:
#
# Employee(id, name, department_id)
# Department(id, name, address)
# Salary_Payments(id, employee_id, amount, date)
#
### A query to list the names of the departments which employed more than 10 employees in the last 3 months
SELECT
API request
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "### Postgres SQL tables, with their properties:\n#\n# Employee(id, name, department_id)\n# Department(id, name, address)\n# Salary_Payments(id, employee_id, amount, date)\n#\n### A query to list the names of the departments which employed more than 10 employees in the last 3 months\nSELECT",
"temperature": 0,
"max_tokens": 150,
"top_p": 1.0,
"frequency_penalty": 0.0,
"presence_penalty": 0.0,
"stop": ["#", ";"]
}'
Enter 发送
Python到自然语言
用人类可理解的语言解释一段Python代码。
 环境
Prompt
# Python 3
def remove_common_prefix(x, prefix, ws_prefix):
x["completion"] = x["completion"].str[len(prefix) :]
if ws_prefix:
# keep the single whitespace as prefix
x["completion"] = " " + x["completion"]
return x

# Explanation of what the code does

#
API request
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "\"\"\"\nUtil exposes the following:\nutil.openai() -> authenticates & returns the openai module, which has the following functions:\nopenai.Completion.create(\n prompt=\">my prompt<\", # The prompt to start completing from\n max_tokens=123, # The max number of tokens to generate\n temperature=1.0 # A measure of randomness\n echo=True, # Whether to return the prompt in addition to the generated completion\n)\n\"\"\"\nimport util\n\"\"\"\nCreate an OpenAI completion starting from the prompt \"Once upon an AI\", no more than 5 tokens. Does not include the prompt.\n\"\"\"\n",
"temperature": 0,
"max_tokens": 64,
"top_p": 1.0,
"frequency_penalty": 0.0,
"presence_penalty": 0.0,
"stop": ["\"\"\""]
}'
Enter 发送
计算时间复杂度
求函数的时间复杂度。
 环境
Prompt
def foo(n, k):
accum = 0
for i in range(n):
for l in range(k):
accum += i
return accum
"""
The time complexity of this function is
API request
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "def foo(n, k):\naccum = 0\nfor i in range(n):\n for l in range(k):\n accum += i\nreturn accum\n\"\"\"\nThe time complexity of this function is",
"temperature": 0,
"max_tokens": 64,
"top_p": 1.0,
"frequency_penalty": 0.0,
"presence_penalty": 0.0,
"stop": ["\n"]
}'
Enter 发送
解释编程语言
要从一种编程语言翻译成另一种编程语言,我们可以使用注释来指定源语言和目标语言。
 环境
Prompt
##### Translate this function from Python into Haskell
### Python

def predict_proba(X: Iterable[str]):
return np.array([predict_one_probas(tweet) for tweet in X])

### Haskell
API request
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "##### Translate this function from Python into Haskell\n### Python\n \n def predict_proba(X: Iterable[str]):\n return np.array([predict_one_probas(tweet) for tweet in X])\n \n### Haskell",
"temperature": 0,
"max_tokens": 150,
"top_p": 1.0,
"frequency_penalty": 0.0,
"presence_penalty": 0.0,
"stop": ["###"]
}'
Enter 发送
解释代码
解释一段复杂的代码。
 环境
Prompt
class Log:
def __init__(self, path):
dirname = os.path.dirname(path)
os.makedirs(dirname, exist_ok=True)
f = open(path, "a+")

# Check that the file is newline-terminated
size = os.path.getsize(path)
if size > 0:
f.seek(size - 1)
end = f.read(1)
if end != "\n":
f.write("\n")
self.f = f
self.path = path

def log(self, event):
event["_event_id"] = str(uuid.uuid4())
json.dump(event, self.f)
self.f.write("\n")

def state(self):
state = {"complete": set(), "last": None}
for line in open(self.path):
event = json.loads(line)
if event["type"] == "submit" and event["success"]:
state["complete"].add(event["id"])
state["last"] = event
return state

API request
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "class Log:\n def __init__(self, path):\n dirname = os.path.dirname(path)\n os.makedirs(dirname, exist_ok=True)\n f = open(path, \"a+\")\n\n # Check that the file is newline-terminated\n size = os.path.getsize(path)\n if size > 0:\n f.seek(size - 1)\n end = f.read(1)\n if end != \"\\n\":\n f.write(\"\\n\")\n self.f = f\n self.path = path\n\n def log(self, event):\n event[\"_event_id\"] = str(uuid.uuid4())\n json.dump(event, self.f)\n self.f.write(\"\\n\")\n\n def state(self):\n state = {\"complete\": set(), \"last\": None}\n for line in open(self.path):\n event = json.loads(line)\n if event[\"type\"] == \"submit\" and event[\"success\"]:\n state[\"complete\"].add(event[\"id\"])\n state[\"last\"] = event\n return state\n\n\"\"\"\nHere's what the above class is doing, explained in a concise way:\n1.",
"temperature": 0,
"max_tokens": 150,
"top_p": 1.0,
"frequency_penalty": 0.0,
"presence_penalty": 0.0,
"stop": ["\"\"\""]
}
Enter 发送
Python错误修复器
有多种方法可以构建检查错误的提示。在这里,我们添加一条注释,建议源代码有问题,然后要求 codex 生成一个固定的代码。
 环境
Prompt
##### Fix bugs in the below function

### Buggy Python
import Random
a = random.randint(1,12)
b = random.randint(1,12)
for i in range(10):
question = "What is "+a+" x "+b+"? "
answer = input(question)
if answer = a*b
print (Well done!)
else:
print("No.")

### Fixed Python
API request
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "##### Fix bugs in the below function\n \n### Buggy Python\nimport Random\na = random.randint(1,12)\nb = random.randint(1,12)\nfor i in range(10):\n question = \"What is \"+a+\" x \"+b+\"? \"\n answer = input(question)\n if answer = a*b\n print (Well done!)\n else:\n print(\"No.\")\n \n### Fixed Python",
"temperature": 0,
"max_tokens": 182,
"top_p": 1.0,
"frequency_penalty": 0.0,
"presence_penalty": 0.0,
"stop": ["###"]
}'
Enter 发送
JavaScript 助手聊天机器人
这是一个消息风格的聊天机器人,可以回答有关使用 JavaScript 的问题。它使用几个示例来开始对话。
 环境
Prompt
You: How do I combine arrays?
JavaScript chatbot: You can use the concat() method.
You: How do you make an alert appear after 10 seconds?
JavaScript chatbot
API request
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "You: How do I combine arrays?\nJavaScript chatbot: You can use the concat() method.\nYou: How do you make an alert appear after 10 seconds?\nJavaScript chatbot",
"temperature": 0,
"max_tokens": 150,
"top_p": 1.0,
"frequency_penalty": 0.5,
"presence_penalty": 0.0,
"stop": ["You:"]
}'
Enter 发送
自然语言到OpenAI API
创建代码以使用自然语言指令调用 OpenAI API。
 环境
Prompt
"""
Util exposes the following:
util.openai() -> authenticates & returns the openai module, which has the following functions:
openai.Completion.create(
prompt=">my prompt<", # The prompt to start completing from
max_tokens=123, # The max number of tokens to generate
temperature=1.0 # A measure of randomness
echo=True, # Whether to return the prompt in addition to the generated completion
)
"""
import util
"""
Create an OpenAI completion starting from the prompt "Once upon an AI", no more than 5 tokens. Does not include the prompt.
"""
API request
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "\"\"\"\nUtil exposes the following:\nutil.openai() -> authenticates & returns the openai module, which has the following functions:\nopenai.Completion.create(\n prompt=\">my prompt<\", # The prompt to start completing from\n max_tokens=123, # The max number of tokens to generate\n temperature=1.0 # A measure of randomness\n echo=True, # Whether to return the prompt in addition to the generated completion\n)\n\"\"\"\nimport util\n\"\"\"\nCreate an OpenAI completion starting from the prompt \"Once upon an AI\", no more than 5 tokens. Does not include the prompt.\n\"\"\"\n",
"temperature": 0,
"max_tokens": 64,
"top_p": 1.0,
"frequency_penalty": 0.0,
"presence_penalty": 0.0,
"stop": ["\"\"\""]
}'
有什么可以帮你的吗
2023/10/15 23:24:50
Enter 发送
自然语言到OpenAI API
创建代码以使用自然语言指令调用 OpenAI API。
 环境
Prompt
"""
Util exposes the following:
util.openai() -> authenticates & returns the openai module, which has the following functions:
openai.Completion.create(
prompt=">my prompt<", # The prompt to start completing from
max_tokens=123, # The max number of tokens to generate
temperature=1.0 # A measure of randomness
echo=True, # Whether to return the prompt in addition to the generated completion
)
"""
import util
"""
Create an OpenAI completion starting from the prompt "Once upon an AI", no more than 5 tokens. Does not include the prompt.
"""
API request
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "\"\"\"\nUtil exposes the following:\nutil.openai() -> authenticates & returns the openai module, which has the following functions:\nopenai.Completion.create(\n prompt=\">my prompt<\", # The prompt to start completing from\n max_tokens=123, # The max number of tokens to generate\n temperature=1.0 # A measure of randomness\n echo=True, # Whether to return the prompt in addition to the generated completion\n)\n\"\"\"\nimport util\n\"\"\"\nCreate an OpenAI completion starting from the prompt \"Once upon an AI\", no more than 5 tokens. Does not include the prompt.\n\"\"\"\n",
"temperature": 0,
"max_tokens": 64,
"top_p": 1.0,
"frequency_penalty": 0.0,
"presence_penalty": 0.0,
"stop": ["\"\"\""]
}'
有什么可以帮你的吗
2023/10/15 23:24:50
Enter 发送
自然语言到OpenAI API
创建代码以使用自然语言指令调用 OpenAI API。
 环境
Prompt
"""
Util exposes the following:
util.openai() -> authenticates & returns the openai module, which has the following functions:
openai.Completion.create(
prompt=">my prompt<", # The prompt to start completing from
max_tokens=123, # The max number of tokens to generate
temperature=1.0 # A measure of randomness
echo=True, # Whether to return the prompt in addition to the generated completion
)
"""
import util
"""
Create an OpenAI completion starting from the prompt "Once upon an AI", no more than 5 tokens. Does not include the prompt.
"""
API request
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "\"\"\"\nUtil exposes the following:\nutil.openai() -> authenticates & returns the openai module, which has the following functions:\nopenai.Completion.create(\n prompt=\">my prompt<\", # The prompt to start completing from\n max_tokens=123, # The max number of tokens to generate\n temperature=1.0 # A measure of randomness\n echo=True, # Whether to return the prompt in addition to the generated completion\n)\n\"\"\"\nimport util\n\"\"\"\nCreate an OpenAI completion starting from the prompt \"Once upon an AI\", no more than 5 tokens. Does not include the prompt.\n\"\"\"\n",
"temperature": 0,
"max_tokens": 64,
"top_p": 1.0,
"frequency_penalty": 0.0,
"presence_penalty": 0.0,
"stop": ["\"\"\""]
}'
有什么可以帮你的吗
2023/10/15 23:24:50
Enter 发送
JavaScript 到 Python
将简单的JavaScript表达式转换为Python。
 环境
Prompt
#JavaScript to Python:
JavaScript:
dogs = ["bill", "joe", "carl"]
car = []
dogs.forEach((dog) {
car.push(dog);
});

Python:
API request
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "#JavaScript to Python:\nJavaScript: \ndogs = [\"bill\", \"joe\", \"carl\"]\ncar = []\ndogs.forEach((dog) {\n car.push(dog);\n});\n\nPython:", "model": "text-davinci-003",
"temperature": 0,
"max_tokens": 64,
"top_p": 1.0,
"frequency_penalty": 0.0,
"presence_penalty": 0.0
}
Enter 发送
编写 Python 文档字符串
如何为给定的 Python 函数创建文档字符串的示例。我们指定 Python 版本,粘贴代码,然后在注释中询问文档字符串,并给出文档字符串 (“”“) 的特征开头。
 环境
Prompt
# Python 3.7

def randomly_split_dataset(folder, filename, split_ratio=[0.8, 0.2]):
df = pd.read_json(folder + filename, lines=True)
train_name, test_name = "train.jsonl", "test.jsonl"
df_train, df_test = train_test_split(df, test_size=split_ratio[1], random_state=42)
df_train.to_json(folder + train_name, orient='records', lines=True)
df_test.to_json(folder + test_name, orient='records', lines=True)
randomly_split_dataset('finetune_data/', 'dataset.jsonl')

# An elaborate, high quality docstring for the above function:
"""
API request
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "# Python 3.7\n \ndef randomly_split_dataset(folder, filename, split_ratio=[0.8, 0.2]):\n df = pd.read_json(folder + filename, lines=True)\n train_name, test_name = \"train.jsonl\", \"test.jsonl\"\n df_train, df_test = train_test_split(df, test_size=split_ratio[1], random_state=42)\n df_train.to_json(folder + train_name, orient='records', lines=True)\n df_test.to_json(folder + test_name, orient='records', lines=True)\nrandomly_split_dataset('finetune_data/', 'dataset.jsonl')\n \n# An elaborate, high quality docstring for the above function:\n\"\"\"",
"temperature": 0,
"max_tokens": 150,
"top_p": 1.0,
"frequency_penalty": 0.0,
"presence_penalty": 0.0,
"stop": ["#", "\"\"\""]
}'
Enter 发送
JavaScript 单行函数
将 JavaScript 函数转换为单行。
 环境
Prompt
Use list comprehension to convert this into one line of JavaScript:

dogs.forEach((dog) => {
car.push(dog);
});

JavaScript one line version:
API request
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "Use list comprehension to convert this into one line of JavaScript:\n\ndogs.forEach((dog) => {\n car.push(dog);\n});\n\nJavaScript one line version:",
"temperature": 0,
"max_tokens": 60,
"top_p": 1.0,
"frequency_penalty": 0.0,
"presence_penalty": 0.0,
"stop": [";"]
}
Enter 发送