Module livekit.plugins.openai.realtime.api_proto

Classes

class AssistantItem (*args, **kwargs)
Expand source code
class AssistantItem(TypedDict):
    id: str
    object: Literal["realtime.item"]
    type: Literal["message"]
    role: Literal["assistant"]
    content: list[TextContent | AudioContent]

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var content : list[TextContent | AudioContent]
var id : str
var object : Literal['realtime.item']
var role : Literal['assistant']
var type : Literal['message']
class AudioContent (*args, **kwargs)
Expand source code
class AudioContent(TypedDict):
    type: Literal["audio"]
    audio: str  # b64

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var audio : str
var type : Literal['audio']
class CachedTokenDetails (*args, **kwargs)
Expand source code
class CachedTokenDetails(TypedDict):
    text_tokens: int
    audio_tokens: int

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var audio_tokens : int
var text_tokens : int
class CancelledStatusDetails (*args, **kwargs)
Expand source code
class CancelledStatusDetails(TypedDict):
    type: Literal["cancelled"]
    reason: Literal["turn_detected", "client_cancelled"]

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var reason : Literal['turn_detected', 'client_cancelled']
var type : Literal['cancelled']
class ClientEvent
Expand source code
class ClientEvent:
    class SessionUpdateData(TypedDict):
        modalities: list[Literal["text", "audio"]]
        instructions: str
        voice: Voice
        input_audio_format: AudioFormat
        output_audio_format: AudioFormat
        input_audio_transcription: InputAudioTranscription | None
        turn_detection: ServerVad | None
        tools: list[FunctionTool]
        tool_choice: ToolChoice
        temperature: float
        # microsoft does not support inf, but accepts None
        max_response_output_tokens: int | Literal["inf"] | None

    class SessionUpdate(TypedDict):
        event_id: NotRequired[str]
        type: Literal["session.update"]
        session: ClientEvent.SessionUpdateData

    class InputAudioBufferAppend(TypedDict):
        event_id: NotRequired[str]
        type: Literal["input_audio_buffer.append"]
        audio: str  # b64

    class InputAudioBufferCommit(TypedDict):
        event_id: NotRequired[str]
        type: Literal["input_audio_buffer.commit"]

    class InputAudioBufferClear(TypedDict):
        event_id: NotRequired[str]
        type: Literal["input_audio_buffer.clear"]

    class UserItemCreate(TypedDict):
        id: str | None
        type: Literal["message"]
        role: Literal["user"]
        content: list[InputTextContent | InputAudioContent]

    class AssistantItemCreate(TypedDict):
        id: str | None
        type: Literal["message"]
        role: Literal["assistant"]
        content: list[TextContent]

    class SystemItemCreate(TypedDict):
        id: str | None
        type: Literal["message"]
        role: Literal["system"]
        content: list[InputTextContent]

    class FunctionCallOutputItemCreate(TypedDict):
        id: str | None
        type: Literal["function_call_output"]
        call_id: str
        output: str

    class FunctionCallItemCreate(TypedDict):
        id: str | None
        type: Literal["function_call"]
        call_id: str
        name: str
        arguments: str

    ConversationItemCreateContent = Union[
        UserItemCreate,
        AssistantItemCreate,
        SystemItemCreate,
        FunctionCallOutputItemCreate,
        FunctionCallItemCreate,
    ]

    class ConversationItemCreate(TypedDict):
        event_id: NotRequired[str]
        type: Literal["conversation.item.create"]
        previous_item_id: NotRequired[str | None]
        item: ClientEvent.ConversationItemCreateContent

    class ConversationItemTruncate(TypedDict):
        event_id: NotRequired[str]
        type: Literal["conversation.item.truncate"]
        item_id: str
        content_index: int
        audio_end_ms: int

    class ConversationItemDelete(TypedDict):
        event_id: NotRequired[str]
        type: Literal["conversation.item.delete"]
        item_id: str

    class ResponseCreateData(TypedDict, total=False):
        modalities: list[Literal["text", "audio"]]
        instructions: str
        voice: Voice
        output_audio_format: AudioFormat
        tools: list[FunctionTool]
        tool_choice: ToolChoice
        temperature: float
        max_output_tokens: int | Literal["inf"]

    class ResponseCreate(TypedDict):
        event_id: NotRequired[str]
        type: Literal["response.create"]
        response: NotRequired[ClientEvent.ResponseCreateData]

    class ResponseCancel(TypedDict):
        event_id: NotRequired[str]
        type: Literal["response.cancel"]

