Skip to main content

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:
…
Parameters:

Static Methods

get_factory

Create a Realtime API client.
Parameters: Returns:

Instance Methods

connect


read_events

Read events from a Realtime Client.

send_audio

Send audio to a Realtime API.
Parameters:

send_function_result

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

send_text

Send a text message to a Realtime API.
Parameters:

session_update

Send a session update to a Realtime API.
Parameters:

truncate_audio

Truncate audio in a Realtime API.
Parameters: