Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,15 +15,26 @@ prompt = "The following is a conversation with an AI assistant. The assistant is
|
|
| 15 |
|
| 16 |
def openai_create(prompt):
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
)
|
| 28 |
|
| 29 |
return response.choices[0].text
|
|
|
|
| 15 |
|
| 16 |
def openai_create(prompt):
|
| 17 |
|
| 18 |
+
openai.api_key = os.getenv("OPENAI_API_KEY")
|
| 19 |
+
|
| 20 |
+
response = openai.ChatCompletion.create(
|
| 21 |
+
model="gpt-3.5-turbo-16k",
|
| 22 |
+
messages=[
|
| 23 |
+
{
|
| 24 |
+
"role": "system",
|
| 25 |
+
"content": "You are a helpful assistant!"
|
| 26 |
+
},
|
| 27 |
+
{
|
| 28 |
+
"role": "user",
|
| 29 |
+
"content": ""
|
| 30 |
+
}
|
| 31 |
+
],
|
| 32 |
+
temperature=0.4,
|
| 33 |
+
max_tokens=12500,
|
| 34 |
+
top_p=1,
|
| 35 |
+
frequency_penalty=0,
|
| 36 |
+
presence_penalty=0
|
| 37 |
+
stop=[" Human:", " AI:"]
|
| 38 |
)
|
| 39 |
|
| 40 |
return response.choices[0].text
|