Private
Public Access
0
0

conductor(checkpoint): Phase 3 complete - Grok (xAI) + Llama (multi-backend) via shared helper

Phase 3 of qwen_llama_grok_integration_20260606 ships Grok and Llama
provider support. 16 of 18 state tasks done (t3.4 and t3.15 cancelled:
no credentials_template.toml exists; t3.6 and t3.17 completed in
Phase 1's initial registry population).

Modules shipped:
- src/ai_client.py: state globals (_grok_*, _llama_* including _llama_base_url
  and _llama_api_key), _ensure_grok_client() (OpenAI SDK with base_url
  https://api.x.ai/v1), _ensure_llama_client() (OpenAI SDK with
  configurable base_url + api_key for Ollama/OpenRouter/custom backends),
  _send_grok() and _send_llama() (both 10-param signature matching
  _send_minimax, both call send_openai_compatible), _list_grok_models()
  and _list_llama_models() (return from capability registry),
  _get_llama_cost_tracking() (the local-LLM signal: returns False when
  base_url is localhost/127.0.0.1), 2 new branches in list_models(),
  Grok + Llama state reset in reset_session()
- src/models.py: 'grok' and 'llama' added to PROVIDERS (centralized;
  gui_2.py and app_controller.py import from this list)
- src/cost_tracker.py: 11 new regex pricing entries (3 Grok + 8 Llama)

Tests shipped:
- tests/test_grok_provider.py (28 lines, 2 tests)
- tests/test_llama_provider.py (68 lines, 6 tests)
- Total new tests this phase: 8 (all passing)
- Cumulative: 38 tests in batch (qwen + grok + llama + minimax + caps +
  openai_compat + cost + no_top_level_sdk_imports)

Architectural correction (Grok-consulted 2026-06-11):
- Spec section 3.1.1 added: 'best API per vendor' principle
- Spec section 4.3 reverted from 'Native REST API' to 'OpenAI-Compatible'
  per Grok's own confirmation: 'the OpenAI-compatible endpoint is
  fully compatible and clean with no meaningful unique native surface
  lost'
- Follow-up track B renamed: 'Llama Native APIs' (Ollama native +
  Meta Llama API), not 'Native Vendor APIs' (no Grok native refactor
  needed)
- v2 matrix field expansion documented (per Grok's recommendation):
  audio, video, grounding, computer_use, local, reasoning,
  web_search, x_search, code_execution, file_search, mcp_support,
  structured_output

Deviations from plan (consistent with Phase 1 and Phase 2):
- Test signatures use 10-arg (real _send_minimax shape), not 12-arg
- PROVIDERS change is at src/models.py:56 (centralized), not in
  gui_2.py and app_controller.py (which import from models)
- t3.4 and t3.15 (credentials template) skipped: no template file
  exists; the user maintains their own credentials.toml directly

Phase 4 (MiniMax refactor) is now unblocked. The refactor replaces
~250 lines of inline OpenAI-compatible send logic in _send_minimax
with a thin wrapper around the shared send_openai_compatible helper
(per the spec §5.2 target: ~50 lines).
This commit is contained in:
2026-06-11 02:05:37 -04:00
parent 9be228f620
commit 21adb4a6f4

Diff Content Not Available