IOWebsockets
autogen.io.IOWebsockets #
Bases: IOStream
A websocket input/output stream.
Initialize the websocket input/output stream.
| PARAMETER | DESCRIPTION |
|---|---|
websocket | The websocket server. TYPE: |
Source code in autogen/io/websockets.py
set_global_default staticmethod #
Set the default input/output stream.
| PARAMETER | DESCRIPTION |
|---|---|
stream | The input/output stream to set as the default. TYPE: |
get_global_default staticmethod #
Get the default input/output stream.
| RETURNS | DESCRIPTION |
|---|---|
IOStream | The default input/output stream. TYPE: |
Source code in autogen/io/base.py
get_default staticmethod #
Get the default input/output stream.
| RETURNS | DESCRIPTION |
|---|---|
IOStream | The default input/output stream. TYPE: |
Source code in autogen/io/base.py
set_default staticmethod #
Set the default input/output stream.
| PARAMETER | DESCRIPTION |
|---|---|
stream | The input/output stream to set as the default. TYPE: |
Source code in autogen/io/base.py
run_server_in_thread staticmethod #
Factory function to create a websocket input/output stream.
| PARAMETER | DESCRIPTION |
|---|---|
host | The host to bind the server to. Defaults to "127.0.0.1". TYPE: |
port | The port to bind the server to. Defaults to 8765. TYPE: |
on_connect | The function to be executed on client connection. Typically creates agents and initiate chat. TYPE: |
ssl_context | The SSL context to use for secure connections. Defaults to None. TYPE: |
kwargs | Additional keyword arguments to pass to the websocket server. TYPE: |
| YIELDS | DESCRIPTION |
|---|---|
str | The URI of the websocket server. TYPE:: |
Source code in autogen/io/websockets.py
print #
Print data to the output stream.
Args:
objects (any): The data to print.
sep (str, optional): The separator between objects. Defaults to " ".
end (str, optional): The end of the output. Defaults to "
". flush (bool, optional): Whether to flush the output. Defaults to False.
Source code in autogen/io/websockets.py
send #
Send a message to the output stream.
| PARAMETER | DESCRIPTION |
|---|---|
message | The message to send. TYPE: |
input #
Read a line from the input stream.
| PARAMETER | DESCRIPTION |
|---|---|
prompt | The prompt to display. Defaults to "". TYPE: |
password | Whether to read a password. Defaults to False. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
str | The line read from the input stream. TYPE: |