Spaces:
Build error
Build error
Update app.py
Browse files526 unmodified lines527528529530531530531532533534535536537538538539540541541542543544545546547548549550551546547548549550551552553554526 unmodified lines except sr.RequestError: user_question = "Could not request results from Google Speech Recognition service."
while iterations < max_iterations: 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}" """ """
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 "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: # Open the image fileapp.py+9-10