-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpublic-api.yaml
1546 lines (1539 loc) · 39.5 KB
/
public-api.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
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.3
info:
title: Groundlight API
version: 0.18.2
description: Groundlight makes it simple to understand images. You can easily create
computer vision detectors just by describing what you want to know using natural
language.
contact:
name: [email protected]
email: [email protected]
paths:
/v1/actions/detector/{detector_id}/rules:
get:
operationId: List detector rules
description: List all rules for a detector
parameters:
- in: path
name: detector_id
schema:
type: string
required: true
- name: page
required: false
in: query
description: A page number within the paginated result set.
schema:
type: integer
- name: page_size
required: false
in: query
description: Number of results to return per page.
schema:
type: integer
tags:
- actions
security:
- ApiToken: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedRuleList'
description: ''
post:
operationId: Create rule
description: Create a new rule for a detector
parameters:
- in: path
name: detector_id
schema:
type: string
required: true
tags:
- actions
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RuleRequest'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/RuleRequest'
multipart/form-data:
schema:
$ref: '#/components/schemas/RuleRequest'
required: true
security:
- ApiToken: []
responses:
'201':
content:
application/json:
schema:
$ref: '#/components/schemas/Rule'
description: ''
/v1/actions/rules:
get:
operationId: List rules
description: Lists all rules over all detectors owned by the requester.
parameters:
- name: page
required: false
in: query
description: A page number within the paginated result set.
schema:
type: integer
- name: page_size
required: false
in: query
description: Number of results to return per page.
schema:
type: integer
tags:
- actions
security:
- ApiToken: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedRuleList'
description: ''
/v1/actions/rules/{id}:
get:
operationId: Get rule
description: Retrieve a rule
parameters:
- in: path
name: id
schema:
type: integer
required: true
tags:
- actions
security:
- ApiToken: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/Rule'
description: ''
delete:
operationId: Delete rule
description: Delete a rule
parameters:
- in: path
name: id
schema:
type: integer
required: true
tags:
- actions
security:
- ApiToken: []
responses:
'204':
description: No response body
/v1/detector-groups:
get:
operationId: Get Detector Groups
description: List all detector groups
tags:
- detector-groups
security:
- ApiToken: []
responses:
'200':
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/DetectorGroup'
description: ''
post:
operationId: Create Detector Group
description: |-
Create a new detector group
POST data:
Required:
- name (str) - name of the predictor set
tags:
- detector-groups
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DetectorGroupRequest'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/DetectorGroupRequest'
multipart/form-data:
schema:
$ref: '#/components/schemas/DetectorGroupRequest'
required: true
security:
- ApiToken: []
responses:
'201':
content:
application/json:
schema:
$ref: '#/components/schemas/DetectorGroup'
description: ''
/v1/detector-reset/{id}:
delete:
operationId: Reset detector
description: Deletes all image queries on the detector
parameters:
- in: path
name: id
schema:
type: string
required: true
tags:
- detector-reset
security:
- ApiToken: []
responses:
'204':
description: No response body
/v1/detectors:
get:
operationId: List detectors
description: Retrieve a list of detectors.
parameters:
- in: query
name: page
schema:
type: integer
description: A page number within the paginated result set.
- in: query
name: page_size
schema:
type: integer
description: Number of items to return per page.
tags:
- detectors
security:
- ApiToken: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedDetectorList'
description: ''
post:
operationId: Create detector
description: Create a new detector.
tags:
- detectors
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DetectorCreationInputRequest'
required: true
security:
- ApiToken: []
responses:
'201':
content:
application/json:
schema:
$ref: '#/components/schemas/Detector'
description: ''
/v1/detectors/{id}:
get:
operationId: Get detector
description: Retrieve a detector by its ID.
parameters:
- in: path
name: id
schema:
type: string
description: Choose a detector by its ID.
required: true
tags:
- detectors
security:
- ApiToken: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/Detector'
description: ''
patch:
operationId: Update detector
description: Update a detector
parameters:
- in: path
name: id
schema:
type: string
required: true
tags:
- detectors
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PatchedDetectorRequest'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/PatchedDetectorRequest'
multipart/form-data:
schema:
$ref: '#/components/schemas/PatchedDetectorRequest'
security:
- ApiToken: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/Detector'
description: ''
delete:
operationId: Delete detector
description: Delete a detector by its ID.
parameters:
- in: path
name: id
schema:
type: string
description: Choose a detector by its ID.
required: true
tags:
- detectors
security:
- ApiToken: []
responses:
'204':
description: No response body
/v1/image-queries:
get:
operationId: List image queries
description: Retrieve a list of image-queries.
parameters:
- in: query
name: detector_id
schema:
type: string
description: Optionally filter image queries by detector ID.
- in: query
name: page
schema:
type: integer
description: A page number within the paginated result set.
- in: query
name: page_size
schema:
type: integer
description: Number of items to return per page.
tags:
- image-queries
security:
- ApiToken: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedImageQueryList'
description: ''
post:
operationId: Submit image query
description: |2
Submit an image query against a detector.
You must use `"Content-Type: image/jpeg"` or similar (image/png, image/webp, etc) for the image data. For example:
```Bash
$ curl https://api.groundlight.ai/device-api/v1/image-queries?detector_id=det_abc123 \
--header "Content-Type: image/jpeg" \
--data-binary @path/to/filename.jpeg
```
parameters:
- in: query
name: confidence_threshold
schema:
type: number
format: float
minimum: 0
maximum: 1
description: The confidence threshold for the image query.
- in: query
name: detector_id
schema:
type: string
description: Choose a detector by its ID.
required: true
- in: query
name: human_review
schema:
type: string
description: |-
If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident).
If set to `ALWAYS`, always send the image query for human review even if the ML model is confident.
If set to `NEVER`, never send the image query for human review even if the ML model is not confident.
- in: query
name: image_query_id
schema:
type: string
description: The ID to assign to the created image query.
- in: query
name: inspection_id
schema:
type: string
description: Associate the image query with an inspection.
- in: query
name: metadata
schema:
type: string
description: A dictionary of custom key/value metadata to associate with the
image query (limited to 1KB).
- in: query
name: patience_time
schema:
type: number
format: float
description: How long to wait for a confident response.
- in: query
name: want_async
schema:
type: string
description: If "true" then submitting an image query returns immediately
without a result. The result will be computed asynchronously and can be
retrieved later.
tags:
- image-queries
requestBody:
content:
image/jpeg:
schema:
type: string
format: binary
image/jpg:
schema:
type: string
format: binary
image/png:
schema:
type: string
format: binary
image/gif:
schema:
type: string
format: binary
image/webp:
schema:
type: string
format: binary
image/bmp:
schema:
type: string
format: binary
image/x-icon:
schema:
type: string
format: binary
security:
- ApiToken: []
responses:
'201':
content:
application/json:
schema:
$ref: '#/components/schemas/ImageQuery'
description: ''
/v1/image-queries/{id}:
get:
operationId: Get image query
description: Retrieve an image-query by its ID.
parameters:
- in: path
name: id
schema:
type: string
description: Choose an image query by its ID.
required: true
tags:
- image-queries
security:
- ApiToken: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ImageQuery'
description: ''
/v1/image-queries/{id}/image:
get:
operationId: Get image
description: Retrieve an image by its ID.
parameters:
- in: path
name: id
schema:
type: string
description: Retrieve the image associated with the image query ID.
required: true
tags:
- image-queries
security:
- ApiToken: []
responses:
'200':
content:
image/jpeg:
schema:
type: string
format: binary
description: ''
/v1/labels:
post:
operationId: create label
description: |-
Create a new LabelValue and attach it to an image query. This will trigger
asynchronous fine-tuner model training.
tags:
- labels
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/LabelValueRequest'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/LabelValueRequest'
multipart/form-data:
schema:
$ref: '#/components/schemas/LabelValueRequest'
required: true
security:
- ApiToken: []
responses:
'201':
content:
application/json:
schema:
$ref: '#/components/schemas/LabelValue'
description: ''
/v1/me:
get:
operationId: Who am I
description: Retrieve the current user.
tags:
- user
security:
- ApiToken: []
responses:
'200':
content:
application/json:
schema:
type: object
properties:
username:
type: string
description: The user's username
description: ''
/v1/notes:
get:
operationId: get notes
description: Retrieves all notes from a given detector and returns them in lists,
one for each note_category.
parameters:
- in: query
name: detector_id
schema:
type: string
description: the detector whose notes to retrieve
required: true
tags:
- notes
security:
- ApiToken: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/AllNotes'
description: ''
post:
operationId: Create note
description: Creates a new note.
parameters:
- in: query
name: detector_id
schema:
type: string
description: the detector to associate the new note with
required: true
tags:
- notes
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/NoteRequest'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/NoteRequest'
multipart/form-data:
schema:
$ref: '#/components/schemas/NoteRequest'
security:
- ApiToken: []
responses:
'204':
description: No response body
components:
schemas:
AllNotes:
type: object
description: |-
Serializes all notes for a given detector, grouped by type as listed in UserProfile.NoteCategoryChoices
The fields must match whats in USERPROFILE.NoteCategoryChoices
properties:
CUSTOMER:
type: array
items:
$ref: '#/components/schemas/Note'
GL:
type: array
items:
$ref: '#/components/schemas/Note'
required:
- CUSTOMER
- GL
AnnotationsRequestedEnum:
enum:
- BINARY_CLASSIFICATION
- BOUNDING_BOXES
type: string
description: |-
* `BINARY_CLASSIFICATION` - Binary Classification
* `BOUNDING_BOXES` - Bounding Boxes
BBoxGeometry:
type: object
description: Mixin for serializers to handle data in the StrictBaseModel format
properties:
left:
type: number
format: double
top:
type: number
format: double
right:
type: number
format: double
bottom:
type: number
format: double
x:
type: number
format: double
readOnly: true
y:
type: number
format: double
readOnly: true
required:
- bottom
- left
- right
- top
- x
- y
BBoxGeometryRequest:
type: object
description: Mixin for serializers to handle data in the StrictBaseModel format
properties:
left:
type: number
format: double
top:
type: number
format: double
right:
type: number
format: double
bottom:
type: number
format: double
required:
- bottom
- left
- right
- top
BlankEnum:
enum:
- ''
Condition:
type: object
properties:
verb:
$ref: '#/components/schemas/VerbEnum'
parameters:
type: object
additionalProperties: {}
required:
- parameters
- verb
ConditionRequest:
type: object
properties:
verb:
$ref: '#/components/schemas/VerbEnum'
parameters:
type: object
additionalProperties: {}
required:
- parameters
- verb
Detector:
type: object
description: Spec for serializing a detector object in the public API.
properties:
id:
type: string
readOnly: true
description: A unique ID for this object.
type:
allOf:
- $ref: '#/components/schemas/DetectorTypeEnum'
readOnly: true
description: The type of this object.
created_at:
type: string
format: date-time
readOnly: true
description: When this detector was created.
name:
type: string
description: A short, descriptive name for the detector.
maxLength: 200
query:
type: string
description: A question about the image.
readOnly: true
group_name:
type: string
readOnly: true
description: Which group should this detector be part of?
confidence_threshold:
type: number
format: double
maximum: 1.0
minimum: 0.0
default: 0.9
description: If the detector's prediction is below this confidence threshold,
send the image query for human review.
patience_time:
type: number
format: double
maximum: 3600
minimum: 0
default: 30.0
description: How long Groundlight will attempt to generate a confident prediction
metadata:
type: object
additionalProperties: {}
nullable: true
readOnly: true
description: Metadata about the detector.
mode:
allOf:
- $ref: '#/components/schemas/ModeEnum'
readOnly: true
mode_configuration:
type: object
additionalProperties: {}
nullable: true
readOnly: true
status:
oneOf:
- $ref: '#/components/schemas/StatusEnum'
- $ref: '#/components/schemas/BlankEnum'
escalation_type:
allOf:
- $ref: '#/components/schemas/EscalationTypeEnum'
description: |-
Category that define internal proccess for labeling image queries
* `STANDARD` - STANDARD
* `NO_HUMAN_LABELING` - NO_HUMAN_LABELING
required:
- created_at
- group_name
- id
- metadata
- mode
- mode_configuration
- name
- query
- type
x-internal: true
DetectorCreationInputRequest:
type: object
description: Helper serializer for validating POST /detectors input.
properties:
name:
type: string
minLength: 1
description: A short, descriptive name for the detector.
maxLength: 200
query:
type: string
minLength: 1
description: A question about the image.
maxLength: 300
group_name:
type: string
minLength: 1
description: Which group should this detector be part of?
maxLength: 100
confidence_threshold:
type: number
format: double
maximum: 1.0
minimum: 0.0
default: 0.9
description: If the detector's prediction is below this confidence threshold,
send the image query for human review.
patience_time:
type: number
format: double
maximum: 3600
minimum: 0
default: 30.0
description: How long Groundlight will attempt to generate a confident prediction
pipeline_config:
type: string
nullable: true
description: (Advanced usage) Configuration needed to instantiate a prediction
pipeline.
maxLength: 100
metadata:
type: string
minLength: 1
description: Base64-encoded metadata for the detector. This should be a
JSON object with string keys. The size after encoding should not exceed
1362 bytes, corresponding to 1KiB before encoding.
maxLength: 1362
mode:
allOf:
- $ref: '#/components/schemas/ModeEnum'
default: BINARY
description: |-
Mode in which this detector will work.
* `BINARY` - BINARY
* `COUNT` - COUNT
* `MULTI_CLASS` - MULTI_CLASS
* `TEXT` - TEXT
mode_configuration:
oneOf:
- $ref: '#/components/schemas/CountModeConfiguration'
- $ref: '#/components/schemas/MultiClassModeConfiguration'
- $ref: '#/components/schemas/TextModeConfiguration'
nullable: true
required:
- name
- query
x-internal: true
DetectorGroup:
type: object
properties:
id:
type: string
readOnly: true
name:
type: string
maxLength: 100
required:
- id
- name
DetectorGroupRequest:
type: object
properties:
name:
type: string
minLength: 1
maxLength: 100
required:
- name
DetectorTypeEnum:
enum:
- detector
type: string
EscalationTypeEnum:
enum:
- STANDARD
- NO_HUMAN_LABELING
type: string
description: |-
* `STANDARD` - STANDARD
* `NO_HUMAN_LABELING` - NO_HUMAN_LABELING
ImageQuery:
type: object
description: Spec for serializing a image-query object in the public API.
properties:
metadata:
type: object
additionalProperties: {}
nullable: true
readOnly: true
description: Metadata about the image query.
id:
type: string
readOnly: true
description: A unique ID for this object.
type:
allOf:
- $ref: '#/components/schemas/ImageQueryTypeEnum'
readOnly: true
description: The type of this object.
created_at:
type: string
format: date-time
readOnly: true
description: When was this detector created?
query:
type: string
readOnly: true
description: A question about the image.
detector_id:
type: string
readOnly: true
description: Which detector was used on this image query?
result_type:
allOf:
- $ref: '#/components/schemas/ResultTypeEnum'
readOnly: true
description: What type of result are we returning?
result:
oneOf:
- $ref: '#/components/schemas/BinaryClassificationResult'
- $ref: '#/components/schemas/CountingResult'
- $ref: '#/components/schemas/MultiClassificationResult'
- $ref: '#/components/schemas/TextRecognitionResult'
nullable: true
patience_time:
type: number
format: double
readOnly: true
description: How long to wait for a confident response.
confidence_threshold:
type: number
format: double
readOnly: true
description: Min confidence needed to accept the response of the image query.
rois:
type: array
items:
$ref: '#/components/schemas/ROI'
readOnly: true
nullable: true
description: An array of regions of interest (bounding boxes) collected
on image
text:
type: string
nullable: true
readOnly: true
description: A text field on image query.
required:
- confidence_threshold
- created_at
- detector_id
- id
- metadata
- patience_time
- query
- result
- result_type
- rois
- text
- type
x-internal: true
ImageQueryTypeEnum:
enum:
- image_query
type: string
LabelValue:
type: object
properties:
confidence:
type: number
format: double
nullable: true
readOnly: true
class_name:
type: string
nullable: true
description: Return a human-readable class name for this label (e.g. YES/NO)
readOnly: true
rois:
type: array
items:
$ref: '#/components/schemas/ROI'
nullable: true
annotations_requested:
type: array
items:
allOf:
- $ref: '#/components/schemas/AnnotationsRequestedEnum'
description: |-
The type of annotation requested