ExportXMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: ABX
    • None
    • None
    • Python Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Problem

      In pymongo_search_utils/index.py, the docstrings for the dimensions argument say to pass None when using auto-embeddings:

      dimensions (int): Number of dimensions in embedding,
          {{None}} if using auto-embeddings
      

      But dimensions is a required positional argument typed int, and the actual sentinel checked by _check_param_config is -1:

      if auto_embedding_model is not None and (dimensions != -1 or similarity is not None):
          raise ValueError(
              "if auto_embedding_model is set, then neither dimensions nor similarity may be set."
          )
      

      So a user following the docstring and passing dimensions=None with auto_embedding_model set gets a ValueError telling them not to set dimensions at all — which is also misleading, since it must be explicitly set to -1.

      Note that similarity is genuinely Optional[str] and None is correct there; only dimensions is wrong.

      Affected functions

      All three take the same argument and repeat the same wrong text:

      • vector_search_index_definition
      • create_vector_search_index
      • update_vector_search_index

      Suggested fix

      Correct the docstrings to say -1 when using auto-embeddings, e.g.:

      dimensions (int): Number of dimensions in the embedding.
          Pass -1 when using auto-embeddings.
      

      Optionally also reword the ValueError message so it states the required value rather than implying the argument should be omitted.

            Assignee:
            Casey Clements
            Reporter:
            Casey Clements
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: