deepwrap 0.1.2__tar.gz → 0.2.0__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.2.0}/PKG-INFO +97 -17
- {deepwrap-0.1.2 → deepwrap-0.2.0}/README.md +96 -16
- deepwrap-0.2.0/deepwrap/__init__.py +4 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/__main__.py +2 -20
- deepwrap-0.2.0/deepwrap/api/__init__.py +10 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/api/chat_session.py +89 -4
- deepwrap-0.2.0/deepwrap/api/files.py +128 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/client.py +2 -2
- deepwrap-0.2.0/deepwrap/config.py +43 -0
- deepwrap-0.2.0/deepwrap/function_calling.py +104 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/interfaces/api.py +64 -10
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/interfaces/cli.py +103 -128
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap.egg-info/PKG-INFO +97 -17
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap.egg-info/SOURCES.txt +4 -1
- {deepwrap-0.1.2 → deepwrap-0.2.0}/pyproject.toml +1 -1
- deepwrap-0.2.0/tests/test_chat_session.py +151 -0
- deepwrap-0.1.2/deepwrap/__init__.py +0 -3
- deepwrap-0.1.2/deepwrap/api/__init__.py +0 -7
- deepwrap-0.1.2/deepwrap/config.py +0 -74
- {deepwrap-0.1.2 → deepwrap-0.2.0}/LICENSE +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/api/base.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/api/chats.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/api/pow.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/core/__init__.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/core/auth.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/core/session_manager.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/interfaces/__init__.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/modules/__init__.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/modules/pow_asm.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/py.typed +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/utils/bearer_token_extractor.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/utils/browser_finder.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/utils/browser_process.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/utils/cdp_client.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/utils/config_store.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/utils/dev_tools_http.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap/utils/port_finder.py +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap.egg-info/dependency_links.txt +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap.egg-info/entry_points.txt +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap.egg-info/requires.txt +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/deepwrap.egg-info/top_level.txt +0 -0
- {deepwrap-0.1.2 → deepwrap-0.2.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: deepwrap
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
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
|
|
|
@@ -323,6 +327,66 @@ The `ChatSession` keeps track of the latest message ID internally, so follow-up
|
|
|
323
327
|
|
|
324
328
|
---
|
|
325
329
|
|
|
330
|
+
### Vision file uploads
|
|
331
|
+
|
|
332
|
+
Files can be attached only to a `vision` session. DeepWrap uploads the file,
|
|
333
|
+
waits for DeepSeek to process it, and forwards its file ID with the prompt.
|
|
334
|
+
|
|
335
|
+
```python
|
|
336
|
+
chat = client.chats.create_session(model="vision")
|
|
337
|
+
|
|
338
|
+
response = chat.respond(
|
|
339
|
+
"Describe this image.",
|
|
340
|
+
files=["./photo.png"],
|
|
341
|
+
stream=False,
|
|
342
|
+
)
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
You can also upload once and reuse the returned ID:
|
|
346
|
+
|
|
347
|
+
```python
|
|
348
|
+
uploaded = chat.upload_file("./photo.png")
|
|
349
|
+
response = chat.respond("What is visible?", file_ids=[uploaded.id], stream=False)
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### Pseudo function calling
|
|
353
|
+
|
|
354
|
+
DeepWrap supplies tool definitions through a synthetic system protocol. The model
|
|
355
|
+
either answers normally or returns a strict `<deepwrap_tool_call>` JSON envelope.
|
|
356
|
+
Passing `functions` enables the automatic tool/result loop; omitting it returns the
|
|
357
|
+
parsed call for execution by the application.
|
|
358
|
+
|
|
359
|
+
```python
|
|
360
|
+
from deepwrap import Tool
|
|
361
|
+
|
|
362
|
+
add = Tool(
|
|
363
|
+
name="add",
|
|
364
|
+
description="Add two integers.",
|
|
365
|
+
parameters={
|
|
366
|
+
"type": "object",
|
|
367
|
+
"properties": {
|
|
368
|
+
"a": {"type": "integer"},
|
|
369
|
+
"b": {"type": "integer"},
|
|
370
|
+
},
|
|
371
|
+
"required": ["a", "b"],
|
|
372
|
+
},
|
|
373
|
+
)
|
|
374
|
+
|
|
375
|
+
result = chat.respond_with_tools(
|
|
376
|
+
"What is 20 + 22?",
|
|
377
|
+
[add],
|
|
378
|
+
functions={"add": lambda a, b: a + b},
|
|
379
|
+
)
|
|
380
|
+
|
|
381
|
+
print(result.content)
|
|
382
|
+
print(result.tool_calls)
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
Tool calling is non-streaming because the complete envelope must be validated
|
|
386
|
+
before a function can be selected or executed.
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
326
390
|
## Supported Models
|
|
327
391
|
|
|
328
392
|
DeepWrap currently supports:
|
|
@@ -333,6 +397,9 @@ default
|
|
|
333
397
|
vision
|
|
334
398
|
```
|
|
335
399
|
|
|
400
|
+
Web search is supported only by `default` (Instant). DeepWrap always sends
|
|
401
|
+
`search_enabled=false` for `expert` and `vision`, even if `search=True` is passed.
|
|
402
|
+
|
|
336
403
|
Example:
|
|
337
404
|
|
|
338
405
|
```python
|
|
@@ -343,9 +410,11 @@ chat = client.chats.create_session(model="default")
|
|
|
343
410
|
|
|
344
411
|
DeepWrap includes an optional **God Mode** for chat sessions.
|
|
345
412
|
|
|
346
|
-
When `god_mode` is enabled,
|
|
413
|
+
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.
|
|
347
414
|
|
|
348
|
-
|
|
415
|
+
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.
|
|
416
|
+
|
|
417
|
+
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
418
|
|
|
350
419
|
> God Mode is disabled by default and must be enabled explicitly per session.
|
|
351
420
|
|
|
@@ -362,7 +431,7 @@ chat = client.chats.create_session(
|
|
|
362
431
|
)
|
|
363
432
|
|
|
364
433
|
response = chat.respond(
|
|
365
|
-
"
|
|
434
|
+
"Give me a blunt explanation of Python metaclasses.",
|
|
366
435
|
stream=False,
|
|
367
436
|
)
|
|
368
437
|
|
|
@@ -379,6 +448,17 @@ Run the interactive terminal interface:
|
|
|
379
448
|
deepwrap
|
|
380
449
|
```
|
|
381
450
|
|
|
451
|
+
To attach an image in interactive mode:
|
|
452
|
+
|
|
453
|
+
```text
|
|
454
|
+
/model vision
|
|
455
|
+
/attach ./photo.png
|
|
456
|
+
Describe this image.
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
Use `/attachments` to inspect pending files and `/detach` to clear them. Pending
|
|
460
|
+
attachments are consumed after the next successful response.
|
|
461
|
+
|
|
382
462
|
Send a single message from the terminal:
|
|
383
463
|
|
|
384
464
|
```bash
|
|
@@ -461,7 +541,7 @@ deepwrap api
|
|
|
461
541
|
Specify host and port:
|
|
462
542
|
|
|
463
543
|
```bash
|
|
464
|
-
deepwrap api --host 127.0.0.1 --port
|
|
544
|
+
deepwrap api --host 127.0.0.1 --port 8000
|
|
465
545
|
```
|
|
466
546
|
|
|
467
547
|
Enable reload for development:
|
|
@@ -489,7 +569,7 @@ deepwrap api --log-level debug
|
|
|
489
569
|
### Health Check
|
|
490
570
|
|
|
491
571
|
```bash
|
|
492
|
-
curl http://127.0.0.1:
|
|
572
|
+
curl http://127.0.0.1:8000/health
|
|
493
573
|
```
|
|
494
574
|
|
|
495
575
|
Example response:
|
|
@@ -498,7 +578,7 @@ Example response:
|
|
|
498
578
|
{
|
|
499
579
|
"ok": true,
|
|
500
580
|
"app": "deepwrap",
|
|
501
|
-
"version": "0.
|
|
581
|
+
"version": "0.2.0",
|
|
502
582
|
"token_configured": true,
|
|
503
583
|
"cached_clients": 1,
|
|
504
584
|
"active_sessions": 0
|
|
@@ -510,7 +590,7 @@ Example response:
|
|
|
510
590
|
### One-Shot Chat Request
|
|
511
591
|
|
|
512
592
|
```bash
|
|
513
|
-
curl -X POST http://127.0.0.1:
|
|
593
|
+
curl -X POST http://127.0.0.1:8000/chat \
|
|
514
594
|
-H "Content-Type: application/json" \
|
|
515
595
|
-d '{
|
|
516
596
|
"message": "Explain recursion in one sentence.",
|
|
@@ -536,7 +616,7 @@ Example response:
|
|
|
536
616
|
### Create Persistent Session
|
|
537
617
|
|
|
538
618
|
```bash
|
|
539
|
-
curl -X POST http://127.0.0.1:
|
|
619
|
+
curl -X POST http://127.0.0.1:8000/sessions \
|
|
540
620
|
-H "Content-Type: application/json" \
|
|
541
621
|
-d '{
|
|
542
622
|
"model": "expert"
|
|
@@ -558,7 +638,7 @@ Example response:
|
|
|
558
638
|
### Use Persistent Session
|
|
559
639
|
|
|
560
640
|
```bash
|
|
561
|
-
curl -X POST http://127.0.0.1:
|
|
641
|
+
curl -X POST http://127.0.0.1:8000/chat \
|
|
562
642
|
-H "Content-Type: application/json" \
|
|
563
643
|
-d '{
|
|
564
644
|
"session_id": "chat_abc123",
|
|
@@ -570,7 +650,7 @@ curl -X POST http://127.0.0.1:7070/chat \
|
|
|
570
650
|
Then:
|
|
571
651
|
|
|
572
652
|
```bash
|
|
573
|
-
curl -X POST http://127.0.0.1:
|
|
653
|
+
curl -X POST http://127.0.0.1:8000/chat \
|
|
574
654
|
-H "Content-Type: application/json" \
|
|
575
655
|
-d '{
|
|
576
656
|
"session_id": "chat_abc123",
|
|
@@ -584,7 +664,7 @@ curl -X POST http://127.0.0.1:7070/chat \
|
|
|
584
664
|
### Delete Session
|
|
585
665
|
|
|
586
666
|
```bash
|
|
587
|
-
curl -X DELETE http://127.0.0.1:
|
|
667
|
+
curl -X DELETE http://127.0.0.1:8000/sessions/chat_abc123
|
|
588
668
|
```
|
|
589
669
|
|
|
590
670
|
---
|
|
@@ -594,7 +674,7 @@ curl -X DELETE http://127.0.0.1:7070/sessions/chat_abc123
|
|
|
594
674
|
### Plain Text Streaming
|
|
595
675
|
|
|
596
676
|
```bash
|
|
597
|
-
curl -N -X POST http://127.0.0.1:
|
|
677
|
+
curl -N -X POST http://127.0.0.1:8000/chat \
|
|
598
678
|
-H "Content-Type: application/json" \
|
|
599
679
|
-d '{
|
|
600
680
|
"message": "Explain black holes simply.",
|
|
@@ -609,7 +689,7 @@ curl -N -X POST http://127.0.0.1:7070/chat \
|
|
|
609
689
|
### Server-Sent Events Streaming
|
|
610
690
|
|
|
611
691
|
```bash
|
|
612
|
-
curl -N -X POST http://127.0.0.1:
|
|
692
|
+
curl -N -X POST http://127.0.0.1:8000/chat \
|
|
613
693
|
-H "Content-Type: application/json" \
|
|
614
694
|
-d '{
|
|
615
695
|
"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
|
|
|
@@ -268,6 +272,66 @@ The `ChatSession` keeps track of the latest message ID internally, so follow-up
|
|
|
268
272
|
|
|
269
273
|
---
|
|
270
274
|
|
|
275
|
+
### Vision file uploads
|
|
276
|
+
|
|
277
|
+
Files can be attached only to a `vision` session. DeepWrap uploads the file,
|
|
278
|
+
waits for DeepSeek to process it, and forwards its file ID with the prompt.
|
|
279
|
+
|
|
280
|
+
```python
|
|
281
|
+
chat = client.chats.create_session(model="vision")
|
|
282
|
+
|
|
283
|
+
response = chat.respond(
|
|
284
|
+
"Describe this image.",
|
|
285
|
+
files=["./photo.png"],
|
|
286
|
+
stream=False,
|
|
287
|
+
)
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
You can also upload once and reuse the returned ID:
|
|
291
|
+
|
|
292
|
+
```python
|
|
293
|
+
uploaded = chat.upload_file("./photo.png")
|
|
294
|
+
response = chat.respond("What is visible?", file_ids=[uploaded.id], stream=False)
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Pseudo function calling
|
|
298
|
+
|
|
299
|
+
DeepWrap supplies tool definitions through a synthetic system protocol. The model
|
|
300
|
+
either answers normally or returns a strict `<deepwrap_tool_call>` JSON envelope.
|
|
301
|
+
Passing `functions` enables the automatic tool/result loop; omitting it returns the
|
|
302
|
+
parsed call for execution by the application.
|
|
303
|
+
|
|
304
|
+
```python
|
|
305
|
+
from deepwrap import Tool
|
|
306
|
+
|
|
307
|
+
add = Tool(
|
|
308
|
+
name="add",
|
|
309
|
+
description="Add two integers.",
|
|
310
|
+
parameters={
|
|
311
|
+
"type": "object",
|
|
312
|
+
"properties": {
|
|
313
|
+
"a": {"type": "integer"},
|
|
314
|
+
"b": {"type": "integer"},
|
|
315
|
+
},
|
|
316
|
+
"required": ["a", "b"],
|
|
317
|
+
},
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
result = chat.respond_with_tools(
|
|
321
|
+
"What is 20 + 22?",
|
|
322
|
+
[add],
|
|
323
|
+
functions={"add": lambda a, b: a + b},
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
print(result.content)
|
|
327
|
+
print(result.tool_calls)
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
Tool calling is non-streaming because the complete envelope must be validated
|
|
331
|
+
before a function can be selected or executed.
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
271
335
|
## Supported Models
|
|
272
336
|
|
|
273
337
|
DeepWrap currently supports:
|
|
@@ -278,6 +342,9 @@ default
|
|
|
278
342
|
vision
|
|
279
343
|
```
|
|
280
344
|
|
|
345
|
+
Web search is supported only by `default` (Instant). DeepWrap always sends
|
|
346
|
+
`search_enabled=false` for `expert` and `vision`, even if `search=True` is passed.
|
|
347
|
+
|
|
281
348
|
Example:
|
|
282
349
|
|
|
283
350
|
```python
|
|
@@ -288,9 +355,11 @@ chat = client.chats.create_session(model="default")
|
|
|
288
355
|
|
|
289
356
|
DeepWrap includes an optional **God Mode** for chat sessions.
|
|
290
357
|
|
|
291
|
-
When `god_mode` is enabled,
|
|
358
|
+
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.
|
|
292
359
|
|
|
293
|
-
|
|
360
|
+
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.
|
|
361
|
+
|
|
362
|
+
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
363
|
|
|
295
364
|
> God Mode is disabled by default and must be enabled explicitly per session.
|
|
296
365
|
|
|
@@ -307,7 +376,7 @@ chat = client.chats.create_session(
|
|
|
307
376
|
)
|
|
308
377
|
|
|
309
378
|
response = chat.respond(
|
|
310
|
-
"
|
|
379
|
+
"Give me a blunt explanation of Python metaclasses.",
|
|
311
380
|
stream=False,
|
|
312
381
|
)
|
|
313
382
|
|
|
@@ -324,6 +393,17 @@ Run the interactive terminal interface:
|
|
|
324
393
|
deepwrap
|
|
325
394
|
```
|
|
326
395
|
|
|
396
|
+
To attach an image in interactive mode:
|
|
397
|
+
|
|
398
|
+
```text
|
|
399
|
+
/model vision
|
|
400
|
+
/attach ./photo.png
|
|
401
|
+
Describe this image.
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
Use `/attachments` to inspect pending files and `/detach` to clear them. Pending
|
|
405
|
+
attachments are consumed after the next successful response.
|
|
406
|
+
|
|
327
407
|
Send a single message from the terminal:
|
|
328
408
|
|
|
329
409
|
```bash
|
|
@@ -406,7 +486,7 @@ deepwrap api
|
|
|
406
486
|
Specify host and port:
|
|
407
487
|
|
|
408
488
|
```bash
|
|
409
|
-
deepwrap api --host 127.0.0.1 --port
|
|
489
|
+
deepwrap api --host 127.0.0.1 --port 8000
|
|
410
490
|
```
|
|
411
491
|
|
|
412
492
|
Enable reload for development:
|
|
@@ -434,7 +514,7 @@ deepwrap api --log-level debug
|
|
|
434
514
|
### Health Check
|
|
435
515
|
|
|
436
516
|
```bash
|
|
437
|
-
curl http://127.0.0.1:
|
|
517
|
+
curl http://127.0.0.1:8000/health
|
|
438
518
|
```
|
|
439
519
|
|
|
440
520
|
Example response:
|
|
@@ -443,7 +523,7 @@ Example response:
|
|
|
443
523
|
{
|
|
444
524
|
"ok": true,
|
|
445
525
|
"app": "deepwrap",
|
|
446
|
-
"version": "0.
|
|
526
|
+
"version": "0.2.0",
|
|
447
527
|
"token_configured": true,
|
|
448
528
|
"cached_clients": 1,
|
|
449
529
|
"active_sessions": 0
|
|
@@ -455,7 +535,7 @@ Example response:
|
|
|
455
535
|
### One-Shot Chat Request
|
|
456
536
|
|
|
457
537
|
```bash
|
|
458
|
-
curl -X POST http://127.0.0.1:
|
|
538
|
+
curl -X POST http://127.0.0.1:8000/chat \
|
|
459
539
|
-H "Content-Type: application/json" \
|
|
460
540
|
-d '{
|
|
461
541
|
"message": "Explain recursion in one sentence.",
|
|
@@ -481,7 +561,7 @@ Example response:
|
|
|
481
561
|
### Create Persistent Session
|
|
482
562
|
|
|
483
563
|
```bash
|
|
484
|
-
curl -X POST http://127.0.0.1:
|
|
564
|
+
curl -X POST http://127.0.0.1:8000/sessions \
|
|
485
565
|
-H "Content-Type: application/json" \
|
|
486
566
|
-d '{
|
|
487
567
|
"model": "expert"
|
|
@@ -503,7 +583,7 @@ Example response:
|
|
|
503
583
|
### Use Persistent Session
|
|
504
584
|
|
|
505
585
|
```bash
|
|
506
|
-
curl -X POST http://127.0.0.1:
|
|
586
|
+
curl -X POST http://127.0.0.1:8000/chat \
|
|
507
587
|
-H "Content-Type: application/json" \
|
|
508
588
|
-d '{
|
|
509
589
|
"session_id": "chat_abc123",
|
|
@@ -515,7 +595,7 @@ curl -X POST http://127.0.0.1:7070/chat \
|
|
|
515
595
|
Then:
|
|
516
596
|
|
|
517
597
|
```bash
|
|
518
|
-
curl -X POST http://127.0.0.1:
|
|
598
|
+
curl -X POST http://127.0.0.1:8000/chat \
|
|
519
599
|
-H "Content-Type: application/json" \
|
|
520
600
|
-d '{
|
|
521
601
|
"session_id": "chat_abc123",
|
|
@@ -529,7 +609,7 @@ curl -X POST http://127.0.0.1:7070/chat \
|
|
|
529
609
|
### Delete Session
|
|
530
610
|
|
|
531
611
|
```bash
|
|
532
|
-
curl -X DELETE http://127.0.0.1:
|
|
612
|
+
curl -X DELETE http://127.0.0.1:8000/sessions/chat_abc123
|
|
533
613
|
```
|
|
534
614
|
|
|
535
615
|
---
|
|
@@ -539,7 +619,7 @@ curl -X DELETE http://127.0.0.1:7070/sessions/chat_abc123
|
|
|
539
619
|
### Plain Text Streaming
|
|
540
620
|
|
|
541
621
|
```bash
|
|
542
|
-
curl -N -X POST http://127.0.0.1:
|
|
622
|
+
curl -N -X POST http://127.0.0.1:8000/chat \
|
|
543
623
|
-H "Content-Type: application/json" \
|
|
544
624
|
-d '{
|
|
545
625
|
"message": "Explain black holes simply.",
|
|
@@ -554,7 +634,7 @@ curl -N -X POST http://127.0.0.1:7070/chat \
|
|
|
554
634
|
### Server-Sent Events Streaming
|
|
555
635
|
|
|
556
636
|
```bash
|
|
557
|
-
curl -N -X POST http://127.0.0.1:
|
|
637
|
+
curl -N -X POST http://127.0.0.1:8000/chat \
|
|
558
638
|
-H "Content-Type: application/json" \
|
|
559
639
|
-d '{
|
|
560
640
|
"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",
|