class_docstr: Ranks Documents based on their similarity to the query.
  It uses a pre-trained cross-encoder model (from the Hugging Face Hub) to embed the query and the Documents.
  
  Usage example:
  ```
  from haystack import Document
  from haystack.components.rankers import TransformersSimilarityRanker
  
  ranker = TransformersSimilarityRanker()
  docs = [Document(content="Paris"), Document(content="Berlin")]
  query = "City in Germany"
  output = ranker.run(query=query, documents=docs)
  docs = output["documents"]
  assert len(docs) == 2
  assert docs[0].content == "Berlin"
  ```
class_docstr_tok: ["Ranks","Documents","based","on","their","similarity","to","the","query",".","It","uses","a","pre-trained","cross-encoder","model","(","from","the","Hugging","Face","Hub",")","to","embed","the","query","and","the","Documents",".","Usage","example",":","``","`","from","haystack","import","Document","from","haystack.components.rankers","import","TransformersSimilarityRanker","ranker","=","TransformersSimilarityRanker","(",")","docs","=","[","Document","(","content=","''","Paris","''",")",",","Document","(","content=","''","Berlin","''",")","]","query","=","``","City","in","Germany","''","output","=","ranker.run","(","query=query",",","documents=docs",")","docs","=","output","[","``","documents","''","]","assert","len","(","docs",")","==","2","assert","docs","[","0","]",".content","==","``","Berlin","''","``","`"]
docstr: Data that is sent to Posthog for usage analytics.
docstr_tok: ["Data","that","is","sent","to","Posthog","for","usage","analytics","."]
code: def _get_telemetry_data(self) -> Dict[str, Any]:
      """
      Data that is sent to Posthog for usage analytics.
      """
      return {"model": str(self.model)}
  
file_path: haystack/haystack/components/rankers/transformers_similarity.py
imports: import logging
  from pathlib import Path
  from typing import List, Union, Dict, Any, Optional
  from haystack import ComponentError, Document, component, default_to_dict, default_from_dict
  from haystack.lazy_imports import LazyImport
  from haystack.utils import get_device
label_desc: Use image node_id 2 for calling the TransformersSimilarityRanker obj's underlying member method code with example usage: obj._get_telemetry_data() and returns: dict