pulkitme
commited on
Commit
·
9c9f63e
1
Parent(s):
7f706fc
simple smolagent with duck duck go search tool
Browse files
app.py
CHANGED
@@ -5,11 +5,12 @@ import inspect
|
|
5 |
import pandas as pd
|
6 |
import time
|
7 |
from google import genai
|
8 |
-
from smolagents import CodeAgent, ToolCallingAgent, DuckDuckGoSearchTool, LiteLLMModel, PythonInterpreterTool, tool, DuckDuckGoSearchTool
|
|
|
9 |
|
10 |
|
11 |
#client = genai.Client(api_key=os.getenv("API_KEY"))
|
12 |
-
model = LiteLLMModel(model_id="gemini/gemini-2.
|
13 |
api_key=os.getenv("API_KEY"))
|
14 |
# (Keep Constants as is)
|
15 |
# --- Constants ---
|
@@ -29,14 +30,20 @@ class BasicAgent:
|
|
29 |
# )
|
30 |
# gemini_flash_answer = response.text
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
agent = CodeAgent(
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
)
|
40 |
answer = agent.run(question)
|
41 |
#fixed_answer = "This is a default answer."
|
42 |
print(f"Agent returning fixed answer: {answer}")
|
|
|
5 |
import pandas as pd
|
6 |
import time
|
7 |
from google import genai
|
8 |
+
from smolagents import Tool , CodeAgent, ToolCallingAgent, DuckDuckGoSearchTool, LiteLLMModel, PythonInterpreterTool, tool, DuckDuckGoSearchTool
|
9 |
+
from langchain.agents import load_tools
|
10 |
|
11 |
|
12 |
#client = genai.Client(api_key=os.getenv("API_KEY"))
|
13 |
+
model = LiteLLMModel(model_id="gemini/gemini-2.5-flash-preview-04-17",
|
14 |
api_key=os.getenv("API_KEY"))
|
15 |
# (Keep Constants as is)
|
16 |
# --- Constants ---
|
|
|
30 |
# )
|
31 |
# gemini_flash_answer = response.text
|
32 |
|
33 |
+
# youtube_tool = Tool.from_space(
|
34 |
+
# "black-forest-labs/FLUX.1-schnell",
|
35 |
+
# name="image_generator",
|
36 |
+
# description="Generate an image from a prompt"
|
37 |
+
# )
|
38 |
+
|
39 |
agent = CodeAgent(
|
40 |
+
tools=[DuckDuckGoSearchTool()],
|
41 |
+
model=model,
|
42 |
+
#additional_authorized_imports=["helium"],
|
43 |
+
#step_callbacks=[save_screenshot],
|
44 |
+
max_steps=20,
|
45 |
+
verbosity_level=2,
|
46 |
+
)
|
47 |
answer = agent.run(question)
|
48 |
#fixed_answer = "This is a default answer."
|
49 |
print(f"Agent returning fixed answer: {answer}")
|