Class: OpenAI::Models::Beta::AgentSession

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

Defined Under Namespace

Modules: RequiredAction, Review, Status Classes: Agent, PromptCacheOptions, SpendControl

Instance Attribute Summary collapse

Attributes inherited from Internal::Type::BaseModel

#last_response

Class Method Summary collapse

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_cached, coerce_with_error, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, resolve_type, 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(consumed:, limit:) ⇒ AgentSession

Returns a new instance of AgentSession.

Parameters:

  • id —

    The ID of the session.

  • agent —

    The agent running in the session.

  • created_at —

    The Unix timestamp, in seconds, when the session was created.

  • environment —

    The execution environment for the session.

  • error —

    The error that caused the session to fail, if any.

  • last_active_at —

    The Unix timestamp, in seconds, when the session was last active.

  • metadata —

    Custom string key-value pairs attached to the session.

  • required_actions —

    Actions that must be completed before the session can continue.

  • spend_control —

    Spending limit and best-effort consumption, in USD cents. The limit is null for an unlimited session. Consumption is null when unavailable.

  • status —

    The current status of the session.

  • usage —

    Best-effort token usage for the session, or null if unknown. Recorded usage may change.

  • vault_ids —

    The IDs of vaults made available to the session.

  • prompt_cache_options —

    Default prompt cache lifetime for turns in this session, when configured.

  • review —

    Review applied to eligible actions in this session. Omitted when review is none and automatic review is not enabled. Omission means none.

  • object —

    The object type. Always agent.session.

  • id: (String)
  • agent: (OpenAI::Beta::AgentSession::Agent)
  • created_at: (Integer)
  • environment: (OpenAI::Models::Beta::environment)
  • error: (String, nil)
  • last_active_at: (Integer)
  • metadata: (::Hash[Symbol, String])
  • required_actions: (::Array[OpenAI::Models::Beta::AgentSession::required_action])
  • spend_control: (OpenAI::Beta::AgentSession::SpendControl)
  • status: (OpenAI::Models::Beta::AgentSession::status)
  • usage: (OpenAI::Beta::TokenUsage, nil)
  • vault_ids: (::Array[String])
  • prompt_cache_options: (OpenAI::Beta::AgentSession::PromptCacheOptions, nil)
  • review: (OpenAI::Models::Beta::AgentSession::review)
  • object: (:"agent.session")


# File 'lib/openai/models/beta/agent_session.rb', line 103

Instance Attribute Details

#agent ⇒ OpenAI::Beta::AgentSession::Agent

The agent running in the session.

Returns:

  • (OpenAI::Beta::AgentSession::Agent)


17
# File 'lib/openai/models/beta/agent_session.rb', line 17

required :agent, -> { OpenAI::Beta::AgentSession::Agent }

#created_at ⇒ Integer

The Unix timestamp, in seconds, when the session was created.

Returns:

  • (Integer)


23
# File 'lib/openai/models/beta/agent_session.rb', line 23

required :created_at, Integer

#environment ⇒ OpenAI::Models::Beta::environment

The execution environment for the session.

Returns:

  • (OpenAI::Models::Beta::environment)


29
# File 'lib/openai/models/beta/agent_session.rb', line 29

required :environment, union: -> { OpenAI::Beta::Environment }

#error ⇒ String?

The error that caused the session to fail, if any.

Returns:

  • (String, nil)


35
# File 'lib/openai/models/beta/agent_session.rb', line 35

required :error, String, nil?: true

#id ⇒ String

The ID of the session.

Returns:

  • (String)


11
# File 'lib/openai/models/beta/agent_session.rb', line 11

required :id, String

#last_active_at ⇒ Integer

The Unix timestamp, in seconds, when the session was last active.

Returns:

  • (Integer)


41
# File 'lib/openai/models/beta/agent_session.rb', line 41

required :last_active_at, Integer

#metadata ⇒ ::Hash[Symbol, String]

Custom string key-value pairs attached to the session.

Returns:

  • (::Hash[Symbol, String])


47
# File 'lib/openai/models/beta/agent_session.rb', line 47

required :metadata, OpenAI::Internal::Type::HashOf[String]

#object ⇒ :"agent.session"

The object type. Always agent.session.

Returns:



53
# File 'lib/openai/models/beta/agent_session.rb', line 53

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

#prompt_cache_options ⇒ OpenAI::Beta::AgentSession::PromptCacheOptions?

Default prompt cache lifetime for turns in this session, when configured.

Returns:

  • (OpenAI::Beta::AgentSession::PromptCacheOptions, nil)


94
# File 'lib/openai/models/beta/agent_session.rb', line 94

