A demonstration implementation of the PRISM (Perspective Reasoning for Integrated Synthesis and Mediation) framework, showcasing how multiple moral perspectives can be integrated into AI systems for better alignment with human values.
This project is built on top of Vercel's AI Chatbot template, extending it with PRISM's multi-perspective reasoning capabilities. We thank the Vercel team for providing this excellent foundation for AI applications.
PRISM is a multiple-perspective framework for addressing persistent challenges in AI alignment such as conflicting human values and specification gaming. The framework is grounded in cognitive science and moral psychology, organizing moral concerns into seven "basis worldviews" that capture distinct dimensions of human moral cognition.
Key aspects of PRISM demonstrated in this project:
- 🧠 Seven basis worldviews from survival-focused to integrative perspectives
- ⚖️ Pareto-inspired optimization for balancing competing priorities
- 🔄 Structured workflow for viewpoint elicitation and synthesis
- 🤝 Transparent conflict mediation process
- 🎯 Context validation for robust real-world application
Learn more about the PRISM framework at prismframework.ai
- 🤖 Multi-perspective AI chat interface implementing PRISM's worldview analysis
- 🎭 Dynamic perspective switching and synthesis
- 📊 Transparent reasoning and trade-off documentation
- 🔄 Real-time updates and streaming responses
- 📄 Document processing and analysis
The core PRISM implementation can be found in the lib/ai/prism
directory:
lib/ai/prism/index.ts
- Main PRISM response processing logiclib/ai/prism/prompts/
- Contains all prompt templates:worldviews.ts
- The seven basis worldviews definitionsperspective.ts
- Prompts for generating perspective-specific responsessynthesize.ts
- Prompts for multi-perspective synthesisconflict.ts
- Prompts for identifying conflicts between perspectivesmediations.ts
- Prompts for mediating between conflicting viewpoints
The PRISM workflow follows these steps:
- Generate responses from each worldview perspective
- Create a baseline response and initial synthesis
- Evaluate potential conflicts between perspectives
- Mediate between conflicting viewpoints
- Generate final synthesized response
Each step streams its progress and intermediate results to the UI for full transparency.
- 🔐 Secure authentication with Google OAuth and email/password
- 💾 PostgreSQL database for persistent storage
- 🚀 Redis caching for performance
- 📱 Responsive design with Tailwind CSS
- 🌙 Dark mode support
- 🎨 Modern UI with Radix UI components
- Next.js 15 - React framework
- TypeScript - Type safety
- Tailwind CSS - Styling
- PostgreSQL - Database
- Redis - Caching
- NextAuth.js - Authentication
- Drizzle ORM - Database ORM
- Radix UI - UI components
Before you begin, ensure you have:
- Node.js 18+ installed
- pnpm installed (
npm install -g pnpm
) - PostgreSQL database
- Redis instance
- Google OAuth credentials (optional, for Google sign-in)
- Clone the repository:
git clone https://github.com/PioneerSquareLabs/prism-demo
cd prism-demo
- Install dependencies:
pnpm install
- Set up environment variables:
cp .env.example .env.local
Edit .env.local
with your configuration.
- Run database migrations:
pnpm db:migrate
- Start the development server:
pnpm dev
The application will be available at http://localhost:3000.
See .env.example
for required environment variables.
Available database commands:
pnpm db:generate # Generate migrations
pnpm db:migrate # Run migrations
pnpm db:studio # Open Drizzle Studio
pnpm db:push # Push schema changes
pnpm db:pull # Pull schema changes
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
This project is built on top of the Next.js AI Chatbot template created by Vercel. The original template is Copyright 2024 Vercel, Inc. and is also licensed under the Apache License 2.0. We are grateful to the Vercel team for providing this excellent foundation for AI applications.
Our modifications and additions, particularly the PRISM framework implementation, are Copyright 2024 Pioneer Square Labs.
pnpm install
pnpm dev
Your app template should now be running on localhost:3000.