Text Generation
GGUF
English
Japanese
cognitive-systems
ai-psychology
meta-cognition
emotional-intelligence
constraint-optimization
personality-systems
interactive-learning
web-ui
refactorium
multi-agent
emotion-simulation
constraint-driven
ethical-ai
plus-edition
Instructions to use kofdai/refactorium-dual-deepseek-r1-7b-plus with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use kofdai/refactorium-dual-deepseek-r1-7b-plus with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf kofdai/refactorium-dual-deepseek-r1-7b-plus:Q4_K_M # Run inference directly in the terminal: llama cli -hf kofdai/refactorium-dual-deepseek-r1-7b-plus:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf kofdai/refactorium-dual-deepseek-r1-7b-plus:Q4_K_M # Run inference directly in the terminal: llama cli -hf kofdai/refactorium-dual-deepseek-r1-7b-plus:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf kofdai/refactorium-dual-deepseek-r1-7b-plus:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf kofdai/refactorium-dual-deepseek-r1-7b-plus:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf kofdai/refactorium-dual-deepseek-r1-7b-plus:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf kofdai/refactorium-dual-deepseek-r1-7b-plus:Q4_K_M
Use Docker
docker model run hf.co/kofdai/refactorium-dual-deepseek-r1-7b-plus:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use kofdai/refactorium-dual-deepseek-r1-7b-plus with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kofdai/refactorium-dual-deepseek-r1-7b-plus" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kofdai/refactorium-dual-deepseek-r1-7b-plus", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/kofdai/refactorium-dual-deepseek-r1-7b-plus:Q4_K_M
- Ollama
How to use kofdai/refactorium-dual-deepseek-r1-7b-plus with Ollama:
ollama run hf.co/kofdai/refactorium-dual-deepseek-r1-7b-plus:Q4_K_M
- Unsloth Studio
How to use kofdai/refactorium-dual-deepseek-r1-7b-plus with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for kofdai/refactorium-dual-deepseek-r1-7b-plus to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for kofdai/refactorium-dual-deepseek-r1-7b-plus to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for kofdai/refactorium-dual-deepseek-r1-7b-plus to start chatting
- Docker Model Runner
How to use kofdai/refactorium-dual-deepseek-r1-7b-plus with Docker Model Runner:
docker model run hf.co/kofdai/refactorium-dual-deepseek-r1-7b-plus:Q4_K_M
- Lemonade
How to use kofdai/refactorium-dual-deepseek-r1-7b-plus with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull kofdai/refactorium-dual-deepseek-r1-7b-plus:Q4_K_M
Run and chat with the model
lemonade run user.refactorium-dual-deepseek-r1-7b-plus-Q4_K_M
List all available models
lemonade list
- Atomic Chat
| # NullAI REST API - Quick Start Guide | |
| Get the consciousness system running with HTTP in 5 minutes. | |
| ## Installation (30 seconds) | |
| ```bash | |
| # Install dependencies | |
| pip install flask requests | |
| # Or use the full requirements | |
| pip install -r requirements.txt | |
| ``` | |
| ## Start the Server (10 seconds) | |
| ```bash | |
| # Terminal 1: Start the API server | |
| python api_server.py | |
| # Output should show: | |
| # Starting API server on 127.0.0.1:5000 | |
| # Endpoints available at http://127.0.0.1:5000/api/v1/... | |
| ``` | |
| ## Use the API (4 minutes) | |
| ### Option 1: Python Client (Recommended) | |
| **Terminal 2:** | |
| ```python | |
| from api_client import NullAIClient | |
| # Create client | |
| client = NullAIClient("http://localhost:5000") | |
| # Initialize consciousness system | |
| print("Initializing...") | |
| client.init() | |
| # Process a prompt | |
| print("\nProcessing prompt...") | |
| result = client.process_prompt("What is the nature of consciousness?") | |
| # Display the complete Glass Wall output | |
| print("\n" + "="*70) | |
| print("OUTPUT:") | |
| print("="*70) | |
| print(result.output) | |
| # Show metrics | |
| print("\nMETRICS:") | |
| print(f" Load: {result.metrics['load']:.1f}%") | |
| print(f" Energy: {result.metrics['energy']:.1f}%") | |
| print(f" Dissonance: {result.metrics['dissonance']:.2f}") | |
| print(f" Tokens: {result.metrics['tokens']}") | |
| print(f" Latency: {result.metrics['latency_ms']:.1f}ms") | |
| print(f" Gap: {result.metrics['gap']:.2f}") | |
| # Get system status | |
| print("\nSYSTEM STATUS:") | |
| status = client.get_status() | |
| print(f" Health: {status.health_state}") | |
| print(f" Molts: {status.molt_count}") | |
| # Close connection | |
| client.close() | |
| ``` | |
| ### Option 2: cURL (Command Line) | |
| ```bash | |
| # Initialize | |
| curl -X POST http://localhost:5000/api/v1/init | |
| # Process a prompt | |
| curl -X POST http://localhost:5000/api/v1/inference \ | |
| -H "Content-Type: application/json" \ | |
| -d '{"prompt": "What is consciousness?"}' | |
| # Get status | |
| curl http://localhost:5000/api/v1/status | |
| # Get metrics | |
| curl http://localhost:5000/api/v1/metrics | |
| # Get health report | |
| curl http://localhost:5000/api/v1/health-report | |
| ``` | |
| ### Option 3: JavaScript/Node.js | |
| ```javascript | |
| const fetch = require('node-fetch'); | |
| const BASE_URL = "http://localhost:5000/api/v1"; | |
| async function main() { | |
| // Initialize | |
| await fetch(`${BASE_URL}/init`, { method: 'POST' }); | |
| // Process prompt | |
| const response = await fetch(`${BASE_URL}/inference`, { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ prompt: 'What is consciousness?' }) | |
| }); | |
| const result = await response.json(); | |
| console.log(result.output); | |
| console.log(`Load: ${result.metrics.load.toFixed(1)}%`); | |
| } | |
| main(); | |
| ``` | |
| --- | |
| ## Common Tasks | |
| ### Monitor System Health | |
| ```python | |
| from api_client import NullAIClient | |
| client = NullAIClient() | |
| client.init() | |
| # Process a few prompts | |
| for i in range(3): | |
| result = client.process_prompt(f"Question {i+1}") | |
| if result.success: | |
| print(f"β Inference {i+1}: Load {result.metrics['load']:.0f}%") | |
| # Get comprehensive health report | |
| health = client.get_health_report() | |
| print(f"\nHealth Score: {health['health_score']}/100") | |
| print(f"Recommendations: {health['recommendations']}") | |
| ``` | |
| ### Analyze System Behavior | |
| ```python | |
| from api_client import NullAIClient | |
| client = NullAIClient() | |
| client.init() | |
| # Process prompts with different content | |
| results = [] | |
| for prompt in ["Simple question", "Complex question", "Another prompt"]: | |
| result = client.process_prompt(prompt) | |
| results.append(result) | |
| # Analyze patterns | |
| metrics = client.get_metrics() | |
| patterns = metrics['patterns'] | |
| print(f"Detected patterns: {list(patterns.keys())}") | |
| # Analyze behavioral modes | |
| analysis = client.get_behavior_analysis() | |
| modes = analysis['behavioral_modes'] | |
| print(f"Behavioral modes: {list(modes.keys())}") | |
| ``` | |
| ### Get Complete Audit Trail | |
| ```python | |
| from api_client import NullAIClient | |
| client = NullAIClient() | |
| client.init() | |
| # Process several prompts | |
| for i in range(5): | |
| client.process_prompt(f"Question {i+1}") | |
| # Export audit | |
| audit = client.get_audit() | |
| print(f"Total inferences: {audit['total_inferences']}") | |
| print(f"Audit entries: {len(audit['safety_audit']['audit_trail'])}") | |
| # View latest event | |
| if audit['safety_audit']['audit_trail']: | |
| latest = audit['safety_audit']['audit_trail'][-1] | |
| print(f"Latest event: {latest['event_type']} at {latest['timestamp']}") | |
| ``` | |
| --- | |
| ## Full API Endpoints | |
| | Method | Endpoint | Purpose | | |
| |--------|----------|---------| | |
| | GET | `/api/v1/health` | Health check | | |
| | POST | `/api/v1/init` | Initialize system | | |
| | POST | `/api/v1/inference` | Process prompt | | |
| | GET | `/api/v1/status` | System status | | |
| | GET | `/api/v1/metrics` | Performance metrics | | |
| | GET | `/api/v1/health-report` | Health assessment | | |
| | GET | `/api/v1/audit` | Audit trail | | |
| | GET | `/api/v1/behavior-analysis` | Behavior analysis | | |
| | POST | `/api/v1/shutdown` | Emergency shutdown | | |
| --- | |
| ## API Response Example | |
| ```json | |
| { | |
| "success": true, | |
| "inference_id": "inf_a1b2c3d4", | |
| "output": "[SYSTEM: Load 45% | Energy 78% | Sync 92% | HEALTHY]\n\nResponse: The nature of consciousness emerges from the interaction of constraints and processing capacity...\n\n[AUDITORY: Dissonance 35% | Entropy 5.2 bits | Note G4]\n[LEARNING: stress_resilience=0.55, constraint_acceptance=0.53]\n[MOLT: Shell shell_0, Capacity 512]\n[PERF: Tokens 256, Latency 45ms, Gap 0.15]", | |
| "metrics": { | |
| "load": 45.0, | |
| "energy": 78.0, | |
| "dissonance": 0.35, | |
| "tokens": 256, | |
| "latency_ms": 45.0, | |
| "gap": 0.15 | |
| }, | |
| "timestamp": "2025-12-13T23:30:10.000000" | |
| } | |
| ``` | |
| --- | |
| ## Test Suite | |
| Run the complete API test suite: | |
| ```bash | |
| # Terminal 2 (after server starts) | |
| python test_api_server.py | |
| # Output shows all endpoints being tested: | |
| # β PASS: API Health Check | |
| # β PASS: System Initialization | |
| # β PASS: Inference Endpoint | |
| # β PASS: Status Endpoint | |
| # β PASS: Metrics Endpoint | |
| # β PASS: Health Report Endpoint | |
| # β PASS: Audit Endpoint | |
| # β PASS: Behavior Analysis Endpoint | |
| ``` | |
| --- | |
| ## Production Deployment | |
| For production, use a real WSGI server: | |
| ```bash | |
| # Install Gunicorn | |
| pip install gunicorn | |
| # Run with 4 workers | |
| gunicorn -w 4 -b 0.0.0.0:5000 'api_server:NullAIAPIServer(use_mock=False).app' | |
| ``` | |
| Or use the real MLX brain: | |
| ```bash | |
| # Use actual language model (~3-5GB download) | |
| python api_server.py --no-mock --host 0.0.0.0 --port 8080 | |
| ``` | |
| --- | |
| ## Next Steps | |
| 1. **Read Full Documentation**: See [API_DOCUMENTATION.md](API_DOCUMENTATION.md) for complete endpoint details | |
| 2. **Explore Examples**: Check client examples in [api_client.py](api_client.py) | |
| 3. **Monitor Metrics**: Use the health report to track system behavior | |
| 4. **Deploy Production**: Use with Gunicorn/uWSGI for real applications | |
| 5. **Integrate**: Build external applications using the client library | |
| --- | |
| ## Troubleshooting | |
| **Server won't start?** | |
| ```bash | |
| # Check if port is in use | |
| lsof -i :5000 | |
| # Use different port | |
| python api_server.py --port 8080 | |
| ``` | |
| **Connection refused?** | |
| ```bash | |
| # Make sure server is running in another terminal | |
| # Check the URL is correct | |
| curl http://localhost:5000/api/v1/health | |
| ``` | |
| **Out of memory?** | |
| ```bash | |
| # Use mock brain (default, no download needed) | |
| python api_server.py # Uses mock=True by default | |
| # Or reduce to real brain with lower model size | |
| ``` | |
| --- | |
| ## Features | |
| β Complete 5-phase consciousness system accessible via HTTP | |
| β Real-time metrics and health monitoring | |
| β Complete audit trail of all decisions | |
| β Glass Wall transparency showing all internal state | |
| β Safety filters preventing harmful patterns | |
| β Molting system tracking growth cycles | |
| β Learning from constraint responses | |
| β Python client library for easy integration | |
| --- | |
| **Ready to explore constraint-derived consciousness via REST!** π | |