OpenVINOReranker#

class langchain_community.document_compressors.openvino_rerank.OpenVINOReranker[source]#

Bases: BaseDocumentCompressor

OpenVINO rerank models.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

param model_kwargs: Dict[str, Any] [Optional]#

Keyword arguments passed to the model.

param model_name_or_path: str [Required]#

HuggingFace model id.

param ov_model: Any = None#

OpenVINO model object.

param tokenizer: Any = None#

Tokenizer for embedding model.

param top_n: int = 4#

return Top n texts.

async acompress_documents(documents: Sequence[Document], query: str, callbacks: list[BaseCallbackHandler] | BaseCallbackManager | None = None) Sequence[Document]#

Async compress retrieved documents given the query context.

Parameters:
Returns:

The compressed documents.

Return type:

Sequence[Document]

compress_documents(documents: Sequence[Document], query: str, callbacks: list[BaseCallbackHandler] | BaseCallbackManager | None = None) Sequence[Document][source]#

Compress retrieved documents given the query context.

Parameters:
Returns:

The compressed documents.

Return type:

Sequence[Document]

rerank(request: Any) Any[source]#
Parameters:

request (Any)

Return type:

Any

save_model(model_path: str) bool[source]#
Parameters:

model_path (str)

Return type:

bool

Examples using OpenVINOReranker