Open kyuz0 opened 1 week ago
i came across the same bug recently. RAGAS seperates the sentences in the response basis the logic here i.e. if sentence.strip().endswith((".", "。", "!", "!"))
since your response string doesn't contain any of these, an empty response (" ") is being sent to check faithfulness. try adding one of these sentence splitters (".") to the response to verify.
This sentence splitting logic is actually a bit inconsistent across different metrics (I am using version 0.2.5). For example:
if sentence.strip().endswith(".")
if sentence.strip().endswith((".", "。", "!", "!"))
For me, it is not clear why you need to filter the sentences in the first place, because the sentence_splitter
is already doing a good job.
In my use-case, I do not control the generation of the datasets and some ground answers may not contain any identifiers (e.g., ".") at the end of the sentence. An example that comes to mind is:
Thus, I created custom subclass of the metrics and changed the _create_statements()
method such that the sentences are no longer filtered (i.e., I removed the if sentence.strip().endswith(".")
).
Question: Is there any unexpected behavior which might occur due to this?
The official example to calculate faithfulness on a single sample straight from the website doc doesn't work:
This results into this warning and nan score:
What am I missing or doing wrong?