saishshinde15's picture
Upload agent
7434b58 verified
import yaml
import os
from smolagents import GradioUI, ToolCallingAgent, HfApiModel
# Get current directory path
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
from tools.web_search import DuckDuckGoSearchTool as WebSearch
from tools.format_github_repos import SimpleTool as FormatGithubRepos
from tools.final_answer import FinalAnswerTool as FinalAnswer
model = HfApiModel(
model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud',
provider=None,
)
web_search = WebSearch()
format_github_repos = FormatGithubRepos()
final_answer = FinalAnswer()
with open(os.path.join(CURRENT_DIR, "prompts.yaml"), 'r') as stream:
prompt_templates = yaml.safe_load(stream)
agent = ToolCallingAgent(
model=model,
tools=[web_search, format_github_repos],
managed_agents=[],
max_steps=6,
verbosity_level=1,
grammar=None,
planning_interval=None,
name=None,
description=None,
prompt_templates=prompt_templates
)
if __name__ == "__main__":
GradioUI(agent).launch()