Skip to content

test_find_context_attributions failing due to mismatched results / expected #778

@jakelorocco

Description

@jakelorocco

The result contains additional entries not in the expected set:

============================= test session starts ==============================
platform darwin -- Python 3.12.13, pytest-9.0.0, pluggy-1.6.0 -- /Users/jake/code/mellea1/.venv/bin/python3
cachedir: .pytest_cache
metadata: {'Python': '3.12.13', 'Platform': 'macOS-15.7.5-arm64-arm-64bit', 'Packages': {'pytest': '9.0.0', 'pluggy': '1.6.0'}, 'Plugins': {'nbmake': '1.5.5', 'recording': '0.13.4', 'anyio': '4.11.0', 'xdist': '3.8.0', 'json-report': '1.5.0', 'timeout': '2.4.0', 'metadata': '3.1.1', 'mypy-plugins': '4.0.0', 'asyncio': '1.3.0', 'langsmith': '0.6.6', 'Faker': '40.11.1', 'cov': '7.0.0'}}
rootdir: /Users/jake/code/mellea1
configfile: pyproject.toml
plugins: nbmake-1.5.5, recording-0.13.4, anyio-4.11.0, xdist-3.8.0, json-report-1.5.0, timeout-2.4.0, metadata-3.1.1, mypy-plugins-4.0.0, asyncio-1.3.0, langsmith-0.6.6, Faker-40.11.1, cov-7.0.0
timeout: 900.0s
timeout method: signal
timeout func_only: False
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
collecting ... collected 1 item

test/stdlib/components/intrinsic/test_core.py::test_find_context_attributions FAILED [100%]

=================================== FAILURES ===================================
________________________ test_find_context_attributions ________________________

backend = <mellea.backends.huggingface.LocalHFBackend object at 0x30bb6b3e0>

    @pytest.mark.qualitative
    def test_find_context_attributions(backend):
        """Verify that the context-attribution intrinsic functions properly."""
        context, assistant_response, documents = _read_rag_input_json(
            "context-attribution.json"
        )
        expected = _read_rag_output_json("context-attribution.json")
    
        result = core.find_context_attributions(
            assistant_response, documents, context, backend
        )
