shreyankisiri commited on
Commit
97e217c
·
verified ·
1 Parent(s): eb45e9c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -155,17 +155,16 @@ fall_back_prompt = ChatPromptTemplate.from_template(fall_back_template)
155
 
156
 
157
  chat_history = lambda x: "\n".join(
158
- [
159
- (
160
- f"human: {msg.content}"
161
- if isinstance(msg, HumanMessage)
162
- else f"AI: {msg.content}"
163
- )
164
- for msg in x["chat_history"]
165
- ]
166
  )
167
 
168
 
 
169
  fallback_chain = (
170
  {"chat_history":chat_history , "query":itemgetter("query")}
171
  | fall_back_prompt
 
155
 
156
 
157
  chat_history = lambda x: "\n".join(
158
+ [
159
+ (
160
+ f"human: {msg.content}" if isinstance(msg, HumanMessage) else f"AI: {msg.content}"
161
+ )
162
+ for msg in x["chat_history"] if hasattr(msg, "content")
163
+ ]
 
 
164
  )
165
 
166
 
167
+
168
  fallback_chain = (
169
  {"chat_history":chat_history , "query":itemgetter("query")}
170
  | fall_back_prompt