Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -9,7 +9,7 @@ from langchain_core.prompts import ChatPromptTemplate
|
|
| 9 |
# 1. Web Browsing
|
| 10 |
from langchain_community.tools import DuckDuckGoSearchRun
|
| 11 |
from langchain_community.document_loaders import ImageCaptionLoader
|
| 12 |
-
import requests
|
| 13 |
import pandas as pd
|
| 14 |
from pypdf import PdfReader
|
| 15 |
from langchain_community.tools import WikipediaQueryRun
|
|
@@ -158,6 +158,7 @@ class BasicAgent:
|
|
| 158 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 159 |
# response = self.agent_exe.invoke({"input": f"Question: {question}"})
|
| 160 |
# fixed_answer = response['message'][-1].content
|
|
|
|
| 161 |
fixed_answer = self.agent.run(f"Answer this question: {question}")
|
| 162 |
# fixed_answer = "This is a default answer."
|
| 163 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
|
|
|
| 9 |
# 1. Web Browsing
|
| 10 |
from langchain_community.tools import DuckDuckGoSearchRun
|
| 11 |
from langchain_community.document_loaders import ImageCaptionLoader
|
| 12 |
+
import requests, time
|
| 13 |
import pandas as pd
|
| 14 |
from pypdf import PdfReader
|
| 15 |
from langchain_community.tools import WikipediaQueryRun
|
|
|
|
| 158 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 159 |
# response = self.agent_exe.invoke({"input": f"Question: {question}"})
|
| 160 |
# fixed_answer = response['message'][-1].content
|
| 161 |
+
time.sleep(15)
|
| 162 |
fixed_answer = self.agent.run(f"Answer this question: {question}")
|
| 163 |
# fixed_answer = "This is a default answer."
|
| 164 |
print(f"Agent returning fixed answer: {fixed_answer}")
|