IngoTB303
Refactor app structure: add agent and tools, enhance question fetching with attachments, and update requirements
1aa16a4
raw
history blame
1.12 kB
import agent_tools
from smolagents import CodeAgent, FinalAnswerTool, DuckDuckGoSearchTool, AzureOpenAIServerModel
import app_tokens
model = AzureOpenAIServerModel(
model_id = app_tokens.AZURE_OPENAI_MODEL,
azure_endpoint = app_tokens.AZURE_OPENAI_ENDPOINT,
api_key = app_tokens.AZURE_OPENAI_API_KEY,
api_version = app_tokens.OPENAI_API_VERSION
)
class BasicAgent:
def __init__(self):
self.web_agent = CodeAgent(
model=model,
tools=[agent_tools.VisitWebpageTool(), FinalAnswerTool(), DuckDuckGoSearchTool()],
max_steps=8,
name="web_agent",
description="Runs web searches for you."
)
self.manager_agent = CodeAgent(
model=model,
tools=[],
managed_agents=[self.web_agent],
additional_authorized_imports=["json","pandas","numpy", "regex"],
planning_interval=5,
verbosity_level=2,
max_steps=12,
)
def forward(self, question: str) -> str:
result = self.manager_agent.run(question)
return result