in opendataqna.py [0:0]
def get_response(session_id,user_question,result_df,Responder_model='gemini-1.0-pro'):
try:
Responder = ResponseAgent(Responder_model)
if session_id is None or session_id=="":
print("This is a new session")
else:
session_history =firestoreconnector.get_chat_logs_for_session(session_id) if USE_SESSION_HISTORY else None
if session_history is None or not session_history:
print("No records for the session. Not rewriting the question\n")
else:
concated_questions,re_written_qe=Responder.rewrite_question(user_question,session_history)
user_question=re_written_qe
_resp=Responder.run(user_question, result_df)
invalid_response=False
except Exception as e:
print(f"An error occured. Aborting... Error Message: {e}")
_resp= "Error has been encountered :: " + str(e)
invalid_response=True
return _resp,invalid_response