>       assert result == expected
E       assert [{'response_begin': 0, 'response_end': 137, 'response_text': 'The Plastic Ono Band was formed by John Lennon and Yoko Ono in 1969 as a collaborative vehicle for their artistic and personal projects. ', 'attribution_doc_id': '0', 'attribution_msg_index': None, 'attribution_begin': 0, 'attribution_end': 130, 'attribution_text': 'The Plastic Ono Band is a band formed by John Lennon and Yoko Ono in 1969 as a vehicle for their collaborative and solo projects. '}, {'response_begin': 0, 'response_end': 137, 'response_text': 'The Plastic Ono Band was formed by John Lennon and Yoko Ono in 1969 as a collaborative vehicle for their artistic and personal projects. ', 'attribution_doc_id': '1', 'attribution_msg_index': None, 'attribution_begin': 0, 'attribution_end': 130, 'attribution_text': 'The Plastic Ono Band is a band formed by John Lennon and Yoko Ono in 1969 as a vehicle for their collaborative and solo projects. '}, {'response_begin': 137, 'response_end': 257, 'response_text': 'They decided to credit all their future efforts to this conceptual and collaborative group after their marriage in 1969.', 'attribution_doc_id': '0', 'attribution_msg_index': None, 'attribution_begin': 249, 'attribution_end': 411, 'attribution_text': 'Following their marriage in 1969, they decided that all of their future endeavours would be credited to a conceptual and collaborative vehicle, Plastic Ono Band. '}, {'response_begin': 137, 'response_end': 257, 'response_text': 'They decided to credit all their future efforts to this conceptual and collaborative group after their marriage in 1969.', 'attribution_doc_id': '0', 'attribution_msg_index': None, 'attribution_begin': 0, 'attribution_end': 130, 'attribution_text': 'The Plastic Ono Band is a band formed by John Lennon and Yoko Ono in 1969 as a vehicle for their collaborative and solo projects. '}, {'response_begin': 137, 'response_end': 257, 'response_text': 'They decided to credit all their future efforts to this conceptual and collaborative group after their marriage in 1969.', 'attribution_doc_id': '0', 'attribution_msg_index': None, 'attribution_begin': 130, 'attribution_end': 249, 'attribution_text': 'Lennon and Ono had begun a personal and artistic relationship in 1968, collaborating on several experimental releases. '}, {'response_begin': 137, 'response_end': 257, 'response_text': 'They decided to credit all their future efforts to this conceptual and collaborative group after their marriage in 1969.', 'attribution_doc_id': '1', 'attribution_msg_index': None, 'attribution_begin': 0, 'attribution_end': 130, 'attribution_text': 'The Plastic Ono Band is a band formed by John Lennon and Yoko Ono in 1969 as a vehicle for their collaborative and solo projects. '}, {'response_begin': 137, 'response_end': 257, 'response_text': 'They decided to credit all their future efforts to this conceptual and collaborative group after their marriage in 1969.', 'attribution_doc_id': '0', 'attribution_msg_index': None, 'attribution_begin': 411, 'attribution_end': 661, 'attribution_text': "The band would go on to feature a rotating lineup of many musicians, including Eric Clapton, Klaus Voormann, Alan White, Billy Preston, Jim Keltner, Delaney & Bonnie and Friends, and Lennon's former Beatles bandmates George Harrison and Ringo Starr. "}, {'response_begin': 137, 'response_end': 257, 'response_text': 'They decided to credit all their future efforts to this conceptual and collaborative group after their marriage in 1969.', 'attribution_doc_id': None, 'attribution_msg_index': 2, 'attribution_begin': 0, 'attribution_end': 66, 'attribution_text': 'What was the concept behind the formation of the Plastic Ono Band?'}, {'response_begin': 137, 'response_end': 257, 'response_text': 'They decided to credit all their future efforts to this conceptual and collaborative group after their marriage in 1969.', 'attribution_doc_id': '0', 'attribution_msg_index': None, 'attribution_begin': 661, 'attribution_end': 740, 'attribution_text': 'Lennon and Ono left the UK to settle in New York City during the fall of 1971. '}, {'response_begin': 137, 'response_end': 257, 'response_text': 'They decided to credit all their future efforts to this conceptual and collaborative group after their marriage in 1969.', 'attribution_doc_id': '1', 'attribution_msg_index': None, 'attribution_begin': 249, 'attribution_end': 411, 'attribution_text': 'Following their marriage in 1969, they decided that all of their future endeavours would be credited to a conceptual and collaborative vehicle, Plastic Ono Band. '}, {'response_begin': 137, 'response_end': 257, 'response_text': 'They decided to credit all their future efforts to this conceptual and collaborative group after their marriage in 1969.', 'attribution_doc_id': None, 'attribution_msg_index': 0, 'attribution_begin': 0, 'attribution_end': 126, 'attribution_text': 'Who were the members of The Metal Ono Band, which was formed by Yoko Ono in 1976 to explore her interest in heavy metal music?'}, {'response_begin': 137, 'response_end': 257, 'response_text': 'They decided to credit all their future efforts to this conceptual and collaborative group after their marriage in 1969.', 'attribution_doc_id': None, 'attribution_msg_index': 1, 'attribution_begin': 0, 'attribution_end': 70, 'attribution_text': "I'm sorry, but I don't have the data to answer that specific question."}] == [{'response_begin': 0, 'response_end': 137, 'response_text': 'The Plastic Ono Band was formed by John Lennon and Yoko Ono in 1969 as a collaborative vehicle for their artistic and personal projects. ', 'attribution_doc_id': '0', 'attribution_msg_index': None, 'attribution_begin': 0, 'attribution_end': 130, 'attribution_text': 'The Plastic Ono Band is a band formed by John Lennon and Yoko Ono in 1969 as a vehicle for their collaborative and solo projects. '}, {'response_begin': 0, 'response_end': 137, 'response_text': 'The Plastic Ono Band was formed by John Lennon and Yoko Ono in 1969 as a collaborative vehicle for their artistic and personal projects. ', 'attribution_doc_id': '1', 'attribution_msg_index': None, 'attribution_begin': 0, 'attribution_end': 130, 'attribution_text': 'The Plastic Ono Band is a band formed by John Lennon and Yoko Ono in 1969 as a vehicle for their collaborative and solo projects. '}, {'response_begin': 137, 'response_end': 257, 'response_text': 'They decided to credit all their future efforts to this conceptual and collaborative group after their marriage in 1969.', 'attribution_doc_id': '0', 'attribution_msg_index': None, 'attribution_begin': 249, 'attribution_end': 411, 'attribution_text': 'Following their marriage in 1969, they decided that all of their future endeavours would be credited to a conceptual and collaborative vehicle, Plastic Ono Band. '}, {'response_begin': 137, 'response_end': 257, 'response_text': 'They decided to credit all their future efforts to this conceptual and collaborative group after their marriage in 1969.', 'attribution_doc_id': '0', 'attribution_msg_index': None, 'attribution_begin': 0, 'attribution_end': 130, 'attribution_text': 'The Plastic Ono Band is a band formed by John Lennon and Yoko Ono in 1969 as a vehicle for their collaborative and solo projects. '}, {'response_begin': 137, 'response_end': 257, 'response_text': 'They decided to credit all their future efforts to this conceptual and collaborative group after their marriage in 1969.', 'attribution_doc_id': '0', 'attribution_msg_index': None, 'attribution_begin': 130, 'attribution_end': 249, 'attribution_text': 'Lennon and Ono had begun a personal and artistic relationship in 1968, collaborating on several experimental releases. '}, {'response_begin': 137, 'response_end': 257, 'response_text': 'They decided to credit all their future efforts to this conceptual and collaborative group after their marriage in 1969.', 'attribution_doc_id': '1', 'attribution_msg_index': None, 'attribution_begin': 0, 'attribution_end': 130, 'attribution_text': 'The Plastic Ono Band is a band formed by John Lennon and Yoko Ono in 1969 as a vehicle for their collaborative and solo projects. '}, {'response_begin': 137, 'response_end': 257, 'response_text': 'They decided to credit all their future efforts to this conceptual and collaborative group after their marriage in 1969.', 'attribution_doc_id': '0', 'attribution_msg_index': None, 'attribution_begin': 411, 'attribution_end': 661, 'attribution_text': "The band would go on to feature a rotating lineup of many musicians, including Eric Clapton, Klaus Voormann, Alan White, Billy Preston, Jim Keltner, Delaney & Bonnie and Friends, and Lennon's former Beatles bandmates George Harrison and Ringo Starr. "}]
E         
E         Left contains 5 more items, first extra item: {'attribution_begin': 0, 'attribution_doc_id': None, 'attribution_end': 66, 'attribution_msg_index': 2, ...}
E         
E         Full diff:
E           [
E               {
E                   'attribution_begin': 0,
E                   'attribution_doc_id': '0',
E                   'attribution_end': 130,
E                   'attribution_msg_index': None,
E                   'attribution_text': 'The Plastic Ono Band is a band formed by John Lennon and Yoko Ono in '
E                   '1969 as a vehicle for their collaborative and solo projects. ',
E                   'response_begin': 0,
E                   'response_end': 137,
E                   'response_text': 'The Plastic Ono Band was formed by John Lennon and Yoko Ono in 1969 '
E                   'as a collaborative vehicle for their artistic and personal projects. ',
E               },
E               {
E                   'attribution_begin': 0,
E                   'attribution_doc_id': '1',
E                   'attribution_end': 130,
E                   'attribution_msg_index': None,
E                   'attribution_text': 'The Plastic Ono Band is a band formed by John Lennon and Yoko Ono in '
E                   '1969 as a vehicle for their collaborative and solo projects. ',
E                   'response_begin': 0,
E                   'response_end': 137,
E                   'response_text': 'The Plastic Ono Band was formed by John Lennon and Yoko Ono in 1969 '
E                   'as a collaborative vehicle for their artistic and personal projects. ',
E               },
E               {
E                   'attribution_begin': 249,
E                   'attribution_doc_id': '0',
E                   'attribution_end': 411,
E                   'attribution_msg_index': None,
E                   'attribution_text': 'Following their marriage in 1969, they decided that all of their '
E                   'future endeavours would be credited to a conceptual and collaborative '
E                   'vehicle, Plastic Ono Band. ',
E                   'response_begin': 137,
E                   'response_end': 257,
E                   'response_text': 'They decided to credit all their future efforts to this conceptual '
E                   'and collaborative group after their marriage in 1969.',
E               },
E               {
E                   'attribution_begin': 0,
E                   'attribution_doc_id': '0',
E                   'attribution_end': 130,
E                   'attribution_msg_index': None,
E                   'attribution_text': 'The Plastic Ono Band is a band formed by John Lennon and Yoko Ono in '
E                   '1969 as a vehicle for their collaborative and solo projects. ',
E                   'response_begin': 137,
E                   'response_end': 257,
E                   'response_text': 'They decided to credit all their future efforts to this conceptual '
E                   'and collaborative group after their marriage in 1969.',
E               },
E               {
E                   'attribution_begin': 130,
E                   'attribution_doc_id': '0',
E                   'attribution_end': 249,
E                   'attribution_msg_index': None,
E                   'attribution_text': 'Lennon and Ono had begun a personal and artistic relationship in '
E                   '1968, collaborating on several experimental releases. ',
E                   'response_begin': 137,
E                   'response_end': 257,
E                   'response_text': 'They decided to credit all their future efforts to this conceptual '
E                   'and collaborative group after their marriage in 1969.',
E               },
E               {
E                   'attribution_begin': 0,
E                   'attribution_doc_id': '1',
E                   'attribution_end': 130,
E                   'attribution_msg_index': None,
E                   'attribution_text': 'The Plastic Ono Band is a band formed by John Lennon and Yoko Ono in '
E                   '1969 as a vehicle for their collaborative and solo projects. ',
E                   'response_begin': 137,
E                   'response_end': 257,
E                   'response_text': 'They decided to credit all their future efforts to this conceptual '
E                   'and collaborative group after their marriage in 1969.',
E               },
E               {
E                   'attribution_begin': 411,
E                   'attribution_doc_id': '0',
E                   'attribution_end': 661,
E                   'attribution_msg_index': None,
E                   'attribution_text': 'The band would go on to feature a rotating lineup of many musicians, '
E                   'including Eric Clapton, Klaus Voormann, Alan White, Billy Preston, '
E                   "Jim Keltner, Delaney & Bonnie and Friends, and Lennon's former "
E                   'Beatles bandmates George Harrison and Ringo Starr. ',
E                   'response_begin': 137,
E                   'response_end': 257,
E                   'response_text': 'They decided to credit all their future efforts to this conceptual '
E                   'and collaborative group after their marriage in 1969.',
E               },
E         +     {
E         +         'attribution_begin': 0,
E         +         'attribution_doc_id': None,
E         +         'attribution_end': 66,
E         +         'attribution_msg_index': 2,
E         +         'attribution_text': 'What was the concept behind the formation of the Plastic Ono Band?',
E         +         'response_begin': 137,
E         +         'response_end': 257,
E         +         'response_text': 'They decided to credit all their future efforts to this conceptual '
E         +         'and collaborative group after their marriage in 1969.',
E         +     },
E         +     {
E         +         'attribution_begin': 661,
E         +         'attribution_doc_id': '0',
E         +         'attribution_end': 740,
E         +         'attribution_msg_index': None,
E         +         'attribution_text': 'Lennon and Ono left the UK to settle in New York City during the fall '
E         +         'of 1971. ',
E         +         'response_begin': 137,
E         +         'response_end': 257,
E         +         'response_text': 'They decided to credit all their future efforts to this conceptual '
E         +         'and collaborative group after their marriage in 1969.',
E         +     },
E         +     {
E         +         'attribution_begin': 249,
E         +         'attribution_doc_id': '1',
E         +         'attribution_end': 411,
E         +         'attribution_msg_index': None,
E         +         'attribution_text': 'Following their marriage in 1969, they decided that all of their '
E         +         'future endeavours would be credited to a conceptual and collaborative '
E         +         'vehicle, Plastic Ono Band. ',
E         +         'response_begin': 137,
E         +         'response_end': 257,
E         +         'response_text': 'They decided to credit all their future efforts to this conceptual '
E         +         'and collaborative group after their marriage in 1969.',
E         +     },
E         +     {
E         +         'attribution_begin': 0,
E         +         'attribution_doc_id': None,
E         +         'attribution_end': 126,
E         +         'attribution_msg_index': 0,
E         +         'attribution_text': 'Who were the members of The Metal Ono Band, which was formed by Yoko '
E         +         'Ono in 1976 to explore her interest in heavy metal music?',
E         +         'response_begin': 137,
E         +         'response_end': 257,
E         +         'response_text': 'They decided to credit all their future efforts to this conceptual '
E         +         'and collaborative group after their marriage in 1969.',
E         +     },
E         +     {
E         +         'attribution_begin': 0,
E         +         'attribution_doc_id': None,
E         +         'attribution_end': 70,
E         +         'attribution_msg_index': 1,
E         +         'attribution_text': "I'm sorry, but I don't have the data to answer that specific "
E         +         'question.',
E         +         'response_begin': 137,
E         +         'response_end': 257,
E         +         'response_text': 'They decided to credit all their future efforts to this conceptual '
E         +         'and collaborative group after their marriage in 1969.',
E         +     },
E           ]

test/stdlib/components/intrinsic/test_core.py:105: AssertionError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions