Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support stream output in ModelResponsee #202

Open
2237276545 opened this issue May 9, 2024 · 4 comments
Open

Support stream output in ModelResponsee #202

2237276545 opened this issue May 9, 2024 · 4 comments
Assignees
Labels

Comments

@2237276545
Copy link

是否存在参数或者方法来接收agent的流式输出,方便对外提供

@pan-x-c
Copy link
Collaborator

pan-x-c commented May 9, 2024

AgentScope 主要面向的是 multi-Agent 场景,其中各个Agent之间的交互的消息需要满足一定的格式信息,而流式传输会打破这一规则,因此目前的 AgentScope 没有提供 agent 级别的流式输出。如果仅仅是希望每个 Agent 对用户显示的内容为流式显示,可以通过修改 agent 内部的模型调用以及 speak 方法,让模型返回流式生成器并使用 speak 依次打印。

我们在未来的版本中可能会考虑加入一类特殊的支持流式输出的 Agent 对外提供流式 API 服务,但 AgentScope 内其他的 Agent 为了保证输入输出格式仍会保持现有的一次性输出。

@2237276545
Copy link
Author

2237276545 commented May 9, 2024 via email

@DavdGao
Copy link
Collaborator

DavdGao commented May 11, 2024

感谢建议,我们会在近期加入流式数据处理方法,初期的构想是在ModelResponse对象中挂载stream属性,该属性会是generator类型,可以通过这个属性在获取ModelResponse对象后流式获取数据。
由于需要兼容不同模型的流式数据方案(e.g., OpenAI, DashScope, Gemini),该方案可能会有一些变动,我们会在近期支持加入支持。

@DavdGao DavdGao added feature work in progress Work in progress labels May 11, 2024
@DavdGao DavdGao changed the title agent输出如何做成流式? Support stream output in ModelResponsee May 11, 2024
@2237276545
Copy link
Author

2237276545 commented May 11, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In Progress
Development

No branches or pull requests

4 participants