-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathopenapi.yaml
633 lines (602 loc) · 18.2 KB
/
openapi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
openapi: 3.0.0
info:
title: Infernet Node API
version: 1.4.0
contact:
name: Stelios Rousoglou
email: [email protected]
license:
name: BSD-3-Clause
url: https://opensource.org/licenses/BSD-3-Clause
servers:
- url: '{baseUrl}'
variables:
baseUrl:
default: http://localhost:4000
description: Development server
paths:
/health:
get:
summary: Server health check
description: Checks if the server is healthy.
responses:
'200':
description: Server is healthy
content:
application/json:
schema:
$ref: '#/components/schemas/HealthInfo'
/info:
get:
summary: Server information
description: Returns information about the server.
responses:
'200':
description: Server information
content:
application/json:
schema:
$ref: '#/components/schemas/NodeInfo'
/resources:
get:
summary: Retrieves container resources
description: Collects hardware resources and available models for each container / service.
parameters:
- name: model_id
in: query
description: Model ID to check containers for.
required: false
schema:
type: string
responses:
'200':
description: If model_id is provided, returns support information for each container. Otherwise, returns all resources for each container.
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/ContainerToModelSupportMap'
- $ref: '#/components/schemas/ContainerToResourcesMap'
/api/jobs:
get:
summary: Retrieves job results
description: |
Fetches job results for a list of job IDs if specified. If no IDs are provided,
returns a list of all job IDs for the client, optionally filtered by their completion status.
parameters:
- name: id
in: query
description: The list of job IDs to retrieve results for.
required: false
schema:
type: array
items:
$ref: '#/components/schemas/JobID'
style: form
explode: true
- name: intermediate
in: query
description: Whether to return intermediate results (only applicable for jobs involving multiple containers).
required: false
schema:
type: boolean
default: false
- name: pending
in: query
description: Filter job IDs by their completion status. True for only pending, false for only completed, and omit for all.
required: false
schema:
type: boolean
responses:
'200':
description: Successfully retrieved job results.
content:
application/json:
schema:
type: array
items:
oneOf:
- type: array
items:
$ref: '#/components/schemas/JobResult'
- type: array
items:
$ref: '#/components/schemas/JobID'
post:
summary: Request a job
description: |
Request an asynchronous job, either onchain (via a DelegatedSubscriptionRequest) or
offchain (via a JobRequest).
requestBody:
required: true
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/JobRequest'
- $ref: '#/components/schemas/DelegatedSubscriptionRequest'
responses:
'200':
description: Job request initiated
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/JobResponse'
- $ref: '#/components/schemas/DelegatedSubscriptionResponse'
description: |
The response is either a JobResponse or a DelegatedSubscriptionResponse,
depending on the request type.
'405':
description: Guardian error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Error processing job request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/api/jobs/batch:
post:
summary: Request jobs in batch
description: Request asynchronous jobs in batch, either onchain or offchain.
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
oneOf:
- $ref: '#/components/schemas/JobRequest'
- $ref: '#/components/schemas/DelegatedSubscriptionRequest'
description: Each item in the list is either a JobRequest or a DelegatedSubscriptionRequest.
responses:
'200':
description: Batch job request initiated
content:
application/json:
schema:
type: array
items:
oneOf:
- $ref: '#/components/schemas/JobResponse'
- $ref: '#/components/schemas/DelegatedSubscriptionResponse'
- $ref: '#/components/schemas/ErrorResponse'
description: |
Each item in the list is either a JobResponse, a DelegatedSubscriptionResponse
or an ErrorResponse, in the same order as the input list.
'500':
description: Error processing batch job request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/api/jobs/stream:
post:
summary: Starts a streaming job
description: |
Sends a request to start a streaming job. The server responds with a stream
where the first message is the job ID, followed by the job output, streamed
as raw bytes.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/JobRequest'
responses:
'200':
description: Stream of job ID followed by job output.
content:
application/octet-stream:
schema:
type: string
format: binary
'405':
description: Guardian error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Error processing job request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/api/status:
put:
summary: Manually records the status of a job
description: |
Updates and records the status of a specified job. Use with caution as incorrect usage can lead to inconsistencies.
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- id
- status
- containers
- data
properties:
id:
$ref: '#/components/schemas/JobID'
status:
$ref: '#/components/schemas/JobStatus'
containers:
type: array
items:
type: string
data:
type: object
additionalProperties: true
responses:
'200':
description: The job status was recorded successfully.
components:
schemas:
HealthInfo:
type: object
properties:
status:
type: string
description: Health status of the server
enum:
- healthy
- unhealthy
ChainInfo:
type: object
description: Chain information for the node.
properties:
address:
type: string
description: The blockchain address associated with the node.
enabled:
type: boolean
description: Indicates whether the chain is enabled.
Container:
type: object
description: Container information.
properties:
id:
type: string
description: Unique identifier for the container.
description:
type: string
description: Description of the container's purpose.
external:
type: boolean
description: Flag indicating whether the container is externally accessible.
image:
type: string
description: Container image identifier.
PendingJobInfo:
type: object
description: Pending job information.
properties:
offchain:
type: integer
description: Number of pending offchain jobs.
onchain:
type: integer
description: Number of pending onchain jobs.
NodeInfo:
type: object
description: Node information.
properties:
version:
type: string
description: Node version.
chain:
$ref: '#/components/schemas/ChainInfo'
containers:
type: array
items:
$ref: '#/components/schemas/Container'
pending_jobs:
$ref: '#/components/schemas/PendingJobInfo'
ContainerOutput:
type: object
description: Container output.
properties:
container:
type: string
description: Identifier of the container.
output:
description: The output from the container, can be of any type.
type: object
additionalProperties: true
ContainerError:
type: object
description: Container error.
properties:
container:
type: string
description: Identifier of the container.
error:
type: string
description: Error message describing the failure within the container.
ContainerResult:
type: object
description: Result from a container which could either be an output or an error.
oneOf:
- $ref: '#/components/schemas/ContainerOutput'
- $ref: '#/components/schemas/ContainerError'
JobRequest:
type: object
description: Job request.
properties:
containers:
type: array
items:
type: string
description: List of container identifiers to be used in the job.
data:
type: object
additionalProperties: true
description: Arbitrary data to be processed or used by the containers.
JobID:
type: string
description: A unique identifier for a job.
JobResponse:
type: object
description: Job response for asynchronous job requests.
properties:
id:
$ref: '#/components/schemas/JobID'
JobStatus:
type: string
description: The current status of the job.
enum:
- success
- failure
- running
JobResult:
type: object
description: Result of a job request.
properties:
id:
$ref: '#/components/schemas/JobID'
status:
$ref: '#/components/schemas/JobStatus'
result:
$ref: '#/components/schemas/ContainerResult'
nullable: true
intermediate:
$ref: '#/components/schemas/ContainerResult'
nullable: true
ErrorResponse:
type: object
description: Error response.
required:
- error
properties:
error:
type: string
description: Error message explaining what went wrong.
params:
type: object
additionalProperties: true
nullable: true
description: Additional parameters to help understand the error.
Signature:
type: object
description: ECDSA signature object. See https://docs.ritual.net/infernet/sdk/reference/EIP712Coordinator for more information.
properties:
nonce:
type: integer
format: int64
expiry:
type: integer
format: int64
v:
type: integer
format: int64
r:
type: integer
format: int64
s:
type: integer
format: int64
Subscription:
type: object
description: An Infernet SDK subscription. See https://docs.ritual.net/infernet/sdk/architecture#subscriptions-in-definition for more information.
properties:
owner:
type: string
active_at:
type: integer
format: int64
period:
type: integer
format: int64
frequency:
type: integer
format: int64
redundancy:
type: integer
format: int16
max_gas_price:
type: integer
format: int64
max_gas_limit:
type: integer
format: int64
container_id:
type: string
inputs:
type: string
format: byte
DelegatedSubscriptionRequest:
type: object
description: A request to create a delegated subscription onchain.
properties:
signature:
$ref: '#/components/schemas/Signature'
subscription:
$ref: '#/components/schemas/Subscription'
data:
type: object
additionalProperties: true
DelegatedSubscriptionResponse:
type: object
description: |
Response to a delegated subscription request. Since results are obtained on-chain,
there is no offchain Job ID, thus this is empty.
additionalProperties: false
ContainerToModelSupportMap:
type: object
description: A mapping from container IDs to objects indicating model support.
additionalProperties:
type: object
properties:
supported:
type: boolean
description: Indicates if the model is supported by the container.
error:
type: string
description: Describes the error in checking the model support.
required:
- supported
MLModel:
type: object
required:
- owner
properties:
owner:
type: string
description: The organization that owns the model.
name:
type: string
description: The name of the model.
repository:
type: string
description: The repository where the model is stored.
storage:
type: string
description: The storage backend where the model is stored
files:
type: array
items:
type: string
description: List of files associated with the model.
version:
type: string
description: The version of the model.
ml_type:
type: string
description: The type of machine learning model.
ComputeCapability:
type: object
required:
- id
- type
- task
properties:
id:
type: string
description: Identifier for the compute capability.
type:
type: string
description: Type of inference service (e.g., CSS, ONNX).
task:
type: array
items:
type: string
description: List of tasks supported by the compute capability.
models:
type: array
items:
$ref: '#/components/schemas/MLModel'
description: List of models available for computation.
cached_models:
type: array
items:
$ref: '#/components/schemas/MLModel'
description: List of models that are cached for faster access.
inference_engine:
type: string
description: Inference engine used by the compute capability.
inference_engine_version:
type: string
description: Version of the inference engine.
HardwareCapability:
type: object
properties:
capability_id:
type: string
description: Unique identifier for the hardware capability.
cpu_info:
$ref: '#/components/schemas/CPUInfo'
disk_info:
type: array
items:
$ref: '#/components/schemas/DiskInfo'
os_info:
$ref: '#/components/schemas/OSInfo'
CPUInfo:
type: object
properties:
architecture:
type: string
byte_order:
type: string
cores:
type: array
items:
type: string
model:
type: string
num_cores:
type: integer
vendor_id:
type: string
DiskInfo:
type: object
properties:
available:
type: integer
filesystem:
type: string
mount_point:
type: string
size:
type: integer
used:
type: integer
OSInfo:
type: object
properties:
name:
type: string
version:
type: string
ContainerToResourcesMap:
type: object
description: A mapping from container IDs to available resources.
additionalProperties:
type: object
properties:
service_id:
type: string
description: The unique identifier for the inference service.
compute_capability:
type: array
description: List of compute capabilities available for the service.
items:
$ref: '#/components/schemas/ComputeCapability'
hardware_capabilities:
type: array
description: List of hardware capabilities available for the service.
items:
$ref: '#/components/schemas/HardwareCapability'
required:
- service_id
- compute_capability
- hardware_capabilities