Skip to content

Commit 69dca45

Browse files
feat: add failure count and success rate to source tag logging
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4.5) <[email protected]>
1 parent f806b98 commit 69dca45

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

wdoc/utils/batch_file_loader.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,10 +500,28 @@ def batch_load_doc(
500500
st[s] += 1
501501
else:
502502
no_st += 1
503+
504+
# Count failures per source tag
505+
st_failed = {t: 0 for t in asked_source_tags}
506+
for failed_doc in missing_docargs:
507+
if "source_tag" in failed_doc:
508+
tag = failed_doc["source_tag"]
509+
if tag in st_failed:
510+
st_failed[tag] += 1
511+
503512
should_crash = False
504513
logger.warning("Found the following source_tag after loading all documents:")
505514
for n, s in st.items():
506-
logger.warning(f"- {s}: {n}")
515+
# n is the tag name, s is the successful count
516+
n_failed = st_failed.get(n, 0)
517+
if n_failed > 0:
518+
total = s + n_failed
519+
success_rate = (s / total * 100) if total > 0 else 0
520+
logger.warning(
521+
f"- {s}: {n} ({n_failed} failed, {success_rate:.1f}% success rate)"
522+
)
523+
else:
524+
logger.warning(f"- {s}: {n}")
507525
if n == 0:
508526
should_crash = True
509527
if extra:

0 commit comments

Comments
 (0)