Private
Public Access
docs(guides): fix stale src/models.py refs + line-number drift across 11 guides
Sweep of the per-source-file guides + Readme.md for stale references to src/models.py as the data model home. models.py is now a ~1.5KB re-export shim per module_taxonomy_refactor_20260627; dataclasses moved to src/mma.py, src/project_files.py, src/type_aliases.py, src/mcp_tool_specs.py, src/result_types.py, src/context_presets.py, src/workspace_manager.py, src/personas.py. - guide_gui_2.md: _gui_func line 754->1062; render_main_interface line 1259->1898. - python.md §10 exemption table: App gui_2.py:307->314; AppController 795->801; RAGEngine 123->125; HookServer 856->941; HookServerInstance 130->171; HookHandler 155->208; WebSocketServer 908->993. - guide_multi_agent_conductor.md: Ticket now in src/mma.py (not models.py); ConductorEngine 116+->112+; WorkerPool 50-114->52-110. - guide_agent_memory_dimensions.md: FileItem ref models.py:510-559 -> src/project_files.py. - guide_context_aggregation.md: FileItem + ContextPreset refs -> src/project_files.py + src/context_presets.py; ai_client _send_* count 5->8. - guide_discussions.md: parse_history_entries now in src/mma.py; ContextPreset/FileItem cross-refs updated. - guide_personas.md: Persona now in src/personas.py; import example updated. - guide_rag.md: RAGConfig now in src/mcp_client.py. - guide_workspace_profiles.md: WorkspaceProfile now in src/workspace_manager.py. - guide_mma.md: Data Structures section notes src/mma.py as the live location. - Readme.md: MMA Engine + Data Models rows updated for the models.py shim reality + 8 providers + mma_exec deprecation. - guide_ai_client.md: '5 provider SDKs'->8 (added note); PROVIDERS line 56->62; __getattr__ re-export line 261->31; provider switching examples use real registered model names (claude-sonnet- 4-5, MiniMax-M2, gemini-2.5-flash, qwen-plus, grok-2, llama-3.1); _provider union lists all 8 providers.
This commit is contained in:
+11
-8
@@ -21,7 +21,7 @@ The OpenAI-compatible vendors all call the shared helper in `src/openai_compatib
|
||||
|
||||
## Module-Level Imports
|
||||
|
||||
> **Important:** The 5 provider SDKs are **NOT** imported at module level. `import google.genai`, `import anthropic`, `import openai`, and `import fastapi` are heavy (~430-955ms each on cold load) and are now obtained via `src.module_loader._require_warmed("google.genai")` and similar calls, after the `WarmupManager` has loaded them in the background. The module-level globals you see in the State section (`_gemini_client`, `_anthropic_client`, etc.) are typed as `Optional` because they're populated by `_require_warmed()` on first use, not at import time.
|
||||
> **Important:** The provider SDKs are **NOT** imported at module level. `import google.genai`, `import anthropic`, `import openai`, `import dashscope`, and `import fastapi` are heavy (~430-955ms each on cold load) and are now obtained via `src.module_loader._require_warmed("google.genai")` and similar calls, after the `WarmupManager` has loaded them in the background. The module-level globals you see in the State section (`_gemini_client`, `_anthropic_client`, etc.) are typed as `Optional` because they're populated by `_require_warmed()` on first use, not at import time. (Updated 2026-07-02: there are 8 providers, not 5 — the original "5 SDKs" count predated the qwen/grok/llama additions.)
|
||||
|
||||
This change was part of the 2026-06-06 `startup_speedup_20260606` track. Before: `import src.ai_client` took ~1800ms. After: ~161ms. The remaining cost is the bare module skeleton.
|
||||
|
||||
@@ -52,7 +52,7 @@ All state is module-level globals. The most important:
|
||||
|
||||
| Variable | Type | Purpose |
|
||||
|---|---|---|
|
||||
| `_provider: str` | `"gemini" \| "anthropic" \| "deepseek" \| "minimax" \| "gemini_cli"` | Active provider |
|
||||
| `_provider: str` | `"gemini" \| "anthropic" \| "gemini_cli" \| "deepseek" \| "minimax" \| "qwen" \| "grok" \| "llama"` | Active provider (8 total) |
|
||||
| `_model: str` | `str` | Active model name |
|
||||
| `_temperature: float` | `0.0` | Sampling temperature |
|
||||
| `_top_p: float` | `1.0` | Nucleus sampling |
|
||||
@@ -129,10 +129,13 @@ Returns the model's response as a `Result[str, ErrorInfo]` (the data-oriented er
|
||||
```python
|
||||
from src import ai_client
|
||||
ai_client.set_provider("gemini", "gemini-3-flash-preview")
|
||||
ai_client.set_provider("anthropic", "claude-3-5-sonnet-latest")
|
||||
ai_client.set_provider("deepseek", "deepseek-chat")
|
||||
ai_client.set_provider("minimax", "grok-2-latest")
|
||||
ai_client.set_provider("gemini_cli", "gemini-2.0-flash")
|
||||
ai_client.set_provider("anthropic", "claude-sonnet-4-5-20250929")
|
||||
ai_client.set_provider("deepseek", "deepseek-v3")
|
||||
ai_client.set_provider("minimax", "MiniMax-M2")
|
||||
ai_client.set_provider("gemini_cli", "gemini-2.5-flash")
|
||||
ai_client.set_provider("qwen", "qwen-plus")
|
||||
ai_client.set_provider("grok", "grok-2")
|
||||
ai_client.set_provider("llama", "llama-3.1-8b-instant")
|
||||
```
|
||||
|
||||
### Parameter Setters
|
||||
@@ -686,9 +689,9 @@ Added 2026-06-11. The `VendorCapabilities` dataclass in `src/vendor_capabilities
|
||||
|
||||
### PROVIDERS Location (Phase 2)
|
||||
|
||||
The `PROVIDERS` list moved from `src/models.py` to `src/ai_client.py:56` per the AGENTS.md HARD RULE (no new `src/<thing>.py` files). A PEP 562 `__getattr__` re-export in `src/models.py:261` maintains backward compatibility (lazy import; breaks the circular dependency where `src/ai_client.py` imports `ToolPreset` from `src/models.py`).
|
||||
The `PROVIDERS` list moved from `src/models.py` to `src/ai_client.py:62` per the AGENTS.md HARD RULE (no new `src/<thing>.py` files; system code lives in the system module). A PEP 562 `__getattr__` re-export in `src/models.py:31` maintains backward compatibility (lazy import; breaks the circular dependency where `src/ai_client.py` imports `ToolPreset` from `src/tool_presets.py` and `src/models.py` is now a thin shim).
|
||||
|
||||
Audit: `scripts/audit_providers_source_of_truth.py` fails if `PROVIDERS` is declared in `src/models.py`.
|
||||
Audit: `scripts/audit_providers_source_of_truth.py` fails if `PROVIDERS` is declared as a literal in `src/models.py`.
|
||||
|
||||
|
||||
### Tests
|
||||
|
||||
Reference in New Issue
Block a user