Create api.py
Browse files
api.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import openai
|
3 |
+
|
4 |
+
openai.api_key = os.getenv("OPENAI_API_KEY")
|
5 |
+
|
6 |
+
response = openai.Completion.create(
|
7 |
+
model="text-davinci-003",
|
8 |
+
prompt="#JavaScript to Python:\nJavaScript: \ndogs = [\"bill\", \"joe\", \"carl\"]\ncar = []\ndogs.forEach((dog) {\n car.push(dog);\n});\n\nPython:",
|
9 |
+
temperature=0,
|
10 |
+
max_tokens=64,
|
11 |
+
top_p=1.0,
|
12 |
+
frequency_penalty=0.0,
|
13 |
+
presence_penalty=0.0
|
14 |
+
)
|