reab5555 commited on
Commit
914b175
·
verified ·
1 Parent(s): 41754b5

Update interview.py

Browse files
Files changed (1) hide show
  1. interview.py +17 -17
interview.py CHANGED
@@ -11,10 +11,10 @@ class Interview:
11
  def __init__(self):
12
  self.question_count = 0
13
  self.history: List[tuple] = []
14
- self.general_impression: str = ""
15
- self.interview_instructions = load_interview_instructions()
16
 
17
  def set_general_impression(self, impression: str):
 
18
  self.general_impression = impression
19
 
20
  def process_message(self, message: str) -> str:
@@ -24,21 +24,20 @@ class Interview:
24
  # Generate next question or final report
25
  if self.question_count < 10:
26
  prompt = f"""
27
- Your are a Psychologist or a Psychiatrist and conducting a clinical interview.
28
-
29
  Use the following information to generate the next question:
30
 
31
- General Impression: {self.general_impression}
32
  Context from knowledge base: {relevant_docs}
33
  Full conversation history:
34
  {self._format_history()}
35
  Current answer: {message}
36
  Question count: {self.question_count + 1}/10
37
 
38
- Based on all this information, generate the next appropriate question for the clinical interview.
39
- Important: Your question MUST be a direct follow-up to the most recent answer, while also considering
40
- the entire conversation history. Ensure that your question builds upon the information just provided
41
- and explores it further or shifts to a related topic based on what was just said.
42
  """
43
  response = llm.invoke(prompt)
44
  self.question_count += 1
@@ -46,14 +45,16 @@ class Interview:
46
  return response.content
47
  else:
48
  prompt = f"""
49
- Based on the following information, generate a comprehensive clinical report (also make use of technical clinical terms from the provided documents or knowledge base):
50
- General Impression: {self.general_impression}
 
51
  Context from knowledge base: {relevant_docs}
52
  Full conversation:
53
  {self._format_history()}
54
  Final answer: {message}
55
 
56
- Provide a detailed clinical analysis based on the entire interview.
 
57
  """
58
  response = llm.invoke(prompt)
59
  self.question_count = 0 # Reset for next interview
@@ -63,14 +64,13 @@ class Interview:
63
 
64
  def start_interview(self) -> str:
65
  prompt = f"""
66
- Your are a Psychologist or a Psychiatrist and starting a clinical interview.
67
-
68
  Based on the following information, generate an appropriate opening question:
69
 
70
- General Impression: {self.general_impression}
71
- Interview Instructions: {self.interview_instructions}
72
 
73
- Provide a warm, engaging opening question that sets the tone for the clinical interview and encourages the individual to start sharing about themselves.
 
74
  """
75
  response = llm.invoke(prompt)
76
  return response.content
 
11
  def __init__(self):
12
  self.question_count = 0
13
  self.history: List[tuple] = []
14
+ self.general_impression: str = "" # This will be set from the previous analysis
 
15
 
16
  def set_general_impression(self, impression: str):
17
+ # This method will be called with the general_impression from processing.py or app.py
18
  self.general_impression = impression
19
 
20
  def process_message(self, message: str) -> str:
 
24
  # Generate next question or final report
25
  if self.question_count < 10:
26
  prompt = f"""
27
+ You are a Psychologist or a Psychiatrist conducting a clinical interview about the speaker analyzed in the video.
 
28
  Use the following information to generate the next question:
29
 
30
+ General Impression from previous analysis: {self.general_impression}
31
  Context from knowledge base: {relevant_docs}
32
  Full conversation history:
33
  {self._format_history()}
34
  Current answer: {message}
35
  Question count: {self.question_count + 1}/10
36
 
37
+ Based on all this information, generate the next appropriate question for the clinical interview about the speaker.
38
+ Important: Your question MUST be a direct follow-up to the most recent answer, while also considering
39
+ the entire conversation history and the initial general impression. Ensure that your question builds upon
40
+ the information just provided and explores it further or shifts to a related topic based on what was just said.
41
  """
42
  response = llm.invoke(prompt)
43
  self.question_count += 1
 
45
  return response.content
46
  else:
47
  prompt = f"""
48
+ Based on the following information, generate a comprehensive clinical report about the speaker
49
+ (also make use of technical clinical terms from the provided documents or knowledge base):
50
+ General Impression from previous analysis: {self.general_impression}
51
  Context from knowledge base: {relevant_docs}
52
  Full conversation:
53
  {self._format_history()}
54
  Final answer: {message}
55
 
56
+ Provide a detailed clinical analysis of the speaker based on the initial general impression and the entire interview.
57
+ Compare and contrast the insights gained from the interview with the initial general impression.
58
  """
59
  response = llm.invoke(prompt)
60
  self.question_count = 0 # Reset for next interview
 
64
 
65
  def start_interview(self) -> str:
66
  prompt = f"""
67
+ You are a Psychologist or a Psychiatrist starting a clinical interview about the speaker analyzed in the video.
 
68
  Based on the following information, generate an appropriate opening question:
69
 
70
+ General Impression from previous analysis: {self.general_impression}
 
71
 
72
+ Provide a warm, engaging opening question that sets the tone for the clinical interview and encourages
73
+ discussion about the speaker, based on the general impression provided from the previous analysis.
74
  """
75
  response = llm.invoke(prompt)
76
  return response.content