Merge pull request #2107 from danielaskdd/add-chunk-id

Refactor: Add error handling with chunk ID prefixing in entity extraction
This commit is contained in:
Daniel.y 2025-09-16 14:46:52 +08:00 committed by GitHub
commit 3705ca13b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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: