Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-4446

[LangChain] MongoDBVectorSearch.delete/.add_texts function rework

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: AI/ML
    • None
    • Python Drivers
    • 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?

      Context

      MongoDBVectorSearch.delete Incorrectly communicates that passing in "ids" will appropriately delete documents when, in actually it deletes values by the text_key. This function needs to be refactored to be clearer and also allow for MongoDB ObjectIds to be deleted as well. We should also document the types we can take for delete. 
      I.e. [str(ObjectId), ObjectId, \{"$oid": str(ObjectId)}] are all valid types

       

      MongoDBVectorSearch.add_texts Returns a list of ObjectIds. Since the RAG Chain cannot serialize bson ObjectIds, we should return a list of dictionaries specified as `{"$oid": str(ObjectId) }`. 

      Definition of done

      Above functions have been refactored

      Pitfalls

      The changes to add_texts can be seen as breaking API changes so we may have to do a versioning bump.

            Assignee:
            casey.clements@mongodb.com Casey Clements
            Reporter:
            jib.adegunloye@mongodb.com Jib Adegunloye
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: