Input | |||
---|---|---|---|
Required Input | Type | Description | |
output | string | The content to be evaluated for semantic list contains against the reference. | |
expected | string or List[string] | A single phrase or list of phrases that the response is expected to semantically include. |
Output | ||
---|---|---|
Field | Description | |
Result | Returns a score representing the semantic list contains of the response against the reference, where higher values indicate better semantic list contains. | |
Reason | Provides a detailed explanation of the semantic list contains evaluation. |
About Semantic List Contains
This evaluation is designed to evaluate whether the model’s output closely resembles any of the key phrases provided. The metric is especially useful when exact wording may differ but meaning is preserved or the reference is a set of expected keywords.How Semantic List Contains Evals Work?
- Encodes both response and reference text into dense vectors using a SentenceTransformer.
- Computes similarity between the response and each phrase using cosine similarity
- Compares the result with a configurable threshold (e.g.,
0.7
) - Returns
1.0
(if exact match) or0.0
(no match) depending on whether:- Any match (
match_all = False
, default) - All match (
match_all = True
)
- Any match (
What if Semantic List Contains Eval Score is Low?
- Lower the
similarity_threshold
value (if your use case allows relaxed semantic matches). - Use
"match_all"= False
if partial coverage is acceptable.