rerank
Rerank
Rerank
Source code in core/rerank.py
__init__(model)
Initialize the rerank model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model | RerankModel | Rerank model | required |
rerank_documents(query, docs)
Rerank the documents based on the query
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query | str | The query use to rerank | required |
docs | List[Document] | List of documents | required |
Returns:
| Type | Description |
|---|---|
Annotated[List[DocumentWithScore], 'List of documents with ranked score and sorted by score'] | List[DocumentWithScore]: List of documents and sorted by score |
Source code in core/rerank.py
RerankModel
Bases: ABC
Rerank Model
Source code in core/rerank.py
rerank_documents(query, docs) abstractmethod
Rerank the documents based on the query
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query | str | The query use to rerank | required |
docs | List[str] | List of documents | required |
Returns:
| Type | Description |
|---|---|
Annotated[List[float], 'List of scores for each document'] | List[float]: List of relevance scores |