File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ pip install git+https://github.com/OpenCSGs/coagent.git
5959import asyncio
6060import os
6161
62- from coagent.agents import ChatAgent, ChatHistory , ChatMessage, ModelClient
62+ from coagent.agents import StreamChatAgent , ChatMessage, ModelClient
6363from coagent.core import AgentSpec, new, set_stderr_logger
6464from coagent.runtimes import LocalRuntime
6565
@@ -73,7 +73,7 @@ client = ModelClient(
7373translator = AgentSpec(
7474 " translator" ,
7575 new(
76- ChatAgent ,
76+ StreamChatAgent ,
7777 system = " You are a professional translator that can translate Chinese to English." ,
7878 client = client,
7979 ),
@@ -85,9 +85,7 @@ async def main():
8585 await runtime.register_spec(translator)
8686
8787 result = translator.run_stream(
88- ChatHistory(
89- messages = [ChatMessage(role = " user" , content = " 你好,世界" )]
90- ).encode()
88+ ChatMessage(role = " user" , content = " 你好,世界" ).encode()
9189 )
9290 async for chunk in result:
9391 msg = ChatMessage.decode(chunk)
You can’t perform that action at this time.
0 commit comments