Uploaded image for project: 'Couchbase Python Client Library'
  1. Couchbase Python Client Library
  2. PYCBC-1552

Python performer raises an error when the value of k < 1 in vector search query options

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • None
    • FIT-performer
    • 0
    • High

    Description

      Python performer raises an error when the value of k < 1 in vector search query options

      Repo:

      Pass K = 0 in VectorQuery options.

      Python performer logs:

      [executors.multi_thread_executor] [INFO] Started thread
      [2024-02-06 17:35:09,707] [concurrent.futures] [ERROR] exception calling callback for <Future at 0x1063684d0 state=finished raised InvalidArgumentException>
      Traceback (most recent call last):
        File "/opt/homebrew/Cellar/python@3.11/3.11.7/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 340, in _invoke_callbacks
          callback(self)
        File "/Users/saurabhmishra/Desktop/work/gerrit/FIT/transactions-fit-performer/performers/python/executors/multi_thread_executor.py", line 117, in _workloads_complete
          raise exc
        File "/opt/homebrew/Cellar/python@3.11/3.11.7/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/thread.py", line 58, in run
          result = self.fn(*self.args, **self.kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/saurabhmishra/Desktop/work/gerrit/FIT/transactions-fit-performer/performers/python/executors/multi_thread_executor.py", line 112, in _execute_workloads
          raise e
        File "/opt/homebrew/Cellar/python@3.11/3.11.7/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/thread.py", line 58, in run
          result = self.fn(*self.args, **self.kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/saurabhmishra/Desktop/work/gerrit/FIT/transactions-fit-performer/performers/python/executors/multi_thread_executor.py", line 43, in execute_workload
          workload.execute(results, global_lock, global_counter, stream_owner)
        File "/Users/saurabhmishra/Desktop/work/gerrit/FIT/transactions-fit-performer/performers/python/workloads/sdk_workload.py", line 38, in execute
          self.execute_command(cmd, executed_cmd_count, results, stream_owner)
        File "/Users/saurabhmishra/Desktop/work/gerrit/FIT/transactions-fit-performer/performers/python/workloads/sdk_workload.py", line 48, in execute_command
          sdk_command = SdkCommandBuilder.build_command(self._conn, command, executed_command_count)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/saurabhmishra/Desktop/work/gerrit/FIT/transactions-fit-performer/performers/python/commands/sdk_command_builder.py", line 44, in build_command
          return SearchCommandBuilder.build_command_v2(cluster_cmd.search_v2, **cmd_kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/saurabhmishra/Desktop/work/gerrit/FIT/transactions-fit-performer/performers/python/commands/search_commands.py", line 775, in build_command_v2
          return SearchQueryCommand.create_v2_command(**cmd_kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/saurabhmishra/Desktop/work/gerrit/FIT/transactions-fit-performer/performers/python/commands/search_commands.py", line 514, in create_v2_command
          command.set_search_request()
        File "/Users/saurabhmishra/Desktop/work/gerrit/FIT/transactions-fit-performer/performers/python/commands/search_commands.py", line 464, in set_search_request
          queries.append(VectorQuery.create(vq.vector_field_name, [v for v in vq.vector_query], **vq_opts))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/saurabhmishra/Desktop/work/gerrit/FIT/python-performer-venv/lib/python3.11/site-packages/couchbase/logic/vector_search.py", line 108, in create
          return cls(field_name, vector, num_candidates=num_candidates, boost=boost)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/saurabhmishra/Desktop/work/gerrit/FIT/python-performer-venv/lib/python3.11/site-packages/couchbase/logic/vector_search.py", line 48, in __init__
          self.num_candidates = num_candidates
          ^^^^^^^^^^^^^^^^^^^
        File "/Users/saurabhmishra/Desktop/work/gerrit/FIT/python-performer-venv/lib/python3.11/site-packages/couchbase/logic/vector_search.py", line 88, in num_candidates
          raise InvalidArgumentException('num_candidates must be >= 1.')
      couchbase.exceptions.InvalidArgumentException: InvalidArgumentException(<message=num_candidates must be >= 1.>)
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jared.casey Jared Casey
            saurabh.mishra Saurabh Mishra
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty