Skip to content

Commit

Permalink
dust-apps: more stability + observability (#4577)
Browse files Browse the repository at this point in the history
* dust-apps: more stability + observability

* remove streaming retries
  • Loading branch information
spolu authored Apr 4, 2024
1 parent e3e4bad commit c6ad5b1
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 116 deletions.
104 changes: 11 additions & 93 deletions core/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ urlencoding = "2.1"
url = "2.3"
dns-lookup = "1.0"
async-stream = "0.3"
eventsource-client = "0.11"
eventsource-client = "0.12"
tera = "1.17"
fancy-regex = "0.11"
rustc-hash = "1.1"
Expand Down
11 changes: 5 additions & 6 deletions core/src/providers/anthropic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -557,7 +553,10 @@ impl AnthropicLLM {
}
},
Err(error) => {
Err(anyhow!("Error streaming from Anthropic: {:?}", error))?;
Err(anyhow!(
"Error streaming tokens from Anthropic: {:?}",
error
))?;
break 'stream;
}
}
Expand Down
8 changes: 2 additions & 6 deletions core/src/providers/mistral.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ impl MistralAPIError {
}

pub fn retryable_streamed(&self) -> bool {
self.retryable()
false
}
}

Expand Down Expand Up @@ -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;
Expand Down
12 changes: 2 additions & 10 deletions core/src/providers/openai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions types/src/front/lib/core_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@ export class CoreAPI {
logger.error(
{
error: e,
errorStr: JSON.stringify(e),
errorSource: "createRunStream",
},
"Error streaming chunks"
);
Expand Down
4 changes: 4 additions & 0 deletions types/src/front/lib/dust_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ export async function processStreamedRunResponse(
logger.error(
{
error: e,
errorStr: JSON.stringify(e),
errorSource: "processStreamedRunResponse",
},
"Error streaming chunks."
);
Expand Down Expand Up @@ -670,6 +672,8 @@ export class DustAPI {
logger.error(
{
error: e,
errorStr: JSON.stringify(e),
errorSource: "postUserMessage",
},
"Error streaming chunks."
);
Expand Down

0 comments on commit c6ad5b1

Please sign in to comment.