Class: OpenAI::Model::Run

Inherits:
Object
  • Object
show all
Defined in:
lib/openai/models/run.rb

Overview

Represents an execution run on a thread.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Run

Returns a new instance of Run.



84
85
86
87
88
# File 'lib/openai/models/run.rb', line 84

def initialize(attributes)
  attributes.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
end

Instance Attribute Details

#assistant_idString (readonly)

Returns The ID of the assistant used for execution of this run.

Returns:

  • (String)

    The ID of the assistant used for execution of this run.



19
20
21
# File 'lib/openai/models/run.rb', line 19

def assistant_id
  @assistant_id
end

#cancelled_atInteger | nil (readonly)

Returns The Unix timestamp (in seconds) for when the run was cancelled.

Returns:

  • (Integer | nil)

    The Unix timestamp (in seconds) for when the run was cancelled.



37
38
39
# File 'lib/openai/models/run.rb', line 37

def cancelled_at
  @cancelled_at
end

#completed_atInteger | nil (readonly)

Returns The Unix timestamp (in seconds) for when the run was completed.

Returns:

  • (Integer | nil)

    The Unix timestamp (in seconds) for when the run was completed.



43
44
45
# File 'lib/openai/models/run.rb', line 43

def completed_at
  @completed_at
end

#created_atInteger (readonly)

Returns The Unix timestamp (in seconds) for when the run was created.

Returns:

  • (Integer)

    The Unix timestamp (in seconds) for when the run was created.



13
14
15
# File 'lib/openai/models/run.rb', line 13

def created_at
  @created_at
end

#expires_atInteger | nil (readonly)

Returns The Unix timestamp (in seconds) for when the run will expire.

Returns:

  • (Integer | nil)

    The Unix timestamp (in seconds) for when the run will expire.



31
32
33
# File 'lib/openai/models/run.rb', line 31

def expires_at
  @expires_at
end

#failed_atInteger | nil (readonly)

Returns The Unix timestamp (in seconds) for when the run failed.

Returns:

  • (Integer | nil)

    The Unix timestamp (in seconds) for when the run failed.



40
41
42
# File 'lib/openai/models/run.rb', line 40

def failed_at
  @failed_at
end

#idString (readonly)

Returns The identifier, which can be referenced in API endpoints.

Returns:

  • (String)

    The identifier, which can be referenced in API endpoints.



7
8
9
# File 'lib/openai/models/run.rb', line 7

def id
  @id
end

#incomplete_detailsString | nil (readonly)

Returns Details on why the run is incomplete. Will be null if the run is not incomplete.

Returns:

  • (String | nil)

    Details on why the run is incomplete. Will be null if the run is not incomplete.



46
47
48
# File 'lib/openai/models/run.rb', line 46

def incomplete_details
  @incomplete_details
end

#instructionsString (readonly)

Returns The instructions that the assistant used for this run.

Returns:

  • (String)

    The instructions that the assistant used for this run.



52
53
54
# File 'lib/openai/models/run.rb', line 52

def instructions
  @instructions
end

#last_errorString | nil (readonly)

Returns The last error associated with this run. Will be null if there are no errors.

Returns:

  • (String | nil)

    The last error associated with this run. Will be null if there are no errors.



28
29
30
# File 'lib/openai/models/run.rb', line 28

def last_error
  @last_error
end

#max_completion_tokensInteger | nil (readonly)

Returns The maximum number of completion tokens specified to have been used over the course of the run.

Returns:

  • (Integer | nil)

    The maximum number of completion tokens specified to have been used over the course of the run.



73
74
75
# File 'lib/openai/models/run.rb', line 73

def max_completion_tokens
  @max_completion_tokens
end

#max_prompt_tokensInteger | nil (readonly)

Returns The maximum number of prompt tokens specified to have been used over the course of the run.

Returns:

  • (Integer | nil)

    The maximum number of prompt tokens specified to have been used over the course of the run.



70
71
72
# File 'lib/openai/models/run.rb', line 70

def max_prompt_tokens
  @max_prompt_tokens
end

#metadataHash[String, String] (readonly)

Returns Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.

Returns:

  • (Hash[String, String])

    Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.



