@@ -44,6 +44,7 @@ struct ServerInfo {
4444 #[ serde( alias = "model" ) ]
4545 model_id : Option < String > ,
4646 model_path : Option < String > ,
47+ served_model_name : Option < String > ,
4748 dp_size : Option < usize > ,
4849 version : Option < String > ,
4950 max_batch_size : Option < usize > ,
@@ -105,6 +106,8 @@ async fn get_dp_info(url: &str, api_key: Option<&str>) -> Result<DpInfo, String>
105106
106107 let model_id = info
107108 . model_id
109+ . filter ( |s| !s. is_empty ( ) )
110+ . or ( info. served_model_name . filter ( |s| !s. is_empty ( ) ) )
108111 . or_else ( || {
109112 info. model_path
110113 . and_then ( |path| path. split ( '/' ) . next_back ( ) . map ( |s| s. to_string ( ) ) )
@@ -318,20 +321,23 @@ impl StepExecutor for DiscoverMetadataStep {
318321 ) ;
319322
320323 let discovered_labels = match connection_mode. as_ref ( ) {
321- ConnectionMode :: Http => {
322- match get_server_info ( & config. url , config. api_key . as_deref ( ) ) . await {
323- Ok ( server_info) => {
324- let mut labels = HashMap :: new ( ) ;
325- if let Some ( model_path) = server_info. model_path {
326- if !model_path. is_empty ( ) {
327- labels. insert ( "model_path" . to_string ( ) , model_path) ;
328- }
324+ ConnectionMode :: Http => match get_server_info ( & config. url , config. api_key . as_deref ( ) ) . await {
325+ Ok ( server_info) => {
326+ let mut labels = HashMap :: new ( ) ;
327+ if let Some ( model_path) = server_info. model_path {
328+ if !model_path. is_empty ( ) {
329+ labels. insert ( "model_path" . to_string ( ) , model_path) ;
329330 }
330- Ok ( labels)
331331 }
332- Err ( e) => Err ( e) ,
332+ if let Some ( served_model_name) = server_info. served_model_name {
333+ if !served_model_name. is_empty ( ) {
334+ labels. insert ( "served_model_name" . to_string ( ) , served_model_name) ;
335+ }
336+ }
337+ Ok ( labels)
333338 }
334- }
339+ Err ( e) => Err ( e) ,
340+ } ,
335341 ConnectionMode :: Grpc { .. } => fetch_grpc_metadata ( & config. url ) . await ,
336342 }
337343 . unwrap_or_else ( |e| {
0 commit comments