Module adcp.types.domains.formats.canonical.audio_hosted
Classes
class AssetSource (*args, **kwds)-
Expand source code
class AssetSource(StrEnum): buyer_uploaded = 'buyer_uploaded' publisher_host_recorded = 'publisher_host_recorded' seller_pre_rendered_from_brief = 'seller_pre_rendered_from_brief' seller_human_designed = 'seller_human_designed' agent_synthesized = 'agent_synthesized' publisher_owned_reference = 'publisher_owned_reference'Enum where members are also (and must be) strings
Ancestors
- enum.StrEnum
- builtins.str
- enum.ReprEnum
- enum.Enum
Class variables
var agent_synthesizedvar buyer_uploadedvar publisher_host_recordedvar publisher_owned_referencevar seller_human_designedvar seller_pre_rendered_from_brief
class AudioChannel (*args, **kwds)-
Expand source code
class AudioChannel(StrEnum): mono = 'mono' stereo = 'stereo'Enum where members are also (and must be) strings
Ancestors
- enum.StrEnum
- builtins.str
- enum.ReprEnum
- enum.Enum
Class variables
var monovar stereo
class AudioCodec (*args, **kwds)-
Expand source code
class AudioCodec(StrEnum): mp3 = 'mp3' aac = 'aac' wav = 'wav' opus = 'opus' flac = 'flac'Enum where members are also (and must be) strings
Ancestors
- enum.StrEnum
- builtins.str
- enum.ReprEnum
- enum.Enum
Class variables
var aacvar flacvar mp3var opusvar wav
class AudioSampleRate (value: Any = <object object>, *, root: Any = <object object>)-
Expand source code
class AudioSampleRate(ScalarInt): __slots__ = () _constraints = {'ge': 1}An
intgenerated from a JSON Schema integer root.Validates the way
SchemaIntvalidates an integer field: strict, so"1"andTrueare refused, with a float carrying no fractional part narrowed tointbecause JSON Schema counts it as one.Ancestors
- adcp.types._scalar.ScalarInt
- adcp.types._scalar._ScalarRoot
- builtins.int
class BuyerAssetAcceptance (*args, **kwds)-
Expand source code
class BuyerAssetAcceptance(StrEnum): accepted = 'accepted' rejected = 'rejected'Enum where members are also (and must be) strings
Ancestors
- enum.StrEnum
- builtins.str
- enum.ReprEnum
- enum.Enum
Class variables
var acceptedvar rejected
class CanonicalFormatHostedAudio (**data: Any)-
Expand source code
class CanonicalFormatHostedAudio(CanonicalFormatBase): model_config = ConfigDict( extra='allow', ) slots: Annotated[ Any | None, Field( description="Default slots for buyer-uploaded audio. Host-read products override with a `script` (asset_type: text) or `creative_brief` (asset_type: brief) slot in place of `audio_main`, plus `asset_source: 'publisher_host_recorded'` and `buyer_asset_acceptance: 'rejected'`. TTS-from-script products override similarly with `asset_source: 'seller_pre_rendered_from_brief'`." ), ] = [ {'asset_group_id': 'audio_main', 'asset_type': 'audio', 'required': True}, {'asset_group_id': 'companion_image', 'asset_type': 'image', 'required': False}, {'asset_group_id': 'brand_name', 'asset_type': 'text', 'required': False}, {'asset_group_id': 'landing_page_url', 'asset_type': 'url', 'required': False}, ] duration_ms_range: Annotated[ list[DurationMsRange | None] | None, Field( description='[min, max] duration in milliseconds. Either endpoint MAY be null to express an unbounded side: [null, 60000] means up to 60s; [15000, null] means at least 15s. [null, null] is invalid because at least one endpoint must be bounded. **Precedence**: when both `duration_ms_exact` and `duration_ms_range` ship on the same product, `duration_ms_exact` takes precedence — buyers MUST validate against the exact value and ignore the range. SDKs SHOULD lint a warning when both fields ship; producers SHOULD pick one.', max_length=2, min_length=2, ), ] = None duration_ms_exact: Annotated[ SchemaInt | None, Field( description='When set, duration must equal exactly this value. Takes precedence over `duration_ms_range` when both ship.', ge=1, ), ] = None audio_codecs: list[AudioCodec] | None = None audio_sample_rates: list[AudioSampleRate] | None = None audio_channels: list[AudioChannel] | None = None min_bitrate_kbps: Annotated[SchemaInt | None, Field(ge=1)] = None max_bitrate_kbps: Annotated[SchemaInt | None, Field(ge=1)] = None max_file_size_mb: Annotated[ StrictFloat | None, Field( description='Maximum hosted audio file size in decimal megabytes. Agents that proxy or cache media SHOULD advertise their effective transport ceiling here.', gt=0.0, ), ] = None loudness_lufs: Annotated[ StrictFloat | None, Field( description='Required integrated loudness in LUFS (typical: -16 for streaming/podcast, -23 for broadcast). Negative values.' ), ] = None loudness_tolerance_db: Annotated[ StrictFloat | None, Field(description='Permitted deviation from loudness_lufs in dB.', ge=0.0), ] = None true_peak_dbfs: Annotated[ StrictFloat | None, Field(description='Maximum true-peak level in dBFS (typical: -2).') ] = None asset_source: Annotated[ AssetSource | None, Field( description="Where the rendered audio bytes come from. Single shared enum across canonicals (see `image.json#asset_source` for the full semantics). `publisher_host_recorded`: the publisher's host records the audio (podcast host-read pattern); buyer must use the publisher's build_creative capability. `publisher_owned_reference` is valid only when the product accepts a reference asset whose publisher-owned source resolves to playable audio. `publisher_host_recorded` remains the normal audio-specific host-read value." ), ] = AssetSource.buyer_uploaded buyer_asset_acceptance: Annotated[ BuyerAssetAcceptance | None, Field( description="Whether the product accepts buyer-uploaded audio. When `rejected`, the buyer cannot ship an audio asset directly — they must use build_creative (or sync_creatives with brief inputs) so the seller produces the audio. Combined with `asset_source`, lets a product declare 'I produce audio from briefs and refuse buyer uploads' (asset_source=`seller_pre_rendered_from_brief`, buyer_asset_acceptance=`rejected`)." ), ] = BuyerAssetAcceptance.accepted companion_image_required: StrictBool | None = None companion_image_aspect_ratio: str | None = None companion_image_max_file_size_kb: Annotated[SchemaInt | None, Field(ge=1)] = None brand_name_max_chars: Annotated[SchemaInt | None, Field(ge=1)] = NoneBase model for AdCP types with spec-compliant serialization.
Defaults to
extra='ignore'so unknown fields from newer spec versions are silently dropped rather than causing validation errors. Generated types whose schemas setadditionalProperties: trueoverride this withextra='allow'in their ownmodel_config.Set
ADCP_STRICT_VALIDATION=1in the environment ("1","true","yes","on"are accepted) to flip the default toextra='forbid'. Use this during spec upgrades to catch silently-dropped renamed fields in tests. See :func:_resolve_extra_policy.Important
The env var is resolved once at module import time. Set it in your shell or CI environment before
import adcpruns — mutatingos.environ["ADCP_STRICT_VALIDATION"]after the firstadcpimport has no effect on already-imported model classes (they captured the policy at class-body evaluation).Consumers who want per-model strict validation can override
model_configon their subclass.Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.Ancestors
- adcp.types.domains.formats.canonical._base.CanonicalFormatBase
- AdCPBaseModel
- pydantic.main.BaseModel
Class variables
var asset_source : AssetSource | Nonevar audio_channels : list[AudioChannel] | Nonevar audio_codecs : list[AudioCodec] | Nonevar audio_sample_rates : list[AudioSampleRate] | Nonevar brand_name_max_chars : int | Nonevar buyer_asset_acceptance : BuyerAssetAcceptance | Nonevar companion_image_aspect_ratio : str | Nonevar companion_image_max_file_size_kb : int | Nonevar companion_image_required : bool | Nonevar duration_ms_exact : int | Nonevar duration_ms_range : list[DurationMsRange | None] | Nonevar loudness_lufs : float | Nonevar loudness_tolerance_db : float | Nonevar max_bitrate_kbps : int | Nonevar max_file_size_mb : float | Nonevar min_bitrate_kbps : int | Nonevar model_configvar slots : typing.Any | Nonevar true_peak_dbfs : float | None
Inherited members
class DurationMsRange (value: Any = <object object>, *, root: Any = <object object>)-
Expand source code
class DurationMsRange(ScalarInt): __slots__ = () _constraints = {'ge': 0}An
intgenerated from a JSON Schema integer root.Validates the way
SchemaIntvalidates an integer field: strict, so"1"andTrueare refused, with a float carrying no fractional part narrowed tointbecause JSON Schema counts it as one.Ancestors
- adcp.types._scalar.ScalarInt
- adcp.types._scalar._ScalarRoot
- builtins.int