You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// The base64 encoded audio input of the user's input message.
1421
+
pubaudio_base64:String,
1422
+
}
1423
+
1424
+
/// Transcribe Audio
1425
+
///
1426
+
/// Uses `whisper-1` to transcribe an audio file passed in as a base64 encoded string.
1427
+
#[utoipa::path(
1428
+
post,
1429
+
path = "/message/transcribe_audio",
1430
+
context_path = "/api",
1431
+
tag = "Message",
1432
+
request_body(content = TranscribeAudioReqPayload, description = "JSON request payload to transcribe an audio file", content_type = "application/json"),
1433
+
responses(
1434
+
(status = 200, description = "The transcribed text", body = String,
1435
+
headers(
1436
+
("TR-QueryID" = uuid::Uuid, description = "Query ID that is used for tracking analytics")
1437
+
)
1438
+
),
1439
+
(status = 400, description = "Service error relating to transcribing the audio", body = ErrorResponseBody),
1440
+
),
1441
+
params(
1442
+
("TR-Dataset" = uuid::Uuid,Header, description = "The dataset id or tracking_id to use for the request. We assume you intend to use an id if the value is a valid uuid."),
1443
+
),
1444
+
security(
1445
+
("ApiKey" = ["admin"]),
1446
+
)
1447
+
)]
1448
+
pubasyncfntranscribe_audio(
1449
+
data: web::Json<TranscribeAudioReqPayload>,
1450
+
dataset_org_plan_sub:DatasetAndOrgWithSubAndPlan,
1451
+
_required_user:AdminOnly,
1452
+
) -> Result<HttpResponse,ServiceError>{
1453
+
let audio_bytes = base64::decode(data.audio_base64.clone()).map_err(|err| {
1454
+
log::error!("Failed to decode base64 audio: {:?}", err);
0 commit comments