Update app.py
Browse files490 unmodified lines4914924934944944954964972 unmodified lines5005015025035035045055065 unmodified lines51251351451551551651751816 unmodified lines5355365375385395395405415425431 unmodified line545546547548549548550551552553490 unmodified lines yield final_summary else: yield "Unable to generate a response. Please try a different query."
else: try: embed = get_embeddings()2 unmodified lines
if os.path.exists("faiss_database"): pdf_database = FAISS.load_local("faiss_database", embed, allow_dangerous_deserialization=True)
if os.path.exists("office_faiss_database"): office_database = FAISS.load_local("office_faiss_database", embed, allow_dangerous_deserialization=True)
5 unmodified lines if pdf_database: pdf_retriever = pdf_database.as_retriever(search_kwargs={"k": 10}) all_relevant_docs.extend(pdf_retriever.get_relevant_documents(message))
if office_database: office_retriever = office_database.as_retriever(search_kwargs={"k": 10}) all_relevant_docs.extend(office_retriever.get_relevant_documents(message))16 unmodified lines
# Process Excel documents if excel_docs: file_type = "excel" if model == "gemini-1.5-flash": for chunk in get_response_from_gemini(message, excel_context, "excel", num_calls, temperature): for chunk in get_response_from_gemini(message, model, selected_docs, file_type, num_calls, temperature): yield chunk else: for response in get_response_from_excel(message, model, excel_context, num_calls, temperature):1 unmodified line
# Process other documents (PDF, Word) if other_docs: file_type = "pdf" if model == "gemini-1.5-flash": for chunk in get_response_from_gemini(message, other_context, "pdf", num_calls, temperature): for chunk in get_response_from_gemini(message, model, selected_docs, file_type, num_calls, temperature): yield chunk elif model == "@cf/meta/llama-3.1-8b-instruct": for response in get_response_from_cloudflare(prompt="", context=other_context, query=message, num_calls=num_calls, temperature=temperature, search_type="document"):app.py+7-5