Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,9 +6,21 @@ import pandas as pd
|
|
| 6 |
from smolagents import CodeAgent, DuckDuckGoSearchTool
|
| 7 |
from smolagents.models import OpenAIServerModel
|
| 8 |
|
| 9 |
-
from tools import WikipediaTool, WikipediaSearchTool
|
| 10 |
#from tools import WikipediaToolWrapper, WikipediaSearchToolWrapper
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
# Define the system prompt
|
| 13 |
SYSTEM_PROMPT = """You are a general AI assistant. I will ask you a question.
|
| 14 |
Report your thoughts, and finish your answer with the following template:
|
|
@@ -35,8 +47,9 @@ class MyAgent:
|
|
| 35 |
DuckDuckGoSearchTool(),
|
| 36 |
#WikipediaToolWrapper(),
|
| 37 |
#WikipediaSearchToolWrapper()
|
| 38 |
-
WikipediaSearchTool(),
|
| 39 |
-
WikipediaTool()
|
|
|
|
| 40 |
], model=self.model)
|
| 41 |
|
| 42 |
def __call__(self, task: dict) -> str:
|
|
|
|
| 6 |
from smolagents import CodeAgent, DuckDuckGoSearchTool
|
| 7 |
from smolagents.models import OpenAIServerModel
|
| 8 |
|
| 9 |
+
#from tools import WikipediaTool, WikipediaSearchTool
|
| 10 |
#from tools import WikipediaToolWrapper, WikipediaSearchToolWrapper
|
| 11 |
|
| 12 |
+
from smolagents import Tool
|
| 13 |
+
from wikipedia_searcher import WikipediaSearcher
|
| 14 |
+
|
| 15 |
+
wikipedia_search_tool = Tool(
|
| 16 |
+
name="wikipedia_search",
|
| 17 |
+
func=WikipediaSearcher().search,
|
| 18 |
+
description="Search Wikipedia for a given query.",
|
| 19 |
+
inputs={"query": "string"},
|
| 20 |
+
output_type="string"
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
|
| 24 |
# Define the system prompt
|
| 25 |
SYSTEM_PROMPT = """You are a general AI assistant. I will ask you a question.
|
| 26 |
Report your thoughts, and finish your answer with the following template:
|
|
|
|
| 47 |
DuckDuckGoSearchTool(),
|
| 48 |
#WikipediaToolWrapper(),
|
| 49 |
#WikipediaSearchToolWrapper()
|
| 50 |
+
#WikipediaSearchTool(),
|
| 51 |
+
#WikipediaTool()
|
| 52 |
+
wikipedia_search_tool
|
| 53 |
], model=self.model)
|
| 54 |
|
| 55 |
def __call__(self, task: dict) -> str:
|