一款强大的 AI 驱动研究助手,使用多个LLMs和网页搜索进行深度、迭代分析。系统可本地运行以保护隐私,或配置为使用基于云的LLMs以增强功能。
? 灵活 LLM 支持
? 丰富的输出选项
?隐私优先
? 加强搜索集成
?本地文档搜索(RAG)
本示例展示了系统执行多次研究迭代的能力,跨科学和商业领域追踪证据线索,并从不同来源综合信息,同时保持适当的引用。
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
终端使用(不推荐):
pythonmain.py
pythonapp.py
这将启动一个本地网络服务器,您可以在浏览器中通过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
创建一个名为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变量来选择:
wiki):最适合一般知识、事实和概述信息arxiv):非常适合科学和学术研究,访问预印本和论文pubmed):非常适合生物医学文献、医学研究和健康信息duckduckgo):无需 API 密钥的通用网页搜索guardian):高质量新闻和文章(需要 API 密钥)serp):谷歌搜索结果(需要 API 密钥)google_pse):可控制搜索范围和域的定制搜索体验(需要 API 密钥和搜索引擎 ID)local_collections.py文件中定义的任何收藏| 欢迎光临 链载Ai (https://www.lianzai.com/) | Powered by Discuz! X3.5 |