Pydantic Models

Smarter API Guardrail Manifest Constants.

Smarter API Manifest - Guardrail.metadata.

class smarter.apps.guardrail.manifest.models.guardrail.metadata.SAMGuardrailMetadata(*, name: str, description: str | None, version: str | None, tags: List[str] | None = <factory>, annotations: List[dict[str, str | int | float | bool | ~datetime.date | ~datetime.datetime | ~decimal.Decimal | ~uuid.UUID | bytes | list | dict]] | None=<factory>)[source]

Bases: AbstractSAMMetadataBase

Smarter API Guardrail Manifest - Metadata class.

class_identifier: ClassVar[str] = 'Guardrail.metadata'
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Return type:

None

Parameters:
  • self – The BaseModel instance.

  • context – The context.

Smarter API Manifest - Guardrail.spec.

class smarter.apps.guardrail.manifest.models.guardrail.spec.SAMGuardrailSpec(*, config: SAMGuardrailSpecConfig)[source]

Bases: AbstractSAMSpecBase

Smarter API Guardrail Manifest Guardrail.spec.

class_identifier: ClassVar[str] = 'Guardrail.spec'
config: SAMGuardrailSpecConfig
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Return type:

None

Parameters:
  • self – The BaseModel instance.

  • context – The context.

class smarter.apps.guardrail.manifest.models.guardrail.spec.SAMGuardrailSpecConfig(*, guardrail_type: GuardrailType, category: GuardrailCategory, match_strategy: MatchStrategy, pattern: str | None = '', config: dict | None = <factory>, action: GuardrailAction, severity: Annotated[int, ~annotated_types.Ge(ge=1), ~annotated_types.Le(le=5)] = 1, confidence_threshold: Annotated[float | None, ~annotated_types.Ge(ge=0.0), ~annotated_types.Le(le=1.0)] = None, is_active: bool = True, is_blocking: bool = False, priority: Annotated[int, ~annotated_types.Ge(ge=0)] = 100, fallback_message: str | None = '')[source]

Bases: AbstractSAMSpecBase

Smarter API Guardrail Manifest Guardrail.spec.config.

action: GuardrailAction
category: GuardrailCategory
class_identifier: ClassVar[str] = 'Guardrail.spec.configuration'
confidence_threshold: float | None
config: dict | None
fallback_message: str | None
guardrail_type: GuardrailType
is_active: bool
is_blocking: bool
match_strategy: MatchStrategy
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Return type:

None

Parameters:
  • self – The BaseModel instance.

  • context – The context.

pattern: str | None
priority: int
severity: int
validate_confidence_threshold_applicability()[source]
Return type:

SAMGuardrailSpecConfig

classmethod validate_config_shape(v, info)[source]
Return type:

dict

validate_fallback_message_on_block()[source]
Return type:

SAMGuardrailSpecConfig

Smarter API Manifest - Guardrail.status.

class smarter.apps.guardrail.manifest.models.guardrail.status.SAMGuardrailStatus(*, recordLocator: str, created: datetime, modified: datetime, accountNumber: str, username: str)[source]

Bases: AbstractSAMStatusBase

Smarter API Guardrail Manifest - Status class.

accountNumber: str
class_identifier: ClassVar[str] = 'Guardrail.status'
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Return type:

None

Parameters:
  • self – The BaseModel instance.

  • context – The context.

username: str

Smarter API Guardrail Manifest.

class smarter.apps.guardrail.manifest.models.guardrail.model.SAMGuardrail(*, apiVersion: str, kind: str, metadata: SAMGuardrailMetadata, spec: SAMGuardrailSpec, status: SAMGuardrailStatus | None = None)[source]

Bases: AbstractSAMBase

Smarter API Manifest - Guardrail.

class_identifier: ClassVar[str] = 'Guardrail'
metadata: SAMGuardrailMetadata
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Return type:

None

Parameters:
  • self – The BaseModel instance.

  • context – The context.

spec: SAMGuardrailSpec
status: SAMGuardrailStatus | None