Skip to content

test: cover Anthropic pricing lookup and version-suffix normalization - #21

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1789677935-anthropic-pricing-tests
Open

devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1789677935-anthropic-pricing-tests

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

Closes the test-coverage gap flagged by the code scan: get_pricing_anthropic and _remove_version_suffix in src/agentlab/llm/tracking.py had no tests, so a normalization change could silently drop Claude models from the pricing map and make set_pricing_attributes fall back to LiteLLM or zero cost.

Tests added in tests/llm/test_tracking.py (no production code changed):

  • parametrized _remove_version_suffix cases asserting exact normalized keys for -vN, -vN:M, the anthropic. prefix, and a name with no suffix (e.g. anthropic.claude-3-sonnet-20240229-v1:0 -> claude-3-sonnet-20240229, anthropic.claude-v2:1 -> claude).
  • get_pricing_anthropic with bedrock_anthropic_callback monkeypatched to a fake exposing the two per-1K cost dicts, asserting the exact merged map (per-token prices, and entries present in only one of the input/output dicts keeping only prompt / completion).
  • the empty-dict fallback when bedrock_anthropic_callback is None (langchain-community absent).

Devin-Org: engineering

Link to Devin session: https://app.devin.ai/sessions/aa821337a6004090a4b20c95324a03e5
Open in Devin Desktop: https://app.devin.ai/desktop/session/aa821337a6004090a4b20c95324a03e5?variant=devin

@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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.

0 participants