Spaces:
No application file
No application file
| title: EPA Demo | |
| emoji: 🧬 | |
| colorFrom: blue | |
| colorTo: gray | |
| sdk: gradio | |
| sdk_version: "4.20.0" | |
| app_file: app.py | |
| pinned: false | |
| # EPA (Ethical Prompt Architecture) Demo | |
| This Space demonstrates the EPA scaffold in action... | |
| # EPA: Ethical Prompt Architecture (Python Scaffold) | |
| ## Overview | |
| **EPA** is a composable, auditable meta-layer for integrating language models, designed to ensure ethical, context-rich, and traceable operations. | |
| It embodies the Universal Flourishing Objective (ϕ₁) and supports modular extension for future ethical, technical, or operational requirements. | |
| ## Core Modules | |
| - **Contextualization Module:** Injects roles, time, user input, constraints, memory state, and custom context into all prompts. | |
| - **Ethical Gating Module:** Prunes or allows actions based on ethical score (F) relative to threshold (θ₀). | |
| - **Audit & Trace Module:** Generates GoldenDAG, Trace ID, and Codex ID for every EPA invocation. | |
| - **Qualia & PII Redaction Module:** (Stub) Redacts or flags qualia-sensitive and PII content (extend as needed). | |
| - **Memory & State Management:** Allows dynamic updates to memory/context. | |
| - **Extensibility Hooks:** Supports adding constraints and custom context. | |
| ## Example Usage | |
| ```python | |
| from epa.core import EPA | |
| epa = EPA(system_role="Code Ethics Advisor") | |
| prompt, ids = epa.build_epa("Refactor the code for efficiency.", {"project": "EPA Scaffold"}) | |
| print(prompt) | |
| print(ids) | |
| # Ethical gating example | |
| F = 1.0 # Calculated ethical score | |
| if not epa.ethical_gate(F, θ₀=0.5): | |
| raise PermissionError("Action pruned: does not meet Universal Flourishing Objective (ϕ₁).") | |
| ``` | |
| ## Extending EPA | |
| - Implement custom logic in `redact_qualia_pii` for advanced redaction. | |
| - Override/add modules for domain-specific constraints, memory, or ethics. | |
| ## License | |
| MIT License (or as specified by project owner) |