text: Skip to main contentğŸ¦œï¸�ğŸ”— LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversAmazon KendraArxivAzure Cognitive SearchBM25ChaindeskChatGPT PluginCohere RerankerDocArray RetrieverElasticSearch BM25Google Cloud Enterprise SearchkNNLOTR (Merger Retriever)MetalPinecone Hybrid SearchPubMedSVMTF-IDFVespaWeaviate Hybrid SearchWikipediaZepText embedding modelsAgent toolkitsToolsVector storesGrouped by providerIntegrationsRetrieversTF-IDFOn this pageTF-IDFTF-IDF means term-frequency times inverse document-frequency.This notebook goes over how to use a retriever that under the hood uses TF-IDF using scikit-learn package.For more information on the details of TF-IDF see this blog post.# !pip install scikit-learnfrom langchain.retrievers import TFIDFRetrieverCreate New Retriever with Textsâ€‹retriever = TFIDFRetriever.from_texts(["foo", "bar", "world", "hello", "foo bar"])Create a New Retriever with Documentsâ€‹You can now create a new retriever with the documents you created.from langchain.schema import Documentretriever = TFIDFRetriever.from_documents(    [        Document(page_content="foo"),        Document(page_content="bar"),        Document(page_content="world"),        Document(page_content="hello"),        Document(page_content="foo bar"),    ])Use Retrieverâ€‹We can now use the retriever!result =