Commit
·
a6c261a
1
Parent(s):
ef0cfcc
Added basic agent using gemini-2.0-flash-lite model
Browse files- requirements.txt +2 -1
- src/agent/base_agent.py +17 -2
- src/tools/external_tools.py +0 -6
requirements.txt
CHANGED
@@ -3,4 +3,5 @@ gradio[oauth]
|
|
3 |
requests~=2.32.3
|
4 |
smolagents~=1.13.0
|
5 |
python-dotenv~=1.1.0
|
6 |
-
pandas~=2.2.3
|
|
|
|
3 |
requests~=2.32.3
|
4 |
smolagents~=1.13.0
|
5 |
python-dotenv~=1.1.0
|
6 |
+
pandas~=2.2.3
|
7 |
+
litellm~=1.66.1
|
src/agent/base_agent.py
CHANGED
@@ -1,9 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
class BasicAgent:
|
2 |
def __init__(self):
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
def __call__(self, question: str) -> str:
|
6 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
7 |
-
fixed_answer =
|
8 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
9 |
return fixed_answer
|
|
|
1 |
+
import os
|
2 |
+
from smolagents import CodeAgent, LiteLLMModel, DuckDuckGoSearchTool
|
3 |
+
from tools.weater_info_tool import WeatherInfoTool
|
4 |
+
|
5 |
+
|
6 |
class BasicAgent:
|
7 |
def __init__(self):
|
8 |
+
model = LiteLLMModel(
|
9 |
+
model_id="gemini/gemini-2.0-flash-lite",
|
10 |
+
api_key=os.getenv("GEMINI_API_KEY")
|
11 |
+
)
|
12 |
+
self.agent = CodeAgent(
|
13 |
+
tools=[WeatherInfoTool(), DuckDuckGoSearchTool()],
|
14 |
+
model=model,
|
15 |
+
add_base_tools=True,
|
16 |
+
planning_interval=3
|
17 |
+
)
|
18 |
+
print("Agent initialized.")
|
19 |
|
20 |
def __call__(self, question: str) -> str:
|
21 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
22 |
+
fixed_answer = self.agent.run(question)
|
23 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
24 |
return fixed_answer
|
src/tools/external_tools.py
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
from smolagents import DuckDuckGoSearchTool
|
2 |
-
|
3 |
-
|
4 |
-
duck_duck_go_search_tool = DuckDuckGoSearchTool()
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|