fix(src): centralize Bedrock model IDs and fix legacy Haiku 3 default#82
Merged
Merged
Conversation
…#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>
Contributor
Author
Testing ApproachThis 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)
Risk assessment
|
Contributor
Author
Test Results (post-merge verification)All tests executed on ✅ 1. model_config imports✅ 2. BasePrompt default no longer legacy(Previously: ✅ 3. All prompt/agent classes import cleanly with correct IDs✅ 4. Grep audit — zero legacy Haiku 3 IDs in src/*.pyCallouts
|
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.
Summary
Closes #51
Replaces hardcoded Bedrock model ID strings across
src/agentic_platform/with imports from a new centralizedmodel_config.py. Fixes the runtimeResourceNotFoundExceptioncaused by the legacy Haiku 3 default inBasePrompt.New file:
src/agentic_platform/core/models/model_config.pyFiles updated (8):
core/models/prompt_models.py— legacy Haiku 3 →HAIKU_LITELLM_MODEL_IDagentic_chat/prompt/agentic_chat_prompt.py— legacy Haiku 3 →HAIKU_LITELLM_MODEL_IDagentic_chat/agent/agentic_chat_agent.py→SONNET_LITELLM_MODEL_IDagentic_rag/agent/agentic_rag_agent.py→SONNET_LITELLM_MODEL_IDagentic_rag/prompt/agentic_rag_prompt.py→SONNET_LITELLM_MODEL_IDjira_agent/jira_agent.py→SONNET_MODEL_ID(direct Bedrock)jira_agent/jira_prompt.py→SONNET_LITELLM_MODEL_IDtool/retrieval/retrieval_tool_prompt.py→NOVA_LITE_MODEL_IDIntentionally NOT changed
infrastructure/modules/ecs/litellmconfig.tfsrc/.../litellm_gateway/litellm_config.yamlsrc/.../strands_glue_athena/agent_service.pyinfrastructure/.../knowledgebase/variables.tfnova-2-multimodal-embeddings) — different category, not part of this issueTest 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 succeedpython -c "from agentic_platform.core.models.prompt_models import BasePrompt; assert 'haiku-4-5' in BasePrompt().model_id"— default no longer legacypython -c "from agentic_platform.agent.agentic_chat.prompt.agentic_chat_prompt import AgenticChatPrompt; assert 'haiku-4-5' in AgenticChatPrompt().model_id"— chat prompt updatedpython -c "from agentic_platform.agent.jira_agent.jira_agent import StrandsJiraAgent"— import succeeds (agent uses SONNET_MODEL_ID)src/forclaude-3-haiku-20240307— zero hits in .py files🤖 Generated with Claude Code