handinger 0.4.0 → 0.6.0
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 +4 -4
- data/CHANGELOG.md +21 -0
- data/README.md +20 -8
- data/lib/handinger/client.rb +1 -1
- data/lib/handinger/models/create_task.rb +41 -6
- data/lib/handinger/models/worker.rb +23 -83
- data/lib/handinger/resources/tasks.rb +5 -11
- data/lib/handinger/resources/workers.rb +3 -3
- data/lib/handinger/version.rb +1 -1
- data/lib/handinger.rb +1 -1
- data/rbi/handinger/models/create_task.rbi +69 -8
- data/rbi/handinger/models/worker.rbi +31 -158
- data/rbi/handinger/resources/tasks.rbi +10 -26
- data/rbi/handinger/resources/workers.rbi +3 -3
- data/sig/handinger/models/create_task.rbs +52 -8
- data/sig/handinger/models/worker.rbs +26 -107
- data/sig/handinger/resources/tasks.rbs +4 -7
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 03e43a5f9df9dc47be5da0cb54df3bbd3a9caa7b0f32e35981f4375b443774e4
|
|
4
|
+
data.tar.gz: 105454fa3a99cc7b62cf7241dd8dfaf72190f01f5208f171da41265cd577f8e3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8ac4f97f05e1380cffc03eccbbd7343e6cbe10d6d5c23a491f5e36a4e76c58febb0db9dbed58d627cfba60062feda20df24214fe87883f9ae10f968ac5fc65c4
|
|
7
|
+
data.tar.gz: 8b9fa07b57feebd1066bac295f738ab3bf66a239c68b6a988e895212774c5dda056fbb4a1dde66ff94d01c182a02cfd4a2da73c983d29a73665b75c06e675143
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.0 (2026-05-11)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.5.0...v0.6.0](https://github.com/Ramensoft/handinger-ruby/compare/v0.5.0...v0.6.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** api update ([7c72012](https://github.com/Ramensoft/handinger-ruby/commit/7c72012ce98e7d806881133cff1c1625a1bfcdac))
|
|
10
|
+
|
|
11
|
+
## 0.5.0 (2026-05-11)
|
|
12
|
+
|
|
13
|
+
Full Changelog: [v0.4.0...v0.5.0](https://github.com/Ramensoft/handinger-ruby/compare/v0.4.0...v0.5.0)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* Duplicate workers ([95c3bab](https://github.com/Ramensoft/handinger-ruby/commit/95c3babf3d9e97ad4d0b410f90c601e3613bdbee))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Chores
|
|
21
|
+
|
|
22
|
+
* remove custom code ([e9cece7](https://github.com/Ramensoft/handinger-ruby/commit/e9cece7ce4e8a03e89b558253048b19f2872f27a))
|
|
23
|
+
|
|
3
24
|
## 0.4.0 (2026-05-11)
|
|
4
25
|
|
|
5
26
|
Full Changelog: [v0.3.0...v0.4.0](https://github.com/Ramensoft/handinger-ruby/compare/v0.3.0...v0.4.0)
|
data/README.md
CHANGED
|
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
|
|
|
17
17
|
<!-- x-release-please-start-version -->
|
|
18
18
|
|
|
19
19
|
```ruby
|
|
20
|
-
gem "handinger", "~> 0.
|
|
20
|
+
gem "handinger", "~> 0.6.0"
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
<!-- x-release-please-end -->
|
|
@@ -32,7 +32,7 @@ handinger = Handinger::Client.new(
|
|
|
32
32
|
api_key: ENV["HANDINGER_API_KEY"] # This is the default and can be omitted
|
|
33
33
|
)
|
|
34
34
|
|
|
35
|
-
worker = handinger.tasks.create(worker_id: "wrk_vk81XUHKHG-qr4")
|
|
35
|
+
worker = handinger.tasks.create(input: "What's the weather today in Barcelona?", worker_id: "wrk_vk81XUHKHG-qr4")
|
|
36
36
|
|
|
37
37
|
puts(worker.id)
|
|
38
38
|
```
|
|
@@ -43,7 +43,7 @@ When the library is unable to connect to the API, or if the API returns a non-su
|
|
|
43
43
|
|
|
44
44
|
```ruby
|
|
45
45
|
begin
|
|
46
|
-
task = handinger.tasks.create(worker_id: "wrk_vk81XUHKHG-qr4")
|
|
46
|
+
task = handinger.tasks.create(input: "What's the weather today in Barcelona?", worker_id: "wrk_vk81XUHKHG-qr4")
|
|
47
47
|
rescue Handinger::Errors::APIConnectionError => e
|
|
48
48
|
puts("The server could not be reached")
|
|
49
49
|
puts(e.cause) # an underlying Exception, likely raised within `net/http`
|
|
@@ -86,7 +86,11 @@ handinger = Handinger::Client.new(
|
|
|
86
86
|
)
|
|
87
87
|
|
|
88
88
|
# Or, configure per-request:
|
|
89
|
-
handinger.tasks.create(
|
|
89
|
+
handinger.tasks.create(
|
|
90
|
+
input: "What's the weather today in Barcelona?",
|
|
91
|
+
worker_id: "wrk_vk81XUHKHG-qr4",
|
|
92
|
+
request_options: {max_retries: 5}
|
|
93
|
+
)
|
|
90
94
|
```
|
|
91
95
|
|
|
92
96
|
### Timeouts
|
|
@@ -100,7 +104,11 @@ handinger = Handinger::Client.new(
|
|
|
100
104
|
)
|
|
101
105
|
|
|
102
106
|
# Or, configure per-request:
|
|
103
|
-
handinger.tasks.create(
|
|
107
|
+
handinger.tasks.create(
|
|
108
|
+
input: "What's the weather today in Barcelona?",
|
|
109
|
+
worker_id: "wrk_vk81XUHKHG-qr4",
|
|
110
|
+
request_options: {timeout: 5}
|
|
111
|
+
)
|
|
104
112
|
```
|
|
105
113
|
|
|
106
114
|
On timeout, `Handinger::Errors::APITimeoutError` is raised.
|
|
@@ -132,6 +140,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete
|
|
|
132
140
|
```ruby
|
|
133
141
|
worker =
|
|
134
142
|
handinger.tasks.create(
|
|
143
|
+
input: "What's the weather today in Barcelona?",
|
|
135
144
|
worker_id: "wrk_vk81XUHKHG-qr4",
|
|
136
145
|
request_options: {
|
|
137
146
|
extra_query: {my_query_parameter: value},
|
|
@@ -178,17 +187,20 @@ This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitio
|
|
|
178
187
|
You can provide typesafe request parameters like so:
|
|
179
188
|
|
|
180
189
|
```ruby
|
|
181
|
-
handinger.tasks.create(worker_id: "wrk_vk81XUHKHG-qr4")
|
|
190
|
+
handinger.tasks.create(input: "What's the weather today in Barcelona?", worker_id: "wrk_vk81XUHKHG-qr4")
|
|
182
191
|
```
|
|
183
192
|
|
|
184
193
|
Or, equivalently:
|
|
185
194
|
|
|
186
195
|
```ruby
|
|
187
196
|
# Hashes work, but are not typesafe:
|
|
188
|
-
handinger.tasks.create(worker_id: "wrk_vk81XUHKHG-qr4")
|
|
197
|
+
handinger.tasks.create(input: "What's the weather today in Barcelona?", worker_id: "wrk_vk81XUHKHG-qr4")
|
|
189
198
|
|
|
190
199
|
# You can also splat a full Params class:
|
|
191
|
-
params = Handinger::TaskCreateParams.new(
|
|
200
|
+
params = Handinger::TaskCreateParams.new(
|
|
201
|
+
input: "What's the weather today in Barcelona?",
|
|
202
|
+
worker_id: "wrk_vk81XUHKHG-qr4"
|
|
203
|
+
)
|
|
192
204
|
handinger.tasks.create(**params)
|
|
193
205
|
```
|
|
194
206
|
|
data/lib/handinger/client.rb
CHANGED
|
@@ -57,7 +57,7 @@ module Handinger
|
|
|
57
57
|
initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY,
|
|
58
58
|
max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY
|
|
59
59
|
)
|
|
60
|
-
base_url ||= "https://
|
|
60
|
+
base_url ||= "https://handinger.com"
|
|
61
61
|
|
|
62
62
|
if api_key.nil?
|
|
63
63
|
raise ArgumentError.new("api_key is required, and can be set via environ: \"HANDINGER_API_KEY\"")
|
|
@@ -2,12 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
module Handinger
|
|
4
4
|
module Models
|
|
5
|
-
class CreateTask < Handinger::
|
|
6
|
-
# @!attribute
|
|
7
|
-
# Worker id the task belongs to.
|
|
5
|
+
class CreateTask < Handinger::Internal::Type::BaseModel
|
|
6
|
+
# @!attribute input
|
|
8
7
|
#
|
|
9
8
|
# @return [String]
|
|
10
|
-
required :
|
|
9
|
+
required :input, String
|
|
10
|
+
|
|
11
|
+
# @!attribute budget
|
|
12
|
+
#
|
|
13
|
+
# @return [Symbol, Handinger::Models::CreateTask::Budget, nil]
|
|
14
|
+
optional :budget, enum: -> { Handinger::CreateTask::Budget }
|
|
15
|
+
|
|
16
|
+
# @!attribute stream
|
|
17
|
+
#
|
|
18
|
+
# @return [Boolean, nil]
|
|
19
|
+
optional :stream, Handinger::Internal::Type::Boolean
|
|
11
20
|
|
|
12
21
|
# @!attribute task_id
|
|
13
22
|
# Optional client-provided task id. Reuse this id to add turns to an existing
|
|
@@ -16,13 +25,39 @@ module Handinger
|
|
|
16
25
|
# @return [String, nil]
|
|
17
26
|
optional :task_id, String, api_name: :taskId
|
|
18
27
|
|
|
19
|
-
# @!
|
|
28
|
+
# @!attribute worker_id
|
|
29
|
+
# Worker id the task belongs to. If omitted, a new worker is created on-the-fly
|
|
30
|
+
# using the input as instructions.
|
|
31
|
+
#
|
|
32
|
+
# @return [String, nil]
|
|
33
|
+
optional :worker_id, String, api_name: :workerId
|
|
34
|
+
|
|
35
|
+
# @!method initialize(input:, budget: nil, stream: nil, task_id: nil, worker_id: nil)
|
|
20
36
|
# Some parameter documentations has been truncated, see
|
|
21
37
|
# {Handinger::Models::CreateTask} for more details.
|
|
22
38
|
#
|
|
23
|
-
# @param
|
|
39
|
+
# @param input [String]
|
|
40
|
+
#
|
|
41
|
+
# @param budget [Symbol, Handinger::Models::CreateTask::Budget]
|
|
42
|
+
#
|
|
43
|
+
# @param stream [Boolean]
|
|
24
44
|
#
|
|
25
45
|
# @param task_id [String] Optional client-provided task id. Reuse this id to add turns to an existing task
|
|
46
|
+
#
|
|
47
|
+
# @param worker_id [String] Worker id the task belongs to. If omitted, a new worker is created on-the-fly us
|
|
48
|
+
|
|
49
|
+
# @see Handinger::Models::CreateTask#budget
|
|
50
|
+
module Budget
|
|
51
|
+
extend Handinger::Internal::Type::Enum
|
|
52
|
+
|
|
53
|
+
LOW = :low
|
|
54
|
+
STANDARD = :standard
|
|
55
|
+
HIGH = :high
|
|
56
|
+
UNLIMITED = :unlimited
|
|
57
|
+
|
|
58
|
+
# @!method self.values
|
|
59
|
+
# @return [Array<Symbol>]
|
|
60
|
+
end
|
|
26
61
|
end
|
|
27
62
|
end
|
|
28
63
|
end
|
|
@@ -41,8 +41,8 @@ module Handinger
|
|
|
41
41
|
|
|
42
42
|
# @!attribute object
|
|
43
43
|
#
|
|
44
|
-
# @return [Symbol,
|
|
45
|
-
required :object,
|
|
44
|
+
# @return [Symbol, :worker]
|
|
45
|
+
required :object, const: :worker
|
|
46
46
|
|
|
47
47
|
# @!attribute output
|
|
48
48
|
#
|
|
@@ -87,7 +87,7 @@ module Handinger
|
|
|
87
87
|
# @return [Handinger::Models::Worker::Usage, nil]
|
|
88
88
|
optional :usage, -> { Handinger::Worker::Usage }
|
|
89
89
|
|
|
90
|
-
# @!method initialize(id:, created_at:, error:, files:, incomplete_details:, messages:, metadata:,
|
|
90
|
+
# @!method initialize(id:, created_at:, error:, files:, incomplete_details:, messages:, metadata:, output:, output_text:, running:, sources:, status:, structured_output:, url:, usage: nil, object: :worker)
|
|
91
91
|
# @param id [String]
|
|
92
92
|
#
|
|
93
93
|
# @param created_at [Integer, nil]
|
|
@@ -102,8 +102,6 @@ module Handinger
|
|
|
102
102
|
#
|
|
103
103
|
# @param metadata [Hash{Symbol=>Object}]
|
|
104
104
|
#
|
|
105
|
-
# @param object [Symbol, Handinger::Models::Worker::Object]
|
|
106
|
-
#
|
|
107
105
|
# @param output [Array<Handinger::Models::Worker::Output>]
|
|
108
106
|
#
|
|
109
107
|
# @param output_text [String]
|
|
@@ -119,6 +117,8 @@ module Handinger
|
|
|
119
117
|
# @param url [String] Web URL of the worker in the Handinger dashboard.
|
|
120
118
|
#
|
|
121
119
|
# @param usage [Handinger::Models::Worker::Usage]
|
|
120
|
+
#
|
|
121
|
+
# @param object [Symbol, :worker]
|
|
122
122
|
|
|
123
123
|
class File < Handinger::Internal::Type::BaseModel
|
|
124
124
|
# @!attribute filename
|
|
@@ -142,16 +142,6 @@ module Handinger
|
|
|
142
142
|
# @param url [String]
|
|
143
143
|
end
|
|
144
144
|
|
|
145
|
-
# @see Handinger::Models::Worker#object
|
|
146
|
-
module Object
|
|
147
|
-
extend Handinger::Internal::Type::Enum
|
|
148
|
-
|
|
149
|
-
WORKER = :worker
|
|
150
|
-
|
|
151
|
-
# @!method self.values
|
|
152
|
-
# @return [Array<Symbol>]
|
|
153
|
-
end
|
|
154
|
-
|
|
155
145
|
class Output < Handinger::Internal::Type::BaseModel
|
|
156
146
|
# @!attribute id
|
|
157
147
|
#
|
|
@@ -165,25 +155,25 @@ module Handinger
|
|
|
165
155
|
|
|
166
156
|
# @!attribute role
|
|
167
157
|
#
|
|
168
|
-
# @return [Symbol,
|
|
169
|
-
required :role,
|
|
158
|
+
# @return [Symbol, :assistant]
|
|
159
|
+
required :role, const: :assistant
|
|
170
160
|
|
|
171
161
|
# @!attribute status
|
|
172
162
|
#
|
|
173
|
-
# @return [Symbol,
|
|
174
|
-
required :status,
|
|
163
|
+
# @return [Symbol, :completed]
|
|
164
|
+
required :status, const: :completed
|
|
175
165
|
|
|
176
166
|
# @!attribute type
|
|
177
167
|
#
|
|
178
|
-
# @return [Symbol,
|
|
179
|
-
required :type,
|
|
168
|
+
# @return [Symbol, :message]
|
|
169
|
+
required :type, const: :message
|
|
180
170
|
|
|
181
|
-
# @!method initialize(id:, content:, role
|
|
171
|
+
# @!method initialize(id:, content:, role: :assistant, status: :completed, type: :message)
|
|
182
172
|
# @param id [String]
|
|
183
173
|
# @param content [Array<Handinger::Models::Worker::Output::Content>]
|
|
184
|
-
# @param role [Symbol,
|
|
185
|
-
# @param status [Symbol,
|
|
186
|
-
# @param type [Symbol,
|
|
174
|
+
# @param role [Symbol, :assistant]
|
|
175
|
+
# @param status [Symbol, :completed]
|
|
176
|
+
# @param type [Symbol, :message]
|
|
187
177
|
|
|
188
178
|
class Content < Handinger::Internal::Type::BaseModel
|
|
189
179
|
# @!attribute text
|
|
@@ -193,52 +183,12 @@ module Handinger
|
|
|
193
183
|
|
|
194
184
|
# @!attribute type
|
|
195
185
|
#
|
|
196
|
-
# @return [Symbol,
|
|
197
|
-
required :type,
|
|
186
|
+
# @return [Symbol, :output_text]
|
|
187
|
+
required :type, const: :output_text
|
|
198
188
|
|
|
199
|
-
# @!method initialize(text:, type:)
|
|
189
|
+
# @!method initialize(text:, type: :output_text)
|
|
200
190
|
# @param text [String]
|
|
201
|
-
# @param type [Symbol,
|
|
202
|
-
|
|
203
|
-
# @see Handinger::Models::Worker::Output::Content#type
|
|
204
|
-
module Type
|
|
205
|
-
extend Handinger::Internal::Type::Enum
|
|
206
|
-
|
|
207
|
-
OUTPUT_TEXT = :output_text
|
|
208
|
-
|
|
209
|
-
# @!method self.values
|
|
210
|
-
# @return [Array<Symbol>]
|
|
211
|
-
end
|
|
212
|
-
end
|
|
213
|
-
|
|
214
|
-
# @see Handinger::Models::Worker::Output#role
|
|
215
|
-
module Role
|
|
216
|
-
extend Handinger::Internal::Type::Enum
|
|
217
|
-
|
|
218
|
-
ASSISTANT = :assistant
|
|
219
|
-
|
|
220
|
-
# @!method self.values
|
|
221
|
-
# @return [Array<Symbol>]
|
|
222
|
-
end
|
|
223
|
-
|
|
224
|
-
# @see Handinger::Models::Worker::Output#status
|
|
225
|
-
module Status
|
|
226
|
-
extend Handinger::Internal::Type::Enum
|
|
227
|
-
|
|
228
|
-
COMPLETED = :completed
|
|
229
|
-
|
|
230
|
-
# @!method self.values
|
|
231
|
-
# @return [Array<Symbol>]
|
|
232
|
-
end
|
|
233
|
-
|
|
234
|
-
# @see Handinger::Models::Worker::Output#type
|
|
235
|
-
module Type
|
|
236
|
-
extend Handinger::Internal::Type::Enum
|
|
237
|
-
|
|
238
|
-
MESSAGE = :message
|
|
239
|
-
|
|
240
|
-
# @!method self.values
|
|
241
|
-
# @return [Array<Symbol>]
|
|
191
|
+
# @param type [Symbol, :output_text]
|
|
242
192
|
end
|
|
243
193
|
end
|
|
244
194
|
|
|
@@ -255,29 +205,19 @@ module Handinger
|
|
|
255
205
|
|
|
256
206
|
# @!attribute type
|
|
257
207
|
#
|
|
258
|
-
# @return [Symbol,
|
|
259
|
-
required :type,
|
|
208
|
+
# @return [Symbol, :url]
|
|
209
|
+
required :type, const: :url
|
|
260
210
|
|
|
261
211
|
# @!attribute url
|
|
262
212
|
#
|
|
263
213
|
# @return [String]
|
|
264
214
|
required :url, String
|
|
265
215
|
|
|
266
|
-
# @!method initialize(id:, title:,
|
|
216
|
+
# @!method initialize(id:, title:, url:, type: :url)
|
|
267
217
|
# @param id [String]
|
|
268
218
|
# @param title [String, nil]
|
|
269
|
-
# @param type [Symbol, Handinger::Models::Worker::Source::Type]
|
|
270
219
|
# @param url [String]
|
|
271
|
-
|
|
272
|
-
# @see Handinger::Models::Worker::Source#type
|
|
273
|
-
module Type
|
|
274
|
-
extend Handinger::Internal::Type::Enum
|
|
275
|
-
|
|
276
|
-
URL = :url
|
|
277
|
-
|
|
278
|
-
# @!method self.values
|
|
279
|
-
# @return [Array<Symbol>]
|
|
280
|
-
end
|
|
220
|
+
# @param type [Symbol, :url]
|
|
281
221
|
end
|
|
282
222
|
|
|
283
223
|
# @see Handinger::Models::Worker#status
|
|
@@ -12,23 +12,17 @@ module Handinger
|
|
|
12
12
|
# `multipart/form-data` to attach files; the bytes are bootstrapped into the
|
|
13
13
|
# worker's workspace before the task starts.
|
|
14
14
|
#
|
|
15
|
-
# @overload create(
|
|
15
|
+
# @overload create(input:, budget: nil, stream: nil, task_id: nil, worker_id: nil, request_options: {})
|
|
16
16
|
#
|
|
17
|
-
# @param
|
|
17
|
+
# @param input [String]
|
|
18
18
|
#
|
|
19
|
-
# @param
|
|
19
|
+
# @param budget [Symbol, Handinger::Models::CreateTask::Budget]
|
|
20
20
|
#
|
|
21
|
-
# @param
|
|
22
|
-
#
|
|
23
|
-
# @param prompt [String] Natural-language description of the worker to use for AI-generated instructions
|
|
24
|
-
#
|
|
25
|
-
# @param summary [String] Short one-line description of the worker's purpose. Auto-generated when omitted
|
|
21
|
+
# @param stream [Boolean]
|
|
26
22
|
#
|
|
27
23
|
# @param task_id [String] Optional client-provided task id. Reuse this id to add turns to an existing task
|
|
28
24
|
#
|
|
29
|
-
# @param
|
|
30
|
-
#
|
|
31
|
-
# @param visibility [Symbol, Handinger::Models::CreateTask::Visibility] `public` (default) is visible to all org members. `private` is only visible to i
|
|
25
|
+
# @param worker_id [String] Worker id the task belongs to. If omitted, a new worker is created on-the-fly us
|
|
32
26
|
#
|
|
33
27
|
# @param request_options [Handinger::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
34
28
|
#
|
|
@@ -111,9 +111,9 @@ module Handinger
|
|
|
111
111
|
)
|
|
112
112
|
end
|
|
113
113
|
|
|
114
|
-
#
|
|
115
|
-
# schedules, and integrations
|
|
116
|
-
# creator can delete a worker.
|
|
114
|
+
# Soft-delete a worker template so it no longer appears in list or retrieve
|
|
115
|
+
# endpoints. Tasks, turns, files, schedules, and integrations remain in the
|
|
116
|
+
# database for analytics. Only the worker creator can delete a worker.
|
|
117
117
|
#
|
|
118
118
|
# @overload delete(worker_id, request_options: {})
|
|
119
119
|
#
|
data/lib/handinger/version.rb
CHANGED
data/lib/handinger.rb
CHANGED
|
@@ -52,8 +52,8 @@ require_relative "handinger/errors"
|
|
|
52
52
|
require_relative "handinger/internal/transport/base_client"
|
|
53
53
|
require_relative "handinger/internal/transport/pooled_net_requester"
|
|
54
54
|
require_relative "handinger/client"
|
|
55
|
-
require_relative "handinger/models/create_worker"
|
|
56
55
|
require_relative "handinger/models/create_task"
|
|
56
|
+
require_relative "handinger/models/create_worker"
|
|
57
57
|
require_relative "handinger/models/update_worker"
|
|
58
58
|
require_relative "handinger/models/delete_task_response"
|
|
59
59
|
require_relative "handinger/models/delete_worker_response"
|
|
@@ -2,15 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
module Handinger
|
|
4
4
|
module Models
|
|
5
|
-
class CreateTask < Handinger::
|
|
5
|
+
class CreateTask < Handinger::Internal::Type::BaseModel
|
|
6
6
|
OrHash =
|
|
7
7
|
T.type_alias do
|
|
8
8
|
T.any(Handinger::CreateTask, Handinger::Internal::AnyHash)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
# Worker id the task belongs to.
|
|
12
11
|
sig { returns(String) }
|
|
13
|
-
attr_accessor :
|
|
12
|
+
attr_accessor :input
|
|
13
|
+
|
|
14
|
+
sig { returns(T.nilable(Handinger::CreateTask::Budget::OrSymbol)) }
|
|
15
|
+
attr_reader :budget
|
|
16
|
+
|
|
17
|
+
sig { params(budget: Handinger::CreateTask::Budget::OrSymbol).void }
|
|
18
|
+
attr_writer :budget
|
|
19
|
+
|
|
20
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
21
|
+
attr_reader :stream
|
|
22
|
+
|
|
23
|
+
sig { params(stream: T::Boolean).void }
|
|
24
|
+
attr_writer :stream
|
|
14
25
|
|
|
15
26
|
# Optional client-provided task id. Reuse this id to add turns to an existing
|
|
16
27
|
# task.
|
|
@@ -20,21 +31,71 @@ module Handinger
|
|
|
20
31
|
sig { params(task_id: String).void }
|
|
21
32
|
attr_writer :task_id
|
|
22
33
|
|
|
34
|
+
# Worker id the task belongs to. If omitted, a new worker is created on-the-fly
|
|
35
|
+
# using the input as instructions.
|
|
36
|
+
sig { returns(T.nilable(String)) }
|
|
37
|
+
attr_reader :worker_id
|
|
38
|
+
|
|
39
|
+
sig { params(worker_id: String).void }
|
|
40
|
+
attr_writer :worker_id
|
|
41
|
+
|
|
23
42
|
sig do
|
|
24
|
-
params(
|
|
43
|
+
params(
|
|
44
|
+
input: String,
|
|
45
|
+
budget: Handinger::CreateTask::Budget::OrSymbol,
|
|
46
|
+
stream: T::Boolean,
|
|
47
|
+
task_id: String,
|
|
48
|
+
worker_id: String
|
|
49
|
+
).returns(T.attached_class)
|
|
25
50
|
end
|
|
26
51
|
def self.new(
|
|
27
|
-
|
|
28
|
-
|
|
52
|
+
input:,
|
|
53
|
+
budget: nil,
|
|
54
|
+
stream: nil,
|
|
29
55
|
# Optional client-provided task id. Reuse this id to add turns to an existing
|
|
30
56
|
# task.
|
|
31
|
-
task_id: nil
|
|
57
|
+
task_id: nil,
|
|
58
|
+
# Worker id the task belongs to. If omitted, a new worker is created on-the-fly
|
|
59
|
+
# using the input as instructions.
|
|
60
|
+
worker_id: nil
|
|
32
61
|
)
|
|
33
62
|
end
|
|
34
63
|
|
|
35
|
-
sig
|
|
64
|
+
sig do
|
|
65
|
+
override.returns(
|
|
66
|
+
{
|
|
67
|
+
input: String,
|
|
68
|
+
budget: Handinger::CreateTask::Budget::OrSymbol,
|
|
69
|
+
stream: T::Boolean,
|
|
70
|
+
task_id: String,
|
|
71
|
+
worker_id: String
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
end
|
|
36
75
|
def to_hash
|
|
37
76
|
end
|
|
77
|
+
|
|
78
|
+
module Budget
|
|
79
|
+
extend Handinger::Internal::Type::Enum
|
|
80
|
+
|
|
81
|
+
TaggedSymbol =
|
|
82
|
+
T.type_alias { T.all(Symbol, Handinger::CreateTask::Budget) }
|
|
83
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
84
|
+
|
|
85
|
+
LOW = T.let(:low, Handinger::CreateTask::Budget::TaggedSymbol)
|
|
86
|
+
STANDARD = T.let(:standard, Handinger::CreateTask::Budget::TaggedSymbol)
|
|
87
|
+
HIGH = T.let(:high, Handinger::CreateTask::Budget::TaggedSymbol)
|
|
88
|
+
UNLIMITED =
|
|
89
|
+
T.let(:unlimited, Handinger::CreateTask::Budget::TaggedSymbol)
|
|
90
|
+
|
|
91
|
+
sig do
|
|
92
|
+
override.returns(
|
|
93
|
+
T::Array[Handinger::CreateTask::Budget::TaggedSymbol]
|
|
94
|
+
)
|
|
95
|
+
end
|
|
96
|
+
def self.values
|
|
97
|
+
end
|
|
98
|
+
end
|
|
38
99
|
end
|
|
39
100
|
end
|
|
40
101
|
end
|
|
@@ -27,7 +27,7 @@ module Handinger
|
|
|
27
27
|
sig { returns(T::Hash[Symbol, T.anything]) }
|
|
28
28
|
attr_accessor :metadata
|
|
29
29
|
|
|
30
|
-
sig { returns(
|
|
30
|
+
sig { returns(Symbol) }
|
|
31
31
|
attr_accessor :object
|
|
32
32
|
|
|
33
33
|
sig { returns(T::Array[Handinger::Worker::Output]) }
|
|
@@ -67,7 +67,6 @@ module Handinger
|
|
|
67
67
|
incomplete_details: NilClass,
|
|
68
68
|
messages: T::Array[T.anything],
|
|
69
69
|
metadata: T::Hash[Symbol, T.anything],
|
|
70
|
-
object: Handinger::Worker::Object::OrSymbol,
|
|
71
70
|
output: T::Array[Handinger::Worker::Output::OrHash],
|
|
72
71
|
output_text: String,
|
|
73
72
|
running: T::Boolean,
|
|
@@ -75,7 +74,8 @@ module Handinger
|
|
|
75
74
|
status: Handinger::Worker::Status::OrSymbol,
|
|
76
75
|
structured_output: T.nilable(T::Hash[Symbol, T.anything]),
|
|
77
76
|
url: String,
|
|
78
|
-
usage: Handinger::Worker::Usage::OrHash
|
|
77
|
+
usage: Handinger::Worker::Usage::OrHash,
|
|
78
|
+
object: Symbol
|
|
79
79
|
).returns(T.attached_class)
|
|
80
80
|
end
|
|
81
81
|
def self.new(
|
|
@@ -86,7 +86,6 @@ module Handinger
|
|
|
86
86
|
incomplete_details:,
|
|
87
87
|
messages:,
|
|
88
88
|
metadata:,
|
|
89
|
-
object:,
|
|
90
89
|
output:,
|
|
91
90
|
output_text:,
|
|
92
91
|
running:,
|
|
@@ -95,7 +94,8 @@ module Handinger
|
|
|
95
94
|
structured_output:,
|
|
96
95
|
# Web URL of the worker in the Handinger dashboard.
|
|
97
96
|
url:,
|
|
98
|
-
usage: nil
|
|
97
|
+
usage: nil,
|
|
98
|
+
object: :worker
|
|
99
99
|
)
|
|
100
100
|
end
|
|
101
101
|
|
|
@@ -109,7 +109,7 @@ module Handinger
|
|
|
109
109
|
incomplete_details: NilClass,
|
|
110
110
|
messages: T::Array[T.anything],
|
|
111
111
|
metadata: T::Hash[Symbol, T.anything],
|
|
112
|
-
object:
|
|
112
|
+
object: Symbol,
|
|
113
113
|
output: T::Array[Handinger::Worker::Output],
|
|
114
114
|
output_text: String,
|
|
115
115
|
running: T::Boolean,
|
|
@@ -158,21 +158,6 @@ module Handinger
|
|
|
158
158
|
end
|
|
159
159
|
end
|
|
160
160
|
|
|
161
|
-
module Object
|
|
162
|
-
extend Handinger::Internal::Type::Enum
|
|
163
|
-
|
|
164
|
-
TaggedSymbol = T.type_alias { T.all(Symbol, Handinger::Worker::Object) }
|
|
165
|
-
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
166
|
-
|
|
167
|
-
WORKER = T.let(:worker, Handinger::Worker::Object::TaggedSymbol)
|
|
168
|
-
|
|
169
|
-
sig do
|
|
170
|
-
override.returns(T::Array[Handinger::Worker::Object::TaggedSymbol])
|
|
171
|
-
end
|
|
172
|
-
def self.values
|
|
173
|
-
end
|
|
174
|
-
end
|
|
175
|
-
|
|
176
161
|
class Output < Handinger::Internal::Type::BaseModel
|
|
177
162
|
OrHash =
|
|
178
163
|
T.type_alias do
|
|
@@ -185,25 +170,31 @@ module Handinger
|
|
|
185
170
|
sig { returns(T::Array[Handinger::Worker::Output::Content]) }
|
|
186
171
|
attr_accessor :content
|
|
187
172
|
|
|
188
|
-
sig { returns(
|
|
173
|
+
sig { returns(Symbol) }
|
|
189
174
|
attr_accessor :role
|
|
190
175
|
|
|
191
|
-
sig { returns(
|
|
176
|
+
sig { returns(Symbol) }
|
|
192
177
|
attr_accessor :status
|
|
193
178
|
|
|
194
|
-
sig { returns(
|
|
179
|
+
sig { returns(Symbol) }
|
|
195
180
|
attr_accessor :type
|
|
196
181
|
|
|
197
182
|
sig do
|
|
198
183
|
params(
|
|
199
184
|
id: String,
|
|
200
185
|
content: T::Array[Handinger::Worker::Output::Content::OrHash],
|
|
201
|
-
role:
|
|
202
|
-
status:
|
|
203
|
-
type:
|
|
186
|
+
role: Symbol,
|
|
187
|
+
status: Symbol,
|
|
188
|
+
type: Symbol
|
|
204
189
|
).returns(T.attached_class)
|
|
205
190
|
end
|
|
206
|
-
def self.new(
|
|
191
|
+
def self.new(
|
|
192
|
+
id:,
|
|
193
|
+
content:,
|
|
194
|
+
role: :assistant,
|
|
195
|
+
status: :completed,
|
|
196
|
+
type: :message
|
|
197
|
+
)
|
|
207
198
|
end
|
|
208
199
|
|
|
209
200
|
sig do
|
|
@@ -211,9 +202,9 @@ module Handinger
|
|
|
211
202
|
{
|
|
212
203
|
id: String,
|
|
213
204
|
content: T::Array[Handinger::Worker::Output::Content],
|
|
214
|
-
role:
|
|
215
|
-
status:
|
|
216
|
-
type:
|
|
205
|
+
role: Symbol,
|
|
206
|
+
status: Symbol,
|
|
207
|
+
type: Symbol
|
|
217
208
|
}
|
|
218
209
|
)
|
|
219
210
|
end
|
|
@@ -232,111 +223,16 @@ module Handinger
|
|
|
232
223
|
sig { returns(String) }
|
|
233
224
|
attr_accessor :text
|
|
234
225
|
|
|
235
|
-
sig
|
|
236
|
-
returns(Handinger::Worker::Output::Content::Type::TaggedSymbol)
|
|
237
|
-
end
|
|
226
|
+
sig { returns(Symbol) }
|
|
238
227
|
attr_accessor :type
|
|
239
228
|
|
|
240
|
-
sig
|
|
241
|
-
|
|
242
|
-
text: String,
|
|
243
|
-
type: Handinger::Worker::Output::Content::Type::OrSymbol
|
|
244
|
-
).returns(T.attached_class)
|
|
245
|
-
end
|
|
246
|
-
def self.new(text:, type:)
|
|
229
|
+
sig { params(text: String, type: Symbol).returns(T.attached_class) }
|
|
230
|
+
def self.new(text:, type: :output_text)
|
|
247
231
|
end
|
|
248
232
|
|
|
249
|
-
sig
|
|
250
|
-
override.returns(
|
|
251
|
-
{
|
|
252
|
-
text: String,
|
|
253
|
-
type: Handinger::Worker::Output::Content::Type::TaggedSymbol
|
|
254
|
-
}
|
|
255
|
-
)
|
|
256
|
-
end
|
|
233
|
+
sig { override.returns({ text: String, type: Symbol }) }
|
|
257
234
|
def to_hash
|
|
258
235
|
end
|
|
259
|
-
|
|
260
|
-
module Type
|
|
261
|
-
extend Handinger::Internal::Type::Enum
|
|
262
|
-
|
|
263
|
-
TaggedSymbol =
|
|
264
|
-
T.type_alias do
|
|
265
|
-
T.all(Symbol, Handinger::Worker::Output::Content::Type)
|
|
266
|
-
end
|
|
267
|
-
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
268
|
-
|
|
269
|
-
OUTPUT_TEXT =
|
|
270
|
-
T.let(
|
|
271
|
-
:output_text,
|
|
272
|
-
Handinger::Worker::Output::Content::Type::TaggedSymbol
|
|
273
|
-
)
|
|
274
|
-
|
|
275
|
-
sig do
|
|
276
|
-
override.returns(
|
|
277
|
-
T::Array[Handinger::Worker::Output::Content::Type::TaggedSymbol]
|
|
278
|
-
)
|
|
279
|
-
end
|
|
280
|
-
def self.values
|
|
281
|
-
end
|
|
282
|
-
end
|
|
283
|
-
end
|
|
284
|
-
|
|
285
|
-
module Role
|
|
286
|
-
extend Handinger::Internal::Type::Enum
|
|
287
|
-
|
|
288
|
-
TaggedSymbol =
|
|
289
|
-
T.type_alias { T.all(Symbol, Handinger::Worker::Output::Role) }
|
|
290
|
-
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
291
|
-
|
|
292
|
-
ASSISTANT =
|
|
293
|
-
T.let(:assistant, Handinger::Worker::Output::Role::TaggedSymbol)
|
|
294
|
-
|
|
295
|
-
sig do
|
|
296
|
-
override.returns(
|
|
297
|
-
T::Array[Handinger::Worker::Output::Role::TaggedSymbol]
|
|
298
|
-
)
|
|
299
|
-
end
|
|
300
|
-
def self.values
|
|
301
|
-
end
|
|
302
|
-
end
|
|
303
|
-
|
|
304
|
-
module Status
|
|
305
|
-
extend Handinger::Internal::Type::Enum
|
|
306
|
-
|
|
307
|
-
TaggedSymbol =
|
|
308
|
-
T.type_alias { T.all(Symbol, Handinger::Worker::Output::Status) }
|
|
309
|
-
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
310
|
-
|
|
311
|
-
COMPLETED =
|
|
312
|
-
T.let(:completed, Handinger::Worker::Output::Status::TaggedSymbol)
|
|
313
|
-
|
|
314
|
-
sig do
|
|
315
|
-
override.returns(
|
|
316
|
-
T::Array[Handinger::Worker::Output::Status::TaggedSymbol]
|
|
317
|
-
)
|
|
318
|
-
end
|
|
319
|
-
def self.values
|
|
320
|
-
end
|
|
321
|
-
end
|
|
322
|
-
|
|
323
|
-
module Type
|
|
324
|
-
extend Handinger::Internal::Type::Enum
|
|
325
|
-
|
|
326
|
-
TaggedSymbol =
|
|
327
|
-
T.type_alias { T.all(Symbol, Handinger::Worker::Output::Type) }
|
|
328
|
-
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
329
|
-
|
|
330
|
-
MESSAGE =
|
|
331
|
-
T.let(:message, Handinger::Worker::Output::Type::TaggedSymbol)
|
|
332
|
-
|
|
333
|
-
sig do
|
|
334
|
-
override.returns(
|
|
335
|
-
T::Array[Handinger::Worker::Output::Type::TaggedSymbol]
|
|
336
|
-
)
|
|
337
|
-
end
|
|
338
|
-
def self.values
|
|
339
|
-
end
|
|
340
236
|
end
|
|
341
237
|
end
|
|
342
238
|
|
|
@@ -352,7 +248,7 @@ module Handinger
|
|
|
352
248
|
sig { returns(T.nilable(String)) }
|
|
353
249
|
attr_accessor :title
|
|
354
250
|
|
|
355
|
-
sig { returns(
|
|
251
|
+
sig { returns(Symbol) }
|
|
356
252
|
attr_accessor :type
|
|
357
253
|
|
|
358
254
|
sig { returns(String) }
|
|
@@ -362,43 +258,20 @@ module Handinger
|
|
|
362
258
|
params(
|
|
363
259
|
id: String,
|
|
364
260
|
title: T.nilable(String),
|
|
365
|
-
|
|
366
|
-
|
|
261
|
+
url: String,
|
|
262
|
+
type: Symbol
|
|
367
263
|
).returns(T.attached_class)
|
|
368
264
|
end
|
|
369
|
-
def self.new(id:, title:,
|
|
265
|
+
def self.new(id:, title:, url:, type: :url)
|
|
370
266
|
end
|
|
371
267
|
|
|
372
268
|
sig do
|
|
373
269
|
override.returns(
|
|
374
|
-
{
|
|
375
|
-
id: String,
|
|
376
|
-
title: T.nilable(String),
|
|
377
|
-
type: Handinger::Worker::Source::Type::TaggedSymbol,
|
|
378
|
-
url: String
|
|
379
|
-
}
|
|
270
|
+
{ id: String, title: T.nilable(String), type: Symbol, url: String }
|
|
380
271
|
)
|
|
381
272
|
end
|
|
382
273
|
def to_hash
|
|
383
274
|
end
|
|
384
|
-
|
|
385
|
-
module Type
|
|
386
|
-
extend Handinger::Internal::Type::Enum
|
|
387
|
-
|
|
388
|
-
TaggedSymbol =
|
|
389
|
-
T.type_alias { T.all(Symbol, Handinger::Worker::Source::Type) }
|
|
390
|
-
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
391
|
-
|
|
392
|
-
URL = T.let(:url, Handinger::Worker::Source::Type::TaggedSymbol)
|
|
393
|
-
|
|
394
|
-
sig do
|
|
395
|
-
override.returns(
|
|
396
|
-
T::Array[Handinger::Worker::Source::Type::TaggedSymbol]
|
|
397
|
-
)
|
|
398
|
-
end
|
|
399
|
-
def self.values
|
|
400
|
-
end
|
|
401
|
-
end
|
|
402
275
|
end
|
|
403
276
|
|
|
404
277
|
module Status
|
|
@@ -10,40 +10,24 @@ module Handinger
|
|
|
10
10
|
# worker's workspace before the task starts.
|
|
11
11
|
sig do
|
|
12
12
|
params(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
prompt: String,
|
|
17
|
-
summary: String,
|
|
13
|
+
input: String,
|
|
14
|
+
budget: Handinger::CreateTask::Budget::OrSymbol,
|
|
15
|
+
stream: T::Boolean,
|
|
18
16
|
task_id: String,
|
|
19
|
-
|
|
20
|
-
visibility: Handinger::CreateTask::Visibility::OrSymbol,
|
|
17
|
+
worker_id: String,
|
|
21
18
|
request_options: Handinger::RequestOptions::OrHash
|
|
22
19
|
).returns(Handinger::Worker)
|
|
23
20
|
end
|
|
24
21
|
def create(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
instructions: nil,
|
|
29
|
-
# Optional JSON Schema (Draft-07) describing the structured object the worker must
|
|
30
|
-
# produce. When set, every task response is validated against the schema and
|
|
31
|
-
# exposed as `structuredOutput`.
|
|
32
|
-
output_schema: nil,
|
|
33
|
-
# Natural-language description of the worker to use for AI-generated instructions
|
|
34
|
-
# when `instructions` is omitted.
|
|
35
|
-
prompt: nil,
|
|
36
|
-
# Short one-line description of the worker's purpose. Auto-generated when omitted
|
|
37
|
-
# and a `prompt` is provided.
|
|
38
|
-
summary: nil,
|
|
22
|
+
input:,
|
|
23
|
+
budget: nil,
|
|
24
|
+
stream: nil,
|
|
39
25
|
# Optional client-provided task id. Reuse this id to add turns to an existing
|
|
40
26
|
# task.
|
|
41
27
|
task_id: nil,
|
|
42
|
-
#
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
# invited members.
|
|
46
|
-
visibility: nil,
|
|
28
|
+
# Worker id the task belongs to. If omitted, a new worker is created on-the-fly
|
|
29
|
+
# using the input as instructions.
|
|
30
|
+
worker_id: nil,
|
|
47
31
|
request_options: {}
|
|
48
32
|
)
|
|
49
33
|
end
|
|
@@ -98,9 +98,9 @@ module Handinger
|
|
|
98
98
|
)
|
|
99
99
|
end
|
|
100
100
|
|
|
101
|
-
#
|
|
102
|
-
# schedules, and integrations
|
|
103
|
-
# creator can delete a worker.
|
|
101
|
+
# Soft-delete a worker template so it no longer appears in list or retrieve
|
|
102
|
+
# endpoints. Tasks, turns, files, schedules, and integrations remain in the
|
|
103
|
+
# database for analytics. Only the worker creator can delete a worker.
|
|
104
104
|
sig do
|
|
105
105
|
params(
|
|
106
106
|
worker_id: String,
|
|
@@ -1,19 +1,63 @@
|
|
|
1
1
|
module Handinger
|
|
2
2
|
module Models
|
|
3
|
-
type create_task =
|
|
3
|
+
type create_task =
|
|
4
|
+
{
|
|
5
|
+
input: String,
|
|
6
|
+
budget: Handinger::Models::CreateTask::budget,
|
|
7
|
+
stream: bool,
|
|
8
|
+
task_id: String,
|
|
9
|
+
worker_id: String
|
|
10
|
+
}
|
|
4
11
|
|
|
5
|
-
class CreateTask < Handinger::
|
|
6
|
-
|
|
12
|
+
class CreateTask < Handinger::Internal::Type::BaseModel
|
|
13
|
+
attr_accessor input: String
|
|
7
14
|
|
|
8
|
-
|
|
15
|
+
attr_reader budget: Handinger::Models::CreateTask::budget?
|
|
9
16
|
|
|
10
|
-
def
|
|
17
|
+
def budget=: (
|
|
18
|
+
Handinger::Models::CreateTask::budget
|
|
19
|
+
) -> Handinger::Models::CreateTask::budget
|
|
11
20
|
|
|
12
|
-
|
|
21
|
+
attr_reader stream: bool?
|
|
13
22
|
|
|
14
|
-
def
|
|
23
|
+
def stream=: (bool) -> bool
|
|
15
24
|
|
|
16
|
-
|
|
25
|
+
attr_reader task_id: String?
|
|
26
|
+
|
|
27
|
+
def task_id=: (String) -> String
|
|
28
|
+
|
|
29
|
+
attr_reader worker_id: String?
|
|
30
|
+
|
|
31
|
+
def worker_id=: (String) -> String
|
|
32
|
+
|
|
33
|
+
def initialize: (
|
|
34
|
+
input: String,
|
|
35
|
+
?budget: Handinger::Models::CreateTask::budget,
|
|
36
|
+
?stream: bool,
|
|
37
|
+
?task_id: String,
|
|
38
|
+
?worker_id: String
|
|
39
|
+
) -> void
|
|
40
|
+
|
|
41
|
+
def to_hash: -> {
|
|
42
|
+
input: String,
|
|
43
|
+
budget: Handinger::Models::CreateTask::budget,
|
|
44
|
+
stream: bool,
|
|
45
|
+
task_id: String,
|
|
46
|
+
worker_id: String
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
type budget = :low | :standard | :high | :unlimited
|
|
50
|
+
|
|
51
|
+
module Budget
|
|
52
|
+
extend Handinger::Internal::Type::Enum
|
|
53
|
+
|
|
54
|
+
LOW: :low
|
|
55
|
+
STANDARD: :standard
|
|
56
|
+
HIGH: :high
|
|
57
|
+
UNLIMITED: :unlimited
|
|
58
|
+
|
|
59
|
+
def self?.values: -> ::Array[Handinger::Models::CreateTask::budget]
|
|
60
|
+
end
|
|
17
61
|
end
|
|
18
62
|
end
|
|
19
63
|
end
|
|
@@ -9,7 +9,7 @@ module Handinger
|
|
|
9
9
|
incomplete_details: nil,
|
|
10
10
|
messages: ::Array[top],
|
|
11
11
|
metadata: ::Hash[Symbol, top],
|
|
12
|
-
object:
|
|
12
|
+
object: :worker,
|
|
13
13
|
output: ::Array[Handinger::Worker::Output],
|
|
14
14
|
output_text: String,
|
|
15
15
|
running: bool,
|
|
@@ -35,7 +35,7 @@ module Handinger
|
|
|
35
35
|
|
|
36
36
|
attr_accessor metadata: ::Hash[Symbol, top]
|
|
37
37
|
|
|
38
|
-
attr_accessor object:
|
|
38
|
+
attr_accessor object: :worker
|
|
39
39
|
|
|
40
40
|
attr_accessor output: ::Array[Handinger::Worker::Output]
|
|
41
41
|
|
|
@@ -63,7 +63,6 @@ module Handinger
|
|
|
63
63
|
incomplete_details: nil,
|
|
64
64
|
messages: ::Array[top],
|
|
65
65
|
metadata: ::Hash[Symbol, top],
|
|
66
|
-
object: Handinger::Models::Worker::object,
|
|
67
66
|
output: ::Array[Handinger::Worker::Output],
|
|
68
67
|
output_text: String,
|
|
69
68
|
running: bool,
|
|
@@ -71,7 +70,8 @@ module Handinger
|
|
|
71
70
|
status: Handinger::Models::Worker::status,
|
|
72
71
|
structured_output: ::Hash[Symbol, top]?,
|
|
73
72
|
url: String,
|
|
74
|
-
?usage: Handinger::Worker::Usage
|
|
73
|
+
?usage: Handinger::Worker::Usage,
|
|
74
|
+
?object: :worker
|
|
75
75
|
) -> void
|
|
76
76
|
|
|
77
77
|
def to_hash: -> {
|
|
@@ -82,7 +82,7 @@ module Handinger
|
|
|
82
82
|
incomplete_details: nil,
|
|
83
83
|
messages: ::Array[top],
|
|
84
84
|
metadata: ::Hash[Symbol, top],
|
|
85
|
-
object:
|
|
85
|
+
object: :worker,
|
|
86
86
|
output: ::Array[Handinger::Worker::Output],
|
|
87
87
|
output_text: String,
|
|
88
88
|
running: bool,
|
|
@@ -111,23 +111,13 @@ module Handinger
|
|
|
111
111
|
def to_hash: -> { filename: String?, media_type: String, url: String }
|
|
112
112
|
end
|
|
113
113
|
|
|
114
|
-
type object = :worker
|
|
115
|
-
|
|
116
|
-
module Object
|
|
117
|
-
extend Handinger::Internal::Type::Enum
|
|
118
|
-
|
|
119
|
-
WORKER: :worker
|
|
120
|
-
|
|
121
|
-
def self?.values: -> ::Array[Handinger::Models::Worker::object]
|
|
122
|
-
end
|
|
123
|
-
|
|
124
114
|
type output =
|
|
125
115
|
{
|
|
126
116
|
id: String,
|
|
127
117
|
content: ::Array[Handinger::Worker::Output::Content],
|
|
128
|
-
role:
|
|
129
|
-
status:
|
|
130
|
-
type:
|
|
118
|
+
role: :assistant,
|
|
119
|
+
status: :completed,
|
|
120
|
+
type: :message
|
|
131
121
|
}
|
|
132
122
|
|
|
133
123
|
class Output < Handinger::Internal::Type::BaseModel
|
|
@@ -135,131 +125,60 @@ module Handinger
|
|
|
135
125
|
|
|
136
126
|
attr_accessor content: ::Array[Handinger::Worker::Output::Content]
|
|
137
127
|
|
|
138
|
-
attr_accessor role:
|
|
128
|
+
attr_accessor role: :assistant
|
|
139
129
|
|
|
140
|
-
attr_accessor status:
|
|
130
|
+
attr_accessor status: :completed
|
|
141
131
|
|
|
142
|
-
attr_accessor type:
|
|
132
|
+
attr_accessor type: :message
|
|
143
133
|
|
|
144
134
|
def initialize: (
|
|
145
135
|
id: String,
|
|
146
136
|
content: ::Array[Handinger::Worker::Output::Content],
|
|
147
|
-
role:
|
|
148
|
-
status:
|
|
149
|
-
type:
|
|
137
|
+
?role: :assistant,
|
|
138
|
+
?status: :completed,
|
|
139
|
+
?type: :message
|
|
150
140
|
) -> void
|
|
151
141
|
|
|
152
142
|
def to_hash: -> {
|
|
153
143
|
id: String,
|
|
154
144
|
content: ::Array[Handinger::Worker::Output::Content],
|
|
155
|
-
role:
|
|
156
|
-
status:
|
|
157
|
-
type:
|
|
145
|
+
role: :assistant,
|
|
146
|
+
status: :completed,
|
|
147
|
+
type: :message
|
|
158
148
|
}
|
|
159
149
|
|
|
160
|
-
type content =
|
|
161
|
-
{
|
|
162
|
-
text: String,
|
|
163
|
-
type: Handinger::Models::Worker::Output::Content::type_
|
|
164
|
-
}
|
|
150
|
+
type content = { text: String, type: :output_text }
|
|
165
151
|
|
|
166
152
|
class Content < Handinger::Internal::Type::BaseModel
|
|
167
153
|
attr_accessor text: String
|
|
168
154
|
|
|
169
|
-
attr_accessor type:
|
|
155
|
+
attr_accessor type: :output_text
|
|
170
156
|
|
|
171
|
-
def initialize: (
|
|
172
|
-
text: String,
|
|
173
|
-
type: Handinger::Models::Worker::Output::Content::type_
|
|
174
|
-
) -> void
|
|
157
|
+
def initialize: (text: String, ?type: :output_text) -> void
|
|
175
158
|
|
|
176
|
-
def to_hash: -> {
|
|
177
|
-
text: String,
|
|
178
|
-
type: Handinger::Models::Worker::Output::Content::type_
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
type type_ = :output_text
|
|
182
|
-
|
|
183
|
-
module Type
|
|
184
|
-
extend Handinger::Internal::Type::Enum
|
|
185
|
-
|
|
186
|
-
OUTPUT_TEXT: :output_text
|
|
187
|
-
|
|
188
|
-
def self?.values: -> ::Array[Handinger::Models::Worker::Output::Content::type_]
|
|
189
|
-
end
|
|
190
|
-
end
|
|
191
|
-
|
|
192
|
-
type role = :assistant
|
|
193
|
-
|
|
194
|
-
module Role
|
|
195
|
-
extend Handinger::Internal::Type::Enum
|
|
196
|
-
|
|
197
|
-
ASSISTANT: :assistant
|
|
198
|
-
|
|
199
|
-
def self?.values: -> ::Array[Handinger::Models::Worker::Output::role]
|
|
200
|
-
end
|
|
201
|
-
|
|
202
|
-
type status = :completed
|
|
203
|
-
|
|
204
|
-
module Status
|
|
205
|
-
extend Handinger::Internal::Type::Enum
|
|
206
|
-
|
|
207
|
-
COMPLETED: :completed
|
|
208
|
-
|
|
209
|
-
def self?.values: -> ::Array[Handinger::Models::Worker::Output::status]
|
|
210
|
-
end
|
|
211
|
-
|
|
212
|
-
type type_ = :message
|
|
213
|
-
|
|
214
|
-
module Type
|
|
215
|
-
extend Handinger::Internal::Type::Enum
|
|
216
|
-
|
|
217
|
-
MESSAGE: :message
|
|
218
|
-
|
|
219
|
-
def self?.values: -> ::Array[Handinger::Models::Worker::Output::type_]
|
|
159
|
+
def to_hash: -> { text: String, type: :output_text }
|
|
220
160
|
end
|
|
221
161
|
end
|
|
222
162
|
|
|
223
|
-
type source =
|
|
224
|
-
{
|
|
225
|
-
id: String,
|
|
226
|
-
title: String?,
|
|
227
|
-
type: Handinger::Models::Worker::Source::type_,
|
|
228
|
-
url: String
|
|
229
|
-
}
|
|
163
|
+
type source = { id: String, title: String?, type: :url, url: String }
|
|
230
164
|
|
|
231
165
|
class Source < Handinger::Internal::Type::BaseModel
|
|
232
166
|
attr_accessor id: String
|
|
233
167
|
|
|
234
168
|
attr_accessor title: String?
|
|
235
169
|
|
|
236
|
-
attr_accessor type:
|
|
170
|
+
attr_accessor type: :url
|
|
237
171
|
|
|
238
172
|
attr_accessor url: String
|
|
239
173
|
|
|
240
174
|
def initialize: (
|
|
241
175
|
id: String,
|
|
242
176
|
title: String?,
|
|
243
|
-
|
|
244
|
-
|
|
177
|
+
url: String,
|
|
178
|
+
?type: :url
|
|
245
179
|
) -> void
|
|
246
180
|
|
|
247
|
-
def to_hash: -> {
|
|
248
|
-
id: String,
|
|
249
|
-
title: String?,
|
|
250
|
-
type: Handinger::Models::Worker::Source::type_,
|
|
251
|
-
url: String
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
type type_ = :url
|
|
255
|
-
|
|
256
|
-
module Type
|
|
257
|
-
extend Handinger::Internal::Type::Enum
|
|
258
|
-
|
|
259
|
-
URL: :url
|
|
260
|
-
|
|
261
|
-
def self?.values: -> ::Array[Handinger::Models::Worker::Source::type_]
|
|
262
|
-
end
|
|
181
|
+
def to_hash: -> { id: String, title: String?, type: :url, url: String }
|
|
263
182
|
end
|
|
264
183
|
|
|
265
184
|
type status = :running | :completed | :pending
|
|
@@ -2,14 +2,11 @@ module Handinger
|
|
|
2
2
|
module Resources
|
|
3
3
|
class Tasks
|
|
4
4
|
def create: (
|
|
5
|
-
|
|
6
|
-
?
|
|
7
|
-
?
|
|
8
|
-
?prompt: String,
|
|
9
|
-
?summary: String,
|
|
5
|
+
input: String,
|
|
6
|
+
?budget: Handinger::Models::CreateTask::budget,
|
|
7
|
+
?stream: bool,
|
|
10
8
|
?task_id: String,
|
|
11
|
-
?
|
|
12
|
-
?visibility: Handinger::Models::CreateTask::visibility,
|
|
9
|
+
?worker_id: String,
|
|
13
10
|
?request_options: Handinger::request_opts
|
|
14
11
|
) -> Handinger::Worker
|
|
15
12
|
|