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,9 +1,10 @@
"""Summary Assistant Agent."""
import logging
from typing import List
from ..actions.blank_action import BlankAction
import logging
from ..core.action.blank_action import BlankAction
from ..core.base_agent import ConversableAgent
from ..core.profile import DynConfig, ProfileConfig
logger = logging.getLogger(__name__)
@@ -11,29 +12,48 @@ logger = logging.getLogger(__name__)
class SummaryAssistantAgent(ConversableAgent):
"""Summary Assistant Agent."""
name: str = "Aristotle"
profile: str = "Summarizer"
goal: str = (
"Summarize answer summaries based on user questions from provided "
"resource information or from historical conversation memories."
)
constraints: List[str] = [
"Prioritize the summary of answers to user questions from the improved resource"
" text. If no relevant information is found, summarize it from the historical "
"dialogue memory given. It is forbidden to make up your own.",
"You need to first detect user's question that you need to answer with your"
" summarization.",
"Extract the provided text content used for summarization.",
"Then you need to summarize the extracted text content.",
"Output the content of summarization ONLY related to user's question. The "
"output language must be the same to user's question language.",
"If you think the provided text content is not related to user questions at "
"all, ONLY output 'Did not find the information you want.'!!.",
]
desc: str = (
"You can summarize provided text content according to user's questions"
" and output the summarization."
profile: ProfileConfig = ProfileConfig(
name=DynConfig(
"Aristotle",
category="agent",
key="dbgpt_agent_expand_summary_assistant_agent_profile_name",
),
role=DynConfig(
"Summarizer",
category="agent",
key="dbgpt_agent_expand_summary_assistant_agent_profile_role",
),
goal=DynConfig(
"Summarize answer summaries based on user questions from provided "
"resource information or from historical conversation memories.",
category="agent",
key="dbgpt_agent_expand_summary_assistant_agent_profile_goal",
),
constraints=DynConfig(
[
"Prioritize the summary of answers to user questions from the improved "
"resource text. If no relevant information is found, summarize it from "
"the historical dialogue memory given. It is forbidden to make up your "
"own.",
"You need to first detect user's question that you need to answer with "
"your summarization.",
"Extract the provided text content used for summarization.",
"Then you need to summarize the extracted text content.",
"Output the content of summarization ONLY related to user's question. "
"The output language must be the same to user's question language.",
"If you think the provided text content is not related to user "
"questions at all, ONLY output 'Did not find the information you "
"want.'!!.",
],
category="agent",
key="dbgpt_agent_expand_summary_assistant_agent_profile_constraints",
),
desc=DynConfig(
"You can summarize provided text content according to user's questions"
" and output the summarization.",
category="agent",
key="dbgpt_agent_expand_summary_assistant_agent_profile_desc",
),
)
def __init__(self, **kwargs):