Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

fixbug: llm.aask unit test failed

莘权 马5e6b665f1509
diff --git a/metagpt/actions/rebuild_sequence_view.py b/metagpt/actions/rebuild_sequence_view.py
index da57af52d..227d29872 100644
--- a/metagpt/actions/rebuild_sequence_view.py
+++ b/metagpt/actions/rebuild_sequence_view.py
@@ -166,6 +166,7 @@ class RebuildSequenceView(Action):
"Translate the given markdown text to a Mermaid Sequence Diagram.",
"Return the merged Mermaid sequence diagram in a markdown code block format.",
],
+ stream=False,
)
sequence_view = rsp.removeprefix("```mermaid").removesuffix("```")
rows = await self.graph_db.select(subject=entry.subject, predicate=GraphKeyword.HAS_SEQUENCE_VIEW)
@@ -317,6 +318,7 @@ class RebuildSequenceView(Action):
"external system execute this use case.\n"
'- a "relationship" key lists all the descriptions of relationship among these use cases.\n',
],
+ stream=False,
)
code_blocks = parse_json_code_block(rsp)
@@ -373,6 +375,7 @@ class RebuildSequenceView(Action):
"Translate the markdown text to a Mermaid Sequence Diagram.",
"Return a markdown mermaid code block.",
],
+ stream=False,
)
sequence_view = rsp.removeprefix("```mermaid").removesuffix("```")
@@ -598,6 +601,7 @@ class RebuildSequenceView(Action):
"Participants with the same name are considered identical.",
"Return the merged Mermaid sequence diagram in a markdown code block format.",
],
+ stream=False,
)
sequence_view = rsp.removeprefix("```mermaid").removesuffix("```")
diff --git a/metagpt/actions/skill_action.py b/metagpt/actions/skill_action.py
index b68596809..078ab008a 100644
--- a/metagpt/actions/skill_action.py
+++ b/metagpt/actions/skill_action.py
@@ -50,6 +50,7 @@ class ArgumentsParingAction(Action):
rsp = await self.llm.aask(
msg=prompt,
system_msgs=["You are a function parser.", "You can convert spoken words into function parameters."],
+ stream=False,
)
logger.debug(f"SKILL:{prompt}\n, RESULT:{rsp}")
self.args = ArgumentsParingAction.parse_arguments(skill_name=self.skill.name, txt=rsp)
diff --git a/metagpt/actions/talk_action.py b/metagpt/actions/talk_action.py
index 0aac1c5a0..81f66f9a1 100644
--- a/metagpt/actions/talk_action.py
+++ b/metagpt/actions/talk_action.py
@@ -92,7 +92,7 @@ class TalkAction(Action):
async def run(self, with_message=None, **kwargs) -> Message:
msg, format_msgs, system_msgs = self.aask_args
- rsp = await self.llm.aask(msg=msg, format_msgs=format_msgs, system_msgs=system_msgs)
+ rsp = await self.llm.aask(msg=msg, format_msgs=format_msgs, system_msgs=system_msgs, stream=False)
self.rsp = Message(content=rsp, role="assistant", cause_by=self)
return self.rsp
diff --git a/metagpt/memory/brain_memory.py b/metagpt/memory/brain_memory.py
index efdcacb4b..ca248d861 100644
--- a/metagpt/memory/brain_memory.py
+++ b/metagpt/memory/brain_memory.py
@@ -208,6 +208,7 @@ class BrainMemory(BaseModel):
"You are a tool capable of determining whether two paragraphs are semantically related."
'Return "TRUE" if "Paragraph 1" is semantically relevant to "Paragraph 2", otherwise return "FALSE".'
],
+ stream=False,
)
result = True if "TRUE" in rsp else False
p2 = text2.replace("\n", "")
@@ -234,6 +235,7 @@ class BrainMemory(BaseModel):
"Do not supplement the context with information that is not present, especially regarding the subject and object.",
"Return the augmented sentence.",
],
+ stream=False,
)
logger.info(f"REWRITE:\nCommand: {prompt}\nRESULT: {rsp}\n")
return rsp
diff --git a/metagpt/roles/assistant.py b/metagpt/roles/assistant.py
index 2774bd9b6..895fd8385 100644
--- a/metagpt/roles/assistant.py
+++ b/metagpt/roles/assistant.py
@@ -65,7 +65,7 @@ class Assistant(Role):
prompt += f"If the text explicitly want you to {desc}, return `[SKILL]: {name}` brief and clear. For instance: [SKILL]: {name}\n"
prompt += 'Otherwise, return `[TALK]: {talk}` brief and clear. For instance: if {talk} is "xxxx" return [TALK]: xxxx\n\n'
prompt += f"Now what specific action is explicitly mentioned in the text: {last_talk}\n"
- rsp = await self.llm.aask(prompt, ["You are an action classifier"])
+ rsp = await self.llm.aask(prompt, ["You are an action classifier"], stream=False)
logger.info(f"THINK: {prompt}\n, THINK RESULT: {rsp}\n")
return await self._plan(rsp, last_talk=last_talk)