Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,9 @@ import pandas as pd
|
|
| 6 |
from smolagents import CodeAgent, DuckDuckGoSearchTool
|
| 7 |
from smolagents.models import OpenAIServerModel
|
| 8 |
|
|
|
|
|
|
|
|
|
|
| 9 |
# Define the system prompt
|
| 10 |
SYSTEM_PROMPT = """You are a general AI assistant. I will ask you a question.
|
| 11 |
Report your thoughts, and finish your answer with the following template:
|
|
@@ -28,8 +31,8 @@ class PatchedOpenAIServerModel(OpenAIServerModel):
|
|
| 28 |
|
| 29 |
class MyAgent:
|
| 30 |
def __init__(self):
|
| 31 |
-
self.model = PatchedOpenAIServerModel(model_id="gpt-4")
|
| 32 |
-
self.agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=self.model)
|
| 33 |
|
| 34 |
def __call__(self, question: str) -> str:
|
| 35 |
return self.agent.run(question)
|
|
|
|
| 6 |
from smolagents import CodeAgent, DuckDuckGoSearchTool
|
| 7 |
from smolagents.models import OpenAIServerModel
|
| 8 |
|
| 9 |
+
from tools import WikipediaTool, WikipediaSearchTool
|
| 10 |
+
|
| 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:
|
|
|
|
| 31 |
|
| 32 |
class MyAgent:
|
| 33 |
def __init__(self):
|
| 34 |
+
self.model = PatchedOpenAIServerModel(model_id="gpt-4-turbo") #to be changed gpt-4
|
| 35 |
+
self.agent = CodeAgent(tools=[DuckDuckGoSearchTool(), WikipediaSearchTool(), WikipediaTool()], model=self.model) #add a new tool
|
| 36 |
|
| 37 |
def __call__(self, question: str) -> str:
|
| 38 |
return self.agent.run(question)
|