ZenRube
ZenRube是一个复杂的模块化认知平台,提供专家AI编排和自发布功能 Rube.app。它采用基于共识的架构构建,具有专门的专家模块,用于智能数据处理、路由、内容生成和自动化发布工作流程。
✨ 特性
- 🧠 专家系统架构:11个以上针对不同任务的专业专家模块
- 🤝 基于共识的AI编排:具有可配置综合风格的多专家共识系统
- 🔀 智能路由:高级语义分析和意图检测
- 🧹 数据处理:自动数据清理和预处理功能
- 📝 内容生成:人工智能支持的摘要和内容创建
- 📤 出版管道:结构化内容发布和分发
- 🚀 汽车出版:自动专家版本检测和市场发布
- 👥 团队委员会:具有动态人格系统的多脑编排
- �️ YAML配置:灵活的配置管理(
.zenrube.yml) - 💾 缓存系统:TTL感知缓存,支持多种后端
- 🔌 可扩展设计:面向定制专家的基于插件的架构
- 🧪 综合测试:覆盖范围广泛的完整测试套件
- 🎭 动态配置文件:可配置的专家个性和行为模式
🚀 快速开始
安装
pip install zenrube或用于当地发展:
git clone https://github.com/vmanoilov/zenrube.git
cd zenrube
pip install -e .[dev]基本用法
from zenrube import zen_consensus
# Run a consensus across all experts
result = zen_consensus(
"What are the key considerations for deploying a machine learning model to production?"
)
print(result["consensus"])可用专家
该系统包括11名专业专家:
岩心处理专家
- 语义路由器:分析输入文本以推断意图和路线数据
- 数据清理器:处理和清理数据以实现一致的格式
- 摘要器:使用AI生成简明摘要
- 出版商:处理内容格式化和发布工作流
系统集成专家
- Rube适配器:与Rube.app平台集成
- LLM连接器:提供LLM提供程序抽象层
- 版本管理器:管理专家版本和更新
- 自动发布器:将专家发布自动化到市场
编排专家
- 团队委员会:具有动态人格系统的多脑编排
- 专家登记处:管理和发现可用的专家
- 务实工程师:实用工程见解
- 系统架构师:高级系统架构指导
- 证券分析师:安全考虑和分析
专家使用示例
使用个人专家
from zenrube.experts import SemanticRouterExpert
router = SemanticRouterExpert()
result = router.run("Error: Database connection failed")
# Returns: {"input": "...", "intent": "error", "route": "debug_expert"}from zenrube.experts import DataCleanerExpert
cleaner = DataCleanerExpert()
result = cleaner.run(raw_data)
# Returns cleaned and structured data专家登记处
from zenrube.experts_module import list_experts, get_expert
# List all available experts
experts = list_experts()
print(experts) # Returns list of all expert slugs
# Get specific expert
expert = get_expert('semantic_router')⚙️ 配置
ZenRube从加载配置 .zenrube.yml 在项目根目录和用户的主目录中:
experts:
- pragmatic_engineer
- systems_architect
- security_analyst
synthesis_style: balanced
parallel_execution: true
provider: rube
max_workers: 4
cache_ttl_seconds: 120
logging:
level: INFO
debug: false
cache:
backend: memory
ttl: 120共识配置
from zenrube import zen_consensus, SYNTHESIS_STYLES
# Custom consensus with specific experts and style
result = zen_consensus(
"How should we approach microservices architecture?",
experts=["systems_architect", "pragmatic_engineer", "security_analyst"],
synthesis_style="collaborative",
parallel=True
)支持的合成样式:
balanced:平衡综合,突出协议和实际步骤critical:强调风险和缓解措施的关键综合collaborative:确定协同增效作用的协作综合
🏗️ 建筑
专家登记处
所有专家都通过 ExpertRegistry:
from zenrube.experts_module import ExpertRegistry, ExpertDefinition
# Register a custom expert
custom_expert = ExpertDefinition(
slug="custom_processor",
name="Custom Processor",
description="Processes custom data types",
handler=custom_handler_function
)
ExpertRegistry.register(custom_expert)提供商系统
提供程序架构支持多个LLM后端:
from zenrube.providers import ProviderRegistry
# Configure Rube provider
from zenrube import configure_rube_client
from rube import invoke_llm as rube_invoke
configure_rube_client(rube_invoke)团队委员会整合
团队委员会专家提供多脑协调:
from zenrube.experts import TeamCouncil
council = TeamCouncil()
result = council.coordinate_experts(
question="Comprehensive analysis of cloud migration strategy",
expert_profiles=["pragmatic_engineer", "systems_architect", "security_analyst"]
)💾 缓存
内置缓存系统支持多个后端:
cache:
backend: memory # or 'file', 'redis'
directory: .zenrube-cache
ttl: 120- 记忆:内存缓存(默认)
- 文件:基于文件系统的缓存
- 瑞迪斯:基于Redis的分布式缓存
🧪 测试
运行综合测试套件:
pip install -e .[dev]
pytest --cov=zenrube测试覆盖范围包括:
- 专家功能和边缘案例
- 配置加载和验证
- 共识编排
- 缓存机制
- 提供商集成
- 错误处理和降级状态
- 团队委员会功能
- 动态人格系统
持续集成运行格式化(black),林廷(flake8),打字(mypy),以及Python 3.9–3.12的覆盖率。
📁 项目结构
zenrube/
├── zenrube/ # Core package
│ ├── experts/ # Expert implementations
│ │ ├── semantic_router.py
│ │ ├── data_cleaner.py
│ │ ├── summarizer.py
│ │ ├── publisher.py
│ │ ├── autopublisher.py
│ │ ├── team_council.py
│ │ ├── version_manager.py
│ │ ├── rube_adapter.py
│ │ ├── llm_connector.py
│ │ └── expert_registry.py
│ ├── profiles/ # Dynamic personality system
│ │ ├── personality_engine.py
│ │ ├── dynamic_profile_engine.py
│ │ └── profile_controller.py
│ ├── orchestration/ # Consensus orchestration
│ └── config/ # Configuration management
├── tests/ # Comprehensive test suite
├── examples/ # Usage examples and demos
├── .zenrube.yml # Default configuration
└── pyproject.toml # Project metadata and dependencies🔄 CLI使用情况
ZenRube为共识操作提供了一个CLI接口:
# Basic consensus query
zenrube "What are the security implications of containerization?"
# Custom style and experts
zenrube "How to scale microservices?" --style collaborative --experts systems_architect pragmatic_engineer
# Sequential execution
zenrube "Database migration strategy" --sequential
# Debug mode
zenrube "Performance optimization" --debug🚀 汽车出版
Auto Publisher专家会自动检测版本更新并发布到Rube.app:
from zenrube.experts import AutoPublisherExpert
publisher = AutoPublisherExpert()
result = publisher.auto_publish_experts()
# Detects changes, regenerates manifests, and publishes automatically🎭 动态配置文件
ZenRube包括一个动态人格系统,用于配置专家行为:
from zenrube.profiles import DynamicProfileEngine
engine = DynamicProfileEngine()
profile = engine.create_profile(
name="cautious_analyst",
personality_traits=["risk_aware", "detail_oriented", "methodical"]
)🤝 贡献
看 贡献.md 用于开发指南和贡献工作流程。
添加新专家
- 创建从基础接口继承的专家类
- 添加元数据和配置
- 在专家模块中注册
- 添加综合测试
- 更新文档
开发设置
# Clone repository
git clone https://github.com/vmanoilov/zenrube.git
cd zenrube
# Install in development mode
pip install -e .[dev]
# Run tests
pytest
# Format code
black zenrube tests
flake8 zenrube tests
mypy zenrube📄 许可证
MIT许可证-请参阅 许可证 文件以获取详细信息。
🙏 致谢
📊 状态
  ](https://badge.fury.io/py/zenrube)
______________________________________________________________________
ZenRube -人工智能专家合作提供全面的解决方案。
