File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ impl SimpleFunctionExecutor for Executor {
9696 . transpose ( ) ?;
9797
9898 if text. is_none ( ) && image_bytes. is_none ( ) {
99- api_bail ! ( "At least one of `text` or `image` must be provided" ) ;
99+ return Ok ( Value :: Null ) ;
100100 }
101101
102102 let user_prompt = text. map_or ( "" , |v| v) ;
@@ -147,7 +147,13 @@ impl SimpleFunctionFactoryBase for Factory {
147147 api_bail ! ( "At least one of 'text' or 'image' must be provided" ) ;
148148 }
149149
150- Ok ( ( args, spec. output_type . clone ( ) ) )
150+ let mut output_type = spec. output_type . clone ( ) ;
151+ if args. text . as_ref ( ) . map_or ( true , |arg| arg. typ . nullable )
152+ && args. image . as_ref ( ) . map_or ( true , |arg| arg. typ . nullable )
153+ {
154+ output_type. nullable = true ;
155+ }
156+ Ok ( ( args, output_type) )
151157 }
152158
153159 async fn build_executor (
You can’t perform that action at this time.
0 commit comments