SAM Models
smarter.models.sam
Typed models of every SAM (Smarter Application Manifest) kind, generated from the Smarter platform’s JSON Schemas.
Each model describes a complete manifest of its kind: apiVersion, kind, metadata,
spec and the read-only status. Use them to build manifests in code, with your editor’s
completion and Pydantic’s validation, or to read a described manifest with typed fields:
from smarter.models.sam import SAMGuardrail, sam_model
manifest = client.guardrails.describe("pii_redactor")
guardrail = manifest.to_sam() # a SAMGuardrail
print(guardrail.spec.config.action)
The models keep fields that they don’t declare, so that a manifest of a newer platform still
parses. The platform’s own models also enforce business rules that a JSON Schema can’t express:
validate a manifest with smarter.resources.manifests.Manifests.validate() before you rely on it.
Do not edit: run scripts/generate_sam_models.py.
- smarter.models.sam.SAM_MODELS
The model of each kind, by its manifest
kind.
- smarter.models.sam.sam_model(kind: str) Type[smarter.models.sam.base.SAMModel]
The model of a kind.
- Parameters:
kind – The manifest kind, e.g.
LLMClient.- Returns:
The model, e.g.
SAMLLMClient.- Raises:
KeyError – If the SDK has no model of the kind.
smarter.models.sam.base
The base class of the generated SAM models.
- class smarter.models.sam.base.SAMModel
Bases:
smarter.models.base.SmarterModelThe base class of the generated SAM models: a
SmarterModel, which keeps unknown fields.Its fields keep the manifest’s own names, e.g.
apiVersionandrecordLocator.Its regular expressions use Python’s
re, because the platform’s schemas include patterns with look-ahead (e.g. Pydantic’s own pattern of aDecimal), which Pydantic’s default engine doesn’t support. The generated fields’ docstrings, which come from the platform’s field descriptions, are their Pydantic descriptions too (use_attribute_docstrings).
Kinds
- SAMAccount
- SAMApiConnection
- SAMApiPlugin
- SAMBudget
- SAMCustomDomain
- SAMGuardrail
- SAMImageSearchPlugin
- SAMLLMClient
- SAMLLMHost
- SAMLLMHostCompute
- SAMMCPClient
- SAMOrchestrator
- SAMPlugin
- SAMPrompt
- SAMProvider
- SAMProxy
- SAMSecret
- SAMSkillPlugin
- SAMSmarterAuthToken
- SAMSqlConnection
- SAMSqlPlugin
- SAMUser
- SAMVectorsearch
- SAMVectorstore
- SAMWebsearchPlugin