项目简介一款强大的 AI 驱动研究助手,使用多个LLMs和网页搜索进行深度、迭代分析。系统可本地运行以保护隐私,或配置为使用基于云的LLMs以增强功能。 特性 ? 高级研究能力
? 灵活 LLM 支持 ? 丰富的输出选项 ?隐私优先 ? 加强搜索集成 - 自动选择搜索来源:智能“自动”搜索引擎会智能分析您的查询,并根据查询内容选择最合适的搜索引擎
- DuckDuckGo 网络搜索集成(可能遇到速率限制)
- SerpAPI 集成到谷歌搜索结果中(需要 API 密钥)
- 谷歌可编程搜索引擎集成,用于定制搜索体验(需要 API 密钥)
- 《卫报》新闻文章和新闻业的集成(需要 API 密钥)
- 本地 RAG 搜索私人文档 - 使用向量嵌入搜索您的文档
?本地文档搜索(RAG) - 兼容各种文档格式(PDF、文本、Markdown 等)
示例研究:聚变能源发展 该仓库包含展示工具功能的完整研究示例。例如,我们的聚变能源研究分析提供了以下全面概述:
本示例展示了系统执行多次研究迭代的能力,跨科学和商业领域追踪证据线索,并从不同来源综合信息,同时保持适当的引用。
安装
克隆仓库:gitclonehttps://github.com/yourusername/local-deep-research.gitcdlocal-deep-research
pipinstall-rrequirements.txt
#InstallOllamafromhttps://ollama.aiollamapullmistral#Defaultmodel-manyworkreallywellchoosebestforyourhardware(fitsinGPU)
# Copy the templatecp .env.template .env
# Edit .env with your API keys (if using cloud LLMs)ANTHROPIC_API_KEY=your-api-key-here # For ClaudeOPENAI_API_KEY=your-openai-key-here # For GPT modelsGUARDIAN_API_KEY=your-guardian-api-key-here # For The Guardian search
使用
终端使用(不推荐):
网页界面 该项目包括一个用于更友好用户体验的网页界面:这将启动一个本地网络服务器,您可以在浏览器中通过http://127.0.0.1:5000访问。 网页界面功能:
配置
请将您最佳设置在问题中报告,以便我们改进默认设置。
Key settings inconfig.py: 关键设置在config.py中: # LLM ConfigurationDEFAULT_MODEL="mistral"# Change based on your needsDEFAULT_TEMPERATURE=0.7MAX_TOKENS=8000
# Search ConfigurationMAX_SEARCH_RESULTS=40SEARCH_REGION="us-en"TIME_PERIOD="y"SAFE_SEARCH=TrueSEARCH_SNIPPETS_ONLY=False
# Choose search tool: "wiki", "arxiv", "duckduckgo", "guardian", "serp", "local_all", or "auto"search_tool="auto"# "auto" will intelligently select the best search engine for your query
本地文档搜索(RAG) 系统包括使用检索增强生成(RAG)的强大本地文档搜索功能。这允许您从自己的文档集合中搜索和检索内容。
设置本地收藏 创建一个名为local_collections.py的文件在项目根目录下:
# local_collections.pyimportosfromtypingimportDict,Any
# Registry of local document collectionsLOCAL_COLLECTIONS = { # Research Papers Collection "research_papers": { "name":"Research Papers", "description":"Academic research papers and articles", "paths": [os.path.abspath("local_search_files/research_papers")], # Use absolute paths "enabled":True, "embedding_model":"all-MiniLM-L6-v2", "embedding_device":"cpu", "embedding_model_type":"sentence_transformers", "max_results":20, "max_filtered_results":5, "chunk_size":800, # Smaller chunks for academic content "chunk_overlap":150, "cache_dir":".cache/local_search/research_papers" },
# Personal Notes Collection "personal_notes": { "name":" ersonal Notes", "description":" ersonal notes and documents", "paths": [os.path.abspath("local_search_files/personal_notes")], # Use absolute paths "enabled":True, "embedding_model":"all-MiniLM-L6-v2", "embedding_device":"cpu", "embedding_model_type":"sentence_transformers", "max_results":30, "max_filtered_results":10, "chunk_size":500, # Smaller chunks for notes "chunk_overlap":100, "cache_dir":".cache/local_search/personal_notes" }}
Create the directoriesforyour collections:```bashmkdir -p local_search_files/research_papersmkdir -p local_search_files/personal_notes
将您的文档添加到这些文件夹中,系统将自动索引它们并使它们可供搜索。
使用本地搜索 您可以使用本地搜索的几种方式:
自动选择:在config.py中设置search_tool = "auto",系统将在查询适当的情况下自动使用您的本地收藏。 显式选择:将search_tool = "research_papers"设置为仅搜索特定集合。 搜索所有本地收藏:将search_tool = "local_all"设置为搜索您所有的本地文档收藏。 查询语法:使用collection:collection_name your query来在查询中指定特定的集合。
搜索引擎选项
系统支持多个搜索引擎,可以通过更改config.py中的search_tool变量来选择:
- 自动( auto ):智能搜索引擎选择器,分析您的查询并选择最合适的来源(维基百科、arXiv、本地收藏等)
- 维基百科(
wiki):最适合一般知识、事实和概述信息 - arXiv(
arxiv):非常适合科学和学术研究,访问预印本和论文 - PubMed(
pubmed):非常适合生物医学文献、医学研究和健康信息 - DuckDuckGo(
duckduckgo):无需 API 密钥的通用网页搜索 - 《卫报》(
guardian):高质量新闻和文章(需要 API 密钥) - SerpAPI(
serp):谷歌搜索结果(需要 API 密钥) - 谷歌可编程搜索引擎(
google_pse):可控制搜索范围和域的定制搜索体验(需要 API 密钥和搜索引擎 ID) - 本地收藏:在您的
local_collections.py文件中定义的任何收藏
|