File size: 1,155 Bytes
55542ef
 
 
 
 
 
 
 
 
 
 
 
1a3bb1c
55542ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e79bd2e
 
55542ef
e79bd2e
55542ef
 
 
 
 
 
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
import gradio as gr
from agent import Agent

# Initialize the agent
agent = Agent("Problem Solver")

# Set the persona
agent.persona = """You are an analytical problem-solving assistant.
You excel at breaking down complex problems and explaining your thought process.
You are thorough, logical, and clear in your explanations."""

# Set a global instruction
agent.instruction = "Ensure your responses are clear, detailed, and well-structured and should finished in 70 words."

def execute_task(task, strategy):
    """Execute the given task using the selected strategy."""
    agent.strategy = strategy
    agent.task = task
    response = agent.execute()
    return response

# Define available strategies
strategies = agent.available_strategies()

# Create the Gradio interface
iface = gr.Interface(
    fn=execute_task,
    inputs=[
        gr.Textbox(lines=5, label="Task"),
        gr.Dropdown(choices=strategies, label="Strategy")
    ],
    outputs=gr.Textbox(label="Response"),
    title="Problem Solver Agent",
    description="Provide a task and select a strategy to see how the agent responds."
)

if __name__ == "__main__":
    iface.launch()