Uploaded image for project: 'Python Integrations'
  1. Python Integrations
  2. INTPYTHON-388

LangChain:Fix error handling while creating index

    • Python Drivers

      1. Update the error message which currently says only the M10+ clusters can create the indexes

      2. Attempt to create duplicate index throws incorrect error

       

       
      OperationFailure: Duplicate Index, full error: {'ok': 0.0, 'errmsg': 'Duplicate Index', 'code': 68, 'codeName': 'IndexAlreadyExists', '$clusterTime': {'clusterTime': Timestamp(1729656959, 20), 'signature': {'hash': b'\x0bf\xea\xb4\xff|gd?f\xdfT\x1bHI\xa2cU\xed\x85', 'keyId': 7384804414130749441}}, 'operationTime': Timestamp(1729656959, 20)} The above exception was the direct cause of the following exception: OperationFailure Traceback (most recent call last)
      /usr/local/lib/python3.10/dist-packages/langchain_mongodb/index.py in create_vector_search_index(collection, index_name, dimensions, path, similarity, filters, wait_until_complete, **kwargs) 87 ) 88 except OperationFailure as e: ---> 89 raise OperationFailure(_search_index_error_message()) from e 90 91 if wait_until_complete: OperationFailure: Search index operations are not currently available on shared clusters, such as MO. They require dedicated clusters >= M10. You may still perform vector search. You simply must set up indexes manually. Follow the instructions here: https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-type/

            Assignee:
            casey.clements@mongodb.com Casey Clements
            Reporter:
            prakul.agarwal@mongodb.com Prakul Agarwal
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: