File size: 1,379 Bytes
65d169c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
32
33
34
35
36
37
38
39
40
41
42
43
#USGAE


#python generate_feedback.py <file name> 


import openai
from dotenv import load_dotenv
import os 
import sys
load_dotenv()

openai.api_key = os.environ.get("OPENAI_API_KEY")
file_name=sys.argv[1]

def get_chat_completion(iContent):
    conv_list=[{"role":"system", "content":f'''You are the world's best interviewer. The model will be given an interview transcript between interviewer and candidate. Based on job profile given in the title, evaluate candidate and rate the candidate on communications ,technical skills, practical skills and attitude. Give the answer in points and describe each point with the rating. For eg:

Attitude: Rating out of 10
Confidence: Rating out of 10
Technical Skills:  Rating out of 10
Practical skills: Rating out of 10

Give Overall rating and verdict for if the candidate has to be considered for next round along with above ratings \n
                {iContent}'''}]
    
    response = openai.ChatCompletion.create(
        model="gpt-3.5-turbo-16k",
        messages=conv_list,
        temperature=0,  
        # max_tokens=50,    
        # frequency_penalty=0.5,  
        # presence_penalty=0.2,  
    )
    return response['choices'][0]['message']['content'].strip()


if __name__=="__main__":
    iContent=st.text_area()
    answer= get_chat_completion(iContent)
    json_answer={'feedback':answer}
    st.json(json_answer)