Spaces:
Build error
Build error
Update app.py
Browse files528 unmodified lines529530531532533534535536537532533534535536537538539540541542543544545546547548549550551540541542543544545546547548549550551552553554528 unmodified lines
while iterations < max_iterations: """if "send email to" in user_question: email_match = re.search(r"send email to ([\w\.-]+@[\w\.-]+)", user_question) if email_match: user_email = email_match.group(1).strip() user_question = user_question.replace(f"send email to {user_email}", "").strip() user_question = f"{user_question}:{user_email}" """if "send email to" in user_question: email_match = re.search(r"send email to ([\w\.-]+@[\w\.-]+)", user_question) if email_match: user_email = email_match.group(1).strip() user_question = user_question.replace(f"send email to {user_email}", "").strip() user_question = f"{user_question}:{user_email}" """
response = agent_executor.invoke({"input": user_question}, config={"callbacks": [langfuse_handler]}) if isinstance(response, dict): response_text = response.get("output", "") else: response_text = response if "invalid" not in response_text.lower(): break iterations += 1 if iterations == max_iterations: return "The agent could not generate a valid response within the iteration limit." response = agent_executor.invoke({"input": user_question}, config={"callbacks": [langfuse_handler]}) if isinstance(response, dict): response_text = response.get("output", "") else: response_text = response if "invalid" not in response_text.lower(): break iterations += 1 if iterations == max_iterations: return "The agent could not generate a valid response within the iteration limit."
if os.getenv("IMAGE_PATH") in response_text:app.py+18-18