Class variables

var AssistantItemCreate

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ConversationItemCreate

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ConversationItemCreateContent
var ConversationItemDelete

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ConversationItemTruncate

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var FunctionCallItemCreate

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var FunctionCallOutputItemCreate

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var InputAudioBufferAppend

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var InputAudioBufferClear

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var InputAudioBufferCommit

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ResponseCancel

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ResponseCreate

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ResponseCreateData

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var SessionUpdate

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var SessionUpdateData

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var SystemItemCreate

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var UserItemCreate

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

class ContentPart (*args, **kwargs)
Expand source code
class ContentPart(TypedDict):
    type: Literal["text", "audio"]
    audio: NotRequired[str]  # b64
    transcript: NotRequired[str]

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var audio : str
var transcript : str
var type : Literal['text', 'audio']
class Error (*args, **kwargs)
Expand source code
class Error(TypedDict):
    code: str
    message: str

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var code : str
var message : str
class FailedStatusDetails (*args, **kwargs)
Expand source code
class FailedStatusDetails(TypedDict):
    type: Literal["failed"]
    error: NotRequired[Error | None]

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var errorError | None
var type : Literal['failed']
class FunctionCallItem (*args, **kwargs)
Expand source code
class FunctionCallItem(TypedDict):
    id: str
    object: Literal["realtime.item"]
    type: Literal["function_call"]
    call_id: str
    name: str
    arguments: str

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var arguments : str
var call_id : str
var id : str
var name : str
var object : Literal['realtime.item']
var type : Literal['function_call']
class FunctionCallOutputItem (*args, **kwargs)
Expand source code
class FunctionCallOutputItem(TypedDict):
    id: str
    object: Literal["realtime.item"]
    type: Literal["function_call_output"]
    call_id: str
    output: str

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var call_id : str
var id : str
var object : Literal['realtime.item']
var output : str
var type : Literal['function_call_output']
class FunctionTool (*args, **kwargs)
Expand source code
class FunctionTool(TypedDict):
    type: Literal["function"]
    name: str
    description: NotRequired[str | None]
    parameters: dict

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var description : str | None
var name : str
var parameters : dict
var type : Literal['function']
class FunctionToolChoice (*args, **kwargs)
Expand source code
class FunctionToolChoice(TypedDict):
    type: Literal["function"]
    name: str

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var name : str
var type : Literal['function']
class IncompleteStatusDetails (*args, **kwargs)
Expand source code
class IncompleteStatusDetails(TypedDict):
    type: Literal["incomplete"]
    reason: Literal["max_output_tokens", "content_filter"]

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var reason : Literal['max_output_tokens', 'content_filter']
var type : Literal['incomplete']
class InputAudioContent (*args, **kwargs)
Expand source code
class InputAudioContent(TypedDict):
    type: Literal["input_audio"]
    audio: str  # b64

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var audio : str
var type : Literal['input_audio']
class InputAudioTranscription (*args, **kwargs)
Expand source code
class InputAudioTranscription(TypedDict):
    model: InputTranscriptionModel | str

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var model : Literal['whisper-1'] | str
class InputTextContent (*args, **kwargs)
Expand source code
class InputTextContent(TypedDict):
    type: Literal["input_text"]
    text: str

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var text : str
var type : Literal['input_text']
class InputTokenDetails (*args, **kwargs)
Expand source code
class InputTokenDetails(TypedDict):
    cached_tokens: int
    text_tokens: int
    audio_tokens: int
    cached_tokens_details: CachedTokenDetails

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var audio_tokens : int
var cached_tokens : int
var cached_tokens_detailsCachedTokenDetails
var text_tokens : int
class OutputTokenDetails (*args, **kwargs)
Expand source code
class OutputTokenDetails(TypedDict):
    text_tokens: int
    audio_tokens: int

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var audio_tokens : int
var text_tokens : int
class Resource
Expand source code
class Resource:
    class Session(TypedDict):
        id: str
        object: Literal["realtime.session"]
        expires_at: int
        model: str
        modalities: list[Literal["text", "audio"]]
        instructions: str
        voice: Voice
        input_audio_format: AudioFormat
        output_audio_format: AudioFormat
        input_audio_transcription: InputAudioTranscription | None
        turn_detection: ServerVad | None
        tools: list[FunctionTool]
        tool_choice: ToolChoice
        temperature: float
        max_response_output_tokens: int | Literal["inf"]

    class Conversation(TypedDict):
        id: str
        object: Literal["realtime.conversation"]

    Item = Union[SystemItem, UserItem, FunctionCallItem, FunctionCallOutputItem]

    class Response(TypedDict):
        id: str
        object: Literal["realtime.response"]
        status: ResponseStatus
        status_details: NotRequired[ResponseStatusDetails | None]
        output: list[Resource.Item]
        usage: NotRequired[Usage | None]

