Class: OpenaiAssistant::Mapper::Assistant

Inherits:
Object
  • Object
show all
Defined in:
lib/openai_assistant/mappers/assistant.rb

Overview

A object model struct of assistant

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ Assistant

Returns a new instance of Assistant.



29
30
31
32
33
# File 'lib/openai_assistant/mappers/assistant.rb', line 29

def initialize(**args)
  args.each do |k, v|
    instance_variable_set("@#{k}", v) unless v.nil?
  end
end

Instance Attribute Details

#created_atInteger

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

Returns:

  • (Integer)

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



13
14
15
# File 'lib/openai_assistant/mappers/assistant.rb', line 13

def created_at
  @created_at
end

#descriptionString

Returns The description of the assistant. The maximum length is 512 characters.

Returns:

  • (String)

    The description of the assistant. The maximum length is 512 characters.



17
18
19
# File 'lib/openai_assistant/mappers/assistant.rb', line 17

def description
  @description
end

#file_idsString

Returns A list of file IDs attached to this assistant.

Returns:

  • (String)

    A list of file IDs attached to this assistant.



25
26
27
# File 'lib/openai_assistant/mappers/assistant.rb', line 25

def file_ids
  @file_ids
end

#idString

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

Returns:

  • (String)

    The identifier, which can be referenced in API endpoints.



9
10
11
# File 'lib/openai_assistant/mappers/assistant.rb', line 9

def id
  @id
end

#instructionsString

Returns The system instructions that the assistant uses. The maximum length is 32768 characters.

Returns:

  • (String)

    The system instructions that the assistant uses. The maximum length is 32768 characters.



21
22
23
# File 'lib/openai_assistant/mappers/assistant.rb', line 21

def instructions
  @instructions
end

#metadataString

Returns Set of 16 key-value pairs that can be attached to an object.

Returns:

  • (String)

    Set of 16 key-value pairs that can be attached to an object.



27
28
29
# File 'lib/openai_assistant/mappers/assistant.rb', line 27

def 
  
end

#modelString

Returns ID of the model to use. Use the List models API to see all available models.

Returns:

  • (String)

    ID of the model to use. Use the List models API to see all available models



19
20
21
# File 'lib/openai_assistant/mappers/assistant.rb', line 19

def model
  @model
end

#nameString

Returns The name of the assistant. The maximum length is 256 characters.

Returns:

  • (String)

    The name of the assistant. The maximum length is 256 characters.



15
16
17
# File 'lib/openai_assistant/mappers/assistant.rb', line 15

def name
  @name
end

#objectString

Returns The object type, which is always assistant.

Returns:

  • (String)

    The object type, which is always assistant.



11
12
13
# File 'lib/openai_assistant/mappers/assistant.rb', line 11

def object
  @object
end

#toolsString

Returns A list of tool enabled on the assistant.

Returns:

  • (String)

    A list of tool enabled on the assistant.



23
24
25
# File 'lib/openai_assistant/mappers/assistant.rb', line 23

def tools
  @tools
end

Class Method Details

.from_json(data) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/openai_assistant/mappers/assistant.rb', line 35

def self.from_json(data)
  OpenaiAssistant::Mapper::Assistant.new(
    id: data["id"],
    object: data["object"],
    created_at: data["created_at"],
    name: data["name"],
    description: data["description"],
    model: data["model"],
    instructions: data["instructions"],
    tools: data["tools"],
    file_ids: data["file_ids"],
    metadata: data["metadata"]
  )
end