model_entry.rs 1.05 KB
Newer Older
1
2
3
// SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

4
use dynamo_runtime::{protocols, slug::Slug};
5
6
use serde::{Deserialize, Serialize};

7
use crate::local_model::runtime_config::ModelRuntimeConfig;
8

9
/// [ModelEntry] contains the information to discover models
10
11
12
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)]
pub struct ModelEntry {
    /// Public name of the model
13
    /// Used to identify the model in the HTTP service from the value used in an OpenAI ChatRequest.
14
15
16
    pub name: String,

    /// How to address this on the network
17
18
    #[serde(rename = "endpoint")]
    pub endpoint_id: protocols::EndpointId,
19

20
21
22
    /// Runtime configuration specific to this model instance
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub runtime_config: Option<ModelRuntimeConfig>,
23
24
25
}

impl ModelEntry {
26
    /// Slugified display name for use in network storage, or URL-safe environments
27
28
29
    pub fn slug(&self) -> Slug {
        Slug::from_string(&self.name)
    }
30
}