File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -499,6 +499,17 @@ async fn embed(
499
499
Input :: Batch ( inputs) => {
500
500
metrics:: increment_counter!( "te_request_count" , "method" => "batch" ) ;
501
501
502
+ if inputs. is_empty ( ) {
503
+ let message = "`inputs` cannot be empty" . to_string ( ) ;
504
+ tracing:: error!( "{message}" ) ;
505
+ let err = ErrorResponse {
506
+ error : message,
507
+ error_type : ErrorType :: Validation ,
508
+ } ;
509
+ metrics:: increment_counter!( "te_request_failure" , "err" => "validation" ) ;
510
+ Err ( err) ?;
511
+ }
512
+
502
513
let batch_size = inputs. len ( ) ;
503
514
if batch_size > info. max_client_batch_size {
504
515
let message = format ! (
@@ -639,6 +650,17 @@ async fn openai_embed(
639
650
Input :: Batch ( inputs) => {
640
651
metrics:: increment_counter!( "te_request_count" , "method" => "batch" ) ;
641
652
653
+ if inputs. is_empty ( ) {
654
+ let message = "`inputs` cannot be empty" . to_string ( ) ;
655
+ tracing:: error!( "{message}" ) ;
656
+ let err = ErrorResponse {
657
+ error : message,
658
+ error_type : ErrorType :: Validation ,
659
+ } ;
660
+ metrics:: increment_counter!( "te_request_failure" , "err" => "validation" ) ;
661
+ Err ( err) ?;
662
+ }
663
+
642
664
let batch_size = inputs. len ( ) ;
643
665
if batch_size > info. max_client_batch_size {
644
666
let message = format ! (
You can’t perform that action at this time.
0 commit comments