Class: OmniAI::OpenAI::Assistants

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

Overview

An OpenAI scope for establishing assistants.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Assistants

Returns a new instance of Assistants.

Parameters:



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

def initialize(client:)
  @client = client
end

Instance Method Details

#all(limit: nil) ⇒ Object

Parameters:

  • limit (Integer) (defaults to: nil)

    optional



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

def all(limit: nil)
  Assistant.all(limit:, client: @client)
end

#build(name: nil, description: nil, instructions: nil, model: Chat::Model, metadata: {}, tools: []) ⇒ Object

Parameters:

  • name (String) (defaults to: nil)
  • model (String) (defaults to: Chat::Model)
  • description (String, nil) (defaults to: nil)

    optional

  • instructions (String, nil) (defaults to: nil)

    optional

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

    optional

  • tools (Array<Hash>) (defaults to: [])

    optional



33
34
35
# File 'lib/omniai/openai/assistants.rb', line 33

def build(name: nil, description: nil, instructions: nil, model: Chat::Model, metadata: {}, tools: [])
  Assistant.new(name:, model:, description:, instructions:, metadata:, tools:, client: @client)
end

#destroy!(id:) ⇒ Object

Parameters:

  • id (String)

    required



23
24
25
# File 'lib/omniai/openai/assistants.rb', line 23

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

#find(id:) ⇒ Object

Parameters:

  • id (String)

    required



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

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