Class: OmniAI::OpenAI::Threads

Inherits:
Object
  • Object
show all
Defined in:
lib/omniai/openai/threads.rb

Overview

An OpenAI scope for establishing threads.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Threads

Returns a new instance of Threads.

Parameters:



8
9
10
# File 'lib/omniai/openai/threads.rb', line 8

def initialize(client:)
  @client = client
end

Instance Method Details

#build(metadata: {}, tool_resources: {}) ⇒ Object

Parameters:

  • metadata (Hash) (defaults to: {})

    optional

  • tool_resources (Hash) (defaults to: {})

    optional



24
25
26
# File 'lib/omniai/openai/threads.rb', line 24

def build(metadata: {}, tool_resources: {})
  Thread.new(metadata:, tool_resources:, client: @client)
end

#destroy!(id:) ⇒ Object

Parameters:

  • id (String)

    required



18
19
20
# File 'lib/omniai/openai/threads.rb', line 18

def destroy!(id:)
  Thread.destroy!(id:, client: @client)
end

#find(id:) ⇒ Object

Parameters:

  • id (String)

    required



13
14
15
# File 'lib/omniai/openai/threads.rb', line 13

def find(id:)
  Thread.find(id:, client: @client)
end