Errors
Shared error helpers for modality transformers, their configuration models, and their builders.
debug_context(*, attachment=None, **context)
Add boundary diagnostics to the GLLM errors raised in the block, then re-raise them unchanged.
The context only fills diagnostic fields that are missing or unknown, so a more specific operation or stage set
where the error was raised is kept. The diagnostics are sanitized by add_multimodal_debug_context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attachment
|
Any
|
Attachment supplying allowlisted media facts. Defaults to None. |
None
|
**context
|
Any
|
Allowlisted diagnostic fields, such as operation, stage, component, and source_kind. |
{}
|
Yields:
| Name | Type | Description |
|---|---|---|
None |
None
|
Control to the guarded block. |
Raises:
| Type | Description |
|---|---|
BaseError
|
A GLLM error raised by the block, re-raised unchanged with the context added. |
reject_unsupported_options(component, options)
Reject keyword arguments that a component does not accept.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
str
|
Name of the component that received the options. |
required |
options
|
Mapping[str, Any]
|
Keyword arguments the component does not use. |
required |
Raises:
| Type | Description |
|---|---|
ComponentConfigError
|
If any option is supplied. The error names each unsupported option. |
validate_converter_configs(component, converter_config)
Check that the converter configuration maps converter names to ConverterConfig instances.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
str
|
Name of the component that received the configuration. |
required |
converter_config
|
Any
|
Converter configurations keyed by converter name. |
required |
Raises:
| Type | Description |
|---|---|
ComponentConfigError
|
If converter_config is not a mapping, or any value is not a ConverterConfig instance. |
validate_router_config(component, router_config)
Check that the router configuration is a RouterConfig instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
str
|
Name of the component that received the configuration. |
required |
router_config
|
Any
|
The router configuration to check. |
required |
Raises:
| Type | Description |
|---|---|
ComponentConfigError
|
If router_config is not a RouterConfig instance. |