Spaces:
Runtime error
Runtime error
Changed to old model
Browse files
app.py
CHANGED
|
@@ -23,26 +23,23 @@ class OpenAI_API:
|
|
| 23 |
def __init__(self):
|
| 24 |
self.openai_api_key = ''
|
| 25 |
|
| 26 |
-
def single_request(self,
|
| 27 |
|
| 28 |
openai.api_type = "azure"
|
| 29 |
openai.api_base = "https://damlaopenai.openai.azure.com/"
|
| 30 |
openai.api_version = "2022-12-01"
|
| 31 |
openai.api_key = os.getenv("API_KEY")
|
| 32 |
-
|
| 33 |
response = openai.Completion.create(
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
frequency_penalty=0,
|
| 44 |
-
presence_penalty=0,
|
| 45 |
-
best_of=1)
|
| 46 |
|
| 47 |
return response
|
| 48 |
|
|
|
|
| 23 |
def __init__(self):
|
| 24 |
self.openai_api_key = ''
|
| 25 |
|
| 26 |
+
def single_request(self, prompt_input):
|
| 27 |
|
| 28 |
openai.api_type = "azure"
|
| 29 |
openai.api_base = "https://damlaopenai.openai.azure.com/"
|
| 30 |
openai.api_version = "2022-12-01"
|
| 31 |
openai.api_key = os.getenv("API_KEY")
|
| 32 |
+
|
| 33 |
response = openai.Completion.create(
|
| 34 |
+
model="text-davinci-003",
|
| 35 |
+
prompt=prompt_input,
|
| 36 |
+
temperature=0,
|
| 37 |
+
max_tokens=300,
|
| 38 |
+
top_p=1,
|
| 39 |
+
frequency_penalty=0.0,
|
| 40 |
+
presence_penalty=0.0,
|
| 41 |
+
stop=["\n"],
|
| 42 |
+
)
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
return response
|
| 45 |
|