refactor(agent): Agent modular refactoring (#1487)

This commit is contained in:
Fangyin Cheng
2024-05-07 09:45:26 +08:00
committed by GitHub
parent 2a418f91e8
commit 863b5404dd
86 changed files with 4513 additions and 967 deletions

View File

@@ -1,37 +1,54 @@
"""Dashboard Assistant Agent."""
from typing import List
from ..actions.dashboard_action import DashboardAction
from ..core.agent import AgentMessage
from ..core.base_agent import ConversableAgent
from ..core.profile import DynConfig, ProfileConfig
from ..resource.resource_db_api import ResourceDbClient
from .actions.dashboard_action import DashboardAction
class DashboardAssistantAgent(ConversableAgent):
"""Dashboard Assistant Agent."""
name: str = "Visionary"
profile: str = "Reporter"
goal: str = (
"Read the provided historical messages, collect various analysis SQLs "
"from them, and assemble them into professional reports."
)
constraints: List[str] = [
"You are only responsible for collecting and sorting out the analysis SQL that"
" already exists in historical messages, and do not generate any analysis sql "
"yourself.",
"In order to build a report with rich display types, you can appropriately "
"adjust the display type of the charts you collect so that you can build a "
"better report. Of course, you can choose from the following available "
"display types: {display_type}",
"Please read and completely collect all analysis sql in the historical "
"conversation, and do not omit or modify the content of the analysis sql.",
]
desc: str = (
"Observe and organize various analysis results and construct "
"professional reports"
profile: ProfileConfig = ProfileConfig(
name=DynConfig(
"Visionary",
category="agent",
key="dbgpt_agent_expand_dashboard_assistant_agent_profile_name",
),
role=DynConfig(
"Reporter",
category="agent",
key="dbgpt_agent_expand_dashboard_assistant_agent_profile_role",
),
goal=DynConfig(
"Read the provided historical messages, collect various analysis SQLs "
"from them, and assemble them into professional reports.",
category="agent",
key="dbgpt_agent_expand_dashboard_assistant_agent_profile_goal",
),
constraints=DynConfig(
[
"You are only responsible for collecting and sorting out the analysis "
"SQL that already exists in historical messages, and do not generate "
"any analysis sql yourself.",
"In order to build a report with rich display types, you can "
"appropriately adjust the display type of the charts you collect so "
"that you can build a better report. Of course, you can choose from "
"the following available display types: {{ display_type }}",
"Please read and completely collect all analysis sql in the "
"historical conversation, and do not omit or modify the content of "
"the analysis sql.",
],
category="agent",
key="dbgpt_agent_expand_dashboard_assistant_agent_profile_constraints",
),
desc=DynConfig(
"Observe and organize various analysis results and construct "
"professional reports",
category="agent",
key="dbgpt_agent_expand_dashboard_assistant_agent_profile_desc",
),
)
def __init__(self, **kwargs):