Spaces:
Runtime error
Runtime error
Azure AI implementation
Browse files
app.py
CHANGED
@@ -11,10 +11,10 @@ from sendgrid.helpers.mail import Mail, Attachment, FileContent, FileName, FileT
|
|
11 |
import base64
|
12 |
from azure.cosmos import CosmosClient, exceptions
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
os_connection_string = os.getenv("CONNECTION")
|
19 |
os_mail_password = os.getenv("MAIL_PASSWORD")
|
20 |
|
@@ -231,7 +231,7 @@ def bot(history, job, resume, job_params):
|
|
231 |
messages.append({"role": "assistant", "content": assistant})
|
232 |
|
233 |
response = openai.ChatCompletion.create(
|
234 |
-
|
235 |
messages=messages,
|
236 |
temperature=0.0,
|
237 |
stream=True,
|
@@ -239,7 +239,7 @@ def bot(history, job, resume, job_params):
|
|
239 |
|
240 |
history[-1][1] = ""
|
241 |
for chunk in response:
|
242 |
-
if len(chunk["choices"][0]["delta"]) != 0:
|
243 |
history[-1][1] = history[-1][1] + chunk["choices"][0]["delta"]["content"]
|
244 |
yield history
|
245 |
if history[-1][1] == "Thank you for conducting the evaluation! We will get back to you shortly.":
|
@@ -268,7 +268,7 @@ def send_evaluation(history, job, resume, job_params):
|
|
268 |
prompt = "You are a professional recruiter who has been given a CV and a job description and has created questions based on that. The eventual applicant has entered his answers to the questions. Now you have to evaluate on the basis of the answers if the applicant fits the job in principle. This is the case when about 70 percent of all questions have been answered satisfactorily and positively. Keep in mind that an answer must always be fact-based, so if, for example, the question asks for examples, the potential applicant must also give such examples. Please also provide details of which questions were answered positively and why."
|
269 |
|
270 |
res = openai.ChatCompletion.create(
|
271 |
-
|
272 |
temperature=0.2,
|
273 |
messages=[
|
274 |
{
|
|
|
11 |
import base64
|
12 |
from azure.cosmos import CosmosClient, exceptions
|
13 |
|
14 |
+
openai.api_key = os.getenv("OPENAI_API_KEY")
|
15 |
+
openai.api_base = "https://tensora-oai.openai.azure.com/"
|
16 |
+
openai.api_type = "azure"
|
17 |
+
openai.api_version = "2023-05-15"
|
18 |
os_connection_string = os.getenv("CONNECTION")
|
19 |
os_mail_password = os.getenv("MAIL_PASSWORD")
|
20 |
|
|
|
231 |
messages.append({"role": "assistant", "content": assistant})
|
232 |
|
233 |
response = openai.ChatCompletion.create(
|
234 |
+
enigne="gpt-4",
|
235 |
messages=messages,
|
236 |
temperature=0.0,
|
237 |
stream=True,
|
|
|
239 |
|
240 |
history[-1][1] = ""
|
241 |
for chunk in response:
|
242 |
+
if len(chunk["choices"][0]["delta"]) != 0 and hasattr(chunk["choices"][0]["delta"], "content"):
|
243 |
history[-1][1] = history[-1][1] + chunk["choices"][0]["delta"]["content"]
|
244 |
yield history
|
245 |
if history[-1][1] == "Thank you for conducting the evaluation! We will get back to you shortly.":
|
|
|
268 |
prompt = "You are a professional recruiter who has been given a CV and a job description and has created questions based on that. The eventual applicant has entered his answers to the questions. Now you have to evaluate on the basis of the answers if the applicant fits the job in principle. This is the case when about 70 percent of all questions have been answered satisfactorily and positively. Keep in mind that an answer must always be fact-based, so if, for example, the question asks for examples, the potential applicant must also give such examples. Please also provide details of which questions were answered positively and why."
|
269 |
|
270 |
res = openai.ChatCompletion.create(
|
271 |
+
engine="gpt-4",
|
272 |
temperature=0.2,
|
273 |
messages=[
|
274 |
{
|