Skip to content

fix: handle None text in context chunks for faithfulness checker (closes #153)#172

Open
gandzekas wants to merge 1 commit into
ascherj:mainfrom
gandzekas:fix/faithfulness-checker-none-text
Open

fix: handle None text in context chunks for faithfulness checker (closes #153)#172
gandzekas wants to merge 1 commit into
ascherj:mainfrom
gandzekas:fix/faithfulness-checker-none-text

Conversation

@gandzekas

Copy link
Copy Markdown

Fix for #153

The FaithfulnessChecker.check() method used chunk.get("text", "") to extract text from context chunks. However, when the key "text" exists but its value is None, .get() returns None (the default only applies to missing keys). This caused a TypeError when " ".join(...) tried to join None values.

Fix: Changed to chunk.get("text") or "" which normalizes None to empty string.

Test: The existing test test_none_context_chunk_text in tests/unit/test_faithfulness_checker.py now passes.

Closes #153

The  method used  which returns  when
the key exists with value  (default only applies to missing keys).
This caused  when joining with .

Fix: Use  to normalize  to empty string.

Closes ascherj#153
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Faithfulness checker crashes when a context chunk has text: None

1 participant