Skip to content

fix(agent): llm.rs sends deprecated temperature=0 to Anthropic, causing live 400s #290

Description

@HappyDevs1

What's broken

HttpModelClient::complete_anthropic in crates/flowproof-agent/src/llm.rs sends "temperature": 0 unconditionally in every Anthropic Messages API request body.

Confirmed via direct curl reproduction against the real API: the crate's own default model (DEFAULT_ANTHROPIC_MODEL = "claude-sonnet-5") rejects any temperature field outright:

400 invalid_request_error: "temperature is deprecated for this model."

Removing the field from the same request makes it succeed immediately — confirmed both ways.

Why it matters

This isn't a hypothetical edge case — it's the core LLM-authoring path. Any live call through Author::Llm / Author::Auto's model fallback (used when deterministic rules can't resolve a step), and heal_with_author's LLM path, will currently fail with this exact 400 against the default model. It was found as a side effect of testing an unrelated experimental module (video_author.rs, PR #242) that had the identical bug — already fixed there.

Fix

Remove temperature from the request body in complete_anthropic. complete_openai also sends temperature: 0 — worth checking whether OpenAI-compatible backends still need it before touching that path, since this deprecation looks Anthropic/model-specific rather than universal.

How to verify

Same way this was diagnosed: a direct API call with and without the field, using the real key. Also worth checking whether there's an existing seam for testing request construction without a live network call, per the repo convention that a fix ships with the test that proves it stays fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions