Skip to content

fix(src): centralize Bedrock model IDs and fix legacy Haiku 3 default#82

Merged
ManojRamani merged 1 commit into
mainfrom
fix/issue-51-centralize-model-ids
May 14, 2026
Merged

fix(src): centralize Bedrock model IDs and fix legacy Haiku 3 default#82
ManojRamani merged 1 commit into
mainfrom
fix/issue-51-centralize-model-ids

Conversation

@ManojRamani
Copy link
Copy Markdown
Contributor

Summary

Closes #51

Replaces hardcoded Bedrock model ID strings across src/agentic_platform/ with imports from a new centralized model_config.py. Fixes the runtime ResourceNotFoundException caused by the legacy Haiku 3 default in BasePrompt.

New file: src/agentic_platform/core/models/model_config.py

# Direct Bedrock API calls
HAIKU_MODEL_ID = "us.anthropic.claude-haiku-4-5-20251001-v1:0"
SONNET_MODEL_ID = "us.anthropic.claude-sonnet-4-20250514-v1:0"
NOVA_LITE_MODEL_ID = "us.amazon.nova-lite-v1:0"

# LiteLLM proxy model names (match litellm_config.yaml)
HAIKU_LITELLM_MODEL_ID = "anthropic.claude-haiku-4-5-20251001-v1:0"
SONNET_LITELLM_MODEL_ID = "anthropic.claude-sonnet-4-20250514-v1:0"

Files updated (8):

  • core/models/prompt_models.py — legacy Haiku 3 → HAIKU_LITELLM_MODEL_ID
  • agentic_chat/prompt/agentic_chat_prompt.py — legacy Haiku 3 → HAIKU_LITELLM_MODEL_ID
  • agentic_chat/agent/agentic_chat_agent.pySONNET_LITELLM_MODEL_ID
  • agentic_rag/agent/agentic_rag_agent.pySONNET_LITELLM_MODEL_ID
  • agentic_rag/prompt/agentic_rag_prompt.pySONNET_LITELLM_MODEL_ID
  • jira_agent/jira_agent.pySONNET_MODEL_ID (direct Bedrock)
  • jira_agent/jira_prompt.pySONNET_LITELLM_MODEL_ID
  • tool/retrieval/retrieval_tool_prompt.pyNOVA_LITE_MODEL_ID

Intentionally NOT changed

File Reason
infrastructure/modules/ecs/litellmconfig.tf Routing table — removing entries breaks deployed services still requesting those models. Requires coordinated rollout.
src/.../litellm_gateway/litellm_config.yaml Same — backwards compat for callers that haven't migrated
src/.../strands_glue_athena/agent_service.py Pins Sonnet 3.7 for a specific Strands integration; changing without dedicated testing could break that agent
infrastructure/.../knowledgebase/variables.tf Embedding model ID (nova-2-multimodal-embeddings) — different category, not part of this issue

Test plan

  • python -c "from agentic_platform.core.models.model_config import HAIKU_MODEL_ID, SONNET_MODEL_ID, NOVA_LITE_MODEL_ID, HAIKU_LITELLM_MODEL_ID, SONNET_LITELLM_MODEL_ID" — imports succeed
  • python -c "from agentic_platform.core.models.prompt_models import BasePrompt; assert 'haiku-4-5' in BasePrompt().model_id" — default no longer legacy
  • python -c "from agentic_platform.agent.agentic_chat.prompt.agentic_chat_prompt import AgenticChatPrompt; assert 'haiku-4-5' in AgenticChatPrompt().model_id" — chat prompt updated
  • python -c "from agentic_platform.agent.jira_agent.jira_agent import StrandsJiraAgent" — import succeeds (agent uses SONNET_MODEL_ID)
  • Grep src/ for claude-3-haiku-20240307 — zero hits in .py files

🤖 Generated with Claude Code

…#51)

Replace hardcoded model ID strings across src/agentic_platform/ with
imports from a new centralized model_config.py module. This fixes the
runtime ResourceNotFoundException caused by the legacy Haiku 3 ID in
BasePrompt and eliminates drift hazards across 8 files.

Key decisions:
- Two constant families: direct Bedrock (us.anthropic.*) and LiteLLM
  proxy (anthropic.*) since the proxy routing table uses non-prefixed
  model names
- BasePrompt.model_id defaults to HAIKU_LITELLM_MODEL_ID since all
  existing callers go through LLMGatewayClient (the LiteLLM proxy)
- Jira agent uses SONNET_MODEL_ID (direct Bedrock via BedrockModel)

Intentionally NOT changed:
- infrastructure/modules/ecs/litellmconfig.tf — routing table that
  deployed services depend on; removing entries breaks callers
- src/.../litellm_gateway/litellm_config.yaml — same reason (backwards
  compat for services still requesting older model names)
- src/.../strands_glue_athena/agent_service.py — pins Sonnet 3.7 for a
  specific Strands integration; changing without testing could break it
