def load_retriever(query_embedder_path, docs, doc_embeds_path, featurizer):
  """Constructs a Retriever based on the specified embedder."""
  query_embedder = retrieval.QueryEmbedder(
      embedder_model_or_path=query_embedder_path, featurizer=featurizer)
  retriever = retrieval.BruteForceRetriever(
      query_embedder=query_embedder,
      documents=docs,
      doc_embeds_or_path=doc_embeds_path,
      num_neighbors=FLAGS.num_candidates)
  logging.info(
      'Loaded retriever with query embedder from %s and doc '
      'embeddings from %s', query_embedder_path, doc_embeds_path)
  return retriever
Constructs a Retriever based on the specified embedder.
language/realm/example_generator.py