Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aggregate_labels cannot handle non-sequence typed filter values #3687

Closed
1 task done
tstadel opened this issue Dec 9, 2022 · 0 comments · Fixed by #3682
Closed
1 task done

aggregate_labels cannot handle non-sequence typed filter values #3687

tstadel opened this issue Dec 9, 2022 · 0 comments · Fixed by #3682
Labels
topic:eval type:bug Something isn't working

Comments

@tstadel
Copy link
Member

tstadel commented Dec 9, 2022

Describe the bug
aggregate_labels cannot handle non-sequence typed filter values:

labels = [
            Label(
                id="standard",
                query="question",
                answer=Answer(answer="answer1", offsets_in_document=[Span(start=12, end=18)]),
                document=Document(content="some", id="123"),
                is_correct_answer=True,
                is_correct_document=True,
                origin="gold-label",
                filters={"name": 123},
            )]
aggregate_labels(labels)

results in:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/tstad/git/haystack/haystack/utils/labels.py", line 78, in aggregate_labels
    label_filter_keys = [f"{k}={''.join(v)}" for k, v in l.filters.items()] if l.filters else []
  File "/home/tstad/git/haystack/haystack/utils/labels.py", line 78, in <listcomp>
    label_filter_keys = [f"{k}={''.join(v)}" for k, v in l.filters.items()] if l.filters else []
TypeError: can only join an iterable

Expected behavior
Labels with non-sequence typed filter values can be aggregated.

FAQ Check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic:eval type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant