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.
Files changed (28) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +64 -0
  3. data/lib/fetch_hive/client.rb +160 -0
  4. data/lib/fetch_hive/generated/api/agents_api.rb +90 -0
  5. data/lib/fetch_hive/generated/api/prompts_api.rb +90 -0
  6. data/lib/fetch_hive/generated/api/workflows_api.rb +90 -0
  7. data/lib/fetch_hive/generated/api_client.rb +441 -0
  8. data/lib/fetch_hive/generated/api_error.rb +58 -0
  9. data/lib/fetch_hive/generated/api_model_base.rb +88 -0
  10. data/lib/fetch_hive/generated/configuration.rb +415 -0
  11. data/lib/fetch_hive/generated/models/agent_message.rb +228 -0
  12. data/lib/fetch_hive/generated/models/async_config.rb +175 -0
  13. data/lib/fetch_hive/generated/models/error_response.rb +158 -0
  14. data/lib/fetch_hive/generated/models/invoke_agent_request.rb +250 -0
  15. data/lib/fetch_hive/generated/models/invoke_agent_response.rb +200 -0
  16. data/lib/fetch_hive/generated/models/invoke_prompt_request.rb +211 -0
  17. data/lib/fetch_hive/generated/models/invoke_prompt_response.rb +177 -0
  18. data/lib/fetch_hive/generated/models/invoke_workflow_async_response.rb +193 -0
  19. data/lib/fetch_hive/generated/models/invoke_workflow_request.rb +208 -0
  20. data/lib/fetch_hive/generated/models/invoke_workflow_response.rb +223 -0
  21. data/lib/fetch_hive/generated/models/sse_chunk.rb +228 -0
  22. data/lib/fetch_hive/generated/models/token_usage.rb +169 -0
  23. data/lib/fetch_hive/generated/models/tool_invocation.rb +169 -0
  24. data/lib/fetch_hive/generated/version.rb +15 -0
  25. data/lib/fetch_hive/streaming.rb +65 -0
  26. data/lib/fetch_hive/version.rb +5 -0
  27. data/lib/fetch_hive.rb +10 -0
  28. metadata +101 -0
