|
| 1 | +<div align="center"> |
| 2 | + |
| 3 | +<pre> |
| 4 | + |
| 5 | + ███████████ ███████████ █████████ █████ |
| 6 | +░░███░░░░░░█░░███░░░░░███ ███░░░░░███ ░░███ |
| 7 | + ░███ █ ░ ░███ ░███ ░███ ░███ ░███ |
| 8 | + ░███████ ░██████████ ░███████████ ░███ |
| 9 | + ░███░░░█ ░███░░░░░███ ░███░░░░░███ ░███ |
| 10 | + ░███ ░ ░███ ░███ ░███ ░███ ░███ |
| 11 | + █████ █████ █████ █████ █████ █████ |
| 12 | +░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ |
| 13 | + |
| 14 | +</pre> |
| 15 | + |
| 16 | +</div> |
| 17 | + |
| 18 | + |
| 19 | +# FRAI · Framework of Responsible Artificial Intelligence |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +FRAI (Framework of Responsible Artificial Intelligence) is an open-source toolkit that helps any team — from solo developers to compliance officers — ship AI features responsibly. It walks you through quick questions, scans your code, and generates documentation you can actually hand to stakeholders: implementation checklists, model cards, risk files, evaluation reports, and policy-aware RAG indexes. |
| 24 | + |
| 25 | +Think of FRAI as a safety net for AI launches: it collects the right facts, highlights blind spots, and keeps evidence tidy so production reviews stop feeling like guesswork. |
| 26 | + |
| 27 | +## 🚀 Getting Started |
| 28 | + |
| 29 | +**1. Install FRAI globally:** |
| 30 | +```bash |
| 31 | +npm install -g frai |
| 32 | +``` |
| 33 | + |
| 34 | +**2. Set up your OpenAI API key (required for AI-powered tips):** |
| 35 | +```bash |
| 36 | +frai --setup |
| 37 | +``` |
| 38 | +You only need to do this once per machine or project. Your key is stored securely and never shared. |
| 39 | + |
| 40 | +**3. Run FRAI in your project:** |
| 41 | +```bash |
| 42 | +frai |
| 43 | +``` |
| 44 | + |
| 45 | +> **Tip:** `frai` is available globally after installing the published npm package. If you're working from a local clone, follow the steps in [Local Development](#-local-development) to run the CLI from source. |
| 46 | +
|
| 47 | +--- |
| 48 | + |
| 49 | +## 🛠️ CLI Commands & Features |
| 50 | + |
| 51 | +| Command | Description | |
| 52 | +|------------------------|-------------| |
| 53 | +| `frai` | Interactive mode for documenting an AI feature (8-question progressive system) | |
| 54 | +| `frai --scan` | Scan codebase for AI/ML code and generate docs | |
| 55 | +| `frai --setup` | Set up your OpenAI API key (local/global) | |
| 56 | +| `frai --ci` | Run in CI mode (non-interactive) | |
| 57 | +| `frai --help`, `-h` | Show help and usage info | |
| 58 | +| `frai --version`, `-v` | Show current version | |
| 59 | +| `frai --update` | Check for new versions of FRAI | |
| 60 | +| `frai --list-docs` | List generated documentation files | |
| 61 | +| `frai --clean` | Remove generated documentation files | |
| 62 | +| `frai --export-pdf` | Export documentation markdown files as PDFs | |
| 63 | +| `frai --show-config` | Show API key config status | |
| 64 | +| `frai --key=API_KEY` | Provide OpenAI API key directly (one-off use) | |
| 65 | +| `frai --global` | Use with --setup to save API key globally | |
| 66 | +| `frai rag index` | Index compliance docs into a local vector store | |
| 67 | +| `frai eval` | Run baseline evaluation metrics and write reports | |
| 68 | + |
| 69 | +### RAG Indexing |
| 70 | + |
| 71 | +```bash |
| 72 | +frai rag index --input docs/policies --output .frai/compliance-index.json --chunk-size 400 |
| 73 | +``` |
| 74 | +- Scans `.md`, `.txt`, `.json`, `.yaml` files recursively. |
| 75 | +- Generates a lightweight JSON vector store consumable by SDKs and future connectors. |
| 76 | + |
| 77 | +### Evaluation Harness |
| 78 | + |
| 79 | +```bash |
| 80 | +frai eval --outputs runs/outputs.json --references runs/golden.json --report reports/eval --format markdown |
| 81 | +``` |
| 82 | +- Runs baseline metrics (exact match, toxicity keyword scan, length variance). |
| 83 | +- Produces JSON and/or Markdown summaries for CI and governance reviews. |
| 84 | + |
| 85 | +**Docs generated:** |
| 86 | +- `checklist.md` — Implementation checklist |
| 87 | +- `model_card.md` — Model card |
| 88 | +- `risk_file.md` — Risk & compliance |
| 89 | + |
| 90 | +--- |
| 91 | + |
| 92 | +## 💡 Features |
| 93 | +- **Progressive 8-question system**: Context-aware, fast, and actionable |
| 94 | +- **AI-powered recommendations**: Get tailored tips for responsible AI |
| 95 | +- **Comprehensive documentation**: Checklist, model card, and risk file |
| 96 | +- **PDF export**: Convert docs to PDF with one command |
| 97 | +- **Codebase scanning**: Detects AI/ML code and generates relevant docs |
| 98 | +- **Easy setup**: One-time API key configuration |
| 99 | +- **Compliance-aware RAG**: Build vector stores from policies for knowledge-grounded guardrails |
| 100 | +- **Evaluation harness**: Run baseline metrics and capture auditable reports |
| 101 | + |
| 102 | +### Monorepo Layout |
| 103 | + |
| 104 | +``` |
| 105 | +frai/ |
| 106 | +├─ packages/ |
| 107 | +│ ├─ frai-cli/ # CLI entry point and command wiring |
| 108 | +│ └─ frai-core/ # Reusable services (config, questionnaire, documents, scanners, RAG, eval) |
| 109 | +├─ docs/ # Roadmaps, design notes, and feature backlogs |
| 110 | +└─ examples/ # Sample AI projects used in tests and demos |
| 111 | +``` |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +## 🔑 API Key Setup |
| 116 | +FRAI requires an OpenAI API key for generating AI-powered tips and documentation. Run: |
| 117 | +```bash |
| 118 | +frai --setup |
| 119 | +``` |
| 120 | +If you skip this step, FRAI will prompt you to set up your key on first use. |
| 121 | + |
| 122 | +--- |
| 123 | + |
| 124 | +## 🧑💻 Local Development |
| 125 | + |
| 126 | +Run FRAI directly from this repository without publishing: |
| 127 | + |
| 128 | +```bash |
| 129 | +pnpm install |
| 130 | +pnpm --filter frai run build |
| 131 | +node packages/frai-cli/dist/index.js --help |
| 132 | +``` |
| 133 | + |
| 134 | +### Configure an OpenAI key from source |
| 135 | + |
| 136 | +- Interactive CLI: |
| 137 | + ```bash |
| 138 | + node packages/frai-cli/dist/index.js --setup YOUR_KEY |
| 139 | + ``` |
| 140 | +- Manual `.env`: |
| 141 | + ``` |
| 142 | + OPENAI_API_KEY=YOUR_KEY |
| 143 | + ``` |
| 144 | + |
| 145 | +To test the global binary locally (without npm publishing), install the workspace package: |
| 146 | + |
| 147 | +```bash |
| 148 | +pnpm install --global ./packages/frai-cli |
| 149 | +# then: |
| 150 | +frai --setup |
| 151 | +``` |
| 152 | + |
| 153 | +--- |
| 154 | + |
| 155 | +## 📖 Learn More |
| 156 | +- [GitHub Repository](https://github.com/sebastianbuzdugan/frai) |
| 157 | +- [NPM Package](https://www.npmjs.com/package/frai) |
| 158 | +- [AI Feature Backlog](docs/ai_feature_backlog.md) |
| 159 | +- [Evaluation Harness Design](docs/eval_harness_design.md) |
| 160 | + |
| 161 | +--- |
| 162 | + |
| 163 | +*Generated by FRAI - Responsible AI in Minutes* |
0 commit comments