Skip to content

fix(tests): add inference_geo to model prices JSON schema validator#21477

Merged
jquinter merged 1 commit intomainfrom
fix/schema-inference-geo-property
Feb 18, 2026
Merged

fix(tests): add inference_geo to model prices JSON schema validator#21477
jquinter merged 1 commit intomainfrom
fix/schema-inference-geo-property

Conversation

@jquinter
Copy link
Copy Markdown
Contributor

Summary

  • model_prices_and_context_window_backup.json includes inference_geo fields on geo-prefixed Anthropic models (e.g. us/claude-sonnet-4-6) used for cost calculation routing
  • The JSON schema in test_aaamodel_prices_and_context_window_json_is_valid had additionalProperties: false but didn't list inference_geo as an allowed property
  • This caused the test to fail with ValidationError: Additional properties are not allowed ('inference_geo' was unexpected)
  • Fix: add "inference_geo": {"type": "string"} to the schema

Test plan

  • poetry run pytest tests/test_litellm/test_utils.py::test_aaamodel_prices_and_context_window_json_is_valid -v passes

🤖 Generated with Claude Code

The model_prices_and_context_window_backup.json file has 'inference_geo'
fields (e.g. on 'us/claude-sonnet-4-6') for geo-prefixed Anthropic models
used in cost calculation, but the JSON schema validator in test_utils.py
did not include 'inference_geo' as an allowed property.

This caused test_aaamodel_prices_and_context_window_json_is_valid to fail
with: Additional properties are not allowed ('inference_geo' was unexpected)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Feb 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Feb 18, 2026 2:31pm

Request Review

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 18, 2026

Greptile Summary

This PR adds the inference_geo field (type: string) to the JSON schema validator in test_aaamodel_prices_and_context_window_json_is_valid. The model_prices_and_context_window_backup.json file already contains an inference_geo: "us" entry on the geo-prefixed us/claude-sonnet-4-6 model, which is used by Anthropic cost calculation routing in litellm/llms/anthropic/cost_calculation.py. Since the test schema uses additionalProperties: false, the missing field caused a ValidationError.

  • Adds "inference_geo": {"type": "string"} to the allowed properties in the test schema
  • Only one model entry currently uses this field (us/claude-sonnet-4-6), and the field value is validated as a string, which is consistent with actual usage

Confidence Score: 5/5

  • This PR is safe to merge — it only adds a missing field to a test schema to match existing data.
  • The change is a single-line addition to a test file's JSON schema, adding a field that already exists in the validated data. It introduces no new logic, no production code changes, and no risk of regression.
  • No files require special attention.

Important Files Changed

Filename Overview
tests/test_litellm/test_utils.py Adds inference_geo string field to the JSON schema validator for model_prices_and_context_window.json, fixing a ValidationError on geo-prefixed Anthropic models.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["model_prices_and_context_window.json"] -->|contains| B["us/claude-sonnet-4-6\nwith inference_geo: us"]
    B -->|validated by| C["test_aaamodel_prices_and_context_window_json_is_valid"]
    C -->|uses| D["JSON Schema\nadditionalProperties: false"]
    D -->|now includes| E["inference_geo: string ✅"]
    B -->|used by| F["anthropic/cost_calculation.py\nprepends geo prefix for cost routing"]
Loading

Last reviewed commit: d4755c8

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@jquinter jquinter merged commit 45d3d1a into main Feb 18, 2026
19 of 26 checks passed
@ishaan-berri ishaan-berri deleted the fix/schema-inference-geo-property branch March 26, 2026 22:29
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.

1 participant