Class: GAI18n::OpenAI::Thread

Inherits:
Object
  • Object
show all
Defined in:
lib/gai18n/openai/thread.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Thread

Returns a new instance of Thread.



15
16
17
18
19
20
# File 'lib/gai18n/openai/thread.rb', line 15

def initialize(response)
  @id = response['id']
  @object = response['object']
  @created_at = response['created_at']
  @metadata = response['metadata']
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



13
14
15
# File 'lib/gai18n/openai/thread.rb', line 13

def created_at
  @created_at
end

#idObject (readonly)

Returns the value of attribute id.



13
14
15
# File 'lib/gai18n/openai/thread.rb', line 13

def id
  @id
end

#metadataObject (readonly)

Returns the value of attribute metadata.



13
14
15
# File 'lib/gai18n/openai/thread.rb', line 13

def 
  @metadata
end

#objectObject (readonly)

Returns the value of attribute object.



13
14
15
# File 'lib/gai18n/openai/thread.rb', line 13

def object
  @object
end

Class Method Details

.createObject



5
6
7
8
9
# File 'lib/gai18n/openai/thread.rb', line 5

def create
  openai_client = GAI18n.config.openai_client
  response = openai_client.threads.create
  new response
end