58
59
60
# File 'lib/openai/models/run.rb', line 58

def 
  @metadata
end

#modelString (readonly)

Returns The model that the assistant used for this run.

Returns:

  • (String)

    The model that the assistant used for this run.



49
50
51
# File 'lib/openai/models/run.rb', line 49

def model
  @model
end

#objectString (readonly)

Returns The object type, which is always thread.run.

Returns:

  • (String)

    The object type, which is always thread.run



10
11
12
# File 'lib/openai/models/run.rb', line 10

def object
  @object
end

#required_actionString | nil (readonly)

Returns Details on the action required to continue the run. Will be null if no action is required.

Returns:

  • (String | nil)

    Details on the action required to continue the run. Will be null if no action is required.



25
26
27
# File 'lib/openai/models/run.rb', line 25

def required_action
  @required_action
end

#response_formatString (readonly)

Returns Specifies the format that the model must output.

Returns:

  • (String)

    Specifies the format that the model must output.



82
83
84
# File 'lib/openai/models/run.rb', line 82

def response_format
  @response_format
end

#started_atInteger | nil (readonly)

Returns The Unix timestamp (in seconds) for when the run was started.

Returns:

  • (Integer | nil)

    The Unix timestamp (in seconds) for when the run was started.



34
35
36
# File 'lib/openai/models/run.rb', line 34

def started_at
  @started_at
end

#statusString (readonly)

Returns The status of the run, which can be either queued, in_progress, requires_action, cancelling, cancelled, failed, completed, or expired.

Returns:

  • (String)

    The status of the run, which can be either queued, in_progress, requires_action, cancelling, cancelled, failed, completed, or expired



22
23
24
# File 'lib/openai/models/run.rb', line 22

def status
  @status
end

#temperatureNumber | nil (readonly)

Returns The sampling temperature used for this run. If not set, defaults to 1.

Returns:

  • (Number | nil)

    The sampling temperature used for this run. If not set, defaults to 1.



64
65
66
# File 'lib/openai/models/run.rb', line 64

def temperature
  @temperature
end

#thread_idString (readonly)

Returns The ID of the thread that was executed on as a part of this run.

Returns:

  • (String)

    The ID of the thread that was executed on as a part of this run.



16
17
18
# File 'lib/openai/models/run.rb', line 16

def thread_id
  @thread_id
end

#tool_choiceString (readonly)

Returns Controls which (if any) tool is called by the model. none means the model will not call any tools and instead generates a message. auto is the default value and means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools before responding to the user. Specifying a particular tool like “file_search” or “function”, “function”: {“name”: “my_function”} forces the model to call that tool.

Returns:

  • (String)

    Controls which (if any) tool is called by the model. none means the model will not call any tools and instead generates a message. auto is the default value and means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools before responding to the user. Specifying a particular tool like “file_search” or “function”, “function”: {“name”: “my_function”} forces the model to call that tool.



79
80
81
# File 'lib/openai/models/run.rb', line 79

def tool_choice
  @tool_choice
end

#toolsString (readonly)

Returns The list of tools that the assistant used for this run.

Returns:

  • (String)

    The list of tools that the assistant used for this run.



55
56
57
# File 'lib/openai/models/run.rb', line 55

def tools
  @tools
end

#top_pNumber | nil (readonly)

Returns The nucleus sampling value used for this run. If not set, defaults to 1.

Returns:

  • (Number | nil)

    The nucleus sampling value used for this run. If not set, defaults to 1.



67
68
69
# File 'lib/openai/models/run.rb', line 67

def top_p
  @top_p
end

#truncation_strategyString (readonly)

Returns Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run.

Returns:

  • (String)

    Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run.



76
77
78
# File 'lib/openai/models/run.rb', line 76

def truncation_strategy
  @truncation_strategy
end

#usageString | nil (readonly)

Returns Usage statistics related to the run. This value will be null if the run is not in a terminal state (i.e. in_progress, queued, etc.).

Returns:

  • (String | nil)

    Usage statistics related to the run. This value will be null if the run is not in a terminal state (i.e. in_progress, queued, etc.).



61
62
63
# File 'lib/openai/models/run.rb', line 61

def usage
  @usage
end