Class: OpenAI::Models::Live::SessionUsageUpdatedEvent

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/live/session_usage_updated_event.rb,
sig/openai/models/live/session_usage_updated_event.rbs

Defined Under Namespace

Classes: ContextWindow

Instance Attribute Summary collapse

Attributes inherited from Internal::Type::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], #_request_id, #_set_last_response, coerce, #deconstruct_keys, #deep_to_h, dump, #encode_with, fields, hash, #hash, inherited, #inspect, inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, coerce_with_error, dump, #dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(event_id:, usage:, client_event_id: nil, context_window: nil, type: :"session.usage.updated") ⇒ Object

Reports cumulative Live audio usage and, when available, the most recent context-window usage. Delegated Responses token usage is reported separately in response.event events.

Parameters:

  • event_id (String)

    The unique ID of the Live server event.

  • usage (OpenAI::Models::Live::SessionUsage)

    The cumulative Live audio usage so far.

  • client_event_id (String) (defaults to: nil)

    The event_id of the client command associated with this server event, when supplied.

  • context_window (OpenAI::Models::Live::SessionUsageUpdatedEvent::ContextWindow) (defaults to: nil)

    The latest measured Live context-window usage. Omitted when the context limit is unknown.

  • type (Symbol, :"session.usage.updated") (defaults to: :"session.usage.updated")

    The event type, always session.usage.updated.



# File 'lib/openai/models/live/session_usage_updated_event.rb', line 39

Instance Attribute Details

#client_event_idString?

The event_id of the client command associated with this server event, when supplied.

Parameters:

  • (String)

Returns:

  • (String, nil)


30
# File 'lib/openai/models/live/session_usage_updated_event.rb', line 30

optional :client_event_id, String

#context_windowOpenAI::Models::Live::SessionUsageUpdatedEvent::ContextWindow?

The latest measured Live context-window usage. Omitted when the context limit is unknown.



37
# File 'lib/openai/models/live/session_usage_updated_event.rb', line 37

optional :context_window, -> { OpenAI::Live::SessionUsageUpdatedEvent::ContextWindow }

#event_idString

The unique ID of the Live server event.

Parameters:

  • value (String)

Returns:

  • (String)


11
# File 'lib/openai/models/live/session_usage_updated_event.rb', line 11

required :event_id, String

#typeSymbol, :"session.usage.updated"

The event type, always session.usage.updated.

Parameters:

  • value (:"session.usage.updated")

Returns:

  • (Symbol, :"session.usage.updated")


17
# File 'lib/openai/models/live/session_usage_updated_event.rb', line 17

required :type, const: :"session.usage.updated"

#usageOpenAI::Models::Live::SessionUsage

The cumulative Live audio usage so far.

Parameters:

  • value (OpenAI::Live::SessionUsage)

Returns:



23
# File 'lib/openai/models/live/session_usage_updated_event.rb', line 23

required :usage, -> { OpenAI::Live::SessionUsage }

Instance Method Details

#to_hash{

Returns:

  • ({)


38
# File 'sig/openai/models/live/session_usage_updated_event.rbs', line 38

def to_hash: -> {