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

[LangChain] SyntaxError: invalid escape sequence

    • 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

      I saw the following error when trying to import `langchain_mongob`:

      .venv/lib/python3.13/site-packages/langchain_mongodb/__init__.py:11: in <module>
          from langchain_mongodb.cache import MongoDBAtlasSemanticCache, MongoDBCache
      .venv/lib/python3.13/site-packages/langchain_mongodb/cache.py:19: in <module>
          from langchain_mongodb.vectorstores import MongoDBAtlasVectorSearch
      .venv/lib/python3.13/site-packages/langchain_mongodb/vectorstores.py:35: in <module>
          from langchain_mongodb.utils import (
      E     File "/home/runner/work/pymongo-voyageai/pymongo-voyageai/.venv/lib/python3.13/site-packages/langchain_mongodb/utils.py", line 91
      E       MMR = argmax_{D_i ∈ R \ S} [λ * Sim(D_i, Q) - (1 - λ) * max_{D_j ∈ S} Sim(D_i, D_j)]
      E                                   ^^
      E   SyntaxError: invalid escape sequence '\ '
      

      https://github.com/blink1073/pymongo-voyageai/actions/runs/14481474159/job/40619117593

      We need to make the docstring a raw string.

            Assignee:
            steve.silvester@mongodb.com Steve Silvester
            Reporter:
            steve.silvester@mongodb.com Steve Silvester
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: