Update app.py
Browse files
app.py
CHANGED
|
@@ -36,7 +36,7 @@ class BasicAgent:
|
|
| 36 |
input_state = {"question": question}
|
| 37 |
# Run the graph
|
| 38 |
answer = self.graph.invoke(input_state)
|
| 39 |
-
print(f"Agent returning fixed answer: {answer}")
|
| 40 |
return answer
|
| 41 |
|
| 42 |
class State(TypedDict):
|
|
@@ -52,7 +52,9 @@ def search_tavily(state):
|
|
| 52 |
tavily_search = TavilySearchResults(max_results=2)
|
| 53 |
|
| 54 |
search_docs = tavily_search.invoke(state['question'])
|
| 55 |
-
|
|
|
|
|
|
|
| 56 |
# Format
|
| 57 |
formatted_search_docs = "\n\n---\n\n".join(
|
| 58 |
[
|
|
@@ -71,6 +73,8 @@ def search_wikipedia(state):
|
|
| 71 |
search_docs = WikipediaLoader(query=state['question'],
|
| 72 |
load_max_docs=2).load()
|
| 73 |
|
|
|
|
|
|
|
| 74 |
# Format
|
| 75 |
formatted_search_docs = "\n\n---\n\n".join(
|
| 76 |
[
|
|
@@ -88,6 +92,8 @@ def search_DuckDuckGo(state):
|
|
| 88 |
ddg_search = DuckDuckGoSearchRun(max_results=2)
|
| 89 |
search_docs = ddg_search.invoke(state['question'])
|
| 90 |
|
|
|
|
|
|
|
| 91 |
# Format
|
| 92 |
formatted_search_docs = "\n\n---\n\n".join(
|
| 93 |
[
|
|
|
|
| 36 |
input_state = {"question": question}
|
| 37 |
# Run the graph
|
| 38 |
answer = self.graph.invoke(input_state)
|
| 39 |
+
print(f"Agent returning fixed answer: {answer.content}")
|
| 40 |
return answer
|
| 41 |
|
| 42 |
class State(TypedDict):
|
|
|
|
| 52 |
tavily_search = TavilySearchResults(max_results=2)
|
| 53 |
|
| 54 |
search_docs = tavily_search.invoke(state['question'])
|
| 55 |
+
|
| 56 |
+
print("Tavily search returned:", search_docs)
|
| 57 |
+
|
| 58 |
# Format
|
| 59 |
formatted_search_docs = "\n\n---\n\n".join(
|
| 60 |
[
|
|
|
|
| 73 |
search_docs = WikipediaLoader(query=state['question'],
|
| 74 |
load_max_docs=2).load()
|
| 75 |
|
| 76 |
+
print("Wikipedia search returned:", search_docs)
|
| 77 |
+
|
| 78 |
# Format
|
| 79 |
formatted_search_docs = "\n\n---\n\n".join(
|
| 80 |
[
|
|
|
|
| 92 |
ddg_search = DuckDuckGoSearchRun(max_results=2)
|
| 93 |
search_docs = ddg_search.invoke(state['question'])
|
| 94 |
|
| 95 |
+
print("DuckDuckGo search returned:", search_docs)
|
| 96 |
+
|
| 97 |
# Format
|
| 98 |
formatted_search_docs = "\n\n---\n\n".join(
|
| 99 |
[
|