mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-02 14:45:17 +02:00
增加TL_INFO,更改TL的_get_prefix,不用额外维护TL的SYSTEM_PROMPT
This commit is contained in:
parent
b6cf6048ec
commit
0315a218be
4 changed files with 15 additions and 11 deletions
|
|
@ -126,6 +126,7 @@ Output the JSON data in a format that can be loaded by the json.loads() function
|
|||
"""
|
||||
|
||||
QUICK_THINK_SYSTEM_PROMPT = """
|
||||
{role_info}
|
||||
Your role is to determine the appropriate response category for the given request.
|
||||
|
||||
# Response Categories
|
||||
|
|
@ -152,8 +153,6 @@ For requests that are unclear, lack sufficient detail, or are outside the system
|
|||
2. If the request is a "how-to" question that asks for a general plan, approach or strategy, it should be categorized as QUICK.
|
||||
|
||||
{examples}
|
||||
|
||||
{role_info}
|
||||
"""
|
||||
|
||||
QUICK_THINK_PROMPT = """
|
||||
|
|
|
|||
|
|
@ -42,6 +42,12 @@ Your team member:
|
|||
However, you MUST respond to the user message by yourself directly, DON'T ask your team members.
|
||||
"""
|
||||
|
||||
TL_INFO = """
|
||||
{role_info}
|
||||
Your team member:
|
||||
{team_info}
|
||||
"""
|
||||
|
||||
FINISH_CURRENT_TASK_CMD = """
|
||||
```json
|
||||
[
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ class RoleZero(Role):
|
|||
|
||||
def format_quick_system_prompt(self) -> str:
|
||||
"""Format the system prompt for quick thinking."""
|
||||
return QUICK_THINK_SYSTEM_PROMPT.format(examples=QUICK_THINK_EXAMPLES, role_info=super()._get_prefix())
|
||||
return QUICK_THINK_SYSTEM_PROMPT.format(examples=QUICK_THINK_EXAMPLES, role_info=self._get_prefix())
|
||||
|
||||
async def _quick_think(self) -> Tuple[Message, str]:
|
||||
answer = ""
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ from metagpt.actions.di.run_command import RunCommand
|
|||
from metagpt.prompts.di.team_leader import (
|
||||
FINISH_CURRENT_TASK_CMD,
|
||||
QUICK_THINK_SYSTEM_PROMPT,
|
||||
TL_INFO,
|
||||
TL_INSTRUCTION,
|
||||
TL_THOUGHT_GUIDANCE,
|
||||
)
|
||||
|
|
@ -47,14 +48,12 @@ class TeamLeader(RoleZero):
|
|||
# continue
|
||||
team_info += f"{role.name}: {role.profile}, {role.goal}\n"
|
||||
return team_info
|
||||
|
||||
def format_quick_system_prompt(self) -> str:
|
||||
quick_system_prompt = super().format_quick_system_prompt()
|
||||
return quick_system_prompt + QUICK_THINK_SYSTEM_PROMPT.format(
|
||||
role_info="", # rolezero's quick think system prompt will include role_info
|
||||
team_info=self._get_team_info(),
|
||||
)
|
||||
|
||||
|
||||
def _get_prefix(self) -> str:
|
||||
role_info = super()._get_prefix()
|
||||
team_info = self._get_team_info()
|
||||
return TL_INFO.format(role_info=role_info, team_info=team_info)
|
||||
|
||||
async def _quick_think(self) -> Message:
|
||||
self.llm.system_prompt = QUICK_THINK_SYSTEM_PROMPT.format(
|
||||
role_info=super()._get_prefix(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue