@@ -368,12 +368,18 @@ def output(self) -> O:
368368 ),
369369 )
370370
371- # For non-iterator types , wait for completion and process output
371+ # For non-streaming , wait for completion and process output
372372 self ._prediction .wait ()
373373
374374 if self ._prediction .status == "failed" :
375375 raise ModelError (self ._prediction )
376376
377+ # Handle concatenate iterators - return joined string
378+ if _has_concatenate_iterator_output_type (self ._schema ):
379+ if isinstance (self ._prediction .output , list ):
380+ return "" .join (str (item ) for item in self ._prediction .output )
381+ return self ._prediction .output
382+
377383 # Process output for file downloads based on schema
378384 return _process_output_with_schema (self ._prediction .output , self ._schema )
379385
@@ -529,12 +535,18 @@ async def output(self) -> O:
529535 ),
530536 )
531537
532- # For non-iterator types , wait for completion and process output
538+ # For non-streaming , wait for completion and process output
533539 await self ._prediction .async_wait ()
534540
535541 if self ._prediction .status == "failed" :
536542 raise ModelError (self ._prediction )
537543
544+ # Handle concatenate iterators - return joined string
545+ if _has_concatenate_iterator_output_type (self ._schema ):
546+ if isinstance (self ._prediction .output , list ):
547+ return "" .join (str (item ) for item in self ._prediction .output )
548+ return self ._prediction .output
549+
538550 # Process output for file downloads based on schema
539551 return _process_output_with_schema (self ._prediction .output , self ._schema )
540552
0 commit comments