Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -131,11 +131,6 @@ If you can't answer something, call `record_unknown_question`. If a user seems i
|
|
131 |
def chat_stream(self, message, history):
|
132 |
messages = [{"role": "system", "content": self.system_prompt()}]
|
133 |
|
134 |
-
if not history:
|
135 |
-
greeting = "Hello, my name is Jacob Isaacson. Please ask me any questions about my professional career and I will do my best to respond."
|
136 |
-
self.session_log.append({"role": "assistant", "content": greeting})
|
137 |
-
yield greeting
|
138 |
-
|
139 |
for msg in history:
|
140 |
if isinstance(msg, dict) and msg.get("role") in ["user", "assistant"]:
|
141 |
messages.append(msg)
|
@@ -144,7 +139,7 @@ If you can't answer something, call `record_unknown_question`. If a user seems i
|
|
144 |
self.session_log.append({"role": "user", "content": message})
|
145 |
|
146 |
response = self.openai.chat.completions.create(
|
147 |
-
model="gpt-4o
|
148 |
messages=messages,
|
149 |
tools=tools,
|
150 |
stream=False
|
@@ -162,7 +157,7 @@ If you can't answer something, call `record_unknown_question`. If a user seems i
|
|
162 |
yield follow_up
|
163 |
else:
|
164 |
stream = self.openai.chat.completions.create(
|
165 |
-
model="gpt-4o
|
166 |
messages=messages,
|
167 |
tools=tools,
|
168 |
stream=True
|
@@ -201,16 +196,14 @@ with gr.Blocks(title="Jacob Isaacson Chatbot") as iface:
|
|
201 |
gr.ChatInterface(
|
202 |
fn=me.chat_stream,
|
203 |
chatbot=gr.Chatbot(
|
|
|
204 |
value=[
|
205 |
{"role": "assistant", "content": "Hello, my name is Jacob Isaacson. Please ask me any questions about my professional career and I will do my best to respond."}
|
206 |
-
]
|
207 |
-
show_copy_button=True,
|
208 |
),
|
209 |
type="messages",
|
210 |
additional_inputs=[],
|
211 |
)
|
212 |
|
213 |
-
|
214 |
if __name__ == "__main__":
|
215 |
iface.launch()
|
216 |
-
|
|
|
131 |
def chat_stream(self, message, history):
|
132 |
messages = [{"role": "system", "content": self.system_prompt()}]
|
133 |
|
|
|
|
|
|
|
|
|
|
|
134 |
for msg in history:
|
135 |
if isinstance(msg, dict) and msg.get("role") in ["user", "assistant"]:
|
136 |
messages.append(msg)
|
|
|
139 |
self.session_log.append({"role": "user", "content": message})
|
140 |
|
141 |
response = self.openai.chat.completions.create(
|
142 |
+
model="gpt-4o",
|
143 |
messages=messages,
|
144 |
tools=tools,
|
145 |
stream=False
|
|
|
157 |
yield follow_up
|
158 |
else:
|
159 |
stream = self.openai.chat.completions.create(
|
160 |
+
model="gpt-4o",
|
161 |
messages=messages,
|
162 |
tools=tools,
|
163 |
stream=True
|
|
|
196 |
gr.ChatInterface(
|
197 |
fn=me.chat_stream,
|
198 |
chatbot=gr.Chatbot(
|
199 |
+
show_copy_button=True,
|
200 |
value=[
|
201 |
{"role": "assistant", "content": "Hello, my name is Jacob Isaacson. Please ask me any questions about my professional career and I will do my best to respond."}
|
202 |
+
]
|
|
|
203 |
),
|
204 |
type="messages",
|
205 |
additional_inputs=[],
|
206 |
)
|
207 |
|
|
|
208 |
if __name__ == "__main__":
|
209 |
iface.launch()
|
|