Skip to content

fix: vocab consolidation on anthropic-sdk v1, and report failed evaluations as failed - #591

Merged
aaronsb merged 5 commits into
mainfrom
fix/590-vocab-consolidation-sdk-v1
Oct 2, 2026
Merged

aaronsb merged 5 commits into
mainfrom
fix/590-vocab-consolidation-sdk-v1

Conversation

@aaronsb

@aaronsb aaronsb commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Closes #590.

  • Root cause: `llm_utils.call_llm_sync` passed `temperature` top-level to `messages.create()`, which anthropic-sdk v1.0 removed. It now goes through `_anthropic_sampling_kwargs` like every other Anthropic call site. Vocabulary consolidation was 100% broken on the Anthropic provider.
  • Failure reporting: an evaluation whose LLM call or parse errored was counted as Rejected, with the exception text as its reasoning. `MergeDecision.failed` now routes these into a separate `failed` list through the manager (dry-run and live), route/model, worker, and CLI. The CLI exits non-zero when every evaluation failed.
  • Operator key validation: `manage_api_keys.py` pinged the retired `claude-3-5-sonnet-20241022`. It now uses `models.list(limit=1)`, matching `AnthropicProvider.validate_api_key` (ADR-800).

Coordination: #586 (`_anthropic_create`, per-model request adaptation) doesn't conflict textually. Whichever lands second should switch `call_llm_sync` to `_anthropic_create` so consolidation gets the same adaptation. Agreed with the session landing #586.

Gates

  • New tests: executed. `tests/unit/lib/test_vocab_consolidation_llm.py` passes (6). With the `llm_utils` fix reverted, the 2 sampling tests fail, so they catch the bug.
  • Related provider tests: executed. `test_describe_image_contract.py` and `test_provider_call_with_tools.py` pass (45 total with new).
  • Full unit suite: executed. 864 passed, 1 failed, 4 errors. The 5 fail identically on unmodified `main` in the same sandbox: `POSTGRES_PASSWORD` unset (`test_provider_config`) and no network for the HF download (`test_embedding_model_manager_real_torch`). They're environmental.
  • CLI `tsc --noEmit`: executed. The only error is the build-generated `../version` module, which is absent in a fresh clone and unrelated.
  • All of the above ran in a throwaway `kg-api:latest` container with the branch mounted read-only. Not yet verified: a live `kg vocab consolidate --dry-run` against the running stack after deploy.

…c_sampling_kwargs

anthropic-sdk v1.0 removed temperature from messages.create(). Every
Anthropic call site in ai_providers.py already goes through the helper,
but the shared dispatch in llm_utils still passed temperature top-level,
so every vocabulary-consolidation evaluation raised TypeError.

Refs #590
A merge evaluation whose LLM call or response parsing errored was
returned as should_merge=False and counted under Rejected, so a dead
provider read as 'the AI judged nothing should merge'. MergeDecision now
carries failed=True for those; consolidation (dry-run and live) collects
them in a separate 'failed' list that the route, worker and CLI surface.
The CLI exits non-zero when every evaluation failed.

Tests pin both #590 halves: call_llm_sync sends temperature via
extra_body (and drops it for models that reject sampling params), and
llm_evaluate_merge marks call and parse errors as failed while a real
rejection is not.

Refs #590
…d model

The key-validation ping called messages.create on the hardcoded
claude-3-5-sonnet-20241022, which 404s once the model is retired and
rejects valid keys. Match AnthropicProvider.validate_api_key (ADR-800).

Refs #590
…_create

Vocabulary consolidation now gets the same per-model adaptation as the
other Anthropic call sites: a model that rejects sampling params is
retried without them instead of failing the merge evaluation.
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.

Vocab consolidation broken on anthropic-sdk v1: call_llm_sync passes temperature to messages.create()

1 participant