openai-assistant 0.7.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/{openai → openai_assistant}/base.rb +10 -8
- data/lib/openai_assistant/client.rb +30 -0
- data/lib/openai_assistant/clients/assistant/create.rb +25 -0
- data/lib/openai_assistant/clients/assistant/delete.rb +19 -0
- data/lib/openai_assistant/clients/assistant/list.rb +22 -0
- data/lib/openai_assistant/clients/assistant/retrieve.rb +19 -0
- data/lib/{http → openai_assistant/clients/http}/http.rb +9 -11
- data/lib/openai_assistant/error_response.rb +31 -0
- data/lib/openai_assistant/mappers/assistant.rb +51 -0
- data/lib/openai_assistant/version.rb +5 -0
- data/lib/openai_assistant.rb +15 -0
- data/openai-assistant.gemspec +3 -3
- metadata +13 -7
- data/lib/openai/assistant/version.rb +0 -7
- data/lib/openai/assistant.rb +0 -107
- data/lib/openai/assistant_obj.rb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d903e8d269b7951b68f30be711b1891f4175ae828f0ef57aa52896971604920
|
4
|
+
data.tar.gz: 2b310fe5f7423d00f57760d9a0a48c715b6617bd592d98ad5c04f07fdb76e4e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab128129583233462bde63adb5ca0dce2799313b362e0c8632d86046803a39c8d57dde423736b34e931b1cf797a0ff539dd19e4deee88f048b6628a8723b3b4b
|
7
|
+
data.tar.gz: cdd30bd9901b70e7c1bc7bb4a749b9e6c37d6450be09e4494f606f3a7f33da8412016f01ba36da43de5c1ce32a8d24beda60e245cd28f93cc1cce2a4532992a8
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# OpenaiAssistant::Assistant
|
2
2
|
This project/gem is for Ruby interact with OpenAI Assistant throught rest api.
|
3
3
|
|
4
|
-
The client to call is: `
|
4
|
+
The client to call is: `OpenaiAssistant::Assistant`
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
Install throught RubyGems server by below step:
|
@@ -14,7 +14,7 @@ Install throught RubyGems server by below step:
|
|
14
14
|
You can direct interact with gem by:
|
15
15
|
|
16
16
|
- use the gem `require "openai/assistant"`
|
17
|
-
- setup the api key `instance =
|
17
|
+
- setup the api key `instance = OpenaiAssistant::Assistant::new(${API_KEY})`
|
18
18
|
- interact with assistant:
|
19
19
|
+ `instance.create_assistant(model, instruction)`
|
20
20
|
|
@@ -1,20 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
module Openai
|
3
|
+
module OpenaiAssistant
|
6
4
|
# Base class of openai
|
7
5
|
class Base
|
8
|
-
@openai_api_key = nil
|
9
|
-
@openai_url = nil
|
10
|
-
@http_client = nil
|
11
|
-
|
12
6
|
def initialize(api_key = "")
|
13
7
|
@openai_api_key = api_key
|
14
8
|
# hard the host because if the official docs change the host, maybe it will change another
|
15
9
|
# we need to update this gem for any change
|
16
10
|
@openai_url = "https://api.openai.com/v1/assistants"
|
17
|
-
@http_client =
|
11
|
+
@http_client = OpenaiAssistant::HTTPClient.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def default_headers
|
15
|
+
{
|
16
|
+
"Authorization": "Bearer #{@openai_api_key}",
|
17
|
+
"OpenAI-Beta": "assistants=v1",
|
18
|
+
"Content-Type": "application/json"
|
19
|
+
}
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenaiAssistant
|
4
|
+
module Assistant
|
5
|
+
# An openai assistant client
|
6
|
+
class Client
|
7
|
+
attr_accessor :api_key
|
8
|
+
|
9
|
+
def initialize(api_key)
|
10
|
+
@api_key = api_key
|
11
|
+
end
|
12
|
+
|
13
|
+
def create_assistant(model, instructions)
|
14
|
+
OpenaiAssistant::Assistant::Create.new(@api_key).create_assistant(model, instructions)
|
15
|
+
end
|
16
|
+
|
17
|
+
def retrieve_assistant(assistant_id)
|
18
|
+
OpenaiAssistant::Assistant::Retrieve.new(@api_key).retrieve_assistant(assistant_id)
|
19
|
+
end
|
20
|
+
|
21
|
+
def list_assistant
|
22
|
+
OpenaiAssistant::Assistant::List.new(@api_key).list_assistant
|
23
|
+
end
|
24
|
+
|
25
|
+
def delete_assistant(assistant_id)
|
26
|
+
OpenaiAssistant::Assistant::Delete.new(@api_key).delete_assistant(assistant_id)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenaiAssistant
|
4
|
+
module Assistant
|
5
|
+
# An openai assistant
|
6
|
+
class Create < Base
|
7
|
+
# @param model [String] Select model of the assistant. refer on: https://platform.openai.com/docs/api-reference/models/list.
|
8
|
+
# @param instructions [String] The system instructions that the assistant uses.
|
9
|
+
# @return [OpenaiAssistant::Mapper::Assistant] A new response object of assistant.
|
10
|
+
def create_assistant(model, instructions)
|
11
|
+
url = URI.parse(@openai_url)
|
12
|
+
req_body = {
|
13
|
+
"instructions": instructions,
|
14
|
+
"name": "assistant",
|
15
|
+
"tools": [{ "type": "code_interpreter" }],
|
16
|
+
"model": model
|
17
|
+
}.to_json
|
18
|
+
response = @http_client.call_post(url, req_body, default_headers)
|
19
|
+
return OpenaiAssistant::ErrorResponse.from_json(response.body) unless response.code == "200"
|
20
|
+
|
21
|
+
OpenaiAssistant::Mapper::Assistant.from_json(JSON.parse(response.body))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenaiAssistant
|
4
|
+
module Assistant
|
5
|
+
# An openai assistant
|
6
|
+
class Delete < Base
|
7
|
+
# @param assistant_id [String] The id of assistant after create
|
8
|
+
# @return [String] Message delete the assistant ok or not
|
9
|
+
def delete_assistant(assistant_id)
|
10
|
+
url = "#{@openai_url}/#{assistant_id}"
|
11
|
+
uri = URI(url)
|
12
|
+
response = @http_client.call_delete(uri, default_headers)
|
13
|
+
return OpenaiAssistant::ErrorResponse.from_json(response.body) unless response.code == "200"
|
14
|
+
|
15
|
+
true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenaiAssistant
|
4
|
+
module Assistant
|
5
|
+
# An openai assistant
|
6
|
+
class List < Base
|
7
|
+
# @return [Array<OpenaiAssistant::Mapper::Assistant>] List all assistant
|
8
|
+
def list_assistant
|
9
|
+
url = @openai_url
|
10
|
+
uri = URI(url)
|
11
|
+
response = @http_client.call_get(uri, default_headers)
|
12
|
+
return OpenaiAssistant::ErrorResponse.from_json(response.body) unless response.code == "200"
|
13
|
+
|
14
|
+
parsed = JSON.parse(response.body)
|
15
|
+
assistants = []
|
16
|
+
parsed["data"].each do |ast|
|
17
|
+
assistants << OpenaiAssistant::Mapper::Assistant.from_json(ast)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenaiAssistant
|
4
|
+
module Assistant
|
5
|
+
# An openai assistant
|
6
|
+
class Retrieve < Base
|
7
|
+
# @param assistant_id [String] The id of assistant after create
|
8
|
+
# @return [OpenaiAssistant::Mapper::OpenaiAssistant] A new response object of assistant.
|
9
|
+
def retrieve_assistant(assistant_id)
|
10
|
+
url = "#{@openai_url}/#{assistant_id}"
|
11
|
+
uri = URI(url)
|
12
|
+
response = @http_client.call_get(uri, default_headers)
|
13
|
+
return OpenaiAssistant::ErrorResponse.from_json(response.body) unless response.code == "200"
|
14
|
+
|
15
|
+
OpenaiAssistant::Mapper::Assistant.from_json(JSON.parse(response.body))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,29 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
require "json"
|
5
|
-
|
6
|
-
module Http
|
3
|
+
module OpenaiAssistant
|
7
4
|
# An http client
|
8
|
-
class
|
9
|
-
|
5
|
+
class HTTPClient
|
6
|
+
# disable_ssl instead of ssl because almost the host is https
|
7
|
+
def call_post(url, req_body, headers, disable_ssl: false)
|
10
8
|
http = Net::HTTP.new(url.host, url.port)
|
11
|
-
http.use_ssl = true
|
9
|
+
http.use_ssl = disable_ssl ? false : true
|
12
10
|
request = Net::HTTP::Post.new(url.path, headers)
|
13
11
|
request.body = req_body unless req_body.nil?
|
14
12
|
http.request(request)
|
15
13
|
end
|
16
14
|
|
17
|
-
def call_delete(url, headers)
|
15
|
+
def call_delete(url, headers, disable_ssl: false)
|
18
16
|
http = Net::HTTP.new(url.host, url.port)
|
19
|
-
http.use_ssl = true
|
17
|
+
http.use_ssl = disable_ssl ? false : true
|
20
18
|
request = Net::HTTP::Delete.new(url.path, headers)
|
21
19
|
http.request(request)
|
22
20
|
end
|
23
21
|
|
24
|
-
def call_get(url, headers)
|
22
|
+
def call_get(url, headers, disable_ssl: false)
|
25
23
|
http = Net::HTTP.new(url.host, url.port)
|
26
|
-
http.use_ssl = true
|
24
|
+
http.use_ssl = disable_ssl ? false : true
|
27
25
|
request = Net::HTTP::Get.new(url.path, headers)
|
28
26
|
http.request(request)
|
29
27
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenaiAssistant
|
4
|
+
# A error response of openai
|
5
|
+
class ErrorResponse
|
6
|
+
# @return [String] error message
|
7
|
+
attr_accessor :message
|
8
|
+
# @return [String] type of error
|
9
|
+
attr_accessor :type
|
10
|
+
# @return [String] parameter that caused the error
|
11
|
+
attr_accessor :param
|
12
|
+
# @return [String] error code of openai
|
13
|
+
attr_accessor :code
|
14
|
+
|
15
|
+
def initialize(**args)
|
16
|
+
args.each do |k, v|
|
17
|
+
instance_variable_set("@#{k}", v) unless v.nil?
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.from_json(response_body)
|
22
|
+
data = JSON.parse(response_body)["error"]
|
23
|
+
OpenaiAssistant::ErrorResponse.new(
|
24
|
+
message: data["message"],
|
25
|
+
type: data["type"],
|
26
|
+
param: data["param"],
|
27
|
+
code: data["code"]
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenaiAssistant
|
4
|
+
# A mapper of assistant
|
5
|
+
module Mapper
|
6
|
+
# A object model struct of assistant
|
7
|
+
class Assistant
|
8
|
+
# @return [String] The identifier, which can be referenced in API endpoints.
|
9
|
+
attr_accessor :id
|
10
|
+
# @return [String] The object type, which is always assistant.
|
11
|
+
attr_accessor :object
|
12
|
+
# @return [Integer] The Unix timestamp (in seconds) for when the assistant was created.
|
13
|
+
attr_accessor :created_at
|
14
|
+
# @return [String] The name of the assistant. The maximum length is 256 characters.
|
15
|
+
attr_accessor :name
|
16
|
+
# @return [String] The description of the assistant. The maximum length is 512 characters.
|
17
|
+
attr_accessor :description
|
18
|
+
# @return [String] ID of the model to use. Use the List models API to see all available models
|
19
|
+
attr_accessor :model
|
20
|
+
# @return [String] The system instructions that the assistant uses. The maximum length is 32768 characters.
|
21
|
+
attr_accessor :instructions
|
22
|
+
# @return [String] A list of tool enabled on the assistant.
|
23
|
+
attr_accessor :tools
|
24
|
+
# @return [String] A list of file IDs attached to this assistant.
|
25
|
+
attr_accessor :file_ids
|
26
|
+
# @return [String] Set of 16 key-value pairs that can be attached to an object.
|
27
|
+
attr_accessor :metadata
|
28
|
+
|
29
|
+
def initialize(**args)
|
30
|
+
args.each do |k, v|
|
31
|
+
instance_variable_set("@#{k}", v) unless v.nil?
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.from_json(data)
|
36
|
+
OpenaiAssistant::Mapper::Assistant.new(
|
37
|
+
id: data["id"],
|
38
|
+
object: data["object"],
|
39
|
+
created_at: data["created_at"],
|
40
|
+
name: data["name"],
|
41
|
+
description: data["description"],
|
42
|
+
model: data["model"],
|
43
|
+
instructions: data["instructions"],
|
44
|
+
tools: data["tools"],
|
45
|
+
file_ids: data["file_ids"],
|
46
|
+
metadata: data["metadata"]
|
47
|
+
)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require "net/http"
|
5
|
+
require "uri"
|
6
|
+
require_relative "openai_assistant/clients/http/http"
|
7
|
+
require_relative "openai_assistant/mappers/assistant"
|
8
|
+
require_relative "openai_assistant/error_response"
|
9
|
+
require_relative "openai_assistant/version"
|
10
|
+
require_relative "openai_assistant/base"
|
11
|
+
require_relative "openai_assistant/client"
|
12
|
+
require_relative "openai_assistant/clients/assistant/create"
|
13
|
+
require_relative "openai_assistant/clients/assistant/retrieve"
|
14
|
+
require_relative "openai_assistant/clients/assistant/delete"
|
15
|
+
require_relative "openai_assistant/clients/assistant/list"
|
data/openai-assistant.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "lib/
|
4
|
-
require_relative "lib/
|
3
|
+
require_relative "lib/openai_assistant/base"
|
4
|
+
require_relative "lib/openai_assistant/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "openai-assistant"
|
8
|
-
spec.version =
|
8
|
+
spec.version = OpenaiAssistant::VERSION
|
9
9
|
spec.authors = ["duonghds"]
|
10
10
|
spec.email = ["duong.hoang@employmenthero.com"]
|
11
11
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openai-assistant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- duonghds
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -38,11 +38,17 @@ files:
|
|
38
38
|
- LICENSE.txt
|
39
39
|
- README.md
|
40
40
|
- Rakefile
|
41
|
-
- lib/
|
42
|
-
- lib/
|
43
|
-
- lib/
|
44
|
-
- lib/
|
45
|
-
- lib/
|
41
|
+
- lib/openai_assistant.rb
|
42
|
+
- lib/openai_assistant/base.rb
|
43
|
+
- lib/openai_assistant/client.rb
|
44
|
+
- lib/openai_assistant/clients/assistant/create.rb
|
45
|
+
- lib/openai_assistant/clients/assistant/delete.rb
|
46
|
+
- lib/openai_assistant/clients/assistant/list.rb
|
47
|
+
- lib/openai_assistant/clients/assistant/retrieve.rb
|
48
|
+
- lib/openai_assistant/clients/http/http.rb
|
49
|
+
- lib/openai_assistant/error_response.rb
|
50
|
+
- lib/openai_assistant/mappers/assistant.rb
|
51
|
+
- lib/openai_assistant/version.rb
|
46
52
|
- openai-assistant.gemspec
|
47
53
|
- sig/openai/assistant.rbs
|
48
54
|
homepage: https://rubygems.org/
|
data/lib/openai/assistant.rb
DELETED
@@ -1,107 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "assistant/version"
|
4
|
-
require_relative "assistant_obj"
|
5
|
-
require_relative "base"
|
6
|
-
require_relative "../http/http"
|
7
|
-
require "json"
|
8
|
-
require "net/http"
|
9
|
-
require "uri"
|
10
|
-
|
11
|
-
module Openai
|
12
|
-
# An openai assistant
|
13
|
-
class Assistant < Base
|
14
|
-
# @param api_key [String] The api key of openai\
|
15
|
-
def initialize(api_key = "")
|
16
|
-
super(api_key)
|
17
|
-
end
|
18
|
-
|
19
|
-
# @param api_key [String] The api key of openai
|
20
|
-
def self.setup(api_key = "")
|
21
|
-
initialize(api_key)
|
22
|
-
end
|
23
|
-
|
24
|
-
# @param model [String] Select model of the assistant. refer on: https://platform.openai.com/docs/api-reference/models/list.
|
25
|
-
# @param instructions [String] The system instructions that the assistant uses.
|
26
|
-
# @return [Openai::AssistantObj] A new response object of assistant.
|
27
|
-
def create_assistant(model, instructions)
|
28
|
-
url = URI.parse(@openai_url)
|
29
|
-
req_body = {
|
30
|
-
"instructions": instructions,
|
31
|
-
"name": "assistant",
|
32
|
-
"tools": [{ "type": "code_interpreter" }],
|
33
|
-
"model": model
|
34
|
-
}.to_json
|
35
|
-
response = @http_client.call_post(url, req_body, default_headers)
|
36
|
-
unless response.code == "200"
|
37
|
-
parsed = JSON.parse(response.body)
|
38
|
-
return parsed["error"]["code"]
|
39
|
-
end
|
40
|
-
parse_assistant_object(JSON.parse(response.body))
|
41
|
-
end
|
42
|
-
|
43
|
-
# @param assistant_id [String] The id of assistant after create
|
44
|
-
# @return [Openai::AssistantObj] A new response object of assistant.
|
45
|
-
def retrieve_assistant(assistant_id)
|
46
|
-
url = "#{@openai_url}/#{assistant_id}"
|
47
|
-
uri = URI(url)
|
48
|
-
response = @http_client.call_get(uri, default_headers)
|
49
|
-
unless response.code == "200"
|
50
|
-
parsed = JSON.parse(response.body)
|
51
|
-
return parsed["error"]["code"]
|
52
|
-
end
|
53
|
-
parse_assistant_object(JSON.parse(response.body))
|
54
|
-
end
|
55
|
-
|
56
|
-
# @param assistant_id [String] The id of assistant after create
|
57
|
-
# @return [String] Message delete the assistant ok or not
|
58
|
-
def delete_assistant(assistant_id)
|
59
|
-
url = "#{@openai_url}/#{assistant_id}"
|
60
|
-
uri = URI(url)
|
61
|
-
response = @http_client.call_delete(uri, default_headers)
|
62
|
-
parsed = JSON.parse(response.body)
|
63
|
-
return parsed["error"]["code"] unless response.code == "200"
|
64
|
-
|
65
|
-
parsed["deleted"]
|
66
|
-
end
|
67
|
-
|
68
|
-
# @return [Array<Openai::AssistantObj>] List all assistant
|
69
|
-
def list_assistant
|
70
|
-
url = @openai_url
|
71
|
-
uri = URI(url)
|
72
|
-
response = @http_client.call_get(uri, default_headers)
|
73
|
-
parsed = JSON.parse(response.body)
|
74
|
-
return parsed["error"]["code"] unless response.code == "200"
|
75
|
-
|
76
|
-
assistants = []
|
77
|
-
parsed["data"].each do |ast|
|
78
|
-
assistants << parse_assistant_object(ast)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
private
|
83
|
-
|
84
|
-
def parse_assistant_object(data)
|
85
|
-
Openai::AssistantObj.new(
|
86
|
-
id: data["id"],
|
87
|
-
object: data["object"],
|
88
|
-
created_at: data["created_at"],
|
89
|
-
name: data["name"],
|
90
|
-
description: data["description"],
|
91
|
-
model: data["model"],
|
92
|
-
instructions: data["instructions"],
|
93
|
-
tools: data["tools"],
|
94
|
-
file_ids: data["file_ids"],
|
95
|
-
metadata: data["metadata"]
|
96
|
-
)
|
97
|
-
end
|
98
|
-
|
99
|
-
def default_headers
|
100
|
-
{
|
101
|
-
"Authorization": "Bearer #{@openai_api_key}",
|
102
|
-
"OpenAI-Beta": "assistants=v1",
|
103
|
-
"Content-Type": "application/json"
|
104
|
-
}
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
data/lib/openai/assistant_obj.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Openai
|
4
|
-
# A object model struct of assistant
|
5
|
-
class AssistantObj
|
6
|
-
# @return [String] The identifier, which can be referenced in API endpoints.
|
7
|
-
attr_accessor :id
|
8
|
-
# @return [String] The object type, which is always assistant.
|
9
|
-
attr_accessor :object
|
10
|
-
# @return [Integer] The Unix timestamp (in seconds) for when the assistant was created.
|
11
|
-
attr_accessor :created_at
|
12
|
-
# @return [String] The name of the assistant. The maximum length is 256 characters.
|
13
|
-
attr_accessor :name
|
14
|
-
# @return [String] The description of the assistant. The maximum length is 512 characters.
|
15
|
-
attr_accessor :description
|
16
|
-
# @return [String] ID of the model to use. Use the List models API to see all available models
|
17
|
-
attr_accessor :model
|
18
|
-
# @return [String] The system instructions that the assistant uses. The maximum length is 32768 characters.
|
19
|
-
attr_accessor :instructions
|
20
|
-
# @return [String] A list of tool enabled on the assistant.
|
21
|
-
attr_accessor :tools
|
22
|
-
# @return [String] A list of file IDs attached to this assistant.
|
23
|
-
attr_accessor :file_ids
|
24
|
-
# @return [String] Set of 16 key-value pairs that can be attached to an object.
|
25
|
-
attr_accessor :metadata
|
26
|
-
|
27
|
-
def initialize(**args)
|
28
|
-
args.each do |k, v|
|
29
|
-
instance_variable_set("@#{k}", v) unless v.nil?
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|