- Python 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| src | ||
| .gitignore | ||
| .pre-commit-config.yaml | ||
| LICENSE | ||
| pyproject.toml | ||
| README.md | ||
entheai-doppel
Fork of modal-labs/doppel-bot (MIT). A Slack app that scrapes a target user's messages in a workspace and fine-tunes an LLM (Llama 3.1 8B by default) to respond like them. All scraping, fine-tuning, and inference run serverless on Modal.
Fork tweaks:
- App/bot renamed to
entheai-doppel(Modal Appentheai-doppel, ASGI labelentheai-doppel, state Dictsentheai-doppel-*). - System prompt retuned for the sovereign constellation ("fine touch from within") instead of the startup-CEO persona.
- The fine-tune base model is the single
MODEL_NAMEknob insrc/common.py(gatedmeta-llama/Meta-Llama-3.1-8B-Instructby default; the HF token must exist as thehuggingface-secretModal secret — already wired into the fine-tune image). Swapping the base model requires matching torchtune recipe (src/llama3_1_8B_lora.yaml) and the inference vLLM version (src/inference.py). - Intended install: the EntheAI collective's Slack workspace.
How it works
Read the upstream docs. The
pipeline: /doppel <user> → scrape the user's public-channel history →
LoRA fine-tune Llama 3.1 8B on an H100 → serve the adapter over vLLM and
answer when the bot is mentioned. Multi-workspace mode is enabled — the
OAuth install flow lets any Slack workspace (e.g. entheai) install the
app through the "Add to Slack" button.
Install to Slack (any workspace, e.g. ENTHEAI)
Once the app is deployed, an install button is live at
https://<deploy-url>/slack/install — click it, pick the target workspace
(ENTHEAI), and Slack OAuth completes the install.
Replace <deploy-url> with the URL modal deploy src.bot prints (e.g.
https://peterlodri-sec--entheai-doppel-bot.modal.run).
One-time app + infra setup (needed for the button to work)
- Slack app at https://api.slack.com/apps (workspace
entheai.slack.com):- OAuth & Permissions → scopes:
app_mentions:read,channels:history,channels:join,channels:read,chat:write,chat:write.customize,commands,users.profile:read,users:read. - Settings → Manage Distribution → Redirect URLs =
https://<deploy-url>/slack/oauth_redirect→ Activate Public Distribution. - From Basic Information, copy Client ID + Client Secret.
- OAuth & Permissions → scopes:
- Modal secrets:
slack-finetune-secret:SLACK_SIGNING_SECRET,SLACK_BOT_TOKEN, plusSLACK_CLIENT_IDandSLACK_CLIENT_SECRET(from step 1).huggingface-secret:HF_TOKEN(gated Llama base).
- Postgres (Neon): create a database; Modal secret
neon-secretfrom the Postgres template; create the table withmodal run src.db. - Deploy:
modal deploy src.bot, then wire Event Subscriptions (@app_mention) and the/doppelslash command to the deploy URL.
After that, the button above (or the /slack/install route) installs the app
into whichever workspace a user chooses.
Usage (single workspace, manual)
If you prefer to skip OAuth and run single-workspace: set
MULTI_WORKSPACE_SLACK_APP = False in src/common.py, install the app to
the workspace via the Slack UI, and use only SLACK_SIGNING_SECRET +
SLACK_BOT_TOKEN (no Neon, no client id/secret).
- Create the Slack app at https://api.slack.com/apps (workspace
entheai.slack.com). Under OAuth & Permissions, add bot scopes:app_mentions:read,channels:history,channels:join,channels:read,chat:write,chat:write.customize,commands,users.profile:read,users:read. Click Install to Workspace. - Create the Modal Slack secret
slack-finetune-secret:SLACK_SIGNING_SECRET(App Credentials) andSLACK_BOT_TOKEN(OAuth & Permissions). - Create the Modal HF secret
huggingface-secretwithHF_TOKEN(needed to download the gated Llama base). - Deploy:
modal deploy src.bot. Note the URL. - Wire the Slack app to the URL:
- Event Subscriptions → on → Request URL = the deploy URL → verify →
add bot event
@app_mention. - Slash Commands → create
/doppel→ Request URL = the same URL. - Basic Information → Install to Workspace (reinstall).
- Event Subscriptions → on → Request URL = the deploy URL → verify →
add bot event
- In any channel run
/doppel <user>to train, then@entheai-doppelto summon the fine-tuned bot.
Development
- Scraper:
modal run src.scrape::scrape --user="<user>" - Fine-tuning:
modal run --detach src.finetune --user="<user>" - Inference:
modal run src.inference --user="<user>" - Optional W&B tracking: create
my-wandb-secretand setWANDB_PROJECTinsrc/common.py.
License
MIT (upstream). Fork maintained by peterlodri-sec.