Ali Kadhim
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,19 +2,22 @@
|
|
| 2 |
|
| 3 |
# OpenAI Chat completion
|
| 4 |
|
| 5 |
-
import openai
|
| 6 |
-
import chainlit as cl
|
| 7 |
|
| 8 |
# You only need the api key inserted here if it's not in your .env file
|
| 9 |
#openai.api_key = "YOUR_API_KEY"
|
| 10 |
|
|
|
|
|
|
|
| 11 |
model_name = "gpt-3.5-turbo"
|
|
|
|
| 12 |
settings = {
|
| 13 |
-
"temperature": 0.7,
|
| 14 |
-
"max_tokens": 500,
|
| 15 |
-
"top_p": 1,
|
| 16 |
-
"frequency_penalty": 0,
|
| 17 |
-
"presence_penalty": 0,
|
| 18 |
}
|
| 19 |
|
| 20 |
|
|
|
|
| 2 |
|
| 3 |
# OpenAI Chat completion
|
| 4 |
|
| 5 |
+
import openai #importing openai for API usage
|
| 6 |
+
import chainlit as cl #importing chainlit for our app
|
| 7 |
|
| 8 |
# You only need the api key inserted here if it's not in your .env file
|
| 9 |
#openai.api_key = "YOUR_API_KEY"
|
| 10 |
|
| 11 |
+
# We select our model. If you do not have access to GPT-4, please use GPT-3.5T (gpt-3.5-turbo)
|
| 12 |
+
|
| 13 |
model_name = "gpt-3.5-turbo"
|
| 14 |
+
# model_name = "gpt-4"
|
| 15 |
settings = {
|
| 16 |
+
"temperature": 0.7, # higher value increases output diveresity/randomness
|
| 17 |
+
"max_tokens": 500, # maximum length of output response
|
| 18 |
+
"top_p": 1, # choose only the top x% of possible words to return
|
| 19 |
+
"frequency_penalty": 0, # higher value will result in the model being more conservative in its use of repeated tokens.
|
| 20 |
+
"presence_penalty": 0, # higher value will result in the model being more likely to generate tokens that have not yet been included in the generated text
|
| 21 |
}
|
| 22 |
|
| 23 |
|