chaithanyashaji commited on
Commit
baddd9f
·
verified ·
1 Parent(s): f7bfa00

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -1
main.py CHANGED
@@ -134,7 +134,11 @@ async def chat(request: ChatRequest):
134
 
135
  # Invoke the QA chain with the user question
136
  result = qa.invoke(input=request.question)
137
- answer = result.get("answer")
 
 
 
 
138
 
139
  if not answer or "The information is not available in the provided context" in answer:
140
  answer = "I'm sorry, I couldn't find relevant information for your query. Please try rephrasing or providing more details."
 
134
 
135
  # Invoke the QA chain with the user question
136
  result = qa.invoke(input=request.question)
137
+ if isinstance(result, dict) and "answer" in result:
138
+ answer = result["answer"]
139
+ else:
140
+ answer = "I'm sorry, I couldn't find relevant information for your query."
141
+
142
 
143
  if not answer or "The information is not available in the provided context" in answer:
144
  answer = "I'm sorry, I couldn't find relevant information for your query. Please try rephrasing or providing more details."