Codexcoder's picture
integration: add chat/README.md
0dd4bf4 verified
|
Raw History Blame Contribute Delete
1.89 kB
# DeepSeek V4 Chat β€” Sovereign Conversational Core
> Model: **sovereign/deepseek-v4-sovereign** (304B MoE, sovereign-tuned,
> MIT lineage β€” see `models/deepseek-v4-sovereign/`)
## Quick start
```bash
# Local echo mode (no key needed)
python3 -c "
from chat.core import ChatSession, DeepSeekV4Client
s = ChatSession(); s.add('user', 'hello')
print(DeepSeekV4Client().complete(s)['content'][:80])
"
# API mode β€” set the key, then run the server
export DEEPSEEK_API_KEY=hf_or_ds_... # DeepSeek-compatible key
export DEEPSEEK_API_BASE=https://api.deepseek.com/v1
export DEEPSEEK_MODEL=sovereign/deepseek-v4-sovereign
uvicorn chat.api.app:app --host 0.0.0.0 --port 8003
# β†’ POST /api/v1/chat/sessions Β· /send Β· GET /models Β· /status
```
The router is also wired into `src/sovereign/main.py` (guarded) β€” the full
stack serves `/api/v1/chat/*`. Web UI: `site/chat.html`.
## Env config
| Env | Default | Purpose |
|---|---|---|
| `DEEPSEEK_API_BASE` | `https://api.deepseek.com/v1` | OpenAI-compatible base URL |
| `DEEPSEEK_API_KEY` | *(unset)* | API key β€” unset β‡’ local echo mode |
| `DEEPSEEK_MODEL` | `sovereign/deepseek-v4-sovereign` | Model id |
## API
| Method | Path | Purpose |
|---|---|---|
| POST | `/api/v1/chat/sessions` | Create a session |
| GET | `/api/v1/chat/sessions/{id}` | Session + history |
| POST | `/api/v1/chat/send` | Send message β†’ reply (`{message, session_id, temperature?, max_tokens?}`) |
| GET | `/api/v1/chat/models` | Model registry |
| GET | `/api/v1/chat/status` | Mode / model / session count |
## Tests
```bash
.venv/bin/pytest tests/test_chat.py -q # 7 tests
```
## Honesty notes
- Local echo mode is deterministic and offline β€” a smoke test, not a model.
- The sovereign model card (304B MoE, GPTQ 4-bit) documents the
architecture; serving it at full scale requires the DeepSeek API or a
compatible runtime.