Add error handling with chunk ID prefixing in entity extraction

This commit is contained in:
yangdx 2025-09-16 13:41:49 +08:00
parent 5f45ff56be
commit ecaee43788

View file

@ -2179,7 +2179,12 @@ async def extract_entities(
async def _process_with_semaphore(chunk):
async with semaphore:
return await _process_single_content(chunk)
try:
return await _process_single_content(chunk)
except Exception as e:
chunk_id = chunk[0] # Extract chunk_id from chunk[0]
prefixed_exception = create_prefixed_exception(e, chunk_id)
raise prefixed_exception from e
tasks = []
for c in ordered_chunks: