@@ -208,7 +208,7 @@ async def _convert_no_chunk_async(
208208 try :
209209 async with AsyncDoclingServiceClient (
210210 url = self .config .base_url ,
211- api_key = self .config .api_key .get_secret_value () if self .config .api_key else None ,
211+ api_key = self .config .api_key .get_secret_value () if self .config .api_key else "" ,
212212 job_timeout = 300.0 ,
213213 ) as client :
214214 job = await client .submit (
@@ -343,15 +343,13 @@ async def _convert_and_chunk_async(
343343 try :
344344 async with AsyncDoclingServiceClient (
345345 url = self .config .base_url ,
346- api_key = self .config .api_key .get_secret_value () if self .config .api_key else None ,
346+ api_key = self .config .api_key .get_secret_value () if self .config .api_key else "" ,
347347 job_timeout = 300.0 ,
348348 ) as client :
349349 job = await client .submit_chunk (
350350 source = tmp_path ,
351351 chunker = ChunkerKind .HYBRID ,
352- options = ConvertDocumentsOptions (
353- chunking_max_tokens = max_tokens ,
354- ),
352+ options = ConvertDocumentsOptions (),
355353 )
356354 response = await job .result ()
357355
@@ -365,8 +363,8 @@ async def _convert_and_chunk_async(
365363
366364 chunks : list [Chunk ] = []
367365 for i , raw_chunk in enumerate (raw_chunks ):
368- # Handle both object and dict responses
369- text = raw_chunk .text if hasattr (raw_chunk , "text" ) else raw_chunk . get ( "text" , "" )
366+ # AsyncDoclingServiceClient returns ChunkedDocumentResultItem objects
367+ text = raw_chunk .text if hasattr (raw_chunk , "text" ) else ""
370368 if not text or not text .strip ():
371369 continue
372370
@@ -378,13 +376,10 @@ async def _convert_and_chunk_async(
378376 ** document_metadata ,
379377 }
380378
381- # Extract headings (handle both object and dict)
379+ # Extract headings from meta object
380+ headings = None
382381 if hasattr (raw_chunk , "meta" ) and hasattr (raw_chunk .meta , "headings" ):
383382 headings = raw_chunk .meta .headings
384- elif isinstance (raw_chunk , dict ):
385- headings = raw_chunk .get ("meta" , {}).get ("headings" , None )
386- else :
387- headings = None
388383
389384 if headings :
390385 meta ["headings" ] = headings
0 commit comments