Private
Public Access
0
0

docs(guides): document run_with_tool_loop, native Ollama, v2 matrix, PROVIDERS

Updates docs/guide_ai_client.md and docs/guide_models.md
to document the follow-up track's Phase 1-4 work:

guide_ai_client.md (added 3 sections + 1 inline note):
  - run_with_tool_loop shared helper (signature, the
    2 extensions for vendored call paths, the
    4 applied + 3 deferred vendors, audit script)
  - Native Ollama adapter (the dispatcher check in
    _send_llama, the think/images/thinking fields,
    the /api/chat endpoint difference)
  - V2 Capability Matrix (12 fields, GUI rendering,
    static vs runtime caps.local)
  - PROVIDERS Location (Phase 2 move, PEP 562 re-export)

guide_models.md (added 2 sections):
  - PROVIDERS Constant (location change + circular
    import rationale + audit)
  - V2 Capability Matrix (v2 field list, how to add
    a new v2 field per the HARD RULE on no new
    src/<thing>.py files)

These docs were previously stale; they still described the
v1 matrix only and the old 'inline tool loop' pattern.
Phase 5 t5_5 is the docs step that brings them in sync
with the current code.

Verification: 118/118 vendor+tool+provider+import-isolation
tests pass (no regressions; docs changes do not affect code)
This commit is contained in:
2026-06-11 21:51:55 -04:00
parent c9135b0565
commit 88aea3199c
2 changed files with 138 additions and 1 deletions
+45
View File
@@ -533,8 +533,53 @@ Tests live in `tests/test_models.py` and module-specific test files (e.g., `test
5. Add tests in `tests/test_models.py` (round-trip + validation).
6. Update `docs/guide_models.md` (this file) to document the new model.
---
## PROVIDERS Constant (Location Change 2026-06-11)
The `PROVIDERS` list was moved from `src/models.py` to `src/ai_client.py:56` per the AGENTS.md HARD RULE (no new `src/<thing>.py` files; system code lives in the system module).
**Current location**: `src/ai_client.py` (import as `from src.ai_client import PROVIDERS`)
**Backward compat**: `src/models.py:261-264` has a PEP 562 `__getattr__` that re-exports `PROVIDERS` via lazy import. This breaks the circular dependency where `src/ai_client.py:50` imports `ToolPreset` from `src/models.py` (a top-level `from src.ai_client import PROVIDERS` in `models.py` would deadlock).
**Audit**: `scripts/audit_providers_source_of_truth.py` fails if `PROVIDERS` is declared as a literal in `src/models.py`.
The 4 internal import sites were updated in commit `6c6a4aef`:
- `src/app_controller.py:3093`
- `src/gui_2.py:2293, 2849, 5377`
---
## V2 Capability Matrix (Added 2026-06-11)
`src/vendor_capabilities.py` defines the `VendorCapabilities` dataclass (NOT in `src/models.py` — it's in its own file because it's not a "data model" but a "capability registry"). The dataclass was extended with 12 v2 fields:
**V1 fields** (unchanged from parent track):
- `vision`, `tool_calling`, `caching`, `streaming`, `model_discovery`, `context_window`, `cost_tracking`
**V2 fields** (added in `qwen_llama_grok_followup_20260611` Phase 4):
- `local` — backend is on-device (Ollama, etc.)
- `reasoning` — model supports `thinking` / reasoning traces
- `structured_output` — model supports JSON / tool-use output
- `code_execution` — model can run code (server-side)
- `web_search` — model can do live web search
- `x_search` — X/Twitter search (grok-specific)
- `file_search` — model has a file_search tool (Anthropic)
- `mcp_support` — model supports the Model Context Protocol
- `audio` — model accepts audio input
- `video` — model accepts video input
- `grounding` — model supports grounding (gemini)
- `computer_use` — model can drive a computer (Anthropic claude-3.5+)
All v2 fields default to `False`. The dataclass is `frozen=True`; per-vendor entries use `register()` at module-import time. The GUI reads the matrix via `get_capabilities(vendor, model)` and adapts 9+ UI elements accordingly (see [guide_ai_client.md §V2 Capability Matrix](guide_ai_client.md#v2-capability-matrix-phase-4)).
**Adding a new v2 field**: The HARD RULE is that all AI-client code lives in `src/ai_client.py`. New v2 fields go in `src/vendor_capabilities.py` (existing file) — NOT in a new `src/<v2_thing>.py` file. Update the dataclass, populate per-model in the registry, add a small rendering helper in `src/gui_2.py` (e.g., `_render_v2_capability_badges` for the existing 11 v2 fields).
---
## See Also
- **[guide_architecture.md](guide_architecture.md)** — How models flow through the system