Skip to content

Commit 1dfcecb

Browse files
committed
fix: bring back status check, default options
1 parent 75b5436 commit 1dfcecb

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/llm/anthropic.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ impl LlmGenerationClient for Client {
101101
&retryable::HEAVY_LOADED_OPTIONS,
102102
)
103103
.await?;
104+
if !resp.status().is_success() {
105+
bail!(
106+
"Anthropic API error: {:?}\n{}\n",
107+
resp.status(),
108+
resp.text().await?
109+
);
110+
}
104111
let mut resp_json: serde_json::Value = resp.json().await.context("Invalid JSON")?;
105112
if let Some(error) = resp_json.get("error") {
106113
bail!("Anthropic API error: {:?}", error);

src/utils/retryable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl Default for RetryOptions {
9292

9393
pub static HEAVY_LOADED_OPTIONS: RetryOptions = RetryOptions {
9494
max_retries: Some(10),
95-
initial_backoff: Duration::from_millis(1),
95+
initial_backoff: Duration::from_secs(1),
9696
max_backoff: Duration::from_secs(60),
9797
};
9898

0 commit comments

Comments
 (0)