From f0c6da6c574ba75a42f58e007d254f69e82f7f81 Mon Sep 17 00:00:00 2001 From: Stanislas Polu Date: Thu, 4 Apr 2024 18:15:40 +0200 Subject: [PATCH] remove streaming retries --- core/src/providers/anthropic.rs | 18 +++++------------- core/src/providers/mistral.rs | 8 ++------ core/src/providers/openai.rs | 12 ++---------- 3 files changed, 9 insertions(+), 29 deletions(-) diff --git a/core/src/providers/anthropic.rs b/core/src/providers/anthropic.rs index d843a43fec54..4796ed6c54ea 100644 --- a/core/src/providers/anthropic.rs +++ b/core/src/providers/anthropic.rs @@ -541,11 +541,7 @@ impl AnthropicLLM { "Anthropic API Error: {}", event.error.to_string() ), - retryable: Some(ModelErrorRetryOptions { - sleep: Duration::from_millis(500), - factor: 1, - retries: 1, - }), + retryable: None, })?; break 'stream; } @@ -557,14 +553,10 @@ impl AnthropicLLM { } }, Err(error) => { - Err(ModelError { - message: format!("Error streaming from Anthropic: {:?}", error), - retryable: Some(ModelErrorRetryOptions { - sleep: Duration::from_millis(500), - factor: 1, - retries: 1, - }), - })?; + Err(anyhow!( + "Error streaming tokens from Anthropic: {:?}", + error + ))?; break 'stream; } } diff --git a/core/src/providers/mistral.rs b/core/src/providers/mistral.rs index 1773333a64fb..6cbe71c19354 100644 --- a/core/src/providers/mistral.rs +++ b/core/src/providers/mistral.rs @@ -331,7 +331,7 @@ impl MistralAPIError { } pub fn retryable_streamed(&self) -> bool { - self.retryable() + false } } @@ -497,11 +497,7 @@ impl MistralAILLM { })?, false => Err(ModelError { message: error.message(), - retryable: Some(ModelErrorRetryOptions { - sleep: Duration::from_millis(500), - factor: 1, - retries: 1, - }), + retryable: None, })?, } break 'stream; diff --git a/core/src/providers/openai.rs b/core/src/providers/openai.rs index 4235c4bf738f..539f3f1cfe02 100644 --- a/core/src/providers/openai.rs +++ b/core/src/providers/openai.rs @@ -280,11 +280,7 @@ pub async fn streamed_completion( })?, false => Err(ModelError { message: error.message(), - retryable: Some(ModelErrorRetryOptions { - sleep: Duration::from_millis(500), - factor: 1, - retries: 1, - }), + retryable: None, })?, } break 'stream; @@ -666,11 +662,7 @@ pub async fn streamed_chat_completion( })?, false => Err(ModelError { message: error.message(), - retryable: Some(ModelErrorRetryOptions { - sleep: Duration::from_millis(500), - factor: 1, - retries: 1, - }), + retryable: None, })?, } break 'stream;