pub fn validate_model_name(
requested_model: &str,
state: Arc<MistralRs>,
) -> Result<(), Error>
Expand description
Validates that the requested model matches one of the loaded models.
This function checks if the model parameter from an OpenAI API request matches one of the models that are currently loaded by the server.
The special model name “default” can be used to bypass this validation, which is useful for clients that require a model parameter but want to use the default model.
§Arguments
requested_model
- The model name from the API requeststate
- The MistralRs state containing the loaded models info
§Returns
Returns Ok(())
if the model is available or if “default” is specified, otherwise returns an error.