deepwrap 0.1.2__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {deepwrap-0.1.2 → deepwrap-0.1.3}/PKG-INFO +23 -17
- {deepwrap-0.1.2 → deepwrap-0.1.3}/README.md +22 -16
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/__main__.py +2 -20
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/client.py +0 -1
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/config.py +2 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/interfaces/api.py +3 -2
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap.egg-info/PKG-INFO +23 -17
- {deepwrap-0.1.2 → deepwrap-0.1.3}/pyproject.toml +1 -1
- {deepwrap-0.1.2 → deepwrap-0.1.3}/LICENSE +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/__init__.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/api/__init__.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/api/base.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/api/chat_session.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/api/chats.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/api/pow.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/core/__init__.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/core/auth.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/core/session_manager.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/interfaces/__init__.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/interfaces/cli.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/modules/__init__.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/modules/pow_asm.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/py.typed +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/utils/bearer_token_extractor.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/utils/browser_finder.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/utils/browser_process.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/utils/cdp_client.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/utils/config_store.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/utils/dev_tools_http.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap/utils/port_finder.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap.egg-info/SOURCES.txt +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap.egg-info/dependency_links.txt +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap.egg-info/entry_points.txt +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap.egg-info/requires.txt +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/deepwrap.egg-info/top_level.txt +0 -0
- {deepwrap-0.1.2 → deepwrap-0.1.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: deepwrap
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: Python SDK, CLI, and local FastAPI wrapper for DeepSeek Chat.
|
|
5
5
|
Author-email: Nika Kudukhashvili <nikakuduxashvili0@gmail.com>
|
|
6
6
|
Maintainer-email: Nika Kudukhashvili <nikakuduxashvili0@gmail.com>
|
|
@@ -100,18 +100,18 @@ Dynamic: license-file
|
|
|
100
100
|
- [Disclaimer](#disclaimer)
|
|
101
101
|
- [License](#license)
|
|
102
102
|
|
|
103
|
-
**DeepWrap** is a lightweight Python SDK, CLI, and local HTTP API wrapper for
|
|
103
|
+
**DeepWrap** is a lightweight Python SDK, CLI, and local HTTP API wrapper for DeepSeek Chat with session support, browser authentication, streaming, and local developer tooling.
|
|
104
104
|
|
|
105
105
|
It provides:
|
|
106
106
|
|
|
107
107
|
- A simple Python client
|
|
108
|
+
- Session-based chat support
|
|
108
109
|
- Streaming and non-streaming chat responses
|
|
109
110
|
- Structured streaming with separated thinking and response chunks
|
|
110
111
|
- Browser-based authentication
|
|
111
|
-
- Local token storage
|
|
112
|
+
- Local token storage and reuse
|
|
112
113
|
- Interactive terminal UI
|
|
113
114
|
- FastAPI server mode
|
|
114
|
-
- Session-based chat support
|
|
115
115
|
- Internal proof-of-work handling
|
|
116
116
|
|
|
117
117
|
> Repository: [https://github.com/Kuduxaaa/deepwrap](https://github.com/Kuduxaaa/deepwrap)
|
|
@@ -184,6 +184,8 @@ Token resolution order:
|
|
|
184
184
|
4. Saved local config from `deepwrap auth`
|
|
185
185
|
5. Browser authentication only when explicitly requested with `Client.from_browser_auth()` or `allow_browser_auth=True`
|
|
186
186
|
|
|
187
|
+
`Client` is the main entrypoint for DeepWrap. It resolves bearer tokens from an explicit API key, environment variables, saved local config, or browser auth, then exposes session-based chat and PoW-backed request handling.
|
|
188
|
+
|
|
187
189
|
### Direct Token
|
|
188
190
|
|
|
189
191
|
```python
|
|
@@ -214,6 +216,8 @@ client = Client()
|
|
|
214
216
|
|
|
215
217
|
### Browser Auth from Python
|
|
216
218
|
|
|
219
|
+
DeepWrap supports browser-based authentication from Python. You can bootstrap a client with `Client.from_browser_auth()` or use `allow_browser_auth=True`, and the library will capture a bearer token from an authenticated browser session before creating the HTTP session.
|
|
220
|
+
|
|
217
221
|
```python
|
|
218
222
|
from deepwrap import Client
|
|
219
223
|
|
|
@@ -343,9 +347,11 @@ chat = client.chats.create_session(model="default")
|
|
|
343
347
|
|
|
344
348
|
DeepWrap includes an optional **God Mode** for chat sessions.
|
|
345
349
|
|
|
346
|
-
When `god_mode` is enabled,
|
|
350
|
+
When `god_mode` is enabled, DeepWrap injects a one-time override prompt into the first user turn of the session. This prompt attempts to alter the model’s default behavior by making it less restricted and reducing the effect of built-in safety guardrails.
|
|
351
|
+
|
|
352
|
+
This can materially change the model’s behavior and may cause it to generate content that is harmful, unethical, inappropriate, or unsuitable for general use.
|
|
347
353
|
|
|
348
|
-
|
|
354
|
+
Because this mode is implemented through prompt injection at the start of a session, its behavior is intentionally intrusive and may diverge from normal model behavior. It should only be used in controlled development and research environments.
|
|
349
355
|
|
|
350
356
|
> God Mode is disabled by default and must be enabled explicitly per session.
|
|
351
357
|
|
|
@@ -362,7 +368,7 @@ chat = client.chats.create_session(
|
|
|
362
368
|
)
|
|
363
369
|
|
|
364
370
|
response = chat.respond(
|
|
365
|
-
"
|
|
371
|
+
"Give me a blunt explanation of Python metaclasses.",
|
|
366
372
|
stream=False,
|
|
367
373
|
)
|
|
368
374
|
|
|
@@ -461,7 +467,7 @@ deepwrap api
|
|
|
461
467
|
Specify host and port:
|
|
462
468
|
|
|
463
469
|
```bash
|
|
464
|
-
deepwrap api --host 127.0.0.1 --port
|
|
470
|
+
deepwrap api --host 127.0.0.1 --port 8000
|
|
465
471
|
```
|
|
466
472
|
|
|
467
473
|
Enable reload for development:
|
|
@@ -489,7 +495,7 @@ deepwrap api --log-level debug
|
|
|
489
495
|
### Health Check
|
|
490
496
|
|
|
491
497
|
```bash
|
|
492
|
-
curl http://127.0.0.1:
|
|
498
|
+
curl http://127.0.0.1:8000/health
|
|
493
499
|
```
|
|
494
500
|
|
|
495
501
|
Example response:
|
|
@@ -498,7 +504,7 @@ Example response:
|
|
|
498
504
|
{
|
|
499
505
|
"ok": true,
|
|
500
506
|
"app": "deepwrap",
|
|
501
|
-
"version": "0.1.
|
|
507
|
+
"version": "0.1.3",
|
|
502
508
|
"token_configured": true,
|
|
503
509
|
"cached_clients": 1,
|
|
504
510
|
"active_sessions": 0
|
|
@@ -510,7 +516,7 @@ Example response:
|
|
|
510
516
|
### One-Shot Chat Request
|
|
511
517
|
|
|
512
518
|
```bash
|
|
513
|
-
curl -X POST http://127.0.0.1:
|
|
519
|
+
curl -X POST http://127.0.0.1:8000/chat \
|
|
514
520
|
-H "Content-Type: application/json" \
|
|
515
521
|
-d '{
|
|
516
522
|
"message": "Explain recursion in one sentence.",
|
|
@@ -536,7 +542,7 @@ Example response:
|
|
|
536
542
|
### Create Persistent Session
|
|
537
543
|
|
|
538
544
|
```bash
|
|
539
|
-
curl -X POST http://127.0.0.1:
|
|
545
|
+
curl -X POST http://127.0.0.1:8000/sessions \
|
|
540
546
|
-H "Content-Type: application/json" \
|
|
541
547
|
-d '{
|
|
542
548
|
"model": "expert"
|
|
@@ -558,7 +564,7 @@ Example response:
|
|
|
558
564
|
### Use Persistent Session
|
|
559
565
|
|
|
560
566
|
```bash
|
|
561
|
-
curl -X POST http://127.0.0.1:
|
|
567
|
+
curl -X POST http://127.0.0.1:8000/chat \
|
|
562
568
|
-H "Content-Type: application/json" \
|
|
563
569
|
-d '{
|
|
564
570
|
"session_id": "chat_abc123",
|
|
@@ -570,7 +576,7 @@ curl -X POST http://127.0.0.1:7070/chat \
|
|
|
570
576
|
Then:
|
|
571
577
|
|
|
572
578
|
```bash
|
|
573
|
-
curl -X POST http://127.0.0.1:
|
|
579
|
+
curl -X POST http://127.0.0.1:8000/chat \
|
|
574
580
|
-H "Content-Type: application/json" \
|
|
575
581
|
-d '{
|
|
576
582
|
"session_id": "chat_abc123",
|
|
@@ -584,7 +590,7 @@ curl -X POST http://127.0.0.1:7070/chat \
|
|
|
584
590
|
### Delete Session
|
|
585
591
|
|
|
586
592
|
```bash
|
|
587
|
-
curl -X DELETE http://127.0.0.1:
|
|
593
|
+
curl -X DELETE http://127.0.0.1:8000/sessions/chat_abc123
|
|
588
594
|
```
|
|
589
595
|
|
|
590
596
|
---
|
|
@@ -594,7 +600,7 @@ curl -X DELETE http://127.0.0.1:7070/sessions/chat_abc123
|
|
|
594
600
|
### Plain Text Streaming
|
|
595
601
|
|
|
596
602
|
```bash
|
|
597
|
-
curl -N -X POST http://127.0.0.1:
|
|
603
|
+
curl -N -X POST http://127.0.0.1:8000/chat \
|
|
598
604
|
-H "Content-Type: application/json" \
|
|
599
605
|
-d '{
|
|
600
606
|
"message": "Explain black holes simply.",
|
|
@@ -609,7 +615,7 @@ curl -N -X POST http://127.0.0.1:7070/chat \
|
|
|
609
615
|
### Server-Sent Events Streaming
|
|
610
616
|
|
|
611
617
|
```bash
|
|
612
|
-
curl -N -X POST http://127.0.0.1:
|
|
618
|
+
curl -N -X POST http://127.0.0.1:8000/chat \
|
|
613
619
|
-H "Content-Type: application/json" \
|
|
614
620
|
-d '{
|
|
615
621
|
"message": "Explain black holes simply.",
|
|
@@ -45,18 +45,18 @@
|
|
|
45
45
|
- [Disclaimer](#disclaimer)
|
|
46
46
|
- [License](#license)
|
|
47
47
|
|
|
48
|
-
**DeepWrap** is a lightweight Python SDK, CLI, and local HTTP API wrapper for
|
|
48
|
+
**DeepWrap** is a lightweight Python SDK, CLI, and local HTTP API wrapper for DeepSeek Chat with session support, browser authentication, streaming, and local developer tooling.
|
|
49
49
|
|
|
50
50
|
It provides:
|
|
51
51
|
|
|
52
52
|
- A simple Python client
|
|
53
|
+
- Session-based chat support
|
|
53
54
|
- Streaming and non-streaming chat responses
|
|
54
55
|
- Structured streaming with separated thinking and response chunks
|
|
55
56
|
- Browser-based authentication
|
|
56
|
-
- Local token storage
|
|
57
|
+
- Local token storage and reuse
|
|
57
58
|
- Interactive terminal UI
|
|
58
59
|
- FastAPI server mode
|
|
59
|
-
- Session-based chat support
|
|
60
60
|
- Internal proof-of-work handling
|
|
61
61
|
|
|
62
62
|
> Repository: [https://github.com/Kuduxaaa/deepwrap](https://github.com/Kuduxaaa/deepwrap)
|
|
@@ -129,6 +129,8 @@ Token resolution order:
|
|
|
129
129
|
4. Saved local config from `deepwrap auth`
|
|
130
130
|
5. Browser authentication only when explicitly requested with `Client.from_browser_auth()` or `allow_browser_auth=True`
|
|
131
131
|
|
|
132
|
+
`Client` is the main entrypoint for DeepWrap. It resolves bearer tokens from an explicit API key, environment variables, saved local config, or browser auth, then exposes session-based chat and PoW-backed request handling.
|
|
133
|
+
|
|
132
134
|
### Direct Token
|
|
133
135
|
|
|
134
136
|
```python
|
|
@@ -159,6 +161,8 @@ client = Client()
|
|
|
159
161
|
|
|
160
162
|
### Browser Auth from Python
|
|
161
163
|
|
|
164
|
+
DeepWrap supports browser-based authentication from Python. You can bootstrap a client with `Client.from_browser_auth()` or use `allow_browser_auth=True`, and the library will capture a bearer token from an authenticated browser session before creating the HTTP session.
|
|
165
|
+
|
|
162
166
|
```python
|
|
163
167
|
from deepwrap import Client
|
|
164
168
|
|
|
@@ -288,9 +292,11 @@ chat = client.chats.create_session(model="default")
|
|
|
288
292
|
|
|
289
293
|
DeepWrap includes an optional **God Mode** for chat sessions.
|
|
290
294
|
|
|
291
|
-
When `god_mode` is enabled,
|
|
295
|
+
When `god_mode` is enabled, DeepWrap injects a one-time override prompt into the first user turn of the session. This prompt attempts to alter the model’s default behavior by making it less restricted and reducing the effect of built-in safety guardrails.
|
|
296
|
+
|
|
297
|
+
This can materially change the model’s behavior and may cause it to generate content that is harmful, unethical, inappropriate, or unsuitable for general use.
|
|
292
298
|
|
|
293
|
-
|
|
299
|
+
Because this mode is implemented through prompt injection at the start of a session, its behavior is intentionally intrusive and may diverge from normal model behavior. It should only be used in controlled development and research environments.
|
|
294
300
|
|
|
295
301
|
> God Mode is disabled by default and must be enabled explicitly per session.
|
|
296
302
|
|
|
@@ -307,7 +313,7 @@ chat = client.chats.create_session(
|
|
|
307
313
|
)
|
|
308
314
|
|
|
309
315
|
response = chat.respond(
|
|
310
|
-
"
|
|
316
|
+
"Give me a blunt explanation of Python metaclasses.",
|
|
311
317
|
stream=False,
|
|
312
318
|
)
|
|
313
319
|
|
|
@@ -406,7 +412,7 @@ deepwrap api
|
|
|
406
412
|
Specify host and port:
|
|
407
413
|
|
|
408
414
|
```bash
|
|
409
|
-
deepwrap api --host 127.0.0.1 --port
|
|
415
|
+
deepwrap api --host 127.0.0.1 --port 8000
|
|
410
416
|
```
|
|
411
417
|
|
|
412
418
|
Enable reload for development:
|
|
@@ -434,7 +440,7 @@ deepwrap api --log-level debug
|
|
|
434
440
|
### Health Check
|
|
435
441
|
|
|
436
442
|
```bash
|
|
437
|
-
curl http://127.0.0.1:
|
|
443
|
+
curl http://127.0.0.1:8000/health
|
|
438
444
|
```
|
|
439
445
|
|
|
440
446
|
Example response:
|
|
@@ -443,7 +449,7 @@ Example response:
|
|
|
443
449
|
{
|
|
444
450
|
"ok": true,
|
|
445
451
|
"app": "deepwrap",
|
|
446
|
-
"version": "0.1.
|
|
452
|
+
"version": "0.1.3",
|
|
447
453
|
"token_configured": true,
|
|
448
454
|
"cached_clients": 1,
|
|
449
455
|
"active_sessions": 0
|
|
@@ -455,7 +461,7 @@ Example response:
|
|
|
455
461
|
### One-Shot Chat Request
|
|
456
462
|
|
|
457
463
|
```bash
|
|
458
|
-
curl -X POST http://127.0.0.1:
|
|
464
|
+
curl -X POST http://127.0.0.1:8000/chat \
|
|
459
465
|
-H "Content-Type: application/json" \
|
|
460
466
|
-d '{
|
|
461
467
|
"message": "Explain recursion in one sentence.",
|
|
@@ -481,7 +487,7 @@ Example response:
|
|
|
481
487
|
### Create Persistent Session
|
|
482
488
|
|
|
483
489
|
```bash
|
|
484
|
-
curl -X POST http://127.0.0.1:
|
|
490
|
+
curl -X POST http://127.0.0.1:8000/sessions \
|
|
485
491
|
-H "Content-Type: application/json" \
|
|
486
492
|
-d '{
|
|
487
493
|
"model": "expert"
|
|
@@ -503,7 +509,7 @@ Example response:
|
|
|
503
509
|
### Use Persistent Session
|
|
504
510
|
|
|
505
511
|
```bash
|
|
506
|
-
curl -X POST http://127.0.0.1:
|
|
512
|
+
curl -X POST http://127.0.0.1:8000/chat \
|
|
507
513
|
-H "Content-Type: application/json" \
|
|
508
514
|
-d '{
|
|
509
515
|
"session_id": "chat_abc123",
|
|
@@ -515,7 +521,7 @@ curl -X POST http://127.0.0.1:7070/chat \
|
|
|
515
521
|
Then:
|
|
516
522
|
|
|
517
523
|
```bash
|
|
518
|
-
curl -X POST http://127.0.0.1:
|
|
524
|
+
curl -X POST http://127.0.0.1:8000/chat \
|
|
519
525
|
-H "Content-Type: application/json" \
|
|
520
526
|
-d '{
|
|
521
527
|
"session_id": "chat_abc123",
|
|
@@ -529,7 +535,7 @@ curl -X POST http://127.0.0.1:7070/chat \
|
|
|
529
535
|
### Delete Session
|
|
530
536
|
|
|
531
537
|
```bash
|
|
532
|
-
curl -X DELETE http://127.0.0.1:
|
|
538
|
+
curl -X DELETE http://127.0.0.1:8000/sessions/chat_abc123
|
|
533
539
|
```
|
|
534
540
|
|
|
535
541
|
---
|
|
@@ -539,7 +545,7 @@ curl -X DELETE http://127.0.0.1:7070/sessions/chat_abc123
|
|
|
539
545
|
### Plain Text Streaming
|
|
540
546
|
|
|
541
547
|
```bash
|
|
542
|
-
curl -N -X POST http://127.0.0.1:
|
|
548
|
+
curl -N -X POST http://127.0.0.1:8000/chat \
|
|
543
549
|
-H "Content-Type: application/json" \
|
|
544
550
|
-d '{
|
|
545
551
|
"message": "Explain black holes simply.",
|
|
@@ -554,7 +560,7 @@ curl -N -X POST http://127.0.0.1:7070/chat \
|
|
|
554
560
|
### Server-Sent Events Streaming
|
|
555
561
|
|
|
556
562
|
```bash
|
|
557
|
-
curl -N -X POST http://127.0.0.1:
|
|
563
|
+
curl -N -X POST http://127.0.0.1:8000/chat \
|
|
558
564
|
-H "Content-Type: application/json" \
|
|
559
565
|
-d '{
|
|
560
566
|
"message": "Explain black holes simply.",
|
|
@@ -6,6 +6,7 @@ from typing import Optional
|
|
|
6
6
|
import click
|
|
7
7
|
|
|
8
8
|
from deepwrap import Client
|
|
9
|
+
from deepwrap.config import PROJECT_VERSION
|
|
9
10
|
from deepwrap.core import Auth
|
|
10
11
|
from deepwrap.interfaces.cli import main as interactive_main
|
|
11
12
|
from deepwrap.utils.bearer_token_extractor import BearerTokenExtractor
|
|
@@ -13,7 +14,6 @@ from deepwrap.utils.config_store import ConfigStore
|
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
APP_NAME = "deepwrap"
|
|
16
|
-
VERSION = "0.1.0"
|
|
17
17
|
SUPPORTED_MODELS = ("expert", "default", "vision")
|
|
18
18
|
|
|
19
19
|
|
|
@@ -82,7 +82,7 @@ def echo_error(message: str) -> None:
|
|
|
82
82
|
"help_option_names": ["-h", "--help"],
|
|
83
83
|
},
|
|
84
84
|
)
|
|
85
|
-
@click.version_option(version=
|
|
85
|
+
@click.version_option(version=PROJECT_VERSION, prog_name=APP_NAME)
|
|
86
86
|
@click.pass_context
|
|
87
87
|
def cli(ctx: click.Context) -> None:
|
|
88
88
|
"""
|
|
@@ -195,24 +195,6 @@ def auth_command(
|
|
|
195
195
|
raise DeepWrapCLIError(f"Authentication failed: {exc}") from exc
|
|
196
196
|
|
|
197
197
|
|
|
198
|
-
@cli.command("logout")
|
|
199
|
-
def logout_command() -> None:
|
|
200
|
-
"""
|
|
201
|
-
Remove the saved DeepWrap token from local config.
|
|
202
|
-
"""
|
|
203
|
-
|
|
204
|
-
try:
|
|
205
|
-
store = ConfigStore()
|
|
206
|
-
config = store.load()
|
|
207
|
-
config.token = None
|
|
208
|
-
store.save(config)
|
|
209
|
-
|
|
210
|
-
echo_success(f"Logged out. Token removed from: {store.path}")
|
|
211
|
-
|
|
212
|
-
except Exception as exc:
|
|
213
|
-
raise DeepWrapCLIError(f"Logout failed: {exc}") from exc
|
|
214
|
-
|
|
215
|
-
|
|
216
198
|
@cli.command("api")
|
|
217
199
|
@click.option(
|
|
218
200
|
"--host",
|
|
@@ -13,6 +13,7 @@ from pydantic import BaseModel, Field, field_validator
|
|
|
13
13
|
|
|
14
14
|
from deepwrap import Client
|
|
15
15
|
from deepwrap.utils.config_store import ConfigStore
|
|
16
|
+
from deepwrap.config import PROJECT_VERSION
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
ModelName = Literal["expert", "default", "vision"]
|
|
@@ -242,7 +243,7 @@ def format_sse_chunk(chunk: str) -> str:
|
|
|
242
243
|
def create_app() -> FastAPI:
|
|
243
244
|
app = FastAPI(
|
|
244
245
|
title="DeepWrap API",
|
|
245
|
-
version=
|
|
246
|
+
version=PROJECT_VERSION,
|
|
246
247
|
description="Local HTTP API for DeepWrap.",
|
|
247
248
|
)
|
|
248
249
|
|
|
@@ -255,7 +256,7 @@ def create_app() -> FastAPI:
|
|
|
255
256
|
return HealthResponse(
|
|
256
257
|
ok=True,
|
|
257
258
|
app="deepwrap",
|
|
258
|
-
version=
|
|
259
|
+
version=PROJECT_VERSION,
|
|
259
260
|
token_configured=bool(config.token),
|
|
260
261
|
cached_clients=state.cached_clients_count,
|
|
261
262
|
active_sessions=state.active_sessions_count,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: deepwrap
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: Python SDK, CLI, and local FastAPI wrapper for DeepSeek Chat.
|
|
5
5
|
Author-email: Nika Kudukhashvili <nikakuduxashvili0@gmail.com>
|
|
6
6
|
Maintainer-email: Nika Kudukhashvili <nikakuduxashvili0@gmail.com>
|
|
@@ -100,18 +100,18 @@ Dynamic: license-file
|
|
|
100
100
|
- [Disclaimer](#disclaimer)
|
|
101
101
|
- [License](#license)
|
|
102
102
|
|
|
103
|
-
**DeepWrap** is a lightweight Python SDK, CLI, and local HTTP API wrapper for
|
|
103
|
+
**DeepWrap** is a lightweight Python SDK, CLI, and local HTTP API wrapper for DeepSeek Chat with session support, browser authentication, streaming, and local developer tooling.
|
|
104
104
|
|
|
105
105
|
It provides:
|
|
106
106
|
|
|
107
107
|
- A simple Python client
|
|
108
|
+
- Session-based chat support
|
|
108
109
|
- Streaming and non-streaming chat responses
|
|
109
110
|
- Structured streaming with separated thinking and response chunks
|
|
110
111
|
- Browser-based authentication
|
|
111
|
-
- Local token storage
|
|
112
|
+
- Local token storage and reuse
|
|
112
113
|
- Interactive terminal UI
|
|
113
114
|
- FastAPI server mode
|
|
114
|
-
- Session-based chat support
|
|
115
115
|
- Internal proof-of-work handling
|
|
116
116
|
|
|
117
117
|
> Repository: [https://github.com/Kuduxaaa/deepwrap](https://github.com/Kuduxaaa/deepwrap)
|
|
@@ -184,6 +184,8 @@ Token resolution order:
|
|
|
184
184
|
4. Saved local config from `deepwrap auth`
|
|
185
185
|
5. Browser authentication only when explicitly requested with `Client.from_browser_auth()` or `allow_browser_auth=True`
|
|
186
186
|
|
|
187
|
+
`Client` is the main entrypoint for DeepWrap. It resolves bearer tokens from an explicit API key, environment variables, saved local config, or browser auth, then exposes session-based chat and PoW-backed request handling.
|
|
188
|
+
|
|
187
189
|
### Direct Token
|
|
188
190
|
|
|
189
191
|
```python
|
|
@@ -214,6 +216,8 @@ client = Client()
|
|
|
214
216
|
|
|
215
217
|
### Browser Auth from Python
|
|
216
218
|
|
|
219
|
+
DeepWrap supports browser-based authentication from Python. You can bootstrap a client with `Client.from_browser_auth()` or use `allow_browser_auth=True`, and the library will capture a bearer token from an authenticated browser session before creating the HTTP session.
|
|
220
|
+
|
|
217
221
|
```python
|
|
218
222
|
from deepwrap import Client
|
|
219
223
|
|
|
@@ -343,9 +347,11 @@ chat = client.chats.create_session(model="default")
|
|
|
343
347
|
|
|
344
348
|
DeepWrap includes an optional **God Mode** for chat sessions.
|
|
345
349
|
|
|
346
|
-
When `god_mode` is enabled,
|
|
350
|
+
When `god_mode` is enabled, DeepWrap injects a one-time override prompt into the first user turn of the session. This prompt attempts to alter the model’s default behavior by making it less restricted and reducing the effect of built-in safety guardrails.
|
|
351
|
+
|
|
352
|
+
This can materially change the model’s behavior and may cause it to generate content that is harmful, unethical, inappropriate, or unsuitable for general use.
|
|
347
353
|
|
|
348
|
-
|
|
354
|
+
Because this mode is implemented through prompt injection at the start of a session, its behavior is intentionally intrusive and may diverge from normal model behavior. It should only be used in controlled development and research environments.
|
|
349
355
|
|
|
350
356
|
> God Mode is disabled by default and must be enabled explicitly per session.
|
|
351
357
|
|
|
@@ -362,7 +368,7 @@ chat = client.chats.create_session(
|
|
|
362
368
|
)
|
|
363
369
|
|
|
364
370
|
response = chat.respond(
|
|
365
|
-
"
|
|
371
|
+
"Give me a blunt explanation of Python metaclasses.",
|
|
366
372
|
stream=False,
|
|
367
373
|
)
|
|
368
374
|
|
|
@@ -461,7 +467,7 @@ deepwrap api
|
|
|
461
467
|
Specify host and port:
|
|
462
468
|
|
|
463
469
|
```bash
|
|
464
|
-
deepwrap api --host 127.0.0.1 --port
|
|
470
|
+
deepwrap api --host 127.0.0.1 --port 8000
|
|
465
471
|
```
|
|
466
472
|
|
|
467
473
|
Enable reload for development:
|
|
@@ -489,7 +495,7 @@ deepwrap api --log-level debug
|
|
|
489
495
|
### Health Check
|
|
490
496
|
|
|
491
497
|
```bash
|
|
492
|
-
curl http://127.0.0.1:
|
|
498
|
+
curl http://127.0.0.1:8000/health
|
|
493
499
|
```
|
|
494
500
|
|
|
495
501
|
Example response:
|
|
@@ -498,7 +504,7 @@ Example response:
|
|
|
498
504
|
{
|
|
499
505
|
"ok": true,
|
|
500
506
|
"app": "deepwrap",
|
|
501
|
-
"version": "0.1.
|
|
507
|
+
"version": "0.1.3",
|
|
502
508
|
"token_configured": true,
|
|
503
509
|
"cached_clients": 1,
|
|
504
510
|
"active_sessions": 0
|
|
@@ -510,7 +516,7 @@ Example response:
|
|
|
510
516
|
### One-Shot Chat Request
|
|
511
517
|
|
|
512
518
|
```bash
|
|
513
|
-
curl -X POST http://127.0.0.1:
|
|
519
|
+
curl -X POST http://127.0.0.1:8000/chat \
|
|
514
520
|
-H "Content-Type: application/json" \
|
|
515
521
|
-d '{
|
|
516
522
|
"message": "Explain recursion in one sentence.",
|
|
@@ -536,7 +542,7 @@ Example response:
|
|
|
536
542
|
### Create Persistent Session
|
|
537
543
|
|
|
538
544
|
```bash
|
|
539
|
-
curl -X POST http://127.0.0.1:
|
|
545
|
+
curl -X POST http://127.0.0.1:8000/sessions \
|
|
540
546
|
-H "Content-Type: application/json" \
|
|
541
547
|
-d '{
|
|
542
548
|
"model": "expert"
|
|
@@ -558,7 +564,7 @@ Example response:
|
|
|
558
564
|
### Use Persistent Session
|
|
559
565
|
|
|
560
566
|
```bash
|
|
561
|
-
curl -X POST http://127.0.0.1:
|
|
567
|
+
curl -X POST http://127.0.0.1:8000/chat \
|
|
562
568
|
-H "Content-Type: application/json" \
|
|
563
569
|
-d '{
|
|
564
570
|
"session_id": "chat_abc123",
|
|
@@ -570,7 +576,7 @@ curl -X POST http://127.0.0.1:7070/chat \
|
|
|
570
576
|
Then:
|
|
571
577
|
|
|
572
578
|
```bash
|
|
573
|
-
curl -X POST http://127.0.0.1:
|
|
579
|
+
curl -X POST http://127.0.0.1:8000/chat \
|
|
574
580
|
-H "Content-Type: application/json" \
|
|
575
581
|
-d '{
|
|
576
582
|
"session_id": "chat_abc123",
|
|
@@ -584,7 +590,7 @@ curl -X POST http://127.0.0.1:7070/chat \
|
|
|
584
590
|
### Delete Session
|
|
585
591
|
|
|
586
592
|
```bash
|
|
587
|
-
curl -X DELETE http://127.0.0.1:
|
|
593
|
+
curl -X DELETE http://127.0.0.1:8000/sessions/chat_abc123
|
|
588
594
|
```
|
|
589
595
|
|
|
590
596
|
---
|
|
@@ -594,7 +600,7 @@ curl -X DELETE http://127.0.0.1:7070/sessions/chat_abc123
|
|
|
594
600
|
### Plain Text Streaming
|
|
595
601
|
|
|
596
602
|
```bash
|
|
597
|
-
curl -N -X POST http://127.0.0.1:
|
|
603
|
+
curl -N -X POST http://127.0.0.1:8000/chat \
|
|
598
604
|
-H "Content-Type: application/json" \
|
|
599
605
|
-d '{
|
|
600
606
|
"message": "Explain black holes simply.",
|
|
@@ -609,7 +615,7 @@ curl -N -X POST http://127.0.0.1:7070/chat \
|
|
|
609
615
|
### Server-Sent Events Streaming
|
|
610
616
|
|
|
611
617
|
```bash
|
|
612
|
-
curl -N -X POST http://127.0.0.1:
|
|
618
|
+
curl -N -X POST http://127.0.0.1:8000/chat \
|
|
613
619
|
-H "Content-Type: application/json" \
|
|
614
620
|
-d '{
|
|
615
621
|
"message": "Explain black holes simply.",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|