ParallelSearchRetriever] 是基于 Parallel 的 Search API 支持的 LangChain BaseRetriever。它返回 list[Document] 并包含丰富的 metadata(url, title, publish_date, search_id, excerpts, query),可无缝集成到任何 RAG 管道中。
需要返回原始搜索响应而非
Document 的 LLM 调用工具?请参考 ParallelSearchTool。概述
集成细节
安装
集成模块位于langchain-parallel 包中。
凭据
前往 Parallel 注册并生成 API 密钥。在环境中设置PARALLEL_API_KEY:
实例化
使用
每个返回的Document 将其摘要合并为 page_content,并暴露来源 URL、标题和发布日期到 metadata:
配置搜索
为objective 添加更丰富的检索目标(与关键词 search_queries 配合)。检索器将向底层 Search API 转发来源和请求策略。
异步
在链中调用
ParallelSearchRetriever 可无缝接入任何 LangChain 链:
API 参考
详细文档请查阅 @[ParallelSearchRetriever] API 参考或 Parallel 搜索 API 指南。
官方原文:src/oss/python/integrations/retrievers/parallel.mdx · 非官方翻译,译文由 AI 生成,以英文原文为准。