主题
检索器集成
使用 LangChain Python 与检索器集成。
检索器 是一个接口,给定非结构化查询即可返回文档。 它比向量存储更通用。 检索器不需要能够存储文档,只需返回(或检索)它们。 检索器可以从向量存储创建,但其范围也足够广,可以包含其他来源。
检索器接受字符串查询作为输入,并返回一个 Document 对象列表作为输出。
请注意,所有向量存储都可以转换为检索器。可用向量存储请参阅向量存储集成文档。 本页列出的是通过继承 BaseRetriever 实现的自定义检索器。
自带文档
以下检索器允许你对自定义文档语料库进行索引和搜索。
外部索引
以下检索器将搜索外部索引(例如,基于互联网数据或类似来源构建的索引)。
| 检索器 | 来源 | 包 |
|---|---|---|
ApifySearchRetriever | 通过 Apify RAG Web Browser 进行互联网搜索 | langchain-apify |
DiffbotKnowledgeGraphRetriever | 在 Diffbot Knowledge Graph 上进行实体搜索 | langchain-diffbot |
DiffbotWebSearchRetriever | 通过 Diffbot Web Search API 进行互联网搜索 | langchain-diffbot |
ParallelSearchRetriever | 通过 Parallel Search API 进行互联网搜索 | langchain-parallel |
PerplexitySearchRetriever | 通过 Perplexity Search API 进行互联网搜索 | langchain-perplexity |
YouRetriever | 互联网搜索 | langchain-youdotcom |
所有检索器
| 检索器 | 自托管 | 云端服务 | 包 | 下载量 | | :- | :- | :- | :- | :- | | [`AmazonKnowledgeBasesRetriever`](https://docs.langchain.com/oss/python/integrations/retrievers/bedrock) | ❌ | ✅ | [`langchain-aws`](https://reference.langchain.com/python/langchain-aws/retrievers/bedrock/AmazonKnowledgeBasesRetriever) |
| | [`Google drive`](https://docs.langchain.com/oss/python/integrations/retrievers/google_drive) | | | [`langchain-google-community`](https://pypi.org/project/langchain-google-community/) |
| | [`VertexAISearchRetriever`](https://docs.langchain.com/oss/python/integrations/retrievers/google_vertex_ai_search) | ❌ | ✅ | [`langchain-google-community`](https://reference.langchain.com/python/langchain-google-community/vertex_ai_search/VertexAISearchRetriever) |
| | [`MongoDBAtlas`](https://docs.langchain.com/oss/python/integrations/retrievers/mongodb_atlas) | | | [`langchain-mongodb`](https://pypi.org/project/langchain-mongodb/) |
| | [`Cohere RAG`](https://docs.langchain.com/oss/python/integrations/retrievers/cohere) | | | [`langchain-cohere`](https://pypi.org/project/langchain-cohere/) |
| | [`Cohere reranker`](https://docs.langchain.com/oss/python/integrations/retrievers/cohere-reranker) | | | [`langchain-cohere`](https://pypi.org/project/langchain-cohere/) |
| | [`NVIDIARAGRetriever`](https://docs.langchain.com/oss/python/integrations/retrievers/nvidia) | ✅ | ❌ | [`langchain-nvidia-ai-endpoints`](https://reference.langchain.com/python/langchain-nvidia-ai-endpoints/retrievers/NVIDIARAGRetriever) |
| | [`Pinecone rerank`](https://docs.langchain.com/oss/python/integrations/retrievers/pinecone_rerank) | | | [`langchain-pinecone`](https://pypi.org/project/langchain-pinecone/) |
| | [`WatsonxRerank`](https://docs.langchain.com/oss/python/integrations/retrievers/ibm_watsonx_ranker) | | | [`langchain-ibm`](https://reference.langchain.com/python/integrations/langchain_ibm/) |
| | [`PerplexitySearchRetriever`](https://docs.langchain.com/oss/python/integrations/retrievers/perplexity_search) | ❌ | ✅ | [`langchain-perplexity`](https://reference.langchain.com/python/langchain-perplexity/retrievers/PerplexitySearchRetriever) |
| | [`ElasticsearchRetriever`](https://docs.langchain.com/oss/python/integrations/retrievers/elasticsearch_retriever) | ✅ | ✅ | [`langchain-elasticsearch`](https://reference.langchain.com/python/langchain-elasticsearch/retrievers/ElasticsearchRetriever) |
| | [`Graph RAG`](https://docs.langchain.com/oss/python/integrations/retrievers/graph_rag) | | | [`langchain-graph-retriever`](https://pypi.org/project/langchain-graph-retriever/) |
| | [`Self Querying with SAP HANA Cloud Vector Engine`](https://pypi.org/project/langchain-hana/) | | | [`langchain-hana`](https://pypi.org/project/langchain-hana/) |
| | [`ApifySearchRetriever`](https://docs.apify.com/integrations/langchain) | | | [`langchain-apify`](https://pypi.org/project/langchain-apify/) |
| | [`Ragatouille`](https://docs.langchain.com/oss/python/integrations/retrievers/ragatouille) | | | [`ragatouille`](https://pypi.org/project/ragatouille/) |
| | [`M3Retriever`](https://github.com/skynetcmd/m3-memory/blob/main/docs/integrations/LANGCHAIN.md) | ✅ | ❌ | [`m3-memory`](https://pypi.org/project/m3-memory/) |
| | [`SemanticaRetriever`](https://docs.getsemantica.ai/integrations/langchain) | ✅ | ❌ | [`semantica`](https://pypi.org/project/semantica/) |
| | [`ParallelSearchRetriever`](https://docs.langchain.com/oss/python/integrations/retrievers/parallel) | ❌ | ✅ | [`langchain-parallel`](https://reference.langchain.com/python/langchain-parallel/retrievers/ParallelSearchRetriever) |
| | [`RecallRetriever`](https://giulioder.github.io/RE-call/integrations.html) | ✅ | ❌ | [`recall-rag`](https://pypi.org/project/recall-rag/) |
| | [`Nebius`](https://docs.tokenfactory.nebius.com/quickstart) | | | [`langchain-nebius`](https://pypi.org/project/langchain-nebius/) |
| | [`BlopusRetriever`](https://blopus.ai/docs/) | | | [`langchain-blopus`](https://pypi.org/project/langchain-blopus/) |
| | [`LinkupSearchRetriever`](https://github.com/LinkupPlatform/langchain-linkup) | | | [`langchain-linkup`](https://pypi.org/project/langchain-linkup/) |
| | [`Nimble Extract`](https://docs.nimbleway.com/integrations/connectors/langchain) | | | [`langchain-nimble`](https://pypi.org/project/langchain-nimble/) |
| | [`Nimble Search`](https://docs.nimbleway.com/integrations/connectors/langchain) | | | [`langchain-nimble`](https://pypi.org/project/langchain-nimble/) |
| | [`YouRetriever`](https://you.com/docs/integrations/langchain) | ❌ | ✅ | [`langchain-youdotcom`](https://pypi.org/project/langchain-youdotcom/) |
| | [`SingleStoreSQLDatabaseRetriever`](https://github.com/singlestore-labs/langchain-singlestore/) | | | [`langchain-singlestore`](https://pypi.org/project/langchain-singlestore/) |
| | [`YouTubeCommentsRetriever`](https://github.com/urraf/langchain-youtube#readme) | | | [`langchain-youtube`](https://pypi.org/project/langchain-youtube/) |
| | [`YouTubePlaylistRetriever`](https://github.com/urraf/langchain-youtube#readme) | | | [`langchain-youtube`](https://pypi.org/project/langchain-youtube/) |
| | [`YouTubeSearchRetriever`](https://github.com/urraf/langchain-youtube#readme) | | | [`langchain-youtube`](https://pypi.org/project/langchain-youtube/) |
| | [`YouTubeTranscriptRetriever`](https://github.com/urraf/langchain-youtube#readme) | | | [`langchain-youtube`](https://pypi.org/project/langchain-youtube/) |
| | [`YouTubeVideoRetriever`](https://github.com/urraf/langchain-youtube#readme) | | | [`langchain-youtube`](https://pypi.org/project/langchain-youtube/) |
| | [`AlfrescoRetriever`](https://github.com/OpenDMA/langchain-opendma/blob/main/docs/Retriever.md#alfrescoretriever) | ✅ | ❌ | [`langchain-opendma`](https://pypi.org/project/langchain-opendma/) |
| | [`DocumentumRetriever`](https://github.com/OpenDMA/langchain-opendma/blob/main/docs/Retriever.md#documentumretriever) | ✅ | ❌ | [`langchain-opendma`](https://pypi.org/project/langchain-opendma/) |
| | [`FileNetP8Retriever`](https://github.com/OpenDMA/langchain-opendma/blob/main/docs/Retriever.md#filenetp8retriever) | ✅ | ❌ | [`langchain-opendma`](https://pypi.org/project/langchain-opendma/) |
| | [`OnBaseRetriever`](https://github.com/OpenDMA/langchain-opendma/blob/main/docs/Retriever.md#onbaseretriever) | ✅ | ❌ | [`langchain-opendma`](https://pypi.org/project/langchain-opendma/) |
| | [`OpenDMARetriever`](https://github.com/OpenDMA/langchain-opendma/blob/main/docs/Retriever.md) | ✅ | ❌ | [`langchain-opendma`](https://pypi.org/project/langchain-opendma/) |
| | [`CKGRetriever`](https://github.com/Yarmoluk/langchain-ckg) | | | [`langchain-ckg`](https://pypi.org/project/langchain-ckg/) |
| | [`HydrafetchSearchRetriever`](https://docs.hydrafetch.com) | | | [`langchain-hydrafetch`](https://pypi.org/project/langchain-hydrafetch/) |
| | [`RedditCommentsRetriever`](https://github.com/urraf/langchain-reddit#readme) | | | [`langchain-reddit`](https://pypi.org/project/langchain-reddit/) |
| | [`RedditSearchRetriever`](https://github.com/urraf/langchain-reddit#readme) | | | [`langchain-reddit`](https://pypi.org/project/langchain-reddit/) |
| | [`RedditSubredditRetriever`](https://github.com/urraf/langchain-reddit#readme) | | | [`langchain-reddit`](https://pypi.org/project/langchain-reddit/) |
| | [`FoxNoseRetriever`](https://langchain-foxnose.readthedocs.io/) | ❌ | ✅ | [`langchain-foxnose`](https://pypi.org/project/langchain-foxnose/) |
| | [`StackOverflowAnswerRetriever`](https://github.com/urraf/langchain-stackoverflow#readme) | | | [`langchain-stackoverflow`](https://pypi.org/project/langchain-stackoverflow/) |
| | [`StackOverflowSearchRetriever`](https://github.com/urraf/langchain-stackoverflow#readme) | | | [`langchain-stackoverflow`](https://pypi.org/project/langchain-stackoverflow/) |
| | [`QuanticDataRetriever`](https://quanticdata.io/docs/) | | | [`langchain-quanticdata`](https://pypi.org/project/langchain-quanticdata/) |
| | [`AlphaAINewsRetriever`](https://alphai.io/developers) | | | [`langchain-alphai`](https://pypi.org/project/langchain-alphai/) |
| | [`HackerNewsCommentsRetriever`](https://github.com/urraf/langchain-hackernews#readme) | | | [`langchain-hackernews`](https://pypi.org/project/langchain-hackernews/) |
| | [`HackerNewsFrontPageRetriever`](https://github.com/urraf/langchain-hackernews#readme) | | | [`langchain-hackernews`](https://pypi.org/project/langchain-hackernews/) |
| | [`HackerNewsSearchRetriever`](https://github.com/urraf/langchain-hackernews#readme) | | | [`langchain-hackernews`](https://pypi.org/project/langchain-hackernews/) |
| | [`PlayStoreAppRetriever`](https://github.com/urraf/langchain-playstore#readme) | | | [`langchain-playstore`](https://pypi.org/project/langchain-playstore/) |
| | [`PlayStoreReviewsRetriever`](https://github.com/urraf/langchain-playstore#readme) | | | [`langchain-playstore`](https://pypi.org/project/langchain-playstore/) |
| | [`Valyucontext`](https://docs.valyu.ai/overview) | | | [`langchain-valyu`](https://pypi.org/project/langchain-valyu/) |
| | [`Contextual AI reranker`](https://docs.contextual.ai/) | | | [`langchain-contextual`](https://pypi.org/project/langchain-contextual/) |
| | [`BoxRetriever`](https://docs.langchain.com/oss/python/integrations/retrievers/box) | | | [`langchain-box`](https://pypi.org/project/langchain-box/) |
| | [`ReplyLayerRetriever`](https://replylayer.ai/docs/guides/langchain) | ❌ | ✅ | [`langchain-replylayer`](https://pypi.org/project/langchain-replylayer/) |
| | [`SynapRetriever`](https://www.maximem.ai/) | | | [`maximem-synap-langchain`](https://pypi.org/project/maximem-synap-langchain/) |
| | [`Dappier`](https://docs.dappier.com/) | | | [`langchain-dappier`](https://pypi.org/project/langchain-dappier/) |
| | [`PerseusVaultRetriever`](https://github.com/Perseus-Computing-LLC/langchain-perseus-vault) | ✅ | ❌ | [`langchain-perseus-vault`](https://pypi.org/project/langchain-perseus-vault/) |
| | [`PolarisRetriever`](https://github.com/Veroq-ai/polaris-sdks/tree/main/python/langchain_polaris) | | | [`langchain-polaris`](https://pypi.org/project/langchain-polaris/) |
| | [`Sourcey`](https://sourcey.com/docs/guides/guide-langchain-retriever) | | | [`langchain-sourcey`](https://pypi.org/project/langchain-sourcey/) |
| | [`Kinetica vectorstore based retriever`](https://github.com/kineticadb/langchain-kinetica) | | | [`langchain-kinetica`](https://pypi.org/project/langchain-kinetica/) |
| | [`arXiv`](https://j1c.github.io/langchain-arxiv-retriever) | | | [`langchain-arxiv-retriever`](https://pypi.org/project/langchain-arxiv-retriever/) |
| | [`SpiceDB Retriever`](https://github.com/authzed/langchain-spicedb) | | | [`langchain-spicedb`](https://pypi.org/project/langchain-spicedb/) |
| | [`MemstateRetriever`](https://memstate.ai/docs/integrations/langchain) | ❌ | ✅ | [`langchain-memstate`](https://pypi.org/project/langchain-memstate/) |
| | [`MengramRetriever`](https://mengram.io/docs) | ✅ | ✅ | [`langchain-mengram`](https://pypi.org/project/langchain-mengram/) |
| | [`EgnyteRetriever`](https://docs.langchain.com/oss/python/integrations/retrievers/egnyte) | | | [`egnyte-langchain-connector`](https://pypi.org/project/egnyte-langchain-connector/) |
| | [`AxioraRetriever`](https://axiora.dev/docs) | ❌ | ✅ | [`langchain-axiora`](https://pypi.org/project/langchain-axiora/) |
| | [`DiffbotKnowledgeGraphRetriever`](https://github.com/diffbot/langchain-diffbot) | | | [`langchain-diffbot`](https://pypi.org/project/langchain-diffbot/) |
| | [`DiffbotWebSearchRetriever`](https://github.com/diffbot/langchain-diffbot) | | | [`langchain-diffbot`](https://pypi.org/project/langchain-diffbot/) |
| | [`CoalentRetriever`](https://coalent.ai/docs) | ✅ | ❌ | [`langchain-coalent`](https://pypi.org/project/langchain-coalent/) |
| | [`HighSNRDocumentCompressor`](https://www.high-snr.com/docs.html) | ❌ | ✅ | [`langchain-highsnr`](https://pypi.org/project/langchain-highsnr/) |
| | [`Permit`](https://docs.permit.io/) | | | [`langchain-permit`](https://pypi.org/project/langchain-permit/) |
| | [`Cognee`](https://docs.cognee.ai/) | | | [`langchain-cognee`](https://pypi.org/project/langchain-cognee/) |
| | [`Galaxia`](https://smabbler.gitbook.io/smabbler/api-rag/smabblers-api-rag) | | | [`langchain-galaxia-retriever`](https://pypi.org/project/langchain-galaxia-retriever/) |
| | [`DeweyRetriever`](https://github.com/meetdewey/langchain-dewey) | ❌ | ✅ | [`langchain-dewey`](https://pypi.org/project/langchain-dewey/) |
| | [`AlchemystMemory`](https://getalchemystai.com/docs) | ❌ | ✅ | [`alchemyst-langchain`](https://pypi.org/project/alchemyst-langchain/) |
| | [`VectorizeRetriever`](https://docs.vectorize.io/rag-pipelines/retrieval-endpoint#access-tokens) | | | [`langchain-vectorize`](https://pypi.org/project/langchain-vectorize/) |
| | [`AgentMail`](https://github.com/agentmail-to/langchain-agentmail) | | | [`langchain-agentmail`](https://pypi.org/project/langchain-agentmail/) |
| | [`IgptSearchRetriever`](https://docs.igpt.ai/docs/sdks/langchain#igpt-search-retriever) | | | [`langchain-igpt`](https://pypi.org/project/langchain-igpt/) |
| | [`IMAP`](https://github.com/jfouret/langchain-imap) | | | [`langchain-imap`](https://pypi.org/project/langchain-imap/) |
| | [`Perigon`](https://perigon.io/docs/api/intro) | | | [`langchain-perigon`](https://pypi.org/project/langchain-perigon/) |
| | [`EngramRetriever`](https://engram.ai/) | | | [`langchain-engram`](https://pypi.org/project/langchain-engram/) |
| | [`Greennode`](https://greennode.ai/) | | | [`langchain-greennode`](https://pypi.org/project/langchain-greennode/) |
| | [`OpenMemoryRetriever`](https://github.com/nullure/langchain-openmemory) | | | [`langchain-openmemory`](https://pypi.org/project/langchain-openmemory/) |
| | [`KeiroRetriever`](https://github.com/Keirolabs-API/langchain-keiro) | ❌ | ✅ | [`langchain-keiro`](https://pypi.org/project/langchain-keiro/) |
| | [`Zotero`](https://github.com/TimBMK/langchain-zotero-retriever) | | | [`langchain-zotero-retriever`](https://pypi.org/project/langchain-zotero-retriever/) |
| | [`WhooshRetriever`](https://github.com/priya-sundaram-dev/whoosh/tree/main/integrations/langchain-whoosh#readme) | ✅ | ❌ | [`langchain-whoosh`](https://pypi.org/project/langchain-whoosh/) |
|