Spaces:
Sleeping
Sleeping
File size: 1,674 Bytes
d80b863 a30fbd0 d80b863 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
import yaml
import os
from smolagents import GradioUI, CodeAgent, OpenAIServerModel
# Get current directory path
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
from tools.web_search import DuckDuckGoSearchTool as WebSearch
from tools.visit_webpage import VisitWebpageTool as VisitWebpage
from tools.estimate_renovation_cost import SimpleTool as EstimateRenovationCost
from tools.material_calculator import SimpleTool as MaterialCalculator
from tools.renovation_timeline_estimator import TimelineEstimatorTool as RenovationTimelineEstimator
from tools.contractor_matcher import ContractorMatchingTool as ContractorMatcher
from tools.final_answer import FinalAnswerTool as FinalAnswer
model = OpenAIServerModel(
model_id='gpt-4o-mini',
)
web_search = WebSearch()
visit_webpage = VisitWebpage()
estimate_renovation_cost = EstimateRenovationCost()
material_calculator = MaterialCalculator()
renovation_timeline_estimator = RenovationTimelineEstimator()
contractor_matcher = ContractorMatcher()
final_answer = FinalAnswer()
with open(os.path.join(CURRENT_DIR, "prompts.yaml"), 'r') as stream:
prompt_templates = yaml.safe_load(stream)
agent = CodeAgent(
model=model,
tools=[web_search, visit_webpage, estimate_renovation_cost, material_calculator, renovation_timeline_estimator, contractor_matcher],
managed_agents=[],
max_steps=12,
verbosity_level=2,
grammar=None,
planning_interval=None,
name='Renovation_Planner_AI',
description=None,
executor_type='local',
executor_kwargs={},
max_print_outputs_length=None,
prompt_templates=prompt_templates
)
if __name__ == "__main__":
GradioUI(agent).launch()
|