fix(health): add Anthropic-specific health probes for doctor checks#293
Open
sjp611 wants to merge 1 commit into
Open
fix(health): add Anthropic-specific health probes for doctor checks#293sjp611 wants to merge 1 commit into
sjp611 wants to merge 1 commit into
Conversation
PROVIDER_PRESETS["anthropic"] sets base_url to https://api.anthropic.com (no /v1 suffix, since AnthropicAdapter appends /v1/messages itself), so the existing OpenAI-style probes in researchclaw doctor build {base_url}/models which 404s on Anthropic. Adds provider auto-detection (_is_anthropic) and routes the three LLM-touching health checks (check_llm_connectivity, check_api_key_valid, _check_models_against_endpoint) to a minimal POST /v1/messages probe with x-api-key + anthropic-version headers when the URL points at Anthropic. Non-Anthropic providers are unaffected. Fixes aiming-lab#292
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #292.
PROVIDER_PRESETS["anthropic"]setsbase_urltohttps://api.anthropic.com(no/v1suffix, sinceAnthropicAdapterappends/v1/messagesitself). The existing OpenAI-style health probes inresearchclaw doctorbuild{base_url}/modelswhich 404s on Anthropic, so the LLM-related checks fail despite a validANTHROPIC_API_KEY.This PR adds provider auto-detection (
_is_anthropic) and routes the affected health checks to a minimalPOST /v1/messagesprobe withx-api-key+anthropic-versionheaders. Non-Anthropic providers are unaffected.Changes
researchclaw/health.py: new helpers_is_anthropic,_anthropic_messages_url,_anthropic_probe,_check_anthropic_*. Branch added tocheck_llm_connectivity,check_api_key_valid, and_check_models_against_endpoint.tests/test_rc_health.py: new tests covering URL detection,/v1normalization, and 200/401/404 paths.Testing
pytest tests/test_rc_health.py -vpasses.