deprem-ocr / openai_api.py
merve's picture
merve HF staff
Update openai_api.py
afacc5e
raw
history blame contribute delete
741 Bytes
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://afet-org.openai.azure.com/"
openai.api_version = "2022-12-01"
openai.api_key = os.getenv("API_KEY")
response = openai.Completion.create(
engine="afet-org",
prompt=address_text,
temperature=0.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