Fix AttributeError when event_date is None in fact_extraction (#875)
* Fix AttributeError when event_date is None in fact_extraction `_extract_facts_from_chunk` crashes with `'NoneType' object has no attribute 'isoformat'` when retaining documents without a timestamp. Two locations fixed: - Line 1058: debug log called `event_date.isoformat()` without a None check - Line 921: `parse_datetime_flexible()` can return None, so re-check before calling `.strftime()` / `.isoformat()` Fixes #874 * Revert unnecessary None guard on line 921 The original `if event_date is not None:` already guards that block. Only line 1058 needed the fix.
This commit is contained in:
parent
f9fe6953a3
commit
6cb309f72b
1 changed files with 1 additions and 1 deletions
|
|
@ -1055,7 +1055,7 @@ async def _extract_facts_from_chunk(
|
||||||
f"LLM response missing 'facts' field or returned empty list. "
|
f"LLM response missing 'facts' field or returned empty list. "
|
||||||
f"Response: {extraction_response_json}. "
|
f"Response: {extraction_response_json}. "
|
||||||
f"Input: "
|
f"Input: "
|
||||||
f"date: {event_date.isoformat()}, "
|
f"date: {event_date.isoformat() if event_date else 'unset'}, "
|
||||||
f"context: {context if context else 'none'}, "
|
f"context: {context if context else 'none'}, "
|
||||||
f"text: {chunk}"
|
f"text: {chunk}"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue