Skip to content

Inference.py - Mismatch in Model String #20

Open
@CharlesCNorton

Description

@CharlesCNorton

In the elif model_str == "claude-3.5-sonnet": block, the code calls:

message = client.messages.create(
    model="claude-3-5-sonnet-latest",
    ...
)

However, the model_str is "claude-3.5-sonnet", and in other places we refer to "claude-3-5-sonnet" (for example, in the cost dictionaries). Essentially, there are three different naming variations in use:

  1. "claude-3-5-sonnet" in the cost dictionaries
  2. "claude-3.5-sonnet" in the elif check
  3. "claude-3-5-sonnet-latest" in client.messages.create()

If the intention is to refer to the exact same model, these should be unified or mapped consistently. Otherwise, token usage and cost may be misattributed or incorrectly tallied

Steps to Reproduce

  1. Call the function query_model("claude-3.5-sonnet", ...)
  2. Notice the cost dictionary uses "claude-3-5-sonnet"
  3. Observe the actual function call references "claude-3-5-sonnet-latest"

Expected Behavior
All references (model checks, cost dictionary keys, model calls, etc.) should match consistently so that token usage and costs align with the same model name.

Actual Behavior
There are three different model strings in the codebase, which may cause inconsistencies in cost calculation or model selection.

Proposed Fix

  • Choose a single, standardized model name—e.g. "claude-3-5-sonnet"—and update:
    1. The elif condition to match that name
    2. The cost dictionary keys to match that name
    3. The actual messages.create() call to also match

By unifying all references, you ensure the correct model is being used throughout the code and that costs are properly tallied.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions