Spaces:
Runtime error
Runtime error
File size: 985 Bytes
4f981cb 9b5b26a c19d193 6aae614 8fe992b 9b5b26a 4f981cb 9b5b26a 4f981cb ae7a494 4f981cb 13d500a 8c01ffb 861422e 9b5b26a 8c01ffb 8fe992b 4f981cb 8c01ffb 861422e 8fe992b 8c01ffb |
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 |
import os
import dotenv
from dotenv import load_dotenv
from smolagents import CodeAgent, load_tool, tool, OpenAIServerModel
import datetime
import requests
import pytz
import yaml
from tools.final_answer import FinalAnswerTool
from Gradio_UI import GradioUI
from tools.get_location import GetLocationTool
from tools.get_weather import GetWeatherTool
load_dotenv()
model = OpenAIServerModel(
"Qwen/Qwen2.5-Coder-32B-Instruct",
api_base="https://api.together.xyz/v1",
api_key=os.environ.get("TOGETHER_API_KEY"),
max_tokens=8096
)
with open("prompts.yaml", 'r') as stream:
prompt_templates = yaml.safe_load(stream)
agent = CodeAgent(
model=model,
tools=[GetLocationTool(), GetWeatherTool(), FinalAnswerTool()], ## add your tools here (don't remove final answer)
max_steps=6,
verbosity_level=1,
grammar=None,
planning_interval=None,
name=None,
description=None,
prompt_templates=prompt_templates
)
GradioUI(agent).launch() |