mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-03 04:42:38 +02:00
Merge branch 'dev' of https://github.com/geekan/MetaGPT into geekan/dev
This commit is contained in:
commit
2eb5e2f913
2 changed files with 13 additions and 8 deletions
|
|
@ -37,11 +37,7 @@ class FaissStore(LocalStore):
|
|||
return FAISS.load_local(self.raw_data_path.parent, self.embedding, self.fname)
|
||||
|
||||
def _write(self, docs, metadatas):
|
||||
try:
|
||||
store = FAISS.from_texts(docs, self.embedding, metadatas=metadatas)
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to write. error: {e}")
|
||||
raise e
|
||||
store = FAISS.from_texts(docs, self.embedding, metadatas=metadatas)
|
||||
return store
|
||||
|
||||
def persist(self):
|
||||
|
|
|
|||
|
|
@ -523,20 +523,29 @@ class Role(SerializationMixin, ContextMixin, BaseModel):
|
|||
return not self.rc.news and not self.rc.todo and self.rc.msg_buffer.empty()
|
||||
|
||||
async def think(self) -> Action:
|
||||
"""The exported `think` function"""
|
||||
await self._observe()
|
||||
"""
|
||||
Export SDK API, used by AgentStore RPC.
|
||||
The exported `think` function
|
||||
"""
|
||||
await self._observe() # For compatibility with the old version of the Agent.
|
||||
await self._think()
|
||||
return self.rc.todo
|
||||
|
||||
async def act(self) -> ActionOutput:
|
||||
"""The exported `act` function"""
|
||||
"""
|
||||
Export SDK API, used by AgentStore RPC.
|
||||
The exported `act` function
|
||||
"""
|
||||
msg = await self._act()
|
||||
return ActionOutput(content=msg.content, instruct_content=msg.instruct_content)
|
||||
|
||||
@property
|
||||
def action_description(self) -> str:
|
||||
"""
|
||||
Export SDK API, used by AgentStore RPC and Agent.
|
||||
AgentStore uses this attribute to display to the user what actions the current role should take.
|
||||
`Role` provides the default property, and this property should be overridden by children classes if necessary,
|
||||
as demonstrated by the `Engineer` class.
|
||||
"""
|
||||
if self.rc.todo:
|
||||
if self.rc.todo.desc:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue