Spaces:
Sleeping
Sleeping
Update app.py
Browse filesRemoved manual testing
app.py
CHANGED
|
@@ -805,42 +805,6 @@ Answer:"""
|
|
| 805 |
print(f"6. Agent returning answer: {answer[:100]}...")
|
| 806 |
return answer
|
| 807 |
|
| 808 |
-
def __call__(self, question: str, image_files: List[str] = None, audio_files: List[str] = None) -> str:
|
| 809 |
-
"""
|
| 810 |
-
Main entry point for manual testing - process media files and generate response.
|
| 811 |
-
"""
|
| 812 |
-
if self.debug:
|
| 813 |
-
print(f"Agent received question: {question}")
|
| 814 |
-
print(f"Image files: {image_files}")
|
| 815 |
-
print(f"Audio files: {audio_files}")
|
| 816 |
-
|
| 817 |
-
# Early validation
|
| 818 |
-
if not question or not question.strip():
|
| 819 |
-
return "Please provide a valid question."
|
| 820 |
-
|
| 821 |
-
try:
|
| 822 |
-
# Process media files first
|
| 823 |
-
attachment_context = self._process_attachments(image_files, audio_files, [])
|
| 824 |
-
|
| 825 |
-
if self.debug and attachment_context:
|
| 826 |
-
print(f"Media context: {attachment_context[:200]}...")
|
| 827 |
-
|
| 828 |
-
# Decide whether to search
|
| 829 |
-
if self._should_search(question, attachment_context):
|
| 830 |
-
if self.debug:
|
| 831 |
-
print("Using search-based approach")
|
| 832 |
-
answer = self._answer_with_search(question, attachment_context)
|
| 833 |
-
else:
|
| 834 |
-
if self.debug:
|
| 835 |
-
print("Using LLM-only approach")
|
| 836 |
-
answer = self._answer_with_llm(question, attachment_context)
|
| 837 |
-
except Exception as e:
|
| 838 |
-
answer = f"Sorry, I encountered an error: {e}"
|
| 839 |
-
|
| 840 |
-
if self.debug:
|
| 841 |
-
print(f"Agent returning answer: {answer[:100]}...")
|
| 842 |
-
return answer
|
| 843 |
-
|
| 844 |
def fetch_questions() -> Tuple[str, Optional[pd.DataFrame]]:
|
| 845 |
"""
|
| 846 |
Fetch questions from the API and cache them.
|
|
|
|
| 805 |
print(f"6. Agent returning answer: {answer[:100]}...")
|
| 806 |
return answer
|
| 807 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 808 |
def fetch_questions() -> Tuple[str, Optional[pd.DataFrame]]:
|
| 809 |
"""
|
| 810 |
Fetch questions from the API and cache them.
|