Logo of Sweep
Add option for user submit questions that model will answerajitesh123/Perf-Review-AI#6

> > >

✓ Completed in 8 minutes, 3 months ago using GPT-4  •   Book a call  •   Report a bug


Progress

  Modifysrc/app.py 

Changed src/app.py in 503be88    

18 print(response.choices[0].message.content)18 print(response.choices[0].message.content)
19 return response.choices[0].message.content19 return response.choices[0].message.content
20 20
21def generate_review(your_role, candidate_role, your_review, your_openai_key):21def generate_review(your_role, candidate_role, your_review, user_questions, your_openai_key):
22 prompt = generate_prompt(your_role, candidate_role, your_review)22 prompt = generate_prompt(your_role, candidate_role, your_review)
23 response = get_completion(prompt, your_openai_key)23 response = get_completion(prompt, your_openai_key)
24 return response24 return response
25 25
26def generate_prompt(your_role, candidate_role, your_review):26def generate_prompt(your_role, candidate_role, your_review, user_questions):
27 delimiter = "####"27 delimiter = "####"
28 prompt = f"""28 prompt = f"""
29 I’m {your_role}. You’re an expert at writing performance reviews. On my behalf, help answer the question for performance reviews below.29 I’m {your_role}. You’re an expert at writing performance reviews. On my behalf, help answer the question for performance reviews below.
...
39 </context>39 </context>
4040
41 <question for performance>41 <question for performance>
42 - Describe example(s) of the topics selected. What was the context? What actions did they take?
43 - In your opinion, what impact did their actions have?
44 - What recommendations do you have for their growth and development? Your feedback can be about any area of their work.42 " + '\n'.join(user_questions) + "
45 </question for performance>43 </question for performance>
4644
47 {delimiter} Output in markdown format in following structure:{delimiter}45 {delimiter} Output in markdown format in following structure:{delimiter}
...
64your_review = st.text_area('Briefly describe your experience of working with the candidate including project, responsibility of candidate, unique things they did etc., in free flow writing')62your_review = st.text_area('Briefly describe your experience of working with the candidate including project, responsibility of candidate, unique things they did etc., in free flow writing')
65 63
66if st.button('Write Review'):64if st.button('Write Review'):
67 review = generate_review(your_role, candidate_role, your_review, your_openai_key)65 review = generate_review(your_role, candidate_role, your_review, ['Sample question 1', 'Sample question 2'], your_openai_key)
68 st.markdown(review)66 st.markdown(review)
692672
  • Update the generate_prompt function signature to accept an additional parameter: user_questions, which is a list of strings. Each string in the list represents a user-submitted question.
  • Inside the generate_prompt function, replace the static text between <question for performance> and </question for performance> with the content of user_questions. This can be achieved by joining the list of questions into a single string, separated by newline characters, and inserting this string into the appropriate place in the prompt.
  • Modify the generate_review function signature to also accept user_questions as an input parameter. This parameter should then be passed to the generate_prompt function call within generate_review.
  • Update any calls to generate_review and generate_prompt within src/app.py to include the new user_questions parameter. For demonstration or testing purposes, if there are any, provide a sample list of questions to these calls.
  • Ensure that the documentation/comments within src/app.py are updated to reflect the changes in function signatures and the new functionality.
  Run GitHub Actions forsrc/app.py 

Plan

This is based on the results of the Planning step. The plan may expand from failed GitHub Actions runs.

  Modifysrc/app.py 
  Run GitHub Actions forsrc/app.py 

Code Snippets Found

This is based on the results of the Searching step.

src/app.py:20-57 
20
21def generate_review(your_role, candidate_role, your_review, your_openai_key):
22    prompt = generate_prompt(your_role, candidate_role, your_review)
23    response = get_completion(prompt, your_openai_key)
24    return response
25
26def generate_prompt(your_role, candidate_role, your_review):
27    delimiter = "####"
28    prompt = f"""
29    I’m {your_role}. You’re an expert at writing performance reviews. On my behalf, help answer the question for performance reviews below.
30
31    {delimiter} Instructions {delimiter}:
32    - Use the context below to understand my perspective of working with him
33    - Keep the role of person I’m review {candidate_role} in mind when writing the review
34    - Use simple language and keep it to the point
35    - Strictly answer the question mentioned in “question for performance”
36
37    <context>
38    {your_review}
39    </context>
40
41    <question for performance>
42    - Describe example(s) of the topics selected. What was the context? What actions did they take?
43    - In your opinion, what impact did their actions have?
44    - What recommendations do you have for their growth and development? Your feedback can be about any area of their work.
45    </question for performance>
46
47    {delimiter} Output in markdown format in following structure:{delimiter}
48    - Q1: Describe example(s) of the topics selected. What was the context? What actions did they take?
49    Your answer
50    - Q2: In your opinion, what impact did their actions have?
51    Your answer
52    - Q3: What recommendations do you have for their growth and development? Your feedback can be about any area of their work.
53    Your answer
54
55    Answer: """
56    return prompt
57