Class variables

var Conversation

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var Item
var Response

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var Session

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

class ServerEvent
Expand source code
class ServerEvent:
    class ErrorContent(TypedDict):
        type: str
        code: NotRequired[str]
        message: str
        param: NotRequired[str]
        event_id: NotRequired[str]

    class Error(TypedDict):
        event_id: str
        type: Literal["error"]
        error: ServerEvent.ErrorContent

    class SessionCreated(TypedDict):
        event_id: str
        type: Literal["session.created"]
        session: Resource.Session

    class SessionUpdated(TypedDict):
        event_id: str
        type: Literal["session.updated"]
        session: Resource.Session

    class ConversationCreated(TypedDict):
        event_id: str
        type: Literal["conversation.created"]
        conversation: Resource.Conversation

    class InputAudioBufferCommitted(TypedDict):
        event_id: str
        type: Literal["input_audio_buffer.committed"]
        item_id: str

    class InputAudioBufferCleared(TypedDict):
        event_id: str
        type: Literal["input_audio_buffer.cleared"]

    class InputAudioBufferSpeechStarted(TypedDict):
        event_id: str
        type: Literal["input_audio_buffer.speech_started"]
        item_id: str
        audio_start_ms: int

    class InputAudioBufferSpeechStopped(TypedDict):
        event_id: str
        type: Literal["input_audio_buffer.speech_stopped"]
        item_id: str
        audio_end_ms: int

    class ConversationItemCreated(TypedDict):
        event_id: str
        type: Literal["conversation.item.created"]
        previous_item_id: str | None
        item: Resource.Item

    class ConversationItemInputAudioTranscriptionCompleted(TypedDict):
        event_id: str
        type: Literal["conversation.item.input_audio_transcription.completed"]
        item_id: str
        content_index: int
        transcript: str

    class InputAudioTranscriptionError(TypedDict):
        type: str
        code: NotRequired[str]
        message: str
        param: NotRequired[str]

    class ConversationItemInputAudioTranscriptionFailed(TypedDict):
        event_id: str
        type: Literal["conversation.item.input_audio_transcription.failed"]
        item_id: str
        content_index: int
        error: ServerEvent.InputAudioTranscriptionError

    class ConversationItemTruncated(TypedDict):
        event_id: str
        type: Literal["conversation.item.truncated"]
        item_id: str
        content_index: int
        audio_end_ms: int

    class ConversationItemDeleted(TypedDict):
        event_id: str
        type: Literal["conversation.item.deleted"]
        item_id: str

    class ResponseCreated(TypedDict):
        event_id: str
        type: Literal["response.created"]
        response: Resource.Response

    class ResponseDone(TypedDict):
        event_id: str
        type: Literal["response.done"]
        response: Resource.Response

    class ResponseOutputItemAdded(TypedDict):
        event_id: str
        type: Literal["response.output_item.added"]
        response_id: str
        output_index: int
        item: Resource.Item

    class ResponseOutputItemDone(TypedDict):
        event_id: str
        type: Literal["response.output.done"]
        response_id: str
        output_index: int
        item: Resource.Item

    class ResponseContentPartAdded(TypedDict):
        event_id: str
        type: Literal["response.content_part.added"]
        item_id: str
        response_id: str
        output_index: int
        content_index: int
        part: ContentPart

    class ResponseContentPartDone(TypedDict):
        event_id: str
        type: Literal["response.content.done"]
        response_id: str
        output_index: int
        content_index: int
        part: ContentPart

    class ResponseTextDeltaAdded(TypedDict):
        event_id: str
        type: Literal["response.text.delta"]
        response_id: str
        output_index: int
        content_index: int
        delta: str

    class ResponseTextDone(TypedDict):
        event_id: str
        type: Literal["response.text.done"]
        response_id: str
        output_index: int
        content_index: int
        text: str

    class ResponseAudioTranscriptDelta(TypedDict):
        event_id: str
        type: Literal["response.audio_transcript.delta"]
        response_id: str
        output_index: int
        content_index: int
        delta: str

    class ResponseAudioTranscriptDone(TypedDict):
        event_id: str
        type: Literal["response.audio_transcript.done"]
        response_id: str
        output_index: int
        content_index: int
        transcript: str

    class ResponseAudioDelta(TypedDict):
        event_id: str
        type: Literal["response.audio.delta"]
        response_id: str
        output_index: int
        content_index: int
        delta: str  # b64

    class ResponseAudioDone(TypedDict):
        event_id: str
        type: Literal["response.audio.done"]
        response_id: str
        output_index: int
        content_index: int

    class ResponseFunctionCallArgumentsDelta(TypedDict):
        event_id: str
        type: Literal["response.function_call_arguments.delta"]
        response_id: str
        output_index: int
        delta: str

    class ResponseFunctionCallArgumentsDone(TypedDict):
        event_id: str
        type: Literal["response.function_call_arguments.done"]
        response_id: str
        output_index: int
        arguments: str

    class RateLimitsData(TypedDict):
        name: Literal["requests", "tokens", "input_tokens", "output_tokens"]
        limit: int
        remaining: int
        reset_seconds: float

    class RateLimitsUpdated:
        event_id: str
        type: Literal["rate_limits.updated"]
        limits: list[ServerEvent.RateLimitsData]

