File size: 2,055 Bytes
b0592df
 
 
 
eca273b
 
 
b0592df
 
 
 
eca273b
b0592df
eca273b
 
 
 
 
 
 
 
 
b0592df
fca449e
555e7a6
13b76ad
fca449e
 
eca273b
 
 
83898ca
 
 
 
eca273b
 
 
 
83898ca
 
 
eca273b
 
 
 
 
 
 
 
 
 
b0592df
eca273b
 
b0592df
eca273b
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
52
53
54
55
56
57
from smolagents import CodeAgent, LiteLLMModel
from smolagents.default_tools import (DuckDuckGoSearchTool,
                                      VisitWebpageTool,
                                      WikipediaSearchTool,
                                      SpeechToTextTool,
                                      PythonInterpreterTool)
import yaml
from final_answer import FinalAnswerTool
from tools import (youtube_frames_to_images, use_vision_model,
                         read_file, download_file_from_url,
                         extract_text_from_image, analyze_csv_file,
                         analyze_excel_file, youtube_transcribe,
                        transcribe_audio, review_youtube_video)
import os
from dotenv import load_dotenv

load_dotenv()

# Load prompts from YAML file
with open("prompts.yaml", 'r') as stream:
    prompt_templates = yaml.safe_load(stream)

# WORKING MODEL SETUP
react_model = LiteLLMModel(
    model_id="huggingface/gemini/gemini-1.5-flash",
    api_key=os.getenv("GEMINI_KEY"),
    temperature=0.2
)

manager_agent = CodeAgent(
    model=react_model,
    tools=[FinalAnswerTool(),
            DuckDuckGoSearchTool(),
            VisitWebpageTool(max_output_length=500000),
            WikipediaSearchTool(extract_format='HTML'),
           SpeechToTextTool(),
           youtube_frames_to_images,
           youtube_transcribe,
           use_vision_model,
           read_file, download_file_from_url,
            extract_text_from_image,
            analyze_csv_file, analyze_excel_file,
           transcribe_audio,
           review_youtube_video
           ],
    managed_agents=[],
    additional_authorized_imports=['os', 'pandas', 'numpy', 'PIL', 'tempfile', 'PIL.Image'],
    max_steps=20,
    verbosity_level=1,
    planning_interval=6,
    name="Manager",
    description="The manager of the team, responsible for overseeing and guiding the team's work.",
    prompt_templates=prompt_templates)

if __name__ == "__main__":
    from smolagents import GradioUI
    GradioUI(manager_agent).launch()