TypeError with an unexpected keyword argument 'query_type' when attempting to perform hybrid similarity search using the databricks-vectorsearch package

Ensure you have the latest version of the databricks-vectorsearch package installed in your environment.

Written by jessica.santos

Last published at: October 17th, 2024

Problem

When using the databricks-vectorsearch package to perform a hybrid keyword-similarity search, you set the query_type argument  to hybrid in the similarity_search function and receive an error. 

TypeError: VectorSearchIndex.similarity_search() got an unexpected keyword argument 'query_type'

 

Cause

The query_type argument was introduced in version 0.38 of the databricks-vectorsearch package. Older versions do not support this type of search.

 

Solution

To resolve the issue, update your databricks-vectorsearch package. 

!pip install databricks-vectorsearch --force-reinstall
dbutils.library.restartPython()