Spaces:
No application file
No application file
File size: 1,861 Bytes
f6fa258 e9726be |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
---
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) |