MetaGPT icon indicating copy to clipboard operation
MetaGPT copied to clipboard

Action ask 可否提供返回stream的函数

Open redlion99 opened this issue 1 year ago • 3 comments

为Agent提供和用户交互的接口,如果Action ask 的结果可以以stream的形式返回,那么在用户端可以不用等所有数据就绪后才能看到结果。

I'm providing a user interaction interface for the Agent. If the result of Action ask can be returned in streaming format, users don't have to wait for all data to be ready before seeing the results.

redlion99 avatar Mar 13 '24 03:03 redlion99

从0.7开始, Action._aask就已经默认是stream模式了。

    async def _aask(self, prompt: str, system_msgs: Optional[list[str]] = None) -> str:
        """Append default prefix"""
        return await self.llm.aask(prompt, system_msgs)
async def aask(
        self,
        msg: str,
        system_msgs: Optional[list[str]] = None,
        format_msgs: Optional[list[dict[str, str]]] = None,
        images: Optional[Union[str, list[str]]] = None,
        timeout=3,
        stream=True,
    ) -> str:

iorisa avatar Mar 14 '24 08:03 iorisa

@redlion99 Can you confirm if the issue has been resolved?

geekan avatar Mar 21 '24 03:03 geekan

yes, although it does not directly return a stream in chunk form, it should not be difficult to wrap one myself. Thanks for your awesome job again.

binlish avatar Mar 24 '24 00:03 binlish

Thanks for your kind comments @binlish

geekan avatar Mar 25 '24 03:03 geekan