autogen.agentchat.realtime.experimental.clients.RealtimeClientProtocol
RealtimeClientProtocol
Base class for protocol classes.
Protocol classes are defined as::
class Proto(Protocol):
def meth(self) -> int:
…
Such classes are primarily used with static type checkers that recognize
structural subtyping (static duck-typing).
For example::
class C:
def meth(self) -> int:
return 0
def func(x: Proto) -> int:
return x.meth()
func(C()) # Passes static type check
See PEP 544 for details. Protocol classes decorated with
@typing.runtime_checkable act as simple-minded runtime protocols that check
only the presence of given attributes, ignoring their type signatures.
Protocol classes can be generic, they are defined as::
class GenProtoT:
def meth(self) -> T:
…
Name | Description |
---|---|
*args | |
**kwargs |
Static Methods
get_factory
Create a Realtime API client.
Name | Description |
---|---|
llm_config | The config for the client. Type: dict[str, typing.Any] |
logger | Type: logging.Logger |
**kwargs | Type: Any |
Type | Description |
---|---|
Callable[[], RealtimeClientProtocol] | None | RealtimeClientProtocol: The Realtime API client is returned if the model matches the pattern |
Instance Methods
connect
read_events
Read events from a Realtime Client.
send_audio
Send audio to a Realtime API.
Name | Description |
---|---|
audio | The audio to send. Type: str |
send_function_result
Send the result of a function call to a Realtime API.
Name | Description |
---|---|
call_id | The ID of the function call. Type: str |
result | The result of the function call. Type: str |
send_text
Send a text message to a Realtime API.
Name | Description |
---|---|
role | The role of the message. Type: Literal[‘user’, ‘assistant’, ‘system’] |
text | The text of the message. Type: str |
session_update
Send a session update to a Realtime API.
Name | Description |
---|---|
session_options | The session options to update. Type: dict[str, typing.Any] |
truncate_audio
Truncate audio in a Realtime API.
Name | 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 |