Class variables

var ConversationCreated

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ConversationItemCreated

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ConversationItemDeleted

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ConversationItemInputAudioTranscriptionCompleted

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ConversationItemInputAudioTranscriptionFailed

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ConversationItemTruncated

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var Error

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ErrorContent

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var InputAudioBufferCleared

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var InputAudioBufferCommitted

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var InputAudioBufferSpeechStarted

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var InputAudioBufferSpeechStopped

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var InputAudioTranscriptionError

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var RateLimitsData

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var RateLimitsUpdated
var ResponseAudioDelta

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ResponseAudioDone

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ResponseAudioTranscriptDelta

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ResponseAudioTranscriptDone

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ResponseContentPartAdded

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ResponseContentPartDone

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ResponseCreated

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ResponseDone

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ResponseFunctionCallArgumentsDelta

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ResponseFunctionCallArgumentsDone

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ResponseOutputItemAdded

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ResponseOutputItemDone

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ResponseTextDeltaAdded

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var ResponseTextDone

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var SessionCreated

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

var SessionUpdated

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

class ServerVad (*args, **kwargs)
Expand source code
class ServerVad(TypedDict):
    type: Literal["server_vad"]
    threshold: NotRequired[float]
    prefix_padding_ms: NotRequired[int]
    silence_duration_ms: NotRequired[int]

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var prefix_padding_ms : int
var silence_duration_ms : int
var threshold : float
var type : Literal['server_vad']
class SystemItem (*args, **kwargs)
Expand source code
class SystemItem(TypedDict):
    id: str
    object: Literal["realtime.item"]
    type: Literal["message"]
    role: Literal["system"]
    content: list[InputTextContent]

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var content : list[InputTextContent]
var id : str
var object : Literal['realtime.item']
var role : Literal['system']
var type : Literal['message']
class TextContent (*args, **kwargs)
Expand source code
class TextContent(TypedDict):
    type: Literal["text"]
    text: str

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var text : str
var type : Literal['text']
class Usage (*args, **kwargs)
Expand source code
class Usage(TypedDict):
    total_tokens: int
    input_tokens: int
    output_tokens: int
    input_token_details: InputTokenDetails
    output_token_details: OutputTokenDetails

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var input_token_detailsInputTokenDetails
var input_tokens : int
var output_token_detailsOutputTokenDetails
var output_tokens : int
var total_tokens : int
class UserItem (*args, **kwargs)
Expand source code
class UserItem(TypedDict):
    id: str
    object: Literal["realtime.item"]
    type: Literal["message"]
    role: Literal["user"]
    content: list[InputTextContent | InputAudioContent]

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var content : list[InputTextContent | InputAudioContent]
var id : str
var object : Literal['realtime.item']
var role : Literal['user']
var type : Literal['message']