[LangGraph] TestMongoDBAtlasFullTextSearchRetriever test failure

XMLWordPrintableJSON

    • 🔵 Done
    • Python Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      https://spruce.mongodb.com/task/ai_ml_pipeline_testing_test_langchain_python_rhel_test_langchain_python_remote_68e4547c73b9a300079b791d_25_10_06_23_45_00/logs?execution=0

      FAILED tests/integration_tests/test_retrievers_standard.py::TestMongoDBAtlasFullTextSearchRetriever::test_k_constructor_param - assert 0 == 3

      [2025/10/06 19:08:16.120] _______ TestMongoDBAtlasFullTextSearchRetriever.test_k_constructor_param _______
      [2025/10/06 19:08:16.120] self = <tests.integration_tests.test_retrievers_standard.TestMongoDBAtlasFullTextSearchRetriever object at 0x7f44f4a4a450>
      [2025/10/06 19:08:16.120]     def test_k_constructor_param(self) -> None:
      [2025/10/06 19:08:16.120]         """Test the number of results constructor parameter.
      [2025/10/06 19:08:16.120]         Test that the retriever constructor accepts a parameter representing
      [2025/10/06 19:08:16.120]         the number of documents to return.
      [2025/10/06 19:08:16.120]         By default, the parameter tested is named ``k``, but it can be overridden by
      [2025/10/06 19:08:16.120]         setting the ``num_results_arg_name`` property.
      [2025/10/06 19:08:16.120]         .. note::
      [2025/10/06 19:08:16.120]             If the retriever doesn't support configuring the number of results returned
      [2025/10/06 19:08:16.120]             via the constructor, this test can be skipped using a pytest ``xfail`` on
      [2025/10/06 19:08:16.120]             the test class:
      [2025/10/06 19:08:16.120]             .. code-block:: python
      [2025/10/06 19:08:16.120]                 @pytest.mark.xfail(
      [2025/10/06 19:08:16.120]                     reason="This retriever doesn't support setting "
      [2025/10/06 19:08:16.120]                     "the number of results via the constructor."
      [2025/10/06 19:08:16.120]                 )
      [2025/10/06 19:08:16.120]                 def test_k_constructor_param(self) -> None:
      [2025/10/06 19:08:16.120]                     raise NotImplementedError
      [2025/10/06 19:08:16.120]         .. dropdown:: Troubleshooting
      [2025/10/06 19:08:16.120]             If this test fails, the retriever constructor does not accept a number
      [2025/10/06 19:08:16.120]             of results parameter, or the retriever does not return the correct number
      [2025/10/06 19:08:16.120]             of documents ( of the one set in ``num_results_arg_name``) when it is
      [2025/10/06 19:08:16.120]             set.
      [2025/10/06 19:08:16.120]             For example, a retriever like
      [2025/10/06 19:08:16.120]             .. code-block:: python
      [2025/10/06 19:08:16.120]                     MyRetriever(k=3).invoke("query")
      [2025/10/06 19:08:16.120]             should return 3 documents when invoked with a query.
      [2025/10/06 19:08:16.120]         """
      [2025/10/06 19:08:16.120]         params = {
      [2025/10/06 19:08:16.120]             k: v
      [2025/10/06 19:08:16.120]             for k, v in self.retriever_constructor_params.items()
      [2025/10/06 19:08:16.120]             if k != self.num_results_arg_name
      [2025/10/06 19:08:16.120]         }
      [2025/10/06 19:08:16.120]         params_3 = {**params, self.num_results_arg_name: 3}
      [2025/10/06 19:08:16.120]         retriever_3 = self.retriever_constructor(**params_3)
      [2025/10/06 19:08:16.120]         result_3 = retriever_3.invoke(self.retriever_query_example)
      [2025/10/06 19:08:16.120] >       assert len(result_3) == 3
      [2025/10/06 19:08:16.120] E       assert 0 == 3
      [2025/10/06 19:08:16.120] E        +  where 0 = len([])
      [2025/10/06 19:08:16.120] .venv/lib64/python3.12/site-packages/langchain_tests/integration_tests/retrievers.py:95: AssertionError
      [2025/10/06 19:08:16.120] =============================== warnings summary ===============================
      

            Assignee:
            Steve Silvester
            Reporter:
            Steve Silvester
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: