[model-gateway] Generate UUID-based request IDs for embedding/classify (#16100)
Co-authored-by: Chang Su <chang.s.su@oracle.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use axum::response::Response;
|
use axum::response::Response;
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::routers::{
|
use crate::routers::{
|
||||||
error,
|
error,
|
||||||
@@ -70,13 +71,12 @@ impl PipelineStage for EmbeddingRequestBuildingStage {
|
|||||||
error::internal_error("client_missing", "Client not selected")
|
error::internal_error("client_missing", "Client not selected")
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
// Extract request ID
|
// Generate request ID with appropriate prefix based on request type
|
||||||
let request_id = ctx
|
let request_id = match &ctx.input.request_type {
|
||||||
.state
|
RequestType::Embedding(_) => format!("embed-{}", Uuid::new_v4()),
|
||||||
.dispatch
|
RequestType::Classify(_) => format!("classify-{}", Uuid::new_v4()),
|
||||||
.as_ref()
|
_ => format!("embed-{}", Uuid::new_v4()), // fallback
|
||||||
.map(|d| d.request_id.clone())
|
};
|
||||||
.unwrap_or_else(|| "unknown".to_string());
|
|
||||||
|
|
||||||
// Extract original text
|
// Extract original text
|
||||||
let original_text = prep_output.original_text.clone();
|
let original_text = prep_output.original_text.clone();
|
||||||
|
|||||||
Reference in New Issue
Block a user