How to use a custom rerank model in query?

Description

I have deployed a bge-reranker-v2-m3 model on a server. We assume the endpoint is http://192.168.1.1:30000.I want to use that rerank model when querying. How should I do? Should I edit the docker-compose.yaml? I use weaviate-client to use weaviate. I create a collection like this, and create a vector store, and query from that. The code like this:

weaviate_client = weaviate.connect_to_custom(http_host=os.getenv("WEAVIATE_HOST"), http_port=18080, http_secure=False, auth_credentials=os.getenv("WEAVIATE_KEY"), grpc_host=os.getenv("WEAVIATE_HOST"), grpc_port=50051, grpc_secure=False) 
weaviate_client.collections.create(name="collection1", vectorizer_config=None, properties=[Property(name="text", data_type=DataType.TEXT), Property(name="source", data_type=DataType.TEXT)])
vector_store = WeaviateVectorStore(             client=weaviate_client,             index_name="collection1",             text_key="text",             embedding=embeddings         ) 
results = vector_store.similarity_search_with_score("query text") 

In this process, how can I use rerank model? I notice that the function create has an argument “reranker_config”:

def create(
        self,
        name: str,
        *,
        description: Optional[str] = None,
        generative_config: Optional[_GenerativeProvider] = None,
        inverted_index_config: Optional[_InvertedIndexConfigCreate] = None,
        multi_tenancy_config: Optional[_MultiTenancyConfigCreate] = None,
        properties: Optional[Sequence[Property]] = None,
        references: Optional[List[_ReferencePropertyBase]] = None,
        replication_config: Optional[_ReplicationConfigCreate] = None,
        reranker_config: Optional[_RerankerProvider] = None,
        sharding_config: Optional[_ShardingConfigCreate] = None,
        vector_index_config: _VectorIndexConfigCreate,
        vectorizer_config: Optional[
            Union[_VectorizerConfigCreate, List[_NamedVectorConfigCreate]]
        ] = None,
        vector_config: Optional[Union[_VectorConfigCreate, List[_VectorConfigCreate]]] = None,
        data_model_properties: Optional[Type[Properties]] = None,
        data_model_references: Optional[Type[References]] = None,
        skip_argument_validation: bool = False,
    ) -> Collection[Properties, References]: ...

Is that argument useful?

Server Setup Information

  • Weaviate Server Version:1.30.2
  • Deployment Method: docker-compose
  • Multi Node? Number of Running Nodes:singleton
  • Client Language and Version:python weaviate_client 4.16.6
  • Multitenancy?:no

Hey @espkaiser

Welcome to our community, it’s great to have you here :partying_face:

You can modify the docker-compose.yaml as described in the docs here:

Weaviate Reranker Configuration – Docker Option 2

Have you given that a try?

Best regards,

Mohamed Shahin
Weaviate Support Engineer
(Ireland, UTC±00:00/+01:00)