optional :prompt_cache_options, -> { OpenAI::Beta::AgentSession::PromptCacheOptions }, nil?: true

#required_actions ⇒ ::Array[OpenAI::Models::Beta::AgentSession::required_action]

Actions that must be completed before the session can continue.

Returns:

  • (::Array[OpenAI::Models::Beta::AgentSession::required_action])


59
60
61
62
# File 'lib/openai/models/beta/agent_session.rb', line 59

required(
  :required_actions,
  -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentSession::RequiredAction] }
)

#review ⇒ OpenAI::Models::Beta::AgentSession::review?

Review applied to eligible actions in this session. Omitted when review is none and automatic review is not enabled. Omission means none.

Returns:

  • (OpenAI::Models::Beta::AgentSession::review, nil)


101
# File 'lib/openai/models/beta/agent_session.rb', line 101

optional :review, enum: -> { OpenAI::Beta::AgentSession::Review }

#spend_control ⇒ OpenAI::Beta::AgentSession::SpendControl

Spending limit and best-effort consumption, in USD cents. The limit is null for an unlimited session. Consumption is null when unavailable.

Returns:

  • (OpenAI::Beta::AgentSession::SpendControl)


69
# File 'lib/openai/models/beta/agent_session.rb', line 69

required :spend_control, -> { OpenAI::Beta::AgentSession::SpendControl }

#status ⇒ OpenAI::Models::Beta::AgentSession::status

The current status of the session.

Returns:

  • (OpenAI::Models::Beta::AgentSession::status)


75
# File 'lib/openai/models/beta/agent_session.rb', line 75

required :status, enum: -> { OpenAI::Beta::AgentSession::Status }

#usage ⇒ OpenAI::Beta::TokenUsage?

Best-effort token usage for the session, or null if unknown. Recorded usage may change.

Returns:

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


82
# File 'lib/openai/models/beta/agent_session.rb', line 82

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

#vault_ids ⇒ ::Array[String]

The IDs of vaults made available to the session.

Returns:

  • (::Array[String])


88
# File 'lib/openai/models/beta/agent_session.rb', line 88

required :vault_ids, OpenAI::Internal::Type::ArrayOf[String]

Class Method Details

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/openai/models/beta/agent_session.rb', line 780

Instance Method Details

#to_hash ⇒ { id: String, agent: OpenAI::Beta::AgentSession::Agent, created_at: Integer, environment: OpenAI::Models::Beta::environment, error: String?, last_active_at: Integer, metadata: ::Hash[Symbol, String], ?object: :"agent.session", required_actions: ::Array[OpenAI::Models::Beta::AgentSession::required_action], spend_control: OpenAI::Beta::AgentSession::SpendControl, status: OpenAI::Models::Beta::AgentSession::status, usage: OpenAI::Beta::TokenUsage?, vault_ids: ::Array[String], ?prompt_cache_options: OpenAI::Beta::AgentSession::PromptCacheOptions?, ?review: OpenAI::Models::Beta::AgentSession::review }

Returns:

  • ({ id: String, agent: OpenAI::Beta::AgentSession::Agent, created_at: Integer, environment: OpenAI::Models::Beta::environment, error: String?, last_active_at: Integer, metadata: ::Hash[Symbol, String], ?object: :"agent.session", required_actions: ::Array[OpenAI::Models::Beta::AgentSession::required_action], spend_control: OpenAI::Beta::AgentSession::SpendControl, status: OpenAI::Models::Beta::AgentSession::status, usage: OpenAI::Beta::TokenUsage?, vault_ids: ::Array[String], ?prompt_cache_options: OpenAI::Beta::AgentSession::PromptCacheOptions?, ?review: OpenAI::Models::Beta::AgentSession::review })


129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'sig/openai/models/beta/agent_session.rbs', line 129

def to_hash: -> {
  id: String,
  agent: OpenAI::Beta::AgentSession::Agent,
  created_at: Integer,
  environment: OpenAI::Models::Beta::environment,
  error: String?,
  last_active_at: Integer,
  metadata: ::Hash[Symbol, String],
  ?object: :"agent.session",
  required_actions: ::Array[OpenAI::Models::Beta::AgentSession::required_action],
  spend_control: OpenAI::Beta::AgentSession::SpendControl,
  status: OpenAI::Models::Beta::AgentSession::status,
  usage: OpenAI::Beta::TokenUsage?,
  vault_ids: ::Array[String],
  ?prompt_cache_options: OpenAI::Beta::AgentSession::PromptCacheOptions?,
  ?review: OpenAI::Models::Beta::AgentSession::review
}