feat(agents,api): route LLM tasks through gateway aliases; drop default model (#478)#491
Merged
Merged
Conversation
beenuar
added a commit
to adi-devv/AiSOC
that referenced
this pull request
Jul 19, 2026
PR beenuar#491 refactored services/agents/app/nl_query/translator.py to route the LLM-enhance path through the gateway alias (resolve_model_alias("nl") + chat_completions_url()) but didn't regenerate the API's vendored mirror. `scripts/sync_vendored_nl_query.py --check` (the Python Lint & Type-check gate) failed on the drift. Re-ran the sync so the vendored copy matches byte-for-byte. In the API service the lazy `app.llm.factory` import is absent and enhance_with_llm falls back to the deterministic translation exactly as before — no behavioral change on the API side.
…lt model (beenuar#478) PR2 of 2 for beenuar#478. Every live LLM call now requests a logical task alias (aisoc-triage / recon / investigation / copilot / summary / report / nl) instead of a hardcoded model; the LiteLLM gateway (PR1) owns the alias -> real-model map. - New services/agents/app/llm/factory.py: make_chat_model(role) + resolve_model_alias(role) + resolve_base_url()/chat_completions_url(); no hardcoded default model. - model_pins.py: all seven roles pinned to aisoc-<role> aliases, each chain terminating in the deterministic floor. - Routed ~14 callsites: agents (auto-triage, cloud/identity/insider/phishing), investigator (recon/forensic/responder/report-writer), copilot, contextual, NL translator; API endpoints (translation, hunts, knowledge base, phishing) via new services/api/app/services/model_aliases.py. Removed the hardcoded gpt-4o-mini default everywhere. Behaviour change (removes the shipped default live model, as beenuar#478 asks): live LLM now runs through the gateway (OPENAI_BASE_URL), or pin a concrete model per role via AISOC_MODEL_PIN_<ROLE> (escape hatch; the slim demo sets these so keyed demos keep working). With neither, the deterministic offline path is used. Tests: services/agents/tests/test_llm_factory.py + tightened test_litellm_config.py (91 agents tests green; pyflakes clean). Live-verified: the gateway recognizes and routes every alias the refactored code emits. Closes beenuar#478. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…eenuar#478) Fix the three I001 import-order errors the CI ruff check gate flagged (test_litellm_config, test_llm_factory, knowledge_base). No behavioural change. Co-Authored-By: Claude Opus 4.8 <[email protected]>
PR beenuar#491 refactored services/agents/app/nl_query/translator.py to route the LLM-enhance path through the gateway alias (resolve_model_alias("nl") + chat_completions_url()) but didn't regenerate the API's vendored mirror. `scripts/sync_vendored_nl_query.py --check` (the Python Lint & Type-check gate) failed on the drift. Re-ran the sync so the vendored copy matches byte-for-byte. In the API service the lazy `app.llm.factory` import is absent and enhance_with_llm falls back to the deterministic translation exactly as before — no behavioral change on the API side.
beenuar
force-pushed
the
feat/litellm-alias-routing
branch
from
July 19, 2026 15:49
922602c to
de9f1c6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #478 — PR2 of 2 (behavioral half). Stacked on #PR1 (
feat/litellm-gateway) — please review/merge PR1 first; until it merges, this PR's diff includes PR1's commit.What this does
Every live LLM call now requests a logical task alias (
aisoc-triage,aisoc-recon,aisoc-investigation,aisoc-copilot,aisoc-summary,aisoc-report,aisoc-nl) instead of a hardcoded model. The LiteLLM gateway (PR1) owns the alias → real-model mapping. The shippedgpt-4o-minidefault is removed, as the issue asks.services/agents/app/llm/factory.py—make_chat_model(role)/resolve_model_alias(role)+resolve_base_url()/chat_completions_url(). No hardcoded default.model_pins.py— all 7 roles pinned toaisoc-<role>aliases, each chain terminating in thedeterministicfloor.services/api/app/services/model_aliases.py.Behavior change
Live LLM now runs through the gateway (
OPENAI_BASE_URL), or pin a concrete model per role viaAISOC_MODEL_PIN_<ROLE>(escape hatch — the slim demo sets these so keyed demos keep working). With neither, the deterministic offline path is used.OPENAI_MODELstill applies to the separate explain/BYOK path.Verification
test_llm_factory.py+ tightenedtest_litellm_config.py); pyflakes clean; all files byte-compile.aisoc-*alias the refactored code emits.python-josedep in the dev env); the changed API modules import cleanly and the newmodel_aliaseshelper resolves correctly.🤖 Generated with Claude Code