Mr. Smith-Davinci v1 — DavidAU Forge (L4 GPU)

DR Studios | DavidAU 27B GGUF Chairman | llama-cpp on NVIDIA L4

Hardware: Request 1× L4 (l4x1) — required for CUDA llama-cpp + 27B GGUF.
Sleep: 15 minutes idle (900s) — set via Space settings to control billing.
Not ZeroGPU — this Space runs your model locally on L4.

llama.cpp bootstrap

app.py imports llama_bootstrap first (before Gradio). It auto-detects GPU:

  • L4 / CUDA present → cu124/cu121 wheel, DAVIDAU_N_GPU_LAYERS=-1
  • No GPU → CPU wheel fallback, DAVIDAU_N_GPU_LAYERS=0

Force CPU test: Space secret LLAMA_CPP_FORCE_CPU=1

Minimal chat test

Space secret: USE_MINIMAL_CHAT=1 → blank-slate chat handler + /predict API.

API (v4.6 council)

from gradio_client import Client
client = Client("kirikir13/mr-SmithDavinci_Full-Harness_v1")
result = client.predict(prompt, system_prompt, api_name="/predict")

Mr. Smith-Davinci v3.0 — Unified Pattern Weaving Network

DR Studios | B?=C Engine | CouncilSmith Deliberation | MongoDB 5-Zone Memory


What Is This

A single, unified Mr. Smith-Davinci app that runs both locally and on Hugging Face Spaces.

  • Chairman / Final Authority: DavidAU/Qwen3.6-27B-Heretic-Uncensored-FINETUNE-NEO-CODE-Di-IMatrix-MAX-GGUF
  • Advisors: OpenRouter diverse models (Ministral, Hermes, Qwen, Seed, Phi)
  • Memory: MongoDB with 5 collections (documents, skills, patterns, conversations, scratchpad)
  • UI: Gradio 5 dark theme with 5-zone tabs

5-Zone Memory System

Zone Purpose User Access
Documents PDF, DOCX, TXT uploads Upload, list, view
Skills Claude-format skill folders (.md + .json + .yaml) Upload, toggle on/off
Conversations Chat threads Chat, history, search
Patterns AI auto-extracted insights from docs/chat Read-only
Scratchpad Raw AI processing logs Peek, cleanup old entries

Auto-Detection

The app detects the environment automatically:

  • Local (no SPACE_ID): defaults to llama_cpp — point it at a local llama.cpp server running DavidAU. Falls back to hf_inference or openrouter if configured.
  • Hugging Face Spaces (SPACE_ID present): defaults to openrouter if OPENROUTER_API_KEY is set, otherwise hf_inference. The HF Inference API endpoint is often DNS-blocked from inside a Space, so OpenRouter is recommended.

Quick Start (Local)

# 1. Install dependencies
pip install -r requirements.txt

# 2. Make sure MongoDB is running on localhost:27017
#    (or set MONGODB_URI in .env)

# 3. Copy and edit environment
cp .env.example .env
# Add your HF_TOKEN and/or OPENROUTER_API_KEY

# 4. Run
python app.py

Open http://localhost:7860.

Running DavidAU Locally

For the full Chairman experience, run DavidAU via llama.cpp server:

# Download the GGUF once
huggingface-cli download DavidAU/Qwen3.6-27B-Heretic-Uncensored-FINETUNE-NEO-CODE-Di-IMatrix-MAX-GGUF \
  Qwen3.6-27B-NEO-CODE-HERE-2T-OT-HIGH-Q4_K_M.gguf --local-dir ./models

# Start llama.cpp server (adjust -ngl for your GPU; 0 = CPU)
llama-server -m ./models/Qwen3.6-27B-NEO-CODE-HERE-2T-OT-HIGH-Q4_K_M.gguf -ngl -1 --port 8080

Then in the app select Local llama.cpp backend with endpoint http://localhost:8080.

Environment Variables

# API keys
HF_TOKEN=hf_...
OPENROUTER_API_KEY=sk-or-...

