fetch_hive 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +64 -0
- data/lib/fetch_hive/client.rb +160 -0
- data/lib/fetch_hive/generated/api/agents_api.rb +90 -0
- data/lib/fetch_hive/generated/api/prompts_api.rb +90 -0
- data/lib/fetch_hive/generated/api/workflows_api.rb +90 -0
- data/lib/fetch_hive/generated/api_client.rb +441 -0
- data/lib/fetch_hive/generated/api_error.rb +58 -0
- data/lib/fetch_hive/generated/api_model_base.rb +88 -0
- data/lib/fetch_hive/generated/configuration.rb +415 -0
- data/lib/fetch_hive/generated/models/agent_message.rb +228 -0
- data/lib/fetch_hive/generated/models/async_config.rb +175 -0
- data/lib/fetch_hive/generated/models/error_response.rb +158 -0
- data/lib/fetch_hive/generated/models/invoke_agent_request.rb +250 -0
- data/lib/fetch_hive/generated/models/invoke_agent_response.rb +200 -0
- data/lib/fetch_hive/generated/models/invoke_prompt_request.rb +211 -0
- data/lib/fetch_hive/generated/models/invoke_prompt_response.rb +177 -0
- data/lib/fetch_hive/generated/models/invoke_workflow_async_response.rb +193 -0
- data/lib/fetch_hive/generated/models/invoke_workflow_request.rb +208 -0
- data/lib/fetch_hive/generated/models/invoke_workflow_response.rb +223 -0
- data/lib/fetch_hive/generated/models/sse_chunk.rb +228 -0
- data/lib/fetch_hive/generated/models/token_usage.rb +169 -0
- data/lib/fetch_hive/generated/models/tool_invocation.rb +169 -0
- data/lib/fetch_hive/generated/version.rb +15 -0
- data/lib/fetch_hive/streaming.rb +65 -0
- data/lib/fetch_hive/version.rb +5 -0
- data/lib/fetch_hive.rb +10 -0
- metadata +101 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Fetch Hive Public API
|
|
3
|
+
|
|
4
|
+
#The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 0.2.2
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.22.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module FetchHive::Generated
|
|
17
|
+
class AsyncConfig < ApiModelBase
|
|
18
|
+
# When `true`, the endpoint returns immediately with a `run_id` rather than waiting for the workflow to complete.
|
|
19
|
+
attr_accessor :enabled
|
|
20
|
+
|
|
21
|
+
# Optional HTTPS URL that receives a POST with the workflow result when execution finishes (async mode only).
|
|
22
|
+
attr_accessor :callback_url
|
|
23
|
+
|
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
25
|
+
def self.attribute_map
|
|
26
|
+
{
|
|
27
|
+
:'enabled' => :'enabled',
|
|
28
|
+
:'callback_url' => :'callback_url'
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Returns attribute mapping this model knows about
|
|
33
|
+
def self.acceptable_attribute_map
|
|
34
|
+
attribute_map
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Returns all the JSON keys this model knows about
|
|
38
|
+
def self.acceptable_attributes
|
|
39
|
+
acceptable_attribute_map.values
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Attribute type mapping.
|
|
43
|
+
def self.openapi_types
|
|
44
|
+
{
|
|
45
|
+
:'enabled' => :'Boolean',
|
|
46
|
+
:'callback_url' => :'String'
|
|
47
|
+
}
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# List of attributes with nullable: true
|
|
51
|
+
def self.openapi_nullable
|
|
52
|
+
Set.new([
|
|
53
|
+
])
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Initializes the object
|
|
57
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
58
|
+
def initialize(attributes = {})
|
|
59
|
+
if (!attributes.is_a?(Hash))
|
|
60
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `FetchHive::Generated::AsyncConfig` initialize method"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
64
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
65
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
66
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
67
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `FetchHive::Generated::AsyncConfig`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
68
|
+
end
|
|
69
|
+
h[k.to_sym] = v
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if attributes.key?(:'enabled')
|
|
73
|
+
self.enabled = attributes[:'enabled']
|
|
74
|
+
else
|
|
75
|
+
self.enabled = nil
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
if attributes.key?(:'callback_url')
|
|
79
|
+
self.callback_url = attributes[:'callback_url']
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
84
|
+
# @return Array for valid properties with the reasons
|
|
85
|
+
def list_invalid_properties
|
|
86
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
87
|
+
invalid_properties = Array.new
|
|
88
|
+
if @enabled.nil?
|
|
89
|
+
invalid_properties.push('invalid value for "enabled", enabled cannot be nil.')
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
invalid_properties
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Check to see if the all the properties in the model are valid
|
|
96
|
+
# @return true if the model is valid
|
|
97
|
+
def valid?
|
|
98
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
99
|
+
return false if @enabled.nil?
|
|
100
|
+
true
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Custom attribute writer method with validation
|
|
104
|
+
# @param [Object] enabled Value to be assigned
|
|
105
|
+
def enabled=(enabled)
|
|
106
|
+
if enabled.nil?
|
|
107
|
+
fail ArgumentError, 'enabled cannot be nil'
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
@enabled = enabled
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Checks equality by comparing each attribute.
|
|
114
|
+
# @param [Object] Object to be compared
|
|
115
|
+
def ==(o)
|
|
116
|
+
return true if self.equal?(o)
|
|
117
|
+
self.class == o.class &&
|
|
118
|
+
enabled == o.enabled &&
|
|
119
|
+
callback_url == o.callback_url
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# @see the `==` method
|
|
123
|
+
# @param [Object] Object to be compared
|
|
124
|
+
def eql?(o)
|
|
125
|
+
self == o
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Calculates hash code according to all attributes.
|
|
129
|
+
# @return [Integer] Hash code
|
|
130
|
+
def hash
|
|
131
|
+
[enabled, callback_url].hash
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Builds the object from hash
|
|
135
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
136
|
+
# @return [Object] Returns the model itself
|
|
137
|
+
def self.build_from_hash(attributes)
|
|
138
|
+
return nil unless attributes.is_a?(Hash)
|
|
139
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
140
|
+
transformed_hash = {}
|
|
141
|
+
openapi_types.each_pair do |key, type|
|
|
142
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
143
|
+
transformed_hash["#{key}"] = nil
|
|
144
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
145
|
+
# check to ensure the input is an array given that the attribute
|
|
146
|
+
# is documented as an array but the input is not
|
|
147
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
148
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
149
|
+
end
|
|
150
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
151
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
new(transformed_hash)
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# Returns the object in the form of hash
|
|
158
|
+
# @return [Hash] Returns the object in the form of hash
|
|
159
|
+
def to_hash
|
|
160
|
+
hash = {}
|
|
161
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
162
|
+
value = self.send(attr)
|
|
163
|
+
if value.nil?
|
|
164
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
165
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
hash[param] = _to_hash(value)
|
|
169
|
+
end
|
|
170
|
+
hash
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
end
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Fetch Hive Public API
|
|
3
|
+
|
|
4
|
+
#The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 0.2.2
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.22.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module FetchHive::Generated
|
|
17
|
+
class ErrorResponse < ApiModelBase
|
|
18
|
+
# Human-readable error description.
|
|
19
|
+
attr_accessor :error
|
|
20
|
+
|
|
21
|
+
# Machine-readable error code.
|
|
22
|
+
attr_accessor :code
|
|
23
|
+
|
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
25
|
+
def self.attribute_map
|
|
26
|
+
{
|
|
27
|
+
:'error' => :'error',
|
|
28
|
+
:'code' => :'code'
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Returns attribute mapping this model knows about
|
|
33
|
+
def self.acceptable_attribute_map
|
|
34
|
+
attribute_map
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Returns all the JSON keys this model knows about
|
|
38
|
+
def self.acceptable_attributes
|
|
39
|
+
acceptable_attribute_map.values
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Attribute type mapping.
|
|
43
|
+
def self.openapi_types
|
|
44
|
+
{
|
|
45
|
+
:'error' => :'String',
|
|
46
|
+
:'code' => :'String'
|
|
47
|
+
}
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# List of attributes with nullable: true
|
|
51
|
+
def self.openapi_nullable
|
|
52
|
+
Set.new([
|
|
53
|
+
])
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Initializes the object
|
|
57
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
58
|
+
def initialize(attributes = {})
|
|
59
|
+
if (!attributes.is_a?(Hash))
|
|
60
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `FetchHive::Generated::ErrorResponse` initialize method"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
64
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
65
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
66
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
67
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `FetchHive::Generated::ErrorResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
68
|
+
end
|
|
69
|
+
h[k.to_sym] = v
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if attributes.key?(:'error')
|
|
73
|
+
self.error = attributes[:'error']
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
if attributes.key?(:'code')
|
|
77
|
+
self.code = attributes[:'code']
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
82
|
+
# @return Array for valid properties with the reasons
|
|
83
|
+
def list_invalid_properties
|
|
84
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
85
|
+
invalid_properties = Array.new
|
|
86
|
+
invalid_properties
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Check to see if the all the properties in the model are valid
|
|
90
|
+
# @return true if the model is valid
|
|
91
|
+
def valid?
|
|
92
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
93
|
+
true
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Checks equality by comparing each attribute.
|
|
97
|
+
# @param [Object] Object to be compared
|
|
98
|
+
def ==(o)
|
|
99
|
+
return true if self.equal?(o)
|
|
100
|
+
self.class == o.class &&
|
|
101
|
+
error == o.error &&
|
|
102
|
+
code == o.code
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# @see the `==` method
|
|
106
|
+
# @param [Object] Object to be compared
|
|
107
|
+
def eql?(o)
|
|
108
|
+
self == o
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Calculates hash code according to all attributes.
|
|
112
|
+
# @return [Integer] Hash code
|
|
113
|
+
def hash
|
|
114
|
+
[error, code].hash
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Builds the object from hash
|
|
118
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
119
|
+
# @return [Object] Returns the model itself
|
|
120
|
+
def self.build_from_hash(attributes)
|
|
121
|
+
return nil unless attributes.is_a?(Hash)
|
|
122
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
123
|
+
transformed_hash = {}
|
|
124
|
+
openapi_types.each_pair do |key, type|
|
|
125
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
126
|
+
transformed_hash["#{key}"] = nil
|
|
127
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
128
|
+
# check to ensure the input is an array given that the attribute
|
|
129
|
+
# is documented as an array but the input is not
|
|
130
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
131
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
132
|
+
end
|
|
133
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
134
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
new(transformed_hash)
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# Returns the object in the form of hash
|
|
141
|
+
# @return [Hash] Returns the object in the form of hash
|
|
142
|
+
def to_hash
|
|
143
|
+
hash = {}
|
|
144
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
145
|
+
value = self.send(attr)
|
|
146
|
+
if value.nil?
|
|
147
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
148
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
hash[param] = _to_hash(value)
|
|
152
|
+
end
|
|
153
|
+
hash
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
end
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Fetch Hive Public API
|
|
3
|
+
|
|
4
|
+
#The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 0.2.2
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.22.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module FetchHive::Generated
|
|
17
|
+
class InvokeAgentRequest < ApiModelBase
|
|
18
|
+
# The user's message to send to the agent.
|
|
19
|
+
attr_accessor :message
|
|
20
|
+
|
|
21
|
+
# Slug of the agent to invoke.
|
|
22
|
+
attr_accessor :agent
|
|
23
|
+
|
|
24
|
+
# Find-or-create a persistent conversation thread by this caller- supplied string. Leave empty to start a stateless invocation.
|
|
25
|
+
attr_accessor :thread_id
|
|
26
|
+
|
|
27
|
+
# When `true` the response is a Server-Sent Events stream.
|
|
28
|
+
attr_accessor :streaming
|
|
29
|
+
|
|
30
|
+
# Optional opaque caller identifier for audit logging.
|
|
31
|
+
attr_accessor :user
|
|
32
|
+
|
|
33
|
+
# Ephemeral conversation history supplied by the caller. Not stored in the database. Takes precedence over `thread_id` history when both are provided.
|
|
34
|
+
attr_accessor :messages
|
|
35
|
+
|
|
36
|
+
# HTTPS image URLs attached to the current `message` for multimodal inputs. All URLs must start with `https://`.
|
|
37
|
+
attr_accessor :image_urls
|
|
38
|
+
|
|
39
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
40
|
+
def self.attribute_map
|
|
41
|
+
{
|
|
42
|
+
:'message' => :'message',
|
|
43
|
+
:'agent' => :'agent',
|
|
44
|
+
:'thread_id' => :'thread_id',
|
|
45
|
+
:'streaming' => :'streaming',
|
|
46
|
+
:'user' => :'user',
|
|
47
|
+
:'messages' => :'messages',
|
|
48
|
+
:'image_urls' => :'image_urls'
|
|
49
|
+
}
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Returns attribute mapping this model knows about
|
|
53
|
+
def self.acceptable_attribute_map
|
|
54
|
+
attribute_map
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Returns all the JSON keys this model knows about
|
|
58
|
+
def self.acceptable_attributes
|
|
59
|
+
acceptable_attribute_map.values
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Attribute type mapping.
|
|
63
|
+
def self.openapi_types
|
|
64
|
+
{
|
|
65
|
+
:'message' => :'String',
|
|
66
|
+
:'agent' => :'String',
|
|
67
|
+
:'thread_id' => :'String',
|
|
68
|
+
:'streaming' => :'Boolean',
|
|
69
|
+
:'user' => :'String',
|
|
70
|
+
:'messages' => :'Array<AgentMessage>',
|
|
71
|
+
:'image_urls' => :'Array<String>'
|
|
72
|
+
}
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# List of attributes with nullable: true
|
|
76
|
+
def self.openapi_nullable
|
|
77
|
+
Set.new([
|
|
78
|
+
])
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Initializes the object
|
|
82
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
83
|
+
def initialize(attributes = {})
|
|
84
|
+
if (!attributes.is_a?(Hash))
|
|
85
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `FetchHive::Generated::InvokeAgentRequest` initialize method"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
89
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
90
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
91
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
92
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `FetchHive::Generated::InvokeAgentRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
93
|
+
end
|
|
94
|
+
h[k.to_sym] = v
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if attributes.key?(:'message')
|
|
98
|
+
self.message = attributes[:'message']
|
|
99
|
+
else
|
|
100
|
+
self.message = nil
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
if attributes.key?(:'agent')
|
|
104
|
+
self.agent = attributes[:'agent']
|
|
105
|
+
else
|
|
106
|
+
self.agent = nil
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
if attributes.key?(:'thread_id')
|
|
110
|
+
self.thread_id = attributes[:'thread_id']
|
|
111
|
+
else
|
|
112
|
+
self.thread_id = ''
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
if attributes.key?(:'streaming')
|
|
116
|
+
self.streaming = attributes[:'streaming']
|
|
117
|
+
else
|
|
118
|
+
self.streaming = false
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
if attributes.key?(:'user')
|
|
122
|
+
self.user = attributes[:'user']
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
if attributes.key?(:'messages')
|
|
126
|
+
if (value = attributes[:'messages']).is_a?(Array)
|
|
127
|
+
self.messages = value
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
if attributes.key?(:'image_urls')
|
|
132
|
+
if (value = attributes[:'image_urls']).is_a?(Array)
|
|
133
|
+
self.image_urls = value
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
139
|
+
# @return Array for valid properties with the reasons
|
|
140
|
+
def list_invalid_properties
|
|
141
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
142
|
+
invalid_properties = Array.new
|
|
143
|
+
if @message.nil?
|
|
144
|
+
invalid_properties.push('invalid value for "message", message cannot be nil.')
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
if @agent.nil?
|
|
148
|
+
invalid_properties.push('invalid value for "agent", agent cannot be nil.')
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
invalid_properties
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Check to see if the all the properties in the model are valid
|
|
155
|
+
# @return true if the model is valid
|
|
156
|
+
def valid?
|
|
157
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
158
|
+
return false if @message.nil?
|
|
159
|
+
return false if @agent.nil?
|
|
160
|
+
true
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Custom attribute writer method with validation
|
|
164
|
+
# @param [Object] message Value to be assigned
|
|
165
|
+
def message=(message)
|
|
166
|
+
if message.nil?
|
|
167
|
+
fail ArgumentError, 'message cannot be nil'
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
@message = message
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Custom attribute writer method with validation
|
|
174
|
+
# @param [Object] agent Value to be assigned
|
|
175
|
+
def agent=(agent)
|
|
176
|
+
if agent.nil?
|
|
177
|
+
fail ArgumentError, 'agent cannot be nil'
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
@agent = agent
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# Checks equality by comparing each attribute.
|
|
184
|
+
# @param [Object] Object to be compared
|
|
185
|
+
def ==(o)
|
|
186
|
+
return true if self.equal?(o)
|
|
187
|
+
self.class == o.class &&
|
|
188
|
+
message == o.message &&
|
|
189
|
+
agent == o.agent &&
|
|
190
|
+
thread_id == o.thread_id &&
|
|
191
|
+
streaming == o.streaming &&
|
|
192
|
+
user == o.user &&
|
|
193
|
+
messages == o.messages &&
|
|
194
|
+
image_urls == o.image_urls
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# @see the `==` method
|
|
198
|
+
# @param [Object] Object to be compared
|
|
199
|
+
def eql?(o)
|
|
200
|
+
self == o
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# Calculates hash code according to all attributes.
|
|
204
|
+
# @return [Integer] Hash code
|
|
205
|
+
def hash
|
|
206
|
+
[message, agent, thread_id, streaming, user, messages, image_urls].hash
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Builds the object from hash
|
|
210
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
211
|
+
# @return [Object] Returns the model itself
|
|
212
|
+
def self.build_from_hash(attributes)
|
|
213
|
+
return nil unless attributes.is_a?(Hash)
|
|
214
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
215
|
+
transformed_hash = {}
|
|
216
|
+
openapi_types.each_pair do |key, type|
|
|
217
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
218
|
+
transformed_hash["#{key}"] = nil
|
|
219
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
220
|
+
# check to ensure the input is an array given that the attribute
|
|
221
|
+
# is documented as an array but the input is not
|
|
222
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
223
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
224
|
+
end
|
|
225
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
226
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
new(transformed_hash)
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
# Returns the object in the form of hash
|
|
233
|
+
# @return [Hash] Returns the object in the form of hash
|
|
234
|
+
def to_hash
|
|
235
|
+
hash = {}
|
|
236
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
237
|
+
value = self.send(attr)
|
|
238
|
+
if value.nil?
|
|
239
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
240
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
hash[param] = _to_hash(value)
|
|
244
|
+
end
|
|
245
|
+
hash
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
end
|