Spaces:
Building
Building
first agent version
Browse files
app.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
import os
|
2 |
import gradio as gr
|
|
|
3 |
import requests
|
4 |
import inspect
|
5 |
import pandas as pd
|
6 |
|
7 |
-
from smolagents import CodeAgent, OpenAIServerModel,
|
8 |
|
9 |
# (Keep Constants as is)
|
10 |
# --- Constants ---
|
@@ -25,21 +26,18 @@ SYSTEM_PROMPT = """
|
|
25 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
26 |
class BasicAgent:
|
27 |
def __init__(self):
|
28 |
-
|
29 |
model = OpenAIServerModel(
|
30 |
-
model_id=
|
31 |
# Google Gemini OpenAI-compatible API base URL
|
32 |
api_base="https://generativelanguage.googleapis.com/v1beta/openai/",
|
33 |
api_key=os.getenv("GEMINI_API_KEY"),
|
34 |
)
|
35 |
-
|
36 |
-
print("Billy Agent initialized.")
|
37 |
self.billy = CodeAgent(
|
38 |
model=model,
|
39 |
-
tools=[
|
40 |
instructions=SYSTEM_PROMPT,
|
41 |
-
|
42 |
-
max_steps=5,
|
43 |
add_base_tools=True
|
44 |
)
|
45 |
def __call__(self, question: str) -> str:
|
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
+
from griffe import LogLevel
|
4 |
import requests
|
5 |
import inspect
|
6 |
import pandas as pd
|
7 |
|
8 |
+
from smolagents import CodeAgent, OpenAIServerModel, WebSearchTool, FinalAnswerTool, VisitWebpageTool
|
9 |
|
10 |
# (Keep Constants as is)
|
11 |
# --- Constants ---
|
|
|
26 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
27 |
class BasicAgent:
|
28 |
def __init__(self):
|
29 |
+
print("Billy Agent initialized.")
|
30 |
model = OpenAIServerModel(
|
31 |
+
model_id='gemini-2.5-flash-lite',
|
32 |
# Google Gemini OpenAI-compatible API base URL
|
33 |
api_base="https://generativelanguage.googleapis.com/v1beta/openai/",
|
34 |
api_key=os.getenv("GEMINI_API_KEY"),
|
35 |
)
|
|
|
|
|
36 |
self.billy = CodeAgent(
|
37 |
model=model,
|
38 |
+
tools=[WebSearchTool(), FinalAnswerTool(), VisitWebpageTool()],
|
39 |
instructions=SYSTEM_PROMPT,
|
40 |
+
max_steps=10,
|
|
|
41 |
add_base_tools=True
|
42 |
)
|
43 |
def __call__(self, question: str) -> str:
|