fetch_hive 0.2.3 → 0.2.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f27931a3ac0003f9116aa9e5d0fc8a872ace63a0514f5c700cd18df613c56d4
4
- data.tar.gz: 0ebadee4a39f04f58af432fee05f8f3398397bf806c520506f9e808e00a4edfc
3
+ metadata.gz: 42e51d3c63d74fff1f041e1e9f7071ece5a5209825f17a28084ef3d06104552b
4
+ data.tar.gz: a53eba2263d50961c429130a1fd31d02c5c2c996f8c997bb6ba0b169f1263f56
5
5
  SHA512:
6
- metadata.gz: 4c3c0e5dc156a36db4bf8fe934f8cd8d65dc4b85e56c03deddb77f10fe7e7118bbf70946ee972fe666cefd40aab9d63e5fc1c6cfb0220876939473e53fa95e45
7
- data.tar.gz: e2a222c32d2857f10030aaa90e1aefd1bae8a0cab2e9f3c1a3b0a97e526c3ffbd2473c124e81a4098b54755e0a895f3674eb1d06cd71eb2fa7185bee1a5e9e7e
6
+ metadata.gz: bf84fa42a8112466fc9fb1f7a8b4b682ce128f15b4c7377b9d2b1d7c70f690c01aa1321ad71e41905e6ae32a12d5fd917889f34f08e00090b58214eea0adf945
7
+ data.tar.gz: 983b6660e859c97b56c1584d14975a92adfe2d3c4a8e23b6c12b7bf0d7594c515511ccb200974808b2a65e2c998b175f19abdc719f4b8c92f5ab45c4d5dd1038
data/README.md CHANGED
@@ -9,7 +9,7 @@ Official Ruby SDK for [Fetch Hive](https://fetchhive.com) — invoke AI prompts,
9
9
  Add to your `Gemfile`:
10
10
 
11
11
  ```ruby
12
- gem "fetch_hive", "~> 0.2.3"
12
+ gem "fetch_hive", "~> 0.2.5"
13
13
  ```
14
14
 
15
15
  Then run:
@@ -48,7 +48,10 @@ puts result["response"]
48
48
 
49
49
  ```ruby
50
50
  client.invoke_prompt_stream(deployment: "my-prompt", inputs: { name: "Alice" }) do |chunk|
51
- print chunk["content"] if chunk["type"] == "delta"
51
+ case chunk["type"]
52
+ when "response" then print chunk["response"]
53
+ when "usage" then puts "\nUsage: #{chunk['usage']}"
54
+ end
52
55
  end
53
56
  ```
54
57
 
@@ -93,8 +96,9 @@ client.invoke_agent_stream(
93
96
  thread_id: "session-abc123" # optional — persist conversation history
94
97
  ) do |chunk|
95
98
  case chunk["type"]
96
- when "delta" then print chunk["content"]
97
- when "tool_start" then puts "\nCalling tool: #{chunk['tool_name']}"
99
+ when "response" then print chunk["response"]
100
+ when "tool" then puts "\nCalling tool: #{chunk['tool']}"
101
+ when "usage" then puts "\nUsage: #{chunk['usage']}"
98
102
  end
99
103
  end
100
104
  ```
@@ -138,7 +142,7 @@ client = FetchHive::Client.new # picks up FETCH_HIVE_API_KEY automatically
138
142
 
139
143
  ## Version
140
144
 
141
- 0.2.3
145
+ 0.2.5
142
146
 
143
147
  ## License
144
148
 
@@ -17,7 +17,11 @@ module FetchHive
17
17
  #
18
18
  # # Streaming agent
19
19
  # client.invoke_agent_stream(agent: "my-agent", message: "Hello") do |chunk|
20
- # print chunk["content"] if chunk["type"] == "delta"
20
+ # case chunk["type"]
21
+ # when "response" then print chunk["response"]
22
+ # when "tool" then puts "\nCalling tool: #{chunk['tool']}"
23
+ # when "usage" then puts "\nUsage: #{chunk['usage']}"
24
+ # end
21
25
  # end
22
26
  #
23
27
  class Client
@@ -38,32 +42,35 @@ module FetchHive
38
42
  # ── Prompt ─────────────────────────────────────────────────────────────────
39
43
 
40
44
  # Invoke a prompt deployment and return the full response hash.
41
- def invoke_prompt(deployment:, variant: nil, inputs: nil, user: nil)
45
+ def invoke_prompt(deployment:, variant: nil, inputs: nil, user: nil, metadata: nil)
42
46
  body = { deployment: deployment, streaming: false }
43
47
  body[:variant] = variant if variant
44
48
  body[:inputs] = inputs if inputs
45
49
  body[:user] = user if user
50
+ body[:metadata] = metadata if metadata
46
51
  post("/invoke", body)
47
52
  end
48
53
 
49
54
  # Invoke a prompt deployment and stream SSE events.
50
55
  # Yields each parsed event hash. Returns an Enumerator when no block given.
51
- def invoke_prompt_stream(deployment:, variant: nil, inputs: nil, user: nil, &block)
56
+ def invoke_prompt_stream(deployment:, variant: nil, inputs: nil, user: nil, metadata: nil, &block)
52
57
  body = { deployment: deployment, streaming: true }
53
58
  body[:variant] = variant if variant
54
59
  body[:inputs] = inputs if inputs
55
60
  body[:user] = user if user
61
+ body[:metadata] = metadata if metadata
56
62
  post_stream("/invoke", body, &block)
57
63
  end
58
64
 
59
65
  # ── Workflow ────────────────────────────────────────────────────────────────
60
66
 
61
67
  # Invoke a workflow deployment (sync or async).
62
- def invoke_workflow(deployment:, variant: nil, inputs: nil, async_mode: false, callback_url: nil, user: nil)
68
+ def invoke_workflow(deployment:, variant: nil, inputs: nil, async_mode: false, callback_url: nil, user: nil, metadata: nil)
63
69
  body = { deployment: deployment }
64
70
  body[:variant] = variant if variant
65
71
  body[:inputs] = inputs if inputs
66
72
  body[:user] = user if user
73
+ body[:metadata] = metadata if metadata
67
74
  if async_mode
68
75
  body[:async] = { enabled: true }
69
76
  body[:async][:callback_url] = callback_url if callback_url
@@ -74,10 +81,11 @@ module FetchHive
74
81
  # ── Agent ───────────────────────────────────────────────────────────────────
75
82
 
76
83
  # Send a message to an agent and return the full response hash.
77
- def invoke_agent(agent:, message:, thread_id: nil, user: nil, messages: nil, image_urls: nil)
84
+ def invoke_agent(agent:, message:, thread_id: nil, user: nil, metadata: nil, messages: nil, image_urls: nil)
78
85
  body = { agent: agent, message: message, streaming: false }
79
86
  body[:thread_id] = thread_id if thread_id
80
87
  body[:user] = user if user
88
+ body[:metadata] = metadata if metadata
81
89
  body[:messages] = messages if messages
82
90
  body[:image_urls] = image_urls if image_urls
83
91
  post("/agent/invoke", body)
@@ -85,10 +93,11 @@ module FetchHive
85
93
 
86
94
  # Send a message to an agent and stream SSE events.
87
95
  # Yields each parsed event hash. Returns an Enumerator when no block given.
88
- def invoke_agent_stream(agent:, message:, thread_id: nil, user: nil, messages: nil, image_urls: nil, &block)
96
+ def invoke_agent_stream(agent:, message:, thread_id: nil, user: nil, metadata: nil, messages: nil, image_urls: nil, &block)
89
97
  body = { agent: agent, message: message, streaming: true }
90
98
  body[:thread_id] = thread_id if thread_id
91
99
  body[:user] = user if user
100
+ body[:metadata] = metadata if metadata
92
101
  body[:messages] = messages if messages
93
102
  body[:image_urls] = image_urls if image_urls
94
103
  post_stream("/agent/invoke", body, &block)
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -30,6 +30,9 @@ module FetchHive::Generated
30
30
  # Optional opaque caller identifier for audit logging.
31
31
  attr_accessor :user
32
32
 
33
+ # Flat caller-defined metadata stored separately from internal metadata for log display and filtering. Keys must be non-empty strings; values must be strings, numbers, booleans, or null.
34
+ attr_accessor :metadata
35
+
33
36
  # Ephemeral conversation history supplied by the caller. Not stored in the database. Takes precedence over `thread_id` history when both are provided.
34
37
  attr_accessor :messages
35
38
 
@@ -44,6 +47,7 @@ module FetchHive::Generated
44
47
  :'thread_id' => :'thread_id',
45
48
  :'streaming' => :'streaming',
46
49
  :'user' => :'user',
50
+ :'metadata' => :'metadata',
47
51
  :'messages' => :'messages',
48
52
  :'image_urls' => :'image_urls'
49
53
  }
@@ -67,6 +71,7 @@ module FetchHive::Generated
67
71
  :'thread_id' => :'String',
68
72
  :'streaming' => :'Boolean',
69
73
  :'user' => :'String',
74
+ :'metadata' => :'Hash<String, MetadataValue>',
70
75
  :'messages' => :'Array<AgentMessage>',
71
76
  :'image_urls' => :'Array<String>'
72
77
  }
@@ -122,6 +127,12 @@ module FetchHive::Generated
122
127
  self.user = attributes[:'user']
123
128
  end
124
129
 
130
+ if attributes.key?(:'metadata')
131
+ if (value = attributes[:'metadata']).is_a?(Hash)
132
+ self.metadata = value
133
+ end
134
+ end
135
+
125
136
  if attributes.key?(:'messages')
126
137
  if (value = attributes[:'messages']).is_a?(Array)
127
138
  self.messages = value
@@ -190,6 +201,7 @@ module FetchHive::Generated
190
201
  thread_id == o.thread_id &&
191
202
  streaming == o.streaming &&
192
203
  user == o.user &&
204
+ metadata == o.metadata &&
193
205
  messages == o.messages &&
194
206
  image_urls == o.image_urls
195
207
  end
@@ -203,7 +215,7 @@ module FetchHive::Generated
203
215
  # Calculates hash code according to all attributes.
204
216
  # @return [Integer] Hash code
205
217
  def hash
206
- [message, agent, thread_id, streaming, user, messages, image_urls].hash
218
+ [message, agent, thread_id, streaming, user, metadata, messages, image_urls].hash
207
219
  end
208
220
 
209
221
  # Builds the object from hash
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -30,6 +30,9 @@ module FetchHive::Generated
30
30
  # Optional opaque caller identifier for audit logging.
31
31
  attr_accessor :user
32
32
 
33
+ # Flat caller-defined metadata stored separately from internal metadata for log display and filtering. Keys must be non-empty strings; values must be strings, numbers, booleans, or null.
34
+ attr_accessor :metadata
35
+
33
36
  # Attribute mapping from ruby-style variable name to JSON key.
34
37
  def self.attribute_map
35
38
  {
@@ -37,7 +40,8 @@ module FetchHive::Generated
37
40
  :'variant' => :'variant',
38
41
  :'inputs' => :'inputs',
39
42
  :'streaming' => :'streaming',
40
- :'user' => :'user'
43
+ :'user' => :'user',
44
+ :'metadata' => :'metadata'
41
45
  }
42
46
  end
43
47
 
@@ -58,7 +62,8 @@ module FetchHive::Generated
58
62
  :'variant' => :'String',
59
63
  :'inputs' => :'Hash<String, Object>',
60
64
  :'streaming' => :'Boolean',
61
- :'user' => :'String'
65
+ :'user' => :'String',
66
+ :'metadata' => :'Hash<String, MetadataValue>'
62
67
  }
63
68
  end
64
69
 
@@ -111,6 +116,12 @@ module FetchHive::Generated
111
116
  if attributes.key?(:'user')
112
117
  self.user = attributes[:'user']
113
118
  end
119
+
120
+ if attributes.key?(:'metadata')
121
+ if (value = attributes[:'metadata']).is_a?(Hash)
122
+ self.metadata = value
123
+ end
124
+ end
114
125
  end
115
126
 
116
127
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -152,7 +163,8 @@ module FetchHive::Generated
152
163
  variant == o.variant &&
153
164
  inputs == o.inputs &&
154
165
  streaming == o.streaming &&
155
- user == o.user
166
+ user == o.user &&
167
+ metadata == o.metadata
156
168
  end
157
169
 
158
170
  # @see the `==` method
@@ -164,7 +176,7 @@ module FetchHive::Generated
164
176
  # Calculates hash code according to all attributes.
165
177
  # @return [Integer] Hash code
166
178
  def hash
167
- [deployment, variant, inputs, streaming, user].hash
179
+ [deployment, variant, inputs, streaming, user, metadata].hash
168
180
  end
169
181
 
170
182
  # Builds the object from hash
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -29,6 +29,9 @@ module FetchHive::Generated
29
29
  # Optional opaque caller identifier for audit logging.
30
30
  attr_accessor :user
31
31
 
32
+ # Flat caller-defined metadata stored separately from internal metadata for log display and filtering. Keys must be non-empty strings; values must be strings, numbers, booleans, or null.
33
+ attr_accessor :metadata
34
+
32
35
  # Attribute mapping from ruby-style variable name to JSON key.
33
36
  def self.attribute_map
34
37
  {
@@ -36,7 +39,8 @@ module FetchHive::Generated
36
39
  :'variant' => :'variant',
37
40
  :'inputs' => :'inputs',
38
41
  :'async' => :'async',
39
- :'user' => :'user'
42
+ :'user' => :'user',
43
+ :'metadata' => :'metadata'
40
44
  }
41
45
  end
42
46
 
@@ -57,7 +61,8 @@ module FetchHive::Generated
57
61
  :'variant' => :'String',
58
62
  :'inputs' => :'Hash<String, Object>',
59
63
  :'async' => :'AsyncConfig',
60
- :'user' => :'String'
64
+ :'user' => :'String',
65
+ :'metadata' => :'Hash<String, MetadataValue>'
61
66
  }
62
67
  end
63
68
 
@@ -108,6 +113,12 @@ module FetchHive::Generated
108
113
  if attributes.key?(:'user')
109
114
  self.user = attributes[:'user']
110
115
  end
116
+
117
+ if attributes.key?(:'metadata')
118
+ if (value = attributes[:'metadata']).is_a?(Hash)
119
+ self.metadata = value
120
+ end
121
+ end
111
122
  end
112
123
 
113
124
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -149,7 +160,8 @@ module FetchHive::Generated
149
160
  variant == o.variant &&
150
161
  inputs == o.inputs &&
151
162
  async == o.async &&
152
- user == o.user
163
+ user == o.user &&
164
+ metadata == o.metadata
153
165
  end
154
166
 
155
167
  # @see the `==` method
@@ -161,7 +173,7 @@ module FetchHive::Generated
161
173
  # Calculates hash code according to all attributes.
162
174
  # @return [Integer] Hash code
163
175
  def hash
164
- [deployment, variant, inputs, async, user].hash
176
+ [deployment, variant, inputs, async, user, metadata].hash
165
177
  end
166
178
 
167
179
  # Builds the object from hash
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -0,0 +1,105 @@
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.5
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
+ module MetadataValue
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'Boolean',
23
+ :'Float',
24
+ :'String'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of oneOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
33
+ # Note:
34
+ # - We do not attempt to check whether exactly one item matches.
35
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
36
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
37
+ # - TODO: scalar values are de facto behaving as if they were nullable.
38
+ # - TODO: logging when debugging is set.
39
+ openapi_one_of.each do |klass|
40
+ begin
41
+ next if klass == :AnyType # "nullable: true"
42
+ return find_and_cast_into_type(klass, data)
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_one_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.iso8601(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = FetchHive::Generated.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+
105
+ end
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -14,30 +14,54 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module FetchHive::Generated
17
- # A single event in a Server-Sent Events stream. The type field is a runtime discriminator. Known values: delta, done, tool_start, tool_end, error.
17
+ # A single event in a Server-Sent Events stream. The `type` field is a runtime discriminator. Known values: - `reasoning` a reasoning / thinking chunk (prompt and agent streams) - `response` — a text chunk (prompt and agent streams) - `tool` — a tool invocation result (agent stream only) - `usage` — final token usage event; signals end of meaningful stream content - `summary` — auto-summarization event emitted before reasoning when a thread history was compressed (agent stream only) - `error` — server-side error during streaming The stream is terminated by `data: [DONE]`, which is handled by the SSE parser and never surfaced as a chunk.
18
18
  class SseChunk < ApiModelBase
19
19
  # Event type discriminator.
20
20
  attr_accessor :type
21
21
 
22
- # Text delta content (present for type \"delta\").
23
- attr_accessor :content
22
+ # Text content of the chunk. Present for `reasoning` and `response` event types.
23
+ attr_accessor :response
24
24
 
25
- # Present on the final \"done\" event.
25
+ # Unique request identifier. Present on most events; always present on `usage`.
26
26
  attr_accessor :request_id
27
27
 
28
- # Present on the final \"done\" event.
28
+ # Model identifier. Present on `response` and `reasoning` events (prompt stream).
29
29
  attr_accessor :model
30
30
 
31
- # Tool name (present for \"tool_start\" / \"tool_end\").
32
- attr_accessor :tool_name
31
+ # Per-chunk boolean flag on `response` and `reasoning` events (agent stream). Not a terminal event type — use the `usage` event to detect end of stream.
32
+ attr_accessor :done
33
33
 
34
- # Serialised JSON tool input (present for \"tool_start\").
34
+ # Unique tool invocation identifier. Present for `tool` events.
35
+ attr_accessor :tool_id
36
+
37
+ # Tool name. Present for `tool` events (e.g. \"google_search\").
38
+ attr_accessor :tool
39
+
40
+ # Internal tool type identifier. Present for `tool` events.
41
+ attr_accessor :tool_type
42
+
43
+ # Parsed tool input arguments. Present for `tool` events.
35
44
  attr_accessor :tool_input
36
45
 
37
- # Serialised JSON tool result (present for \"tool_end\").
46
+ # Serialised JSON tool result. Present for `tool` events.
38
47
  attr_accessor :observation
39
48
 
40
- # Error message (present for \"error\" events).
49
+ # Reason the stream ended. Present on `usage` events (e.g. \"completed\").
50
+ attr_accessor :stop_reason
51
+
52
+ # Compressed summary of the prior conversation. Present for `summary` events.
53
+ attr_accessor :summary_text
54
+
55
+ # Token count before summarization. Present for `summary` events.
56
+ attr_accessor :original_token_count
57
+
58
+ # Model context window size. Present for `summary` events.
59
+ attr_accessor :context_limit
60
+
61
+ # LLM provider used for summarization. Present for `summary` events.
62
+ attr_accessor :provider
63
+
64
+ # Error message. Present for `error` events.
41
65
  attr_accessor :error
42
66
 
43
67
  attr_accessor :usage
@@ -46,12 +70,20 @@ module FetchHive::Generated
46
70
  def self.attribute_map
47
71
  {
48
72
  :'type' => :'type',
49
- :'content' => :'content',
73
+ :'response' => :'response',
50
74
  :'request_id' => :'request_id',
51
75
  :'model' => :'model',
52
- :'tool_name' => :'tool_name',
76
+ :'done' => :'done',
77
+ :'tool_id' => :'tool_id',
78
+ :'tool' => :'tool',
79
+ :'tool_type' => :'tool_type',
53
80
  :'tool_input' => :'tool_input',
54
81
  :'observation' => :'observation',
82
+ :'stop_reason' => :'stop_reason',
83
+ :'summary_text' => :'summary_text',
84
+ :'original_token_count' => :'original_token_count',
85
+ :'context_limit' => :'context_limit',
86
+ :'provider' => :'provider',
55
87
  :'error' => :'error',
56
88
  :'usage' => :'usage'
57
89
  }
@@ -71,12 +103,20 @@ module FetchHive::Generated
71
103
  def self.openapi_types
72
104
  {
73
105
  :'type' => :'String',
74
- :'content' => :'String',
106
+ :'response' => :'String',
75
107
  :'request_id' => :'String',
76
108
  :'model' => :'String',
77
- :'tool_name' => :'String',
78
- :'tool_input' => :'String',
109
+ :'done' => :'Boolean',
110
+ :'tool_id' => :'String',
111
+ :'tool' => :'String',
112
+ :'tool_type' => :'String',
113
+ :'tool_input' => :'Hash<String, Object>',
79
114
  :'observation' => :'String',
115
+ :'stop_reason' => :'String',
116
+ :'summary_text' => :'String',
117
+ :'original_token_count' => :'Integer',
118
+ :'context_limit' => :'Integer',
119
+ :'provider' => :'String',
80
120
  :'error' => :'String',
81
121
  :'usage' => :'TokenUsage'
82
122
  }
@@ -108,8 +148,8 @@ module FetchHive::Generated
108
148
  self.type = attributes[:'type']
109
149
  end
110
150
 
111
- if attributes.key?(:'content')
112
- self.content = attributes[:'content']
151
+ if attributes.key?(:'response')
152
+ self.response = attributes[:'response']
113
153
  end
114
154
 
115
155
  if attributes.key?(:'request_id')
@@ -120,18 +160,52 @@ module FetchHive::Generated
120
160
  self.model = attributes[:'model']
121
161
  end
122
162
 
123
- if attributes.key?(:'tool_name')
124
- self.tool_name = attributes[:'tool_name']
163
+ if attributes.key?(:'done')
164
+ self.done = attributes[:'done']
165
+ end
166
+
167
+ if attributes.key?(:'tool_id')
168
+ self.tool_id = attributes[:'tool_id']
169
+ end
170
+
171
+ if attributes.key?(:'tool')
172
+ self.tool = attributes[:'tool']
173
+ end
174
+
175
+ if attributes.key?(:'tool_type')
176
+ self.tool_type = attributes[:'tool_type']
125
177
  end
126
178
 
127
179
  if attributes.key?(:'tool_input')
128
- self.tool_input = attributes[:'tool_input']
180
+ if (value = attributes[:'tool_input']).is_a?(Hash)
181
+ self.tool_input = value
182
+ end
129
183
  end
130
184
 
131
185
  if attributes.key?(:'observation')
132
186
  self.observation = attributes[:'observation']
133
187
  end
134
188
 
189
+ if attributes.key?(:'stop_reason')
190
+ self.stop_reason = attributes[:'stop_reason']
191
+ end
192
+
193
+ if attributes.key?(:'summary_text')
194
+ self.summary_text = attributes[:'summary_text']
195
+ end
196
+
197
+ if attributes.key?(:'original_token_count')
198
+ self.original_token_count = attributes[:'original_token_count']
199
+ end
200
+
201
+ if attributes.key?(:'context_limit')
202
+ self.context_limit = attributes[:'context_limit']
203
+ end
204
+
205
+ if attributes.key?(:'provider')
206
+ self.provider = attributes[:'provider']
207
+ end
208
+
135
209
  if attributes.key?(:'error')
136
210
  self.error = attributes[:'error']
137
211
  end
@@ -162,12 +236,20 @@ module FetchHive::Generated
162
236
  return true if self.equal?(o)
163
237
  self.class == o.class &&
164
238
  type == o.type &&
165
- content == o.content &&
239
+ response == o.response &&
166
240
  request_id == o.request_id &&
167
241
  model == o.model &&
168
- tool_name == o.tool_name &&
242
+ done == o.done &&
243
+ tool_id == o.tool_id &&
244
+ tool == o.tool &&
245
+ tool_type == o.tool_type &&
169
246
  tool_input == o.tool_input &&
170
247
  observation == o.observation &&
248
+ stop_reason == o.stop_reason &&
249
+ summary_text == o.summary_text &&
250
+ original_token_count == o.original_token_count &&
251
+ context_limit == o.context_limit &&
252
+ provider == o.provider &&
171
253
  error == o.error &&
172
254
  usage == o.usage
173
255
  end
@@ -181,7 +263,7 @@ module FetchHive::Generated
181
263
  # Calculates hash code according to all attributes.
182
264
  # @return [Integer] Hash code
183
265
  def hash
184
- [type, content, request_id, model, tool_name, tool_input, observation, error, usage].hash
266
+ [type, response, request_id, model, done, tool_id, tool, tool_type, tool_input, observation, stop_reason, summary_text, original_token_count, context_limit, provider, error, usage].hash
185
267
  end
186
268
 
187
269
  # Builds the object from hash
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 0.2.3
6
+ The version of the OpenAPI document: 0.2.5
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -9,7 +9,10 @@ module FetchHive
9
9
  #
10
10
  # io = response.body # any IO or string
11
11
  # FetchHive::Streaming.parse_sse(io) do |event|
12
- # puts event["content"] if event["type"] == "delta"
12
+ # case event["type"]
13
+ # when "response" then print event["response"]
14
+ # when "usage" then puts "\nUsage: #{event['usage']}"
15
+ # end
13
16
  # end
14
17
  #
15
18
  module Streaming
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fetch_hive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fetch Hive
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-05-17 00:00:00.000000000 Z
11
+ date: 2026-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -66,6 +66,7 @@ files:
66
66
  - lib/fetch_hive/generated/models/invoke_workflow_async_response.rb
67
67
  - lib/fetch_hive/generated/models/invoke_workflow_request.rb
68
68
  - lib/fetch_hive/generated/models/invoke_workflow_response.rb
69
+ - lib/fetch_hive/generated/models/metadata_value.rb
69
70
  - lib/fetch_hive/generated/models/sse_chunk.rb
70
71
  - lib/fetch_hive/generated/models/token_usage.rb
71
72
  - lib/fetch_hive/generated/models/tool_invocation.rb