[Build Failure] langchain_mongodb test_fulltext_retriever

XMLWordPrintableJSON

    • None
    • 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

      The test_fulltext_retriever is currently flaky because it does not wait for the index to settle after adding documents to the collection. We need to add this wait condition.

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

      [2024/12/04 17:56:30.598] =================================== FAILURES ===================================
      [2024/12/04 17:56:30.598] ___________________________ test_fulltext_retriever ____________________________
      [2024/12/04 17:56:30.598] indexed_vectorstore = <tests.utils.PatchedMongoDBAtlasVectorSearch object at 0x7f76f733b2b0>
      [2024/12/04 17:56:30.598]     def test_fulltext_retriever(
      [2024/12/04 17:56:30.598]         indexed_vectorstore: PatchedMongoDBAtlasVectorSearch,
      [2024/12/04 17:56:30.598]     ) -> None:
      [2024/12/04 17:56:30.598]         """Test result of performing fulltext search.
      [2024/12/04 17:56:30.598]         The Retriever is independent of the VectorStore.
      [2024/12/04 17:56:30.598]         We use it here only to get the Collection, which we know to be indexed.
      [2024/12/04 17:56:30.598]         """
      [2024/12/04 17:56:30.598]         collection: Collection = indexed_vectorstore.collection
      [2024/12/04 17:56:30.598]         retriever = MongoDBAtlasFullTextSearchRetriever(
      [2024/12/04 17:56:30.598]             collection=collection,
      [2024/12/04 17:56:30.598]             search_index_name=SEARCH_INDEX_NAME,
      [2024/12/04 17:56:30.598]             search_field=PAGE_CONTENT_FIELD,
      [2024/12/04 17:56:30.598]         )
      [2024/12/04 17:56:30.598]         query = "When was the last time I visited new orleans?"
      [2024/12/04 17:56:30.598]         results = retriever.invoke(query)
      [2024/12/04 17:56:30.598] >       assert "New Orleans" in results[0].page_content
      [2024/12/04 17:56:30.598] E       IndexError: list index out of range
      [2024/12/04 17:56:30.598] tests/integration_tests/test_retrievers.py:165: IndexError
      

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

                Created:
                Updated:
                Resolved: