Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion crates/openhuman-tinyhumans/src/inference/backend_error_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,20 @@ pub fn body_flags_malformed(err: &str) -> bool {
after_colon.starts_with("true")
}

/// User-facing message for a hosted voice request the backend's own upstream
/// provider refused. Nothing the user can change, so no instruction. The
/// failure behind it was already reported (or demoted as transient) by
/// `authed_json`, so the backend-error classifier marks this message
/// backend-owned and not reportable (no second event at the RPC boundary).
pub const HOSTED_VOICE_UNAVAILABLE_USER_MESSAGE: &str =
"The voice service is temporarily unavailable. Please try again later.";

/// Whether `err` is exactly the neutral hosted-voice copy, bare or behind an
/// RPC method name (`voice.reply_synthesize: <copy>`). Matching the sentence
/// anywhere would also exempt another provider's error that happens to quote
/// it, which `authed_json` never reported.
fn is_hosted_voice_unavailable_copy(err: &str) -> bool {
let message = crate::voice::reply_speech::HOSTED_VOICE_UNAVAILABLE_USER_MESSAGE;
let message = HOSTED_VOICE_UNAVAILABLE_USER_MESSAGE;
let err = err.trim();
if err == message {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ fn classification_keeps_provider_ownership_separate_from_raw_token_and_reportabi
fn hosted_voice_unavailable_copy_is_backend_owned_and_not_reported_again() {
// `authed_json` already reported (or demoted as transient) the failure the
// neutral copy replaces; the RPC boundary must not report it a second time.
let message = crate::voice::reply_speech::HOSTED_VOICE_UNAVAILABLE_USER_MESSAGE;
let message = super::HOSTED_VOICE_UNAVAILABLE_USER_MESSAGE;
for err in [
message.to_string(),
format!("voice.reply_synthesize: {message}"),
Expand Down
1 change: 1 addition & 0 deletions crates/openhuman-tinyhumans/src/inference/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use openhuman_embed::__host::inference_registry::{
};
use tinyinference_llm::model::ChatModel;

pub use backend_error_code::HOSTED_VOICE_UNAVAILABLE_USER_MESSAGE;
pub use managed_model::ManagedOptions;

use crate::install::InstallOptions;
Expand Down
9 changes: 2 additions & 7 deletions crates/openhuman-tinyhumans/src/voice/reply_speech.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,8 @@ const LOG_PREFIX: &str = "[voice_reply]";
/// The route this module posts to.
const SPEECH_PATH: &str = "/openai/v1/audio/speech";

/// User-facing message for a hosted voice request the backend's own upstream
/// provider refused. Nothing the user can change, so no instruction. The
/// failure behind it was already reported (or demoted as transient) by
/// `authed_json`, so the backend-error classifier marks this message
/// backend-owned and not reportable (no second event at the RPC boundary).
pub const HOSTED_VOICE_UNAVAILABLE_USER_MESSAGE: &str =
"The voice service is temporarily unavailable. Please try again later.";
/// Lives with the backend-error classifier, which is not gated on `voice`.
pub use crate::inference::HOSTED_VOICE_UNAVAILABLE_USER_MESSAGE;

/// The backend's wrappings of an upstream ElevenLabs failure
/// (`elevenlabsService` in the backend: TTS, streaming TTS, transcription).
Expand Down
Loading