mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-04 13:22:39 +02:00
researcher allow override system prompt
This commit is contained in:
parent
4006edac04
commit
c92793c27c
1 changed files with 12 additions and 1 deletions
|
|
@ -46,7 +46,7 @@ class Researcher(Role):
|
|||
else:
|
||||
topic = msg.content
|
||||
|
||||
research_system_text = get_research_system_text(topic, self.language)
|
||||
research_system_text = self.research_system_text(topic)
|
||||
if isinstance(todo, CollectLinks):
|
||||
links = await todo.run(topic, 4, 4)
|
||||
ret = Message("", Report(topic=topic, links=links), role=self.profile, cause_by=type(todo))
|
||||
|
|
@ -64,6 +64,17 @@ class Researcher(Role):
|
|||
self._rc.memory.add(ret)
|
||||
return ret
|
||||
|
||||
def research_system_text(self, topic) -> str:
|
||||
""" BACKWARD compatible
|
||||
This allows sub-class able to define its own system prompt based on topic.
|
||||
return the previous implementation to have backward compatible
|
||||
Args:
|
||||
topic:
|
||||
language:
|
||||
|
||||
Returns: str
|
||||
"""
|
||||
return get_research_system_text(topic, self.language)
|
||||
async def react(self) -> Message:
|
||||
msg = await super().react()
|
||||
report = msg.instruct_content
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue