@@ -472,6 +472,8 @@ func describeAPI(name string, resourcesRes *schema.GetResourcesResponse, flagVer
472
472
473
473
out += titleStr ("Model Input Signature" )
474
474
475
+ out += describeModelInput (groupStatus , apiEndpoint )
476
+
475
477
if modelName , ok := yaml .ExtractAtSymbolText (api .Model ); ok {
476
478
model := ctx .Models [modelName ]
477
479
resIDs := strset .New ()
@@ -489,51 +491,51 @@ func describeAPI(name string, resourcesRes *schema.GetResourcesResponse, flagVer
489
491
}
490
492
sort .Strings (samplePlaceholderFields )
491
493
samplesPlaceholderStr := `{ "samples": [ { ` + strings .Join (samplePlaceholderFields , ", " ) + " } ] }"
492
- out += "Payload: " + samplesPlaceholderStr + "\n "
493
- } else {
494
- if groupStatus .Available () == 0 {
495
- out += "Waiting for API to be ready"
496
- return out , nil
497
- }
494
+ out += "\n \n Payload: " + samplesPlaceholderStr
495
+ }
498
496
499
- modelInput , err := getModelInput (urls .Join (apiEndpoint , "signature" ))
500
- if err != nil {
501
- out += "Waiting for API to be ready"
502
- return out , nil
503
- }
497
+ return out , nil
498
+ }
504
499
505
- rows := make ([][]interface {}, len (modelInput .Signature ))
506
- rowNum := 0
507
- for inputName , featureSignature := range modelInput .Signature {
508
- shapeStr := make ([]string , len (featureSignature .Shape ))
509
- for idx , dim := range featureSignature .Shape {
510
- if dim == 0 {
511
- shapeStr [idx ] = "?"
512
- } else {
513
- shapeStr [idx ] = s .Int (dim )
514
- }
515
- }
516
- rows [rowNum ] = []interface {}{
517
- inputName ,
518
- featureSignature .Type ,
519
- s .ObjFlatNoQuotes (shapeStr ),
500
+ func describeModelInput (groupStatus * resource.APIGroupStatus , apiEndpoint string ) string {
501
+ if groupStatus .Available () == 0 {
502
+ return "Waiting for API to be ready"
503
+ }
504
+
505
+ modelInput , err := getModelInput (urls .Join (apiEndpoint , "signature" ))
506
+ if err != nil {
507
+ return "Waiting for API to be ready"
508
+ }
509
+
510
+ rows := make ([][]interface {}, len (modelInput .Signature ))
511
+ rowNum := 0
512
+ for inputName , featureSignature := range modelInput .Signature {
513
+ shapeStr := make ([]string , len (featureSignature .Shape ))
514
+ for idx , dim := range featureSignature .Shape {
515
+ if dim == 0 {
516
+ shapeStr [idx ] = "?"
517
+ } else {
518
+ shapeStr [idx ] = s .Int (dim )
520
519
}
521
- rowNum ++
522
520
}
523
-
524
- t := table.Table {
525
- Headers : []table.Header {
526
- {Title : "FEATURE" , MaxWidth : 32 },
527
- {Title : "TYPE" , MaxWidth : 10 },
528
- {Title : "SHAPE" , MaxWidth : 20 },
529
- },
530
- Rows : rows ,
521
+ rows [rowNum ] = []interface {}{
522
+ inputName ,
523
+ featureSignature .Type ,
524
+ "(" + strings .Join (shapeStr , ", " ) + ")" ,
531
525
}
526
+ rowNum ++
527
+ }
532
528
533
- out += table .MustFormat (t )
529
+ t := table.Table {
530
+ Headers : []table.Header {
531
+ {Title : "FEATURE" , MaxWidth : 32 },
532
+ {Title : "TYPE" , MaxWidth : 10 },
533
+ {Title : "SHAPE" , MaxWidth : 20 },
534
+ },
535
+ Rows : rows ,
534
536
}
535
537
536
- return out , nil
538
+ return table . MustFormat ( t )
537
539
}
538
540
539
541
func getModelInput (infoAPIPath string ) (* schema.ModelInput , error ) {
0 commit comments