Skip to content

Commit fc5ac75

Browse files
committed
chore: Remove service_name from ModelDeploymentCard
We had two names in the ModelDeploymentCard: display_name and service_name. They were either always identical, or service_name was a [slug](https://sentry.io/answers/slug-in-django/)-ified version of the display_name. Having two names is confusing, especially for #2267 . Now we only have `display_name`. The HTTP server gets to decide how to translate that to the `model` HTTP field (if at all), it's not in the card. In practice it still uses a slug. Most of the code change in here is because I merged `model_card/create.rs` and `model_card/model.rs`. It always confused me why the object and it's implementation should be in separate files (modules). It confused Rust too, we had to make fields `pub` just to access them. I suspect it was a pattern from a different language mis-applied to Rust. Is fixed.
1 parent dbe48a1 commit fc5ac75

File tree

12 files changed

+896
-988
lines changed

12 files changed

+896
-988
lines changed

lib/llm/src/backend.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
// SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
// SPDX-License-Identifier: Apache-2.0
3-
//
4-
// Licensed under the Apache License, Version 2.0 (the "License");
5-
// you may not use this file except in compliance with the License.
6-
// You may obtain a copy of the License at
7-
//
8-
// http://www.apache.org/licenses/LICENSE-2.0
9-
//
10-
// Unless required by applicable law or agreed to in writing, software
11-
// distributed under the License is distributed on an "AS IS" BASIS,
12-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
// See the License for the specific language governing permissions and
14-
// limitations under the License.
153

164
//! Backend
175
//!
@@ -33,7 +21,7 @@ use anyhow::{Error, Result};
3321
use futures::stream::{self, StreamExt};
3422
use tracing as log;
3523

36-
use crate::model_card::model::{ModelDeploymentCard, TokenizerKind};
24+
use crate::model_card::{ModelDeploymentCard, TokenizerKind};
3725
use dynamo_runtime::{
3826
pipeline::{
3927
async_trait, AsyncEngineContextProvider, ManyOut, Operator, ResponseStream,

lib/llm/src/local_model.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,15 @@ impl LocalModel {
251251
&self.full_path
252252
}
253253

254+
/// Human friendly model name. This is the correct name.
254255
pub fn display_name(&self) -> &str {
255256
&self.card.display_name
256257
}
257258

259+
/// The name under which we make this model available over HTTP.
260+
/// A slugified version of the model's name, for use in NATS, etcd, etc.
258261
pub fn service_name(&self) -> &str {
259-
&self.card.service_name
262+
self.card.slug().as_ref()
260263
}
261264

262265
pub fn request_template(&self) -> Option<RequestTemplate> {

lib/llm/src/migration.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
// SPDX-License-Identifier: Apache-2.0
3-
//
4-
// Licensed under the Apache License, Version 2.0 (the "License");
5-
// you may not use this file except in compliance with the License.
6-
// You may obtain a copy of the License at
7-
//
8-
// http://www.apache.org/licenses/LICENSE-2.0
9-
//
10-
// Unless required by applicable law or agreed to in writing, software
11-
// distributed under the License is distributed on an "AS IS" BASIS,
12-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
// See the License for the specific language governing permissions and
14-
// limitations under the License.
153

164
use std::sync::Arc;
175

@@ -23,7 +11,7 @@ use async_nats::client::{
2311
};
2412

2513
use crate::{
26-
model_card::model::ModelDeploymentCard,
14+
model_card::ModelDeploymentCard,
2715
protocols::common::llm_backend::{LLMEngineOutput, PreprocessedRequest},
2816
};
2917

0 commit comments

Comments
 (0)