ReasonSphere是一个基于大语言模型的递归思维增强系统,它能够通过多轮迭代和不同思维策略的动态切换,对复杂问题进行深入分析和思考。
- 标准思维(standard): 深入分析问题,进行连贯性思考
- 对比思维(contrastive): 提出与主流观点不同的替代方案
- 假设检验(hypothesis_testing): 批判性检验关键假设
- 发散思维(divergent): 探索新角度和创新解决方案
- 收敛思维(convergent): 综合分析,得出最终结论
- 基础验证与专业领域验证相结合
- 支持技术、商业、教育等多个专业领域
- 提供详细的问题反馈和改进建议
- 思考路径可视化
- 验证分数趋势分析
- 思维策略转换追踪
- 支持线性、树状、图状等多种存储结构
- 自动保存思考历史和验证结果
- 便于回溯和分析思考过程
- 克隆仓库:
git clone [email protected]:biantaishabi2/think.git
cd think- 安装依赖:
pip install -r requirements.txt- 设置环境变量:
export DEEPSEEK_API_KEY=your_api_keyfrom reasonsphere import ReasonSphereEngine
from reasonsphere.api import DeepseekAPI
# 创建API客户端
api_client = DeepseekAPI(
api_key=os.environ.get("DEEPSEEK_API_KEY"),
model="deepseek-reasoner"
)
# 创建引擎实例
engine = ReasonSphereEngine(
main_llm=api_client,
validator_llm=api_client,
config={
"max_iterations": 5,
"verbose": True
}
)
# 执行递归思考
question = "如何设计一个高效的微服务架构系统?"
summary, thought_history, metrics = await engine.recursive_think(question)from reasonsphere.validation import ValidationSystem
class CustomValidator(ValidationSystem):
async def validate(self, new_thought, thought_history):
base_result = await super().validate(new_thought, thought_history)
# 添加自定义验证逻辑
return base_result
engine.validator = CustomValidator(api_client)from examples.visualization import visualize_thinking_process
visualization_file = visualize_thinking_process(
engine.thought_store.storage_path,
engine.thought_store.session_id
)reasonsphere/
├── __init__.py
├── engine.py # 主控制引擎
├── thinking.py # 思考生成模块
├── validation.py # 验证系统
├── strategy.py # 策略控制器
├── context.py # 上下文管理
├── storage.py # 思考存储
└── utils.py # 工具函数
examples/basic_usage.py: 基本使用示例examples/advanced_strategies.py: 高级策略示例examples/custom_validators.py: 自定义验证器示例examples/visualization.py: 思考可视化示例
MIT License