Class: OpenAI::Models::Beta::Agents::Sessions::Turn

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/beta/agents/sessions/turn.rb,
sig/openai/models/beta/agents/sessions/turn.rbs

Overview

See Also:

  • OpenAI::Resources::Beta::Agents::Sessions::Turns#retrieve

Defined Under Namespace

Modules: Status

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(id:, agent_id:, completed_at:, created_at:, error:, session_id:, started_at:, status:, subagent_id:, usage:, object: :"agent.session.turn") ⇒ Object

The canonical public representation of a session turn.

Parameters:

  • id (String)

    The ID of the turn.

  • agent_id (String)

    The ID of the agent that ran the turn.

  • completed_at (Integer, nil)

    The Unix timestamp, in seconds, when the turn reached a terminal state.

  • created_at (Integer)

    The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable.

  • error (OpenAI::Models::Beta::SessionTurnError, nil)

    A customer-safe error describing why a session request failed.

  • session_id (String)

    The ID of the session that owns the turn.

  • started_at (Integer, nil)

    The Unix timestamp, in seconds, when the turn started.

  • status (Symbol, OpenAI::Models::Beta::Agents::Sessions::Turn::Status)

    The current status of the turn.

  • subagent_id (String, nil)

    The ID of the subagent that ran the turn, if applicable.

  • usage (OpenAI::Models::Beta::TokenUsage, nil)

    Recorded token usage for a session or turn. Usage is best effort and may change.

  • object (Symbol, :"agent.session.turn") (defaults to: :"agent.session.turn")

    The object type. Always agent.session.turn.



# File 'lib/openai/models/beta/agents/sessions/turn.rb', line 78

Instance Attribute Details

#agent_idString

The ID of the agent that ran the turn.

Parameters:

  • value (String)

Returns:

  • (String)


20
# File 'lib/openai/models/beta/agents/sessions/turn.rb', line 20

required :agent_id, String

#completed_atInteger?

The Unix timestamp, in seconds, when the turn reached a terminal state.

Parameters:

  • value (Integer, nil)

Returns:

  • (Integer, nil)


26
# File 'lib/openai/models/beta/agents/sessions/turn.rb', line 26

required :completed_at, Integer, nil?: true

#created_atInteger

The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable.

Parameters:

  • value (Integer)

Returns:

  • (Integer)


34
# File 'lib/openai/models/beta/agents/sessions/turn.rb', line 34

required :created_at, Integer

#errorOpenAI::Models::Beta::SessionTurnError?

A customer-safe error describing why a session request failed.

Parameters:

  • value (OpenAI::Beta::SessionTurnError, nil)

Returns:



40
# File 'lib/openai/models/beta/agents/sessions/turn.rb', line 40

required :error, -> { OpenAI::Beta::SessionTurnError }, nil?: true

#idString

The ID of the turn.

Parameters:

  • value (String)

Returns:

  • (String)


14
# File 'lib/openai/models/beta/agents/sessions/turn.rb', line 14

required :id, String

#objectSymbol, :"agent.session.turn"

The object type. Always agent.session.turn.

Parameters:

  • value (:"agent.session.turn")

Returns:

  • (Symbol, :"agent.session.turn")


46
# File 'lib/openai/models/beta/agents/sessions/turn.rb', line 46

required :object, const: :"agent.session.turn"

#session_idString

The ID of the session that owns the turn.

Parameters:

  • value (String)

Returns:

  • (String)


52
# File 'lib/openai/models/beta/agents/sessions/turn.rb', line 52

required :session_id, String

#started_atInteger?

The Unix timestamp, in seconds, when the turn started.

Parameters:

  • value (Integer, nil)

Returns:

  • (Integer, nil)


58
# File 'lib/openai/models/beta/agents/sessions/turn.rb', line 58

required :started_at, Integer, nil?: true

#statusSymbol, OpenAI::Models::Beta::Agents::Sessions::Turn::Status

The current status of the turn.

Parameters:

  • value (OpenAI::Models::Beta::Agents::Sessions::Turn::status)

Returns:



64
# File 'lib/openai/models/beta/agents/sessions/turn.rb', line 64

required :status, enum: -> { OpenAI::Beta::Agents::Sessions::Turn::Status }

#subagent_idString?

The ID of the subagent that ran the turn, if applicable.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


70
# File 'lib/openai/models/beta/agents/sessions/turn.rb', line 70

required :subagent_id, String, nil?: true

#usageOpenAI::Models::Beta::TokenUsage?

Recorded token usage for a session or turn. Usage is best effort and may change.

Parameters:

  • value (OpenAI::Beta::TokenUsage, nil)

Returns:



76
# File 'lib/openai/models/beta/agents/sessions/turn.rb', line 76

required :usage, -> { OpenAI::Beta::TokenUsage }, nil?: true

Instance Method Details

#to_hash{

Returns:

  • ({)


58
# File 'sig/openai/models/beta/agents/sessions/turn.rbs', line 58

def to_hash: -> {