Update app.py
Browse files278 unmodified lines27928028128228328428528628730 unmodified lines31831932031832132232332419 unmodified lines344345346344345346347348349350278 unmodified lines
contextualized_question, topics, entity_tracker = chatbot.process_question(question)
# Convert sets to lists in entity_tracker serializable_entity_tracker = {k: list(v) for k, v in entity_tracker.items()}
if web_search: search_results = google_search(contextualized_question) all_answers = []30 unmodified lines conv_context=chatbot.get_context(), question=question, topics=", ".join(topics), entities=json.dumps(entity_tracker) entities=json.dumps(serializable_entity_tracker) )
full_response = generate_chunked_response(model, formatted_prompt)19 unmodified lines
except Exception as e: print(f"Error in ask_question (attempt {attempt + 1}): {e}") if "Input validation error" in str(e) and attempt < max_attempts - 1: print(f"Reducing context length for next attempt") elif attempt == max_attempts - 1: if attempt == max_attempts - 1: all_answers.append(f"I apologize, but I'm having trouble processing the query due to its length or complexity.")
answer = "\n\n".join(all_answers)app.py+5-4