- infrastructure/.../knowledgebase/variables.tf — embedding model ID,
  different category entirely

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ManojRamani ManojRamani merged commit b4c1626 into main May 14, 2026
2 checks passed
@ManojRamani ManojRamani deleted the fix/issue-51-centralize-model-ids branch May 14, 2026 03:07
@ManojRamani
Copy link
Copy Markdown
Contributor Author

Testing Approach

This is a refactor with no logic changes — hardcoded strings are replaced with imports from a centralized module. The testing strategy focuses on verifying correctness at import time and confirming no legacy IDs remain.

1. Static verification (no infra required)

# Confirm BasePrompt default is no longer legacy Haiku 3
python -c "from agentic_platform.core.models.prompt_models import BasePrompt; assert 'haiku-4-5' in BasePrompt().model_id, f'Got: {BasePrompt().model_id}'"

# Confirm all constants import cleanly
python -c "from agentic_platform.core.models.model_config import HAIKU_MODEL_ID, SONNET_MODEL_ID, NOVA_LITE_MODEL_ID, HAIKU_LITELLM_MODEL_ID, SONNET_LITELLM_MODEL_ID; print('All imports OK')"

# Confirm each agent/prompt module imports without error
python -c "from agentic_platform.agent.agentic_chat.prompt.agentic_chat_prompt import AgenticChatPrompt"
python -c "from agentic_platform.agent.agentic_rag.prompt.agentic_rag_prompt import AgenticRagPrompt"
python -c "from agentic_platform.agent.jira_agent.jira_prompt import JiraPrompt"
python -c "from agentic_platform.tool.retrieval.retrieval_tool_prompt import RAGPrompt"

2. Grep audit (confirm no legacy strings remain)

# Should return ZERO results in .py files
grep -r "claude-3-haiku-20240307" src/ --include="*.py"

3. Integration smoke test (requires AWS creds + LiteLLM proxy running)

# Start the LiteLLM gateway, then hit the chat endpoint
# If model_id is wrong → immediate ResourceNotFoundException
# If model_name doesn't match litellm_config.yaml → proxy routing error
curl -X POST http://localhost:8000/chat -d '{"message": "hello"}'

4. What's NOT tested (and why it's acceptable)

  • litellm_config.yaml / litellmconfig.tf: Not touched — these are routing tables, not defaults. Existing deployed services continue to work unchanged.
  • strands_glue_athena: Not touched — retains its pinned Sonnet 3.7 ID.
  • End-to-end agent quality: Model IDs point to the same model families (Sonnet 4, Haiku 4.5) — no behavioral change expected.

Risk assessment

Risk Likelihood Mitigation
Import cycle (model_configprompt_models) None — model_config.py has zero internal imports N/A
LiteLLM model name mismatch Low — verified against litellm_config.yaml line 2 and 12 Grep + import test
Breaking a deployed service None — only defaults changed, deployed envs override via env vars Env var OTEL_EXPORTER_OTLP_ENDPOINT pattern already exists

@ManojRamani
Copy link
Copy Markdown
Contributor Author

Test Results (post-merge verification)

All tests executed on main after squash merge.

✅ 1. model_config imports

HAIKU_MODEL_ID=us.anthropic.claude-haiku-4-5-20251001-v1:0
SONNET_MODEL_ID=us.anthropic.claude-sonnet-4-20250514-v1:0
NOVA_LITE_MODEL_ID=us.amazon.nova-lite-v1:0
HAIKU_LITELLM_MODEL_ID=anthropic.claude-haiku-4-5-20251001-v1:0
SONNET_LITELLM_MODEL_ID=anthropic.claude-sonnet-4-20250514-v1:0

✅ 2. BasePrompt default no longer legacy

BasePrompt.model_id = anthropic.claude-haiku-4-5-20251001-v1:0

(Previously: us.anthropic.claude-3-haiku-20240307-v1:0 → ResourceNotFoundException)

✅ 3. All prompt/agent classes import cleanly with correct IDs

AgenticChatPrompt.model_id = anthropic.claude-haiku-4-5-20251001-v1:0
AgenticRagPrompt.model_id  = anthropic.claude-sonnet-4-20250514-v1:0
JiraPrompt.model_id        = anthropic.claude-sonnet-4-20250514-v1:0
RAGPrompt.model_id         = us.amazon.nova-lite-v1:0

✅ 4. Grep audit — zero legacy Haiku 3 IDs in src/*.py

grep "claude-3-haiku-20240307" src/**/*.py → 0 matches

Callouts

  • BasePrompt() requires system_prompt and user_prompt args (Pydantic required fields) — you can't instantiate it bare, but the model_id default is verified via subclasses
  • Integration smoke test (hitting the LiteLLM proxy) not run — requires the full Docker stack. The import + grep tests confirm the string values are correct; runtime routing depends on litellm_config.yaml which was intentionally not modified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[src] Hardcoded / legacy Bedrock model IDs in src/agentic_platform/ should be centralised

1 participant