Skip to content

RealtimeClientProtocol

autogen.agentchat.realtime.experimental.clients.RealtimeClientProtocol #

Bases: Protocol

send_function_result async #

send_function_result(call_id, result)

Send the result of a function call to a Realtime API.

PARAMETER DESCRIPTION
call_id

The ID of the function call.

TYPE: str

result

The result of the function call.

TYPE: str

Source code in autogen/agentchat/realtime/experimental/clients/realtime_client.py
async def send_function_result(self, call_id: str, result: str) -> None:
    """Send the result of a function call to a Realtime API.

    Args:
        call_id (str): The ID of the function call.
        result (str): The result of the function call.
    """
    ...

send_text async #

send_text(*, role, text)

Send a text message to a Realtime API.

PARAMETER DESCRIPTION
role

The role of the message.

TYPE: str

text

The text of the message.

TYPE: str

Source code in autogen/agentchat/realtime/experimental/clients/realtime_client.py
async def send_text(self, *, role: Role, text: str) -> None:
    """Send a text message to a Realtime API.

    Args:
        role (str): The role of the message.
        text (str): The text of the message.
    """
    ...

send_audio async #

send_audio(audio)

Send audio to a Realtime API.

PARAMETER DESCRIPTION
audio

The audio to send.

TYPE: str

Source code in autogen/agentchat/realtime/experimental/clients/realtime_client.py
async def send_audio(self, audio: str) -> None:
    """Send audio to a Realtime API.

    Args:
        audio (str): The audio to send.
    """
    ...

truncate_audio async #

truncate_audio(audio_end_ms, content_index, item_id)

Truncate audio in a Realtime API.

PARAMETER DESCRIPTION
audio_end_ms

The end of the audio to truncate.

TYPE: int

content_index

The index of the content to truncate.

TYPE: int

item_id

The ID of the item to truncate.

TYPE: str

Source code in autogen/agentchat/realtime/experimental/clients/realtime_client.py
async def truncate_audio(self, audio_end_ms: int, content_index: int, item_id: str) -> None:
    """Truncate audio in a Realtime API.

    Args:
        audio_end_ms (int): The end of the audio to truncate.
        content_index (int): The index of the content to truncate.
        item_id (str): The ID of the item to truncate.
    """
    ...

session_update async #

session_update(session_options)

Send a session update to a Realtime API.

PARAMETER DESCRIPTION
session_options

The session options to update.

TYPE: dict[str, Any]

Source code in autogen/agentchat/realtime/experimental/clients/realtime_client.py
async def session_update(self, session_options: dict[str, Any]) -> None:
    """Send a session update to a Realtime API.

    Args:
        session_options (dict[str, Any]): The session options to update.
    """
    ...

connect #

connect()
Source code in autogen/agentchat/realtime/experimental/clients/realtime_client.py
def connect(self) -> AsyncContextManager[None]: ...

read_events #

read_events()

Read events from a Realtime Client.

Source code in autogen/agentchat/realtime/experimental/clients/realtime_client.py
def read_events(self) -> AsyncGenerator[RealtimeEvent, None]:
    """Read events from a Realtime Client."""
    ...

get_factory classmethod #

get_factory(llm_config, logger, **kwargs)

Create a Realtime API client.

PARAMETER DESCRIPTION
llm_config

The config for the client.

TYPE: dict[str, Any]

logger

The logger to use for logging events.

TYPE: Logger

**kwargs

Additional arguments.

TYPE: Any DEFAULT: {}

RETURNS DESCRIPTION
RealtimeClientProtocol

The Realtime API client is returned if the model matches the pattern

TYPE: Optional[Callable[[], RealtimeClientProtocol]]

Source code in autogen/agentchat/realtime/experimental/clients/realtime_client.py
@classmethod
def get_factory(
    cls, llm_config: dict[str, Any], logger: Logger, **kwargs: Any
) -> Optional[Callable[[], "RealtimeClientProtocol"]]:
    """Create a Realtime API client.

    Args:
        llm_config: The config for the client.
        logger: The logger to use for logging events.
        **kwargs: Additional arguments.

    Returns:
        RealtimeClientProtocol: The Realtime API client is returned if the model matches the pattern
    """
    ...