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 if the input data cannot be parsed to form a valid model.
- 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:
documents (Sequence[Document]) – The retrieved documents.
query (str) – The query context.
callbacks (List[BaseCallbackHandler] | BaseCallbackManager | None) – Optional callbacks to run during compression.
- 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:
documents (Sequence[Document]) – The retrieved documents.
query (str) – The query context.
callbacks (List[BaseCallbackHandler] | BaseCallbackManager | None) – Optional callbacks to run during compression.
- Returns:
The compressed documents.
- Return type:
Sequence[Document]
Examples using OpenVINOReranker