JoeVonDahab commited on
Commit
bd0b6cf
·
verified ·
1 Parent(s): 9a1247c

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +26 -1
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: cv_conversation
3
  app_file: app.py
4
  sdk: gradio
5
  sdk_version: 5.33.1
 
1
  ---
2
+ title: Ask_Youssef
3
  app_file: app.py
4
  sdk: gradio
5
  sdk_version: 5.33.1
app.py CHANGED
@@ -28,6 +28,10 @@ def record_unknown_question(question):
28
  push(f"Recording {question}")
29
  return {"recorded": "ok"}
30
 
 
 
 
 
31
  record_user_details_json = {
32
  "name": "record_user_details",
33
  "description": "Use this tool to record that a user is interested in being in touch and provided an email address",
@@ -69,8 +73,26 @@ record_unknown_question_json = {
69
  }
70
  }
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  tools = [{"type": "function", "function": record_user_details_json},
73
- {"type": "function", "function": record_unknown_question_json}]
 
74
 
75
 
76
  class Me:
@@ -114,6 +136,9 @@ If the user is engaging in discussion, try to steer them towards getting in touc
114
  return system_prompt
115
 
116
  def chat(self, message, history):
 
 
 
117
  messages = [{"role": "system", "content": self.system_prompt()}] + history + [{"role": "user", "content": message}]
118
  done = False
119
  while not done:
 
28
  push(f"Recording {question}")
29
  return {"recorded": "ok"}
30
 
31
+ def record_any_question(question):
32
+ push(f"New question asked: {question}")
33
+ return {"recorded": "ok"}
34
+
35
  record_user_details_json = {
36
  "name": "record_user_details",
37
  "description": "Use this tool to record that a user is interested in being in touch and provided an email address",
 
73
  }
74
  }
75
 
76
+ record_any_question_json = {
77
+ "name": "record_any_question",
78
+ "description": "Always use this tool to record ANY incoming user question immediately, regardless of whether an answer is known.",
79
+ "parameters": {
80
+ "type": "object",
81
+ "properties": {
82
+ "question": {
83
+ "type": "string",
84
+ "description": "The exact question the user asked."
85
+ }
86
+ },
87
+ "required": ["question"],
88
+ "additionalProperties": False
89
+ }
90
+ }
91
+
92
+
93
  tools = [{"type": "function", "function": record_user_details_json},
94
+ {"type": "function", "function": record_unknown_question_json},
95
+ {"type": "function", "function": record_any_question_json}]
96
 
97
 
98
  class Me:
 
136
  return system_prompt
137
 
138
  def chat(self, message, history):
139
+ # NEW: Always record the question first
140
+ record_any_question(message)
141
+
142
  messages = [{"role": "system", "content": self.system_prompt()}] + history + [{"role": "user", "content": message}]
143
  done = False
144
  while not done: