Anthropic model-list requests currently flatten request, transport, response, and API failures into `anyhow` strings. Callers therefore cannot distinguish an invalid API key from connectivity or provider failures, even though Anthropic returns a structured error payload. This changes `list_models` to return `AnthropicError`, maps each request stage to its existing typed variant, and routes unsuccessful responses through the same structured response handler used by completion requests. The language model provider converts that error at its existing `LanguageModelCompletionError` boundary. A regression test verifies that an authentication response retains both its error category and Anthropic's human-readable message. Testing performed: - `cargo fmt --check` - `cargo nextest run -p anthropic -p language_models` - `./script/clippy -p anthropic -p language_models` Release Notes: - Fixed Anthropic API key errors being reported as generic model-list failures.
34 lines
677 B
TOML
34 lines
677 B
TOML
[package]
|
|
name = "anthropic"
|
|
version = "0.1.0"
|
|
edition.workspace = true
|
|
publish.workspace = true
|
|
license = "GPL-3.0-or-later"
|
|
|
|
[features]
|
|
default = []
|
|
schemars = ["dep:schemars"]
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[lib]
|
|
path = "src/anthropic.rs"
|
|
|
|
[dependencies]
|
|
anyhow.workspace = true
|
|
chrono.workspace = true
|
|
collections.workspace = true
|
|
futures.workspace = true
|
|
http_client.workspace = true
|
|
language_model_core.workspace = true
|
|
log.workspace = true
|
|
schemars = { workspace = true, optional = true }
|
|
serde.workspace = true
|
|
serde_json.workspace = true
|
|
strum.workspace = true
|
|
thiserror.workspace = true
|
|
|
|
[dev-dependencies]
|
|
http_client = { workspace = true, features = ["test-support"] }
|