snsynth commited on
Commit
bab388e
·
1 Parent(s): 4073c4a

update chat utils

Browse files
Files changed (1) hide show
  1. rag_app/chat_utils.py +6 -5
rag_app/chat_utils.py CHANGED
@@ -40,12 +40,13 @@ def respond_to_chat(query: str, history: list[ChatMessage]):
40
  assistant_message = ChatMessage(role=_ROLE_ASSISTANT)
41
  yield assistant_message
42
  state = me.state(State)
43
- pdf_files = state.pdf_files
44
- if pdf_files:
45
- response = extract_final_answer(pdf_files, query)
46
  else:
47
- response = answer_question(query)
48
-
 
 
49
  print("Agent response=", response)
50
  yield response
51
 
 
40
  assistant_message = ChatMessage(role=_ROLE_ASSISTANT)
41
  yield assistant_message
42
  state = me.state(State)
43
+ if len(state.pdf_files)==0:
44
+ pdf_files = ["data/annual-report-of-fy-2022-23.pdf", "data/reliance-jio-infocomm-limited-annual-report-fy-2023-24.pdf"]
 
45
  else:
46
+ pdf_files = state.pdf_files
47
+
48
+ response = extract_final_answer(pdf_files, query)
49
+
50
  print("Agent response=", response)
51
  yield response
52