Repository: redis/redis-py
File: redis/commands/vectorset/commands.py (Python)

Code before:
        key: KeyT,
        input: Union[List[float], bytes, str],
        with_scores: Optional[bool] = False,
        with_attribs: Optional[bool] = False,
        count: Optional[int] = None,
        ef: Optional[Number] = None,
        filter: Optional[str] = None,
        filter_ef: Optional[str] = None,
        truth: Optional[bool] = False,
        no_thread: Optional[bool] = False,
        epsilon: Optional[Number] = None,
    ) -> Union[
        Awaitable[
            Optional[
                List[
                    Union[
                        List[EncodableT],
                        Dict[EncodableT, Number],
                        Dict[EncodableT, Dict[str, Any]],
                    ]
                ]
            ]
        ],
        Optional[
            List[
                Union[
                    List[EncodableT],
                    Dict[EncodableT, Number],
                    Dict[EncodableT, Dict[str, Any]],
                ]
            ]
        ],
    ]:
        """
        Compare a vector or element ``input``  with the other vectors in a vector set ``key``.

        ``with_scores`` sets if returns, for each element, the JSON attribute associated
        with the element or None when no attributes are present.

        ``with_attribs`` sets if the results should be returned with the
                attributes of the elements in the result.

        ``count`` sets the number of results to return.

        ``ef`` sets the exploration factor.

        ``filter`` sets the filter that should be applied for the search.

        ``filter_ef`` sets the max filtering effort.

        ``truth`` when enabled, forces the command to perform a linear scan.

Review comment (bug):
The docstring for `with_scores` is incorrect. It describes attribute functionality instead of score functionality. It should describe that `with_scores` returns similarity scores for each element.
```suggestion
        ``with_scores`` sets if similarity scores should be returned for each element in the result.
```

Code after:
            pieces.extend(["SETATTR", attributes_json])

        if numlinks:
            pieces.extend(["M", numlinks])

        return self.execute_command(VADD_CMD, key, *pieces)

    def vsim(
        self,
        key: KeyT,
        input: Union[List[float], bytes, str],
        with_scores: Optional[bool] = False,
        with_attribs: Optional[bool] = False,
        count: Optional[int] = None,
        ef: Optional[Number] = None,
        filter: Optional[str] = None,
        filter_ef: Optional[str] = None,
        truth: Optional[bool] = False,
        no_thread: Optional[bool] = False,
        epsilon: Optional[Number] = None,
    ) -> Union[Awaitable[VSimResult], VSimResult]:
        """
        Compare a vector or element ``input``  with the other vectors in a vector set ``key``.

        ``with_scores`` sets if similarity scores should be returned for each element in the result.

        ``with_attribs`` ``with_attribs`` sets if the results should be returned with the
                attributes of the elements in the result, or None when no attributes are present.

        ``count`` sets the number of results to return.

        ``ef`` sets the exploration factor.

        ``filter`` sets the filter that should be applied for the search.

        ``filter_ef`` sets the max filtering effort.

        ``truth`` when enabled, forces the command to perform a linear scan.

        ``no_thread`` when enabled forces the command to execute the search
                on the data structure in the main thread.

        ``epsilon`` floating point between 0 and 1, if specified will return
                only elements with distance no further than the specified one.

        For more information, see https://redis.io/commands/vsim.
        """

        if not input:
            raise DataError("'input' should be provided")