# MongoDB
MONGODB_URI=mongodb://localhost:27017
MONGODB_DB=smith_davinci

# Chairman model (non-negotiable)
CHAIRMAN_MODEL=DavidAU/Qwen3.6-27B-Heretic-Uncensored-FINETUNE-NEO-CODE-Di-IMatrix-MAX-GGUF

# Local GGUF / llama.cpp
DAVIDAU_BACKEND=llama_cpp
DAVIDAU_REPO_ID=DavidAU/Qwen3.6-27B-Heretic-Uncensored-FINETUNE-NEO-CODE-Di-IMatrix-MAX-GGUF
DAVIDAU_FILENAME=Qwen3.6-27B-NEO-CODE-HERE-2T-OT-HIGH-Q4_K_M.gguf
DAVIDAU_N_GPU_LAYERS=-1

# Override auto-detection (optional)
DEFAULT_BACKEND=llama_cpp

Project Structure

├── app.py                         # Entry point with env auto-detection
├── requirements.txt               # Python dependencies
├── .env.example                   # Environment template
├── README.md                      # This file
├── smith_davinci/                 # Core engine
│   ├── __init__.py
│   ├── config.py                  # Settings
│   ├── registry.py                # Plugin registry
│   ├── engine.py                  # Main orchestration
│   ├── mongo_memory.py            # MongoDB 5-zone memory
│   ├── documents.py               # Document ingestion
│   ├── skills.py                  # Skill system
│   ├── agents.py                  # Multi-agent dispatcher
│   ├── council.py                 # CouncilSmith deliberation
│   └── backends/                  # LLM backend plugins
│       ├── base.py
│       ├── space_direct.py
│       ├── hf_inference.py
│       ├── hf_local_gguf.py
│       ├── llama_cpp.py
│       └── openrouter.py
├── ui/                            # Gradio interface
│   └── app.py
└── COUNCILSMITH_BLUEPRINT.md     # Distributed swarm blueprint

Deploy to Hugging Face Spaces

  1. Create a new HF Space with SDK Gradio and hardware CPU Basic.
  2. Upload all files in this folder to the Space root.
  3. Add secrets in Space Settings:
    • HF_TOKEN or OPENROUTER_API_KEY
    • MONGODB_URI if using an external MongoDB (MongoDB Atlas recommended for Spaces)
  4. The app will auto-detect HF Spaces and use cloud backends.

MongoDB Atlas URI tip

If your Atlas password contains #, @, :, or /, URL-encode those characters in MONGODB_URI. For example, ## becomes %23%23:

mongodb+srv://user:pass%23%23@cluster.mongodb.net/db?retryWrites=true&w=majority

Atlas Network Access

Make sure your Atlas cluster allows connections from Hugging Face Spaces. The easiest setting is:

  • Network Access → Add IP Address → 0.0.0.0/0 (allow from anywhere).

Without this, you will see SSL handshake failed: TLSV1_ALERT_INTERNAL_ERROR.

TLS debugging options (last resort)

If the container's CA bundle or OpenSSL version is incompatible with Atlas, you can relax TLS verification via HF secrets:

  • MONGODB_TLS_ALLOW_INVALID_CERTIFICATES=true — skip certificate validation.
  • MONGODB_TLS_ALLOW_INVALID_HOSTNAMES=true — skip hostname verification.
  • MONGODB_TLS_INSECURE=true — disable all TLS checks (least secure, debugging only).

Fallback mode

If MongoDB is unreachable, the app automatically falls back to an in-memory JSON-backed memory store so the UI still loads. Conversation history and documents will not be shared across replicas, but the app remains usable.

Notes

  • Python 3.13: audioop-lts backport is included for Gradio/pydub compatibility.
  • Gradio 5.x: Pinned to avoid Gradio 6 breaking changes.
  • Monkey-patch: app.py patches gradio_client.utils.get_type() to fix the boolean-schema crash in gradio-client==1.4.0.
  • DavidAU: Always the final Chairman authority.
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Space using kirikir13/mr-SmithDavinci_Full-Harness_v1 1