Skip to main content

ModelFamilyProvider

Trait ModelFamilyProvider 

Source
pub trait ModelFamilyProvider: Send + Sync {
    type Config: Clone + Send + Sync + Serialize + DeserializeOwned + 'static;

    // Required methods
    fn family_id(&self) -> &ModelFamilyId;
    fn external_metadata_ids(&self) -> BTreeSet<ExternalModelMetadataId>;
    fn validate_config_identity(
        &self,
        raw: &Value,
        config: &Self::Config,
    ) -> Result<(), VNextError>;
    fn validated_external_metadata_id(
        &self,
        raw: &Value,
        config: &Self::Config,
    ) -> Result<ExternalModelMetadataId, VNextError>;
    fn parse_config(&self, raw: &Value) -> Result<Self::Config, VNextError>;
    fn weight_schema(
        &self,
        config: &Self::Config,
    ) -> Result<WeightSchema, VNextError>;
    fn semantic_program(
        &self,
        config: &Self::Config,
    ) -> Result<ModelProgram, VNextError>;
    fn semantic_metadata(
        &self,
        config: &Self::Config,
    ) -> Result<ModelSemanticMetadata, VNextError>;
}
Expand description

Compile-time model family provider with a typed, validated configuration.

Required Associated Types§

Required Methods§

Source

fn family_id(&self) -> &ModelFamilyId

Source

fn external_metadata_ids(&self) -> BTreeSet<ExternalModelMetadataId>

Source

fn validate_config_identity( &self, raw: &Value, config: &Self::Config, ) -> Result<(), VNextError>

Source

fn validated_external_metadata_id( &self, raw: &Value, config: &Self::Config, ) -> Result<ExternalModelMetadataId, VNextError>

Returns the exact external metadata identity represented by config. Every provider must make this selection explicit; core never assumes a singleton catalog row is the intended typed identity.

Source

fn parse_config(&self, raw: &Value) -> Result<Self::Config, VNextError>

Source

fn weight_schema( &self, config: &Self::Config, ) -> Result<WeightSchema, VNextError>

Source

fn semantic_program( &self, config: &Self::Config, ) -> Result<ModelProgram, VNextError>

Source

fn semantic_metadata( &self, config: &Self::Config, ) -> Result<ModelSemanticMetadata, VNextError>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§