Introducing IOStream protocol and adding support for websockets#1551
Conversation
|
@sonichi can you please run AI test? |
|
OAI Tests passed. @davorrunje one last merge conflict. |
@ekzhu fixed :) |
|
@davorrunje Congratulations, I have seen you working hard every day on this feature for months! Excellent work. |
|
Merging this to anticipate changes in #2030 for structured output of prints. Can you also create a topic page under |
@ekzhu sure, I'll do it tomorrow night. |
|
davorrunje Getting problem with this notebook |
@beckortikov The author provided the answer above; you can scroll up to see it. |
Thanx for reporting it, the workaround is above. I'll update the notebook. |
|
@davorrunje Thank you sir! I have also one questions. How can I implement it to AI chat with human_input_mode ALWAYS, where I also have function calls. Looking for a lot of issues, but couldn't find any solution how to deploy it through FastAPI, and make conversable agent. Will begreat if you could provide little code in this case. Thank you! |
@beckortikov can you please check out https://captn.ai/ for an example of a larger system built with this and related code not yet merged into autogen? I’ll factor out the mechanism to build it and open-source it in the following weeks. One major part is distributing it to multiple workers and streaming results back to clients. The streaming part was merged this week into autogen. The distribution of workers is not yet as it is a bit more complex to factor it out. There is also a code injection mechanism with a bunch of security related features. LLM never get any sensitive information about users, but functions called by LLM have access to it through code injection. There are also helpers like a decorator for checking if the user explicitly approves calling a function with specific parameters (when human mode is never). Anyway, you should be able to easily build something like this very soon. |
|
any docs on how to use streaming? Thanks a lot for the help. |
@ekzhu @jackgerrits could you check if this is in the doc roadmap? |
@sonichi there is another PR coming that will make websockets much easier to use, the main idea is to use structured JSON-encoded messages for websockets and convert them to strings for console output. Right now there is an example in notebooks on how to use it, I could quickly make a documentation out of it. |
|
@davorrunje thanks, we can covert the notebook to a user guide page under |
|
@davorrunje thanks a lot for adding the streaming feature. We followed the notebook https://github.com/microsoft/autogen/blob/main/notebook/agentchat_websockets.ipynb to setup a fastapi server and deploy on aws using fargate. we are able to use the endpoint such as ws://x.x.x.x:8000/autogen locally when testing. Mixed Content: The page at 'https://app.domain.com/autogenchat' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://x.x.x.x:8000/autogen'. This request has been blocked; this endpoint must be available over WSS. we don't know how to setup WSS - any pointers on this? Thanks a lot. |
|
I could be wrong here, but when you are calling a streaming websockets endpoint I think you should be calling it as wss:// rather than ws:// |
|
@davorrunje Thanks a lot for the streaming feature. I have checked out the notebook that uses FastAPI. I was wondering how the same approach could be used on with a Django server. I have a chatbot that uses autogen with multiple agents including custom agent specific function. The issue is when it comes to setting up the Websocket server given that Django uses channels for this. Please point me to some resources that can get me started. |
|
@RuthNjeri6 I am sorry for the late reply, I was travelling for the past four weeks. Do you still need helo with this? |
|
Hello Davor, Yes I still need help to integrate streaming on a Django
backend.
…On Mon, Jun 10, 2024 at 2:36 PM Davor Runje ***@***.***> wrote:
@RuthNjeri6 <https://github.com/RuthNjeri6> I am sorry for the late
reply, I was travelling for the past four weeks. Do you still need helo
with this?
—
Reply to this email directly, view it on GitHub
<#1551 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AINASFRLLEWNOS4DJ26AZGLZGWFUVAVCNFSM6AAAAABC25CDYCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJYGEYDKMJXHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|

The goals of this PR are:
IOStreamclass and a mechanism to change the default output from the console to alternative outputs such as websocketsIOWebsocketsclass that can be used to output streams to websocket.The plan is to accomplish this by the following steps:
IOStreamwithprintandinputmethodsIOConsoleimplementing the protocol using consoleConversableAgent,OpenAIClientandOpenAIWrapperto useIOStreaminternallyConversableAgent,OpenAIClientandOpenAIWrapperusingIOConsoleIOWebSocketsimplementing the protocol using web socketsIOWebSocketswith unit tests (a bit tricky because it has to be a multithreaded test)IOWebSocketswith a new notebookIOStreamprotocolWhy are these changes needed?
Related issue number
Closes #1199 , closes #1143 , closes #217 , closes #394
Related pull requests
#1290, #1414
Checks