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

LangChain: MongoDBAtlasVectorSearch: Implement async versions of add_texts & add_documents

    • Type: Icon: Task Task
    • Resolution: Works as Designed
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: langchain-mongodb-0.3
    • 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

      apoorva.joshi@mongodb.com pointed out that she wasn't seeing any speed improvements in using the ParentDocRetriever. I looked into this and see that that's because we do not provide a function that can take advantage of concurrency in calling out to the LLM to create embedding vectors when we add documents to the Collection.

      A batching structure is already in place, so this really is going from for to async for

      Note that one can call aadd_documents now, but this is implemented in the super-class as await run_in_executor(self.add_documents, *, ** so it doesn't provide benefit to the calls to the LLM, which can be done via aembed_documents.

      So, we implement
      _aadd_documents
      _aadd_texts
      and abulk_embed_and_insert_texts

      and call out to
      {{aembed_documents(texts)

      Definition of done

      Implement. Add tests. Open PR. Merge. Release.

            Assignee:
            Unassigned Unassigned
            Reporter:
            casey.clements@mongodb.com Casey Clements
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: