Update app.py
Browse filesDuckDuckGoSearchRun added
app.py
CHANGED
@@ -3,6 +3,8 @@ import gradio as gr
|
|
3 |
import requests
|
4 |
import inspect
|
5 |
import pandas as pd
|
|
|
|
|
6 |
|
7 |
# (Keep Constants as is)
|
8 |
# --- Constants ---
|
@@ -18,9 +20,13 @@ class BasicAgent:
|
|
18 |
def __call__(self, question: str) -> str:
|
19 |
print(f"{user_name}")
|
20 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
24 |
|
25 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
26 |
"""
|
|
|
3 |
import requests
|
4 |
import inspect
|
5 |
import pandas as pd
|
6 |
+
from langchain_community.tools import DuckDuckGoSearchRun
|
7 |
+
|
8 |
|
9 |
# (Keep Constants as is)
|
10 |
# --- Constants ---
|
|
|
20 |
def __call__(self, question: str) -> str:
|
21 |
print(f"{user_name}")
|
22 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
23 |
+
search_tool = DuckDuckGoSearchRun()
|
24 |
+
results = search_tool.invoke(f"{question}")
|
25 |
+
# print(results)
|
26 |
+
# fixed_answer = "This is a default answer."
|
27 |
+
# print(f"Agent returning fixed answer: {fixed_answer}")
|
28 |
+
print(f"Agent returning fixed answer: {results}")
|
29 |
+
return results
|
30 |
|
31 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
32 |
"""
|