diff --git a/rig-core/src/providers/cohere.rs b/rig-core/src/providers/cohere.rs index 18603479..9efe4a58 100644 --- a/rig-core/src/providers/cohere.rs +++ b/rig-core/src/providers/cohere.rs @@ -208,6 +208,7 @@ impl embeddings::EmbeddingModel for EmbeddingModel { })) .send() .await? + .error_for_status()? .json::>() .await?; @@ -503,6 +504,7 @@ impl completion::CompletionModel for CompletionModel { ) .send() .await? + .error_for_status()? .json::>() .await?; diff --git a/rig-core/src/providers/openai.rs b/rig-core/src/providers/openai.rs index 3c8c7952..586dc9ce 100644 --- a/rig-core/src/providers/openai.rs +++ b/rig-core/src/providers/openai.rs @@ -266,6 +266,7 @@ impl embeddings::EmbeddingModel for EmbeddingModel { })) .send() .await? + .error_for_status()? .json::>() .await?; @@ -525,6 +526,7 @@ impl completion::CompletionModel for CompletionModel { ) .send() .await? + .error_for_status()? .json::>() .await?;