24Arys11's picture
embracing langgraph; addapted LLMFactory, Args.LLMInterface, IAgent, Toolbox and agents.py; simplified graph: removed math and encryption agents while promoting the reasoner
4fb4269
raw
history blame
3.3 kB
from args import Args
from itf_agent import IAgent
from llm_factory import AgentPreset
from toolbox import Toolbox
PRIMARY_AGENT_PRESET = AgentPreset(Args.primary_llm_interface, Args.primary_model,
temperature = None, max_tokens = 2048, repeat_penalty = None)
SECONDARY_AGENT_PRESET = AgentPreset(Args.primary_llm_interface, Args.secondary_model,
temperature = None, max_tokens = 2048, repeat_penalty = None)
VISION_AGENT_PRESET = AgentPreset(Args.vlm_interface, Args.vision_model,
temperature = None, max_tokens = 2048, repeat_penalty = None)
class Manager(IAgent):
"""
Orchestrates the workflow by delegating tasks to specialized nodes and integrating their outputs
"""
def __init__(self):
super().__init__("01_manager.txt", PRIMARY_AGENT_PRESET)
class Auditor(IAgent):
"""
Reviews manager's outputs for accuracy, safety, and quality
"""
def __init__(self):
super().__init__("02_auditor.txt", PRIMARY_AGENT_PRESET)
class Summarizer(IAgent):
"""
Generates concise summaries of conversations or passages.
"""
def __init__(self):
super().__init__("04_summarizer.txt", PRIMARY_AGENT_PRESET)
class Solver(IAgent):
"""
Central problem-solving node that coordinates with specialized experts based on task requirements
"""
def __init__(self):
super().__init__("03_solver.txt", PRIMARY_AGENT_PRESET)
class Researcher(IAgent):
"""
Retrieves and synthesizes information from various sources to answer knowledge-based questions
"""
def __init__(self):
toolbox = Toolbox.web_search
tools = [
toolbox.duckduckgo_text_search,
toolbox.duckduckgo_images_search,
toolbox.duckduckgo_videos_search
]
super().__init__("05_researcher.txt", PRIMARY_AGENT_PRESET, tools)
class Reasoner(IAgent):
"""
Performs logical reasoning, inference, and step-by-step problem-solving
"""
def __init__(self):
math_toolbox = Toolbox.math
encryption_toolbox = Toolbox.encryption
tools = [
math_toolbox.symbolic_calc,
math_toolbox.unit_converter,
encryption_toolbox.ascii_decode,
encryption_toolbox.ascii_encode,
encryption_toolbox.base64_decode,
encryption_toolbox.base64_encode,
encryption_toolbox.caesar_cipher_decode,
encryption_toolbox.caesar_cipher_encode,
encryption_toolbox.caesar_cipher_brute_force,
encryption_toolbox.reverse_string
]
super().__init__("08_reasoner.txt", PRIMARY_AGENT_PRESET, tools)
class OutputGuard(IAgent):
"""
Performs logical reasoning, inference, and step-by-step problem-solving
"""
def __init__(self):
super().__init__("11_output_guard.txt", SECONDARY_AGENT_PRESET)
class ImageHandler(IAgent):
"""
Processes, analyzes, and generates information related to images
"""
def __init__(self):
super().__init__("09_image_handler.txt", VISION_AGENT_PRESET)
class VideoHandler(IAgent):
"""
Processes, analyzes, and generates information related to videos
"""
def __init__(self):
super().__init__("10_video_handler.txt", VISION_AGENT_PRESET)