@@ -12,6 +12,12 @@ import {
1212 Split ,
1313} from "@/v2/product/index.js" ;
1414
15+ interface CliProduct {
16+ name : string ;
17+ description : string ;
18+ productClass : typeof BaseProduct ;
19+ }
20+
1521const program = new Command ( ) ;
1622
1723//
@@ -35,13 +41,11 @@ async function enqueueAndGetInference(
3541 const response = await mindeeClient . enqueueAndGetResult (
3642 product ,
3743 inputSource ,
44+ { modelId : options . model } ,
3845 {
39- modelId : options . model ,
40- pollingOptions : {
41- initialDelaySec : 2 ,
42- delaySec : 1.5 ,
43- maxRetries : 80 ,
44- }
46+ initialDelaySec : 2 ,
47+ delaySec : 1.5 ,
48+ maxRetries : 80 ,
4549 }
4650 ) ;
4751 if ( ! response . inference ) {
@@ -76,12 +80,12 @@ export function cli() {
7680 . option ( "-d, --debug" , "high verbosity mode" )
7781 . option ( "-k, --api-key <api_key>" , "your Mindee API key" ) ;
7882
79- const inferenceTypes = [
80- { name : "extraction" , description : "Extract data from a document." , product : Extraction } ,
81- { name : "crop" , description : "Crop a document." , product : Crop } ,
82- { name : "split" , description : "Split a document into pages." , product : Split } ,
83- { name : "ocr" , description : "Read text from a document." , product : Ocr } ,
84- { name : "classification" , description : "Classify a document." , product : Classification } ,
83+ const inferenceTypes : CliProduct [ ] = [
84+ { name : "extraction" , description : "Extract data from a document." , productClass : Extraction } ,
85+ { name : "crop" , description : "Crop a document." , productClass : Crop } ,
86+ { name : "split" , description : "Split a document into pages." , productClass : Split } ,
87+ { name : "ocr" , description : "Read text from a document." , productClass : Ocr } ,
88+ { name : "classification" , description : "Classify a document." , productClass : Classification } ,
8589 ] ;
8690
8791 for ( const inference of inferenceTypes ) {
@@ -95,7 +99,7 @@ export function cli() {
9599 options : OptionValues ,
96100 ) {
97101 const allOptions = { ...program . opts ( ) , ...options } ;
98- return enqueueAndGetInference ( inference . product , inputPath , allOptions ) ;
102+ return enqueueAndGetInference ( inference . productClass , inputPath , allOptions ) ;
99103 } ) ;
100104 }
101105
0 commit comments