Files
OpenCode 68a9071cf1 feat: reconcile local master with origin (exa/hot-platform hunters, leaks ledger, latest results)
Local branch had diverged from origin/master (sibling commits on the same base). Rewrote local history linearly on top of origin/master, folding in all local content: exa/hot-platform discovery hunters, leaks ledger, nightly sweep orchestrator, updated .gitignore and skill docs, plus the latest hunt output and vault state. Remote-only files (vault keys, channel scripts) were restored rather than dropped, so the resulting tree is a full union of both sides.
2026-08-07 12:53:47 +08:00

1 line
2.7 KiB
JSON

{"repo": "apertureplus/dext", "files": {"tests/dext/llm/test_llm_client.py": {"96f6eec2157706e0a6d28f64b33fcd7a0dea326f": {"t": 1786068484.6390195, "n": 2403, "h": "f815ecdb2a3d833e", "c": "import json\nfrom types import SimpleNamespace\n\nimport pytest\n\nfrom dext.llm.client import LLMClient, LLMResponse\n\n\ndef _settings(key=\"sk-x\"):\n return SimpleNamespace(\n deepseek_api_key=key, llm_base_url=\"https://api.deepseek.com\",\n llm_model=\"deepseek-v4-flash\", llm_reasoning_effort=\"high\",\n llm_reasoning_effort_retry=\"max\", llm_max_page_tokens=24000,\n )\n\n\ndef test_build_kwargs_first_pass_uses_high_and_enables_thinking():\n c = LLMClient(_settings())\n kw = c._build_kwargs([{\"role\": \"user\", \"content\": \"hi\"}], tools=None,\n tool_choice=None, response_format=None, thinking=True, retry_mode=False)\n assert kw[\"model\"] == \"deepseek-v4-flash\"\n assert kw[\"reasoning_effort\"] == \"high\"\n assert kw[\"extra_body\"] == {\"thinking\": {\"type\": \"enabled\"}}\n\n\ndef test_build_kwargs_retry_escalates_to_max():\n c = LLMClient(_settings())\n kw = c._build_kwargs([], tools=None, tool_choice=None, response_format=None,\n thinking=True, retry_mode=True)\n assert kw[\"reasoning_effort\"] == \"max\"\n\n\ndef test_build_kwargs_thinking_disabled_omits_effort():\n c = LLMClient(_settings())\n kw = c._build_kwargs([], tools=None, tool_choice=None, response_format=None,\n thinking=False, retry_mode=True)\n assert \"reasoning_effort\" not in kw\n assert kw[\"extra_body\"] == {\"thinking\": {\"type\": \"disabled\"}}\n\n\ndef test_parse_splits_valid_and_invalid_tool_calls():\n msg = SimpleNamespace(\n content=None,\n reasoning_content=\"…\",\n tool_calls=[\n SimpleNamespace(function=SimpleNamespace(name=\"save_professors\", arguments='{\"professors\": []}')),\n SimpleNamespace(function=SimpleNamespace(name=\"save_professors\", arguments='{bad json')),\n ],\n )\n resp = SimpleNamespace(choices=[SimpleNamespace(message=msg)], usage=None)\n out = LLMClient._parse(resp)\n assert isinstance(out, LLMResponse)\n assert out.tool_calls == [{\"name\": \"save_professors\", \"arguments\": {\"professors\": []}}]\n assert len(out.invalid_tool_calls) == 1\n assert out.invalid_tool_calls[0][\"name\"] == \"save_professors\"\n assert out.reasoning_content == \"…\"\n\n\nasync def test_missing_api_key_raises_runtimeerror():\n c = LLMClient(_settings(key=\"\"))\n with pytest.raises(RuntimeError, match=\"DEEPSEEK_API_KEY\"):\n await c.chat([{\"role\": \"user\", \"content\": \"hi\"}])\n"}}}}