@@ -0,0 +1,200 @@
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
+ # Agent response. All fields are optional because the shape differs slightly between streaming and non-streaming modes.
18
+ class InvokeAgentResponse < ApiModelBase
19
+ # Unique identifier for this invocation.
20
+ attr_accessor :request_id
21
+
22
+ # The agent's final text response (non-streaming only).
23
+ attr_accessor :response
24
+
25
+ # Thread identifier. Present when `thread_id` was supplied.
26
+ attr_accessor :thread_id
27
+
28
+ # Model used for this invocation.
29
+ attr_accessor :model
30
+
31
+ attr_accessor :usage
32
+
33
+ # Tool invocations made during this run (if any).
34
+ attr_accessor :tool_calls
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'request_id' => :'request_id',
40
+ :'response' => :'response',
41
+ :'thread_id' => :'thread_id',
42
+ :'model' => :'model',
43
+ :'usage' => :'usage',
44
+ :'tool_calls' => :'tool_calls'
45
+ }
46
+ end
47
+
48
+ # Returns attribute mapping this model knows about
49
+ def self.acceptable_attribute_map
50
+ attribute_map
51
+ end
52
+
53
+ # Returns all the JSON keys this model knows about
54
+ def self.acceptable_attributes
55
+ acceptable_attribute_map.values
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'request_id' => :'String',
62
+ :'response' => :'String',
63
+ :'thread_id' => :'String',
64
+ :'model' => :'String',
65
+ :'usage' => :'TokenUsage',
66
+ :'tool_calls' => :'Array<ToolInvocation>'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FetchHive::Generated::InvokeAgentResponse` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ acceptable_attribute_map = self.class.acceptable_attribute_map
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!acceptable_attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FetchHive::Generated::InvokeAgentResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'request_id')
93
+ self.request_id = attributes[:'request_id']
94
+ end
95
+
96
+ if attributes.key?(:'response')
97
+ self.response = attributes[:'response']
98
+ end
99
+
100
+ if attributes.key?(:'thread_id')
101
+ self.thread_id = attributes[:'thread_id']
102
+ end
103
+
104
+ if attributes.key?(:'model')
105
+ self.model = attributes[:'model']
106
+ end
107
+
108
+ if attributes.key?(:'usage')
109
+ self.usage = attributes[:'usage']
110
+ end
111
+
112
+ if attributes.key?(:'tool_calls')
113
+ if (value = attributes[:'tool_calls']).is_a?(Array)
114
+ self.tool_calls = value
115
+ end
116
+ end
117
+ end
118
+
119
+ # Show invalid properties with the reasons. Usually used together with valid?
120
+ # @return Array for valid properties with the reasons
121
+ def list_invalid_properties
122
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
123
+ invalid_properties = Array.new
124
+ invalid_properties
125
+ end
126
+
127
+ # Check to see if the all the properties in the model are valid
128
+ # @return true if the model is valid
129
+ def valid?
130
+ warn '[DEPRECATED] the `valid?` method is obsolete'
131
+ true
132
+ end
133
+
134
+ # Checks equality by comparing each attribute.
135
+ # @param [Object] Object to be compared
136
+ def ==(o)
137
+ return true if self.equal?(o)
138
+ self.class == o.class &&
139
+ request_id == o.request_id &&
140
+ response == o.response &&
141
+ thread_id == o.thread_id &&
142
+ model == o.model &&
143
+ usage == o.usage &&
144
+ tool_calls == o.tool_calls
145
+ end
146
+
147
+ # @see the `==` method
148
+ # @param [Object] Object to be compared
149
+ def eql?(o)
150
+ self == o
151
+ end
152
+
153
+ # Calculates hash code according to all attributes.
154
+ # @return [Integer] Hash code
155
+ def hash
156
+ [request_id, response, thread_id, model, usage, tool_calls].hash
157
+ end
158
+
159
+ # Builds the object from hash
160
+ # @param [Hash] attributes Model attributes in the form of hash
161
+ # @return [Object] Returns the model itself
162
+ def self.build_from_hash(attributes)
163
+ return nil unless attributes.is_a?(Hash)
164
+ attributes = attributes.transform_keys(&:to_sym)
165
+ transformed_hash = {}
166
+ openapi_types.each_pair do |key, type|
167
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
168
+ transformed_hash["#{key}"] = nil
169
+ elsif type =~ /\AArray<(.*)>/i
170
+ # check to ensure the input is an array given that the attribute
171
+ # is documented as an array but the input is not
172
+ if attributes[attribute_map[key]].is_a?(Array)
173
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
174
+ end
175
+ elsif !attributes[attribute_map[key]].nil?
176
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
177
+ end
178
+ end
179
+ new(transformed_hash)
180
+ end
181
+
182
+ # Returns the object in the form of hash
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_hash
185
+ hash = {}
186
+ self.class.attribute_map.each_pair do |attr, param|
187
+ value = self.send(attr)
188
+ if value.nil?
189
+ is_nullable = self.class.openapi_nullable.include?(attr)
190
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
191
+ end
192
+
193
+ hash[param] = _to_hash(value)
194
+ end
195
+ hash
196
+ end
197
+
198
+ end
199
+
200
+ end
@@ -0,0 +1,211 @@
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 InvokePromptRequest < ApiModelBase
18
+ # Slug of the prompt deployment to invoke.
19
+ attr_accessor :deployment
20
+
21
+ # Optional variant name to override the default.
22
+ attr_accessor :variant
23
+
24
+ # Key-value pairs that are substituted into the prompt template. Values may be strings, numbers, booleans, arrays, or nested objects.
25
+ attr_accessor :inputs
26
+
27
+ # When `true` the response is a Server-Sent Events stream rather than a single JSON body.
28
+ attr_accessor :streaming
29
+
30
+ # Optional opaque caller identifier for audit logging.
31
+ attr_accessor :user
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'deployment' => :'deployment',
37
+ :'variant' => :'variant',
38
+ :'inputs' => :'inputs',
39
+ :'streaming' => :'streaming',
40
+ :'user' => :'user'
41
+ }
42
+ end
43
+
44
+ # Returns attribute mapping this model knows about
45
+ def self.acceptable_attribute_map
46
+ attribute_map
47
+ end
48
+
49
+ # Returns all the JSON keys this model knows about
50
+ def self.acceptable_attributes
51
+ acceptable_attribute_map.values
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'deployment' => :'String',
58
+ :'variant' => :'String',
59
+ :'inputs' => :'Hash<String, Object>',
60
+ :'streaming' => :'Boolean',
61
+ :'user' => :'String'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FetchHive::Generated::InvokePromptRequest` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ acceptable_attribute_map = self.class.acceptable_attribute_map
80
+ attributes = attributes.each_with_object({}) { |(k, v), h|
81
+ if (!acceptable_attribute_map.key?(k.to_sym))
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FetchHive::Generated::InvokePromptRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
83
+ end
84
+ h[k.to_sym] = v
85
+ }
86
+
87
+ if attributes.key?(:'deployment')
88
+ self.deployment = attributes[:'deployment']
89
+ else
90
+ self.deployment = nil
91
+ end
92
+
93
+ if attributes.key?(:'variant')
94
+ self.variant = attributes[:'variant']
95
+ else
96
+ self.variant = ''
97
+ end
98
+
99
+ if attributes.key?(:'inputs')
100
+ if (value = attributes[:'inputs']).is_a?(Hash)
101
+ self.inputs = value
102
+ end
103
+ end
104
+
105
+ if attributes.key?(:'streaming')
106
+ self.streaming = attributes[:'streaming']
107
+ else
108
+ self.streaming = false
109
+ end
110
+
111
+ if attributes.key?(:'user')
112
+ self.user = attributes[:'user']
113
+ end
114
+ end
115
+
116
+ # Show invalid properties with the reasons. Usually used together with valid?
117
+ # @return Array for valid properties with the reasons
118
+ def list_invalid_properties
119
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
120
+ invalid_properties = Array.new
121
+ if @deployment.nil?
122
+ invalid_properties.push('invalid value for "deployment", deployment cannot be nil.')
123
+ end
124
+
125
+ invalid_properties
126
+ end
127
+
128
+ # Check to see if the all the properties in the model are valid
129
+ # @return true if the model is valid
130
+ def valid?
131
+ warn '[DEPRECATED] the `valid?` method is obsolete'
132
+ return false if @deployment.nil?
133
+ true
134
+ end
135
+
136
+ # Custom attribute writer method with validation
137
+ # @param [Object] deployment Value to be assigned
138
+ def deployment=(deployment)
139
+ if deployment.nil?
140
+ fail ArgumentError, 'deployment cannot be nil'
141
+ end
142
+
143
+ @deployment = deployment
144
+ end
145
+
146
+ # Checks equality by comparing each attribute.
147
+ # @param [Object] Object to be compared
148
+ def ==(o)
149
+ return true if self.equal?(o)
150
+ self.class == o.class &&
151
+ deployment == o.deployment &&
152
+ variant == o.variant &&
153
+ inputs == o.inputs &&
154
+ streaming == o.streaming &&
155
+ user == o.user
156
+ end
157
+
158
+ # @see the `==` method
159
+ # @param [Object] Object to be compared
160
+ def eql?(o)
161
+ self == o
162
+ end
163
+
164
+ # Calculates hash code according to all attributes.
165
+ # @return [Integer] Hash code
166
+ def hash
167
+ [deployment, variant, inputs, streaming, user].hash
168
+ end
169
+
170
+ # Builds the object from hash
171
+ # @param [Hash] attributes Model attributes in the form of hash
172
+ # @return [Object] Returns the model itself
173
+ def self.build_from_hash(attributes)
174
+ return nil unless attributes.is_a?(Hash)
175
+ attributes = attributes.transform_keys(&:to_sym)
176
+ transformed_hash = {}
177
+ openapi_types.each_pair do |key, type|
178
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
179
+ transformed_hash["#{key}"] = nil
180
+ elsif type =~ /\AArray<(.*)>/i
181
+ # check to ensure the input is an array given that the attribute
182
+ # is documented as an array but the input is not
183
+ if attributes[attribute_map[key]].is_a?(Array)
184
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
185
+ end
186
+ elsif !attributes[attribute_map[key]].nil?
187
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
188
+ end
189
+ end
190
+ new(transformed_hash)
191
+ end
192
+
193
+ # Returns the object in the form of hash
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_hash
196
+ hash = {}
197
+ self.class.attribute_map.each_pair do |attr, param|
198
+ value = self.send(attr)
199
+ if value.nil?
200
+ is_nullable = self.class.openapi_nullable.include?(attr)
201
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
202
+ end
203
+
204
+ hash[param] = _to_hash(value)
205
+ end
206
+ hash
207
+ end
208
+
209
+ end
210
+
211
+ end
@@ -0,0 +1,177 @@
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 InvokePromptResponse < ApiModelBase
18
+ # Unique identifier for this invocation.
19
+ attr_accessor :request_id
20
+
21
+ # The model's text response. For streaming requests this field is absent; content arrives as `SseChunk` events instead.
22
+ attr_accessor :response
23
+
24
+ # Model identifier used for this invocation.
25
+ attr_accessor :model
26
+
27
+ attr_accessor :usage
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'request_id' => :'request_id',
33
+ :'response' => :'response',
34
+ :'model' => :'model',
35
+ :'usage' => :'usage'
36
+ }
37
+ end
38
+
39
+ # Returns attribute mapping this model knows about
40
+ def self.acceptable_attribute_map
41
+ attribute_map
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ acceptable_attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'request_id' => :'String',
53
+ :'response' => :'String',
54
+ :'model' => :'String',
55
+ :'usage' => :'TokenUsage'
56
+ }
57
+ end
58
+
59
+ # List of attributes with nullable: true
60
+ def self.openapi_nullable
61
+ Set.new([
62
+ ])
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ if (!attributes.is_a?(Hash))
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FetchHive::Generated::InvokePromptResponse` initialize method"
70
+ end
71
+
72
+ # check to see if the attribute exists and convert string to symbol for hash key
73
+ acceptable_attribute_map = self.class.acceptable_attribute_map
74
+ attributes = attributes.each_with_object({}) { |(k, v), h|
75
+ if (!acceptable_attribute_map.key?(k.to_sym))
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FetchHive::Generated::InvokePromptResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+ if attributes.key?(:'request_id')
82
+ self.request_id = attributes[:'request_id']
83
+ end
84
+
85
+ if attributes.key?(:'response')
86
+ self.response = attributes[:'response']
87
+ end
88
+
89
+ if attributes.key?(:'model')
90
+ self.model = attributes[:'model']
91
+ end
92
+
93
+ if attributes.key?(:'usage')
94
+ self.usage = attributes[:'usage']
95
+ end
96
+ end
97
+
98
+ # Show invalid properties with the reasons. Usually used together with valid?
99
+ # @return Array for valid properties with the reasons
100
+ def list_invalid_properties
101
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
102
+ invalid_properties = Array.new
103
+ invalid_properties
104
+ end
105
+
106
+ # Check to see if the all the properties in the model are valid
107
+ # @return true if the model is valid
108
+ def valid?
109
+ warn '[DEPRECATED] the `valid?` method is obsolete'
110
+ true
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
+ request_id == o.request_id &&
119
+ response == o.response &&
120
+ model == o.model &&
121
+ usage == o.usage
122
+ end
123
+
124
+ # @see the `==` method
125
+ # @param [Object] Object to be compared
126
+ def eql?(o)
127
+ self == o
128
+ end
129
+
130
+ # Calculates hash code according to all attributes.
131
+ # @return [Integer] Hash code
132
+ def hash
133
+ [request_id, response, model, usage].hash
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def self.build_from_hash(attributes)
140
+ return nil unless attributes.is_a?(Hash)
141
+ attributes = attributes.transform_keys(&:to_sym)
142
+ transformed_hash = {}
143
+ openapi_types.each_pair do |key, type|
144
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
145
+ transformed_hash["#{key}"] = nil
146
+ elsif type =~ /\AArray<(.*)>/i
147
+ # check to ensure the input is an array given that the attribute
148
+ # is documented as an array but the input is not
149
+ if attributes[attribute_map[key]].is_a?(Array)
150
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
151
+ end
152
+ elsif !attributes[attribute_map[key]].nil?
153
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
154
+ end
155
+ end
156
+ new(transformed_hash)
157
+ end
158
+
159
+ # Returns the object in the form of hash
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_hash
162
+ hash = {}
163
+ self.class.attribute_map.each_pair do |attr, param|
164
+ value = self.send(attr)
165
+ if value.nil?
166
+ is_nullable = self.class.openapi_nullable.include?(attr)
167
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
168
+ end
169
+
170
+ hash[param] = _to_hash(value)
171
+ end
172
+ hash
173
+ end
174
+
175
+ end
176
+
177
+ end