Class: LanggraphPlatform::Models::Thread
- Inherits:
-
Object
- Object
- LanggraphPlatform::Models::Thread
- Defined in:
- lib/langgraph_platform/models/thread.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#thread_id ⇒ Object
readonly
Returns the value of attribute thread_id.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
- #busy? ⇒ Boolean
- #error? ⇒ Boolean
- #idle? ⇒ Boolean
-
#initialize(attributes) ⇒ Thread
constructor
A new instance of Thread.
- #interrupted? ⇒ Boolean
- #to_h ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Thread
Returns a new instance of Thread.
6 7 8 9 10 11 12 13 |
# File 'lib/langgraph_platform/models/thread.rb', line 6 def initialize(attributes) @thread_id = attributes['thread_id'] @created_at = parse_time(attributes['created_at']) @updated_at = parse_time(attributes['updated_at']) @metadata = attributes['metadata'] || {} @status = attributes['status'] @values = attributes['values'] end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
4 5 6 |
# File 'lib/langgraph_platform/models/thread.rb', line 4 def created_at @created_at end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
4 5 6 |
# File 'lib/langgraph_platform/models/thread.rb', line 4 def @metadata end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/langgraph_platform/models/thread.rb', line 4 def status @status end |
#thread_id ⇒ Object (readonly)
Returns the value of attribute thread_id.
4 5 6 |
# File 'lib/langgraph_platform/models/thread.rb', line 4 def thread_id @thread_id end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
4 5 6 |
# File 'lib/langgraph_platform/models/thread.rb', line 4 def updated_at @updated_at end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
4 5 6 |
# File 'lib/langgraph_platform/models/thread.rb', line 4 def values @values end |
Instance Method Details
#busy? ⇒ Boolean
19 20 21 |
# File 'lib/langgraph_platform/models/thread.rb', line 19 def busy? @status == 'busy' end |
#error? ⇒ Boolean
27 28 29 |
# File 'lib/langgraph_platform/models/thread.rb', line 27 def error? @status == 'error' end |
#idle? ⇒ Boolean
15 16 17 |
# File 'lib/langgraph_platform/models/thread.rb', line 15 def idle? @status == 'idle' end |
#interrupted? ⇒ Boolean
23 24 25 |
# File 'lib/langgraph_platform/models/thread.rb', line 23 def interrupted? @status == 'interrupted' end |
#to_h ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/langgraph_platform/models/thread.rb', line 31 def to_h { thread_id: @thread_id, created_at: @created_at, updated_at: @updated_at, metadata: @metadata, status: @status, values: @values } end |
#to_json(*args) ⇒ Object
42 43 44 |
# File 'lib/langgraph_platform/models/thread.rb', line 42 def to_json(*args) to_h.to_json(*args) end |