diff --git a/docs/DEEPSEEK41.md b/docs/DEEPSEEK41.md index fd2e2f5d..bf7955c6 100644 --- a/docs/DEEPSEEK41.md +++ b/docs/DEEPSEEK41.md @@ -81,11 +81,10 @@ The server speaks to the engine as it does for the other models, so `/v1/chat/co server turns them into OpenAI `tool_calls` and Anthropic `tool_use`, including `tool_choice`, streamed arguments and calls written inside the thinking. A value marked `string="true"` stays a string. - Defaults when a request names none: temperature 1.0, top_p 1.0. -- Agents and sub-agents that take turns can skip reading their prompts again (off in this version, a switch for testing). With - `STRATA_DS4_SLOT_KEEP=1` the engine sets a conversation aside when another request takes the model (about 17 MB per 6.5K tokens) and takes it +- Agents and sub-agents that take turns do not read their prompts again. The engine sets a conversation aside when another request takes the model (about 17 MB per 6.5K tokens) and takes it back when the next prompt continues it, also after a restart. Slots live in `ds4-slots` next to the run log, are capped at 2 GB - (`STRATA_DS4_SLOT_GB`) and are removed after a week. `STRATA_DS4_AUTO_PIN=1` also keeps the system prompt and tools shared by an agent - and its sub-agents as a checkpoint. + (`STRATA_DS4_SLOT_GB`) and are removed after a week. The system prompt and tools shared by an agent + and its sub-agents are kept as a checkpoint too. `STRATA_DS4_SLOT_KEEP=0` and `STRATA_DS4_AUTO_PIN=0` turn this off. Not in this version: several requests at once (`--parallel` is ignored with a warning) and pictures (`--vision` is ignored with a warning). diff --git a/serve/server.py b/serve/server.py index a53d1512..71a55e1f 100644 --- a/serve/server.py +++ b/serve/server.py @@ -3479,7 +3479,7 @@ def hip_auto_devices(cfg: dict, env: dict) -> list[int] | None: return visible -DS41_SLOT_KEEP_DEFAULT = "0" # the engine keeps a displaced conversation in RAM and in the slot folder (see below) +DS41_SLOT_KEEP_DEFAULT = "1" # the engine keeps a displaced conversation in RAM and in the slot folder (see below) DS41_SLOT_GB_DEFAULT = "2" # the folder's cap in GB (a 6.5K-token conversation is about 17 MB) @@ -3488,7 +3488,7 @@ def deepseek_slot_env(env: dict, cfg: dict) -> None: at its checkpoints (agents and sub-agents that take turns do not read their prompts again). STRATA_DS4_SLOT_KEEP switches it (the default above; a config's env or the shell wins); the folder is `ds4-slots` next to the run log, in Strata's data folder (STRATA_DS4_SLOT_DIR names another), and the engine caps it (STRATA_DS4_SLOT_GB, 2 here, 16 in the engine) and - removes what is older than a week or not this model's. Off by default (0.2.4); STRATA_DS4_SLOT_KEEP=1 turns it on.""" + removes what is older than a week or not this model's. On by default; STRATA_DS4_SLOT_KEEP=0 turns it off.""" env.setdefault("STRATA_DS4_SLOT_KEEP", DS41_SLOT_KEEP_DEFAULT) env.setdefault("STRATA_DS4_SLOT_GB", DS41_SLOT_GB_DEFAULT) log = cfg.get("log") @@ -4931,8 +4931,8 @@ class Service: """DeepSeek-V4.1 only: how many leading messages are the system prompt (its tools are rendered with them). An agent and its sub-agents that work behind the same system prompt and tools share exactly this start, so the engine keeps a checkpoint of its state there (pin=N): the next agent behind the same start goes back to it - instead of reading it again. 0: none (off unless STRATA_DS4_AUTO_PIN=1, no system message, or nothing after it).""" - if os.environ.get("STRATA_DS4_AUTO_PIN", "0") != "1": + instead of reading it again. 0: none (STRATA_DS4_AUTO_PIN=0, no system message, or nothing after it).""" + if os.environ.get("STRATA_DS4_AUTO_PIN", "1") == "0": return 0 n = 0 for m in messages: diff --git a/serve/test_dsv41.py b/serve/test_dsv41.py index 28b1d02e..e47224d9 100644 --- a/serve/test_dsv41.py +++ b/serve/test_dsv41.py @@ -562,10 +562,12 @@ class Api(ApiBase): self.chat() self.assertNotIn("strata_prefix", self.engine.last_sampling) # no system message body = {"messages": [{"role": "system", "content": "s"}, {"role": "user", "content": "u"}], "max_tokens": 40} - for off in (None, "0"): # off by default, and when switched off - self.auto_pin(off) - self.post("/v1/chat/completions", body) - self.assertNotIn("strata_prefix", self.engine.last_sampling) + self.auto_pin("0") # switched off + self.post("/v1/chat/completions", body) + self.assertNotIn("strata_prefix", self.engine.last_sampling) + self.auto_pin(None) # on by default + self.post("/v1/chat/completions", body) + self.assertIn("strata_prefix", self.engine.last_sampling) def test_a_clients_own_prefix_wins(self): self.start("ok") @@ -600,7 +602,7 @@ class SlotEnv(unittest.TestCase): def test_deepseek_gets_a_folder_in_the_data_folder_and_the_default_switch(self): env = self.env({"arch": "deepseek41", "log": str(Path("data") / "strata-deepseek.log"), "args": []}) self.assertEqual(Path(env["STRATA_DS4_SLOT_DIR"]), Path("data") / "ds4-slots") - self.assertEqual(env["STRATA_DS4_SLOT_KEEP"], "0") + self.assertEqual(env["STRATA_DS4_SLOT_KEEP"], "1") self.assertEqual(env["STRATA_DS4_SLOT_GB"], "2") def test_the_configs_own_settings_win(self):