Spaces:
Runtime error
Runtime error
File size: 745 Bytes
f66b5f5 827ed8f f66b5f5 827ed8f f66b5f5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import openai
import os
class OpenAI_API:
def __init__(self):
self.openai_api_key = ""
def single_request(self, address_text):
openai.api_type = "azure"
openai.api_base = "https://damlaopenai.openai.azure.com/"
openai.api_version = "2022-12-01"
openai.api_key = os.getenv("API_KEY")
response = openai.Completion.create(
engine="Davinci-003",
prompt=address_text,
temperature=0.,
max_tokens=500,
top_p=1,
# n=1,
# logprobs=0,
# echo=False,
stop=["\n"],
frequency_penalty=0,
presence_penalty=0,
# best_of=1,
)
return response
|