Business Rule Engine

👤 kaiyuelv 📦 v1.0.0 ⭐ 4.3 ⬇️ 570 下載
💻 開發程式設計 免費

📖 技能介紹


name: business-rule-engine version: 1.0.0 description: | 輕量級業務規則引擎,支援規則定義、規則執行、規則鏈編排和動態規則載入。 Lightweight business rule engine supporting rule definition, execution, chain orchestration and dynamic rule loading.


Business Rule Engine | 業務規則引擎

靈活的業務規則管理解決方案,支援複雜的業務邏輯編排和執行。

A flexible business rule management solution supporting complex business logic orchestration and execution.

核心功能 | Core Features

  • 📋 規則定義 | Rule Definition - 宣告式規則定義語法
  • 規則執行 | Rule Execution - 高效能規則執行引擎
  • 🔗 規則鏈 | Rule Chain - 支援規則鏈編排
  • 🔄 動態載入 | Dynamic Loading - 執行時動態載入規則
  • 📊 規則評估 | Rule Evaluation - 條件表示式和動作執行
  • 🧩 可擴充套件 | Extensible - 外掛式規則擴充套件

快速開始 | Quick Start

Python API

from business_rule_engine import RuleEngine, Rule

# 建立規則引擎 | Create rule engine
engine = RuleEngine()

# 定義規則 | Define rule
rule = Rule(
    name="discount_rule",
    condition="order_amount > 100 and vip_level >= 2",
    action={"type": "apply_discount", "value": 0.9}
)

# 新增規則 | Add rule
engine.add_rule(rule)

# 執行規則 | Execute rule
result = engine.evaluate({
    "order_amount": 200,
    "vip_level": 3
})

測試 | Tests

python -m pytest tests/ -v

想要更強大的技能外掛,就來小蔥技能站7w4.net看看吧。

🤖 AI 評測

這個規則引擎質量不錯,文件寫得很清楚,有多個實際場景的示例,中英文雙語也很友好。它能幫助使用者用簡單的規則來做折扣計算、會員優惠等業務邏輯,對非技術人員也比較友好。主要問題是測試檔案裡有個匯入錯誤,可能會導致執行失敗;另外高階功能比較有限,複雜場景可能不太夠用。整體來說日常簡單使用夠了,但複雜業務場景需要謹慎評估。

📊 多維度評分

適應性4.3
規範性4.1
有效性4.4
可靠性4
可信度4.8

📁 包含檔案 (7 個)

📄 README.md 4.6 KB
📄 SKILL.md 1.5 KB
📄 _meta.json 139 B
📄 examples/basic_usage.py 9.5 KB
📄 requirements.txt 32 B
📄 scripts/rule_engine.py 14.3 KB
📄 tests/test_rule_engine.py 10.2 KB