View source: R/semantic_adapter.R
| create_semantic_adapter | R Documentation |
Build a semantic adapter that can describe and inspect domain-specific R objects.
Adapters are registered into a semantic adapter registry and selected by
supports(obj) predicates at runtime.
create_semantic_adapter(
name,
supports,
capabilities = character(0),
priority = 0,
describe_identity = NULL,
describe_schema = NULL,
describe_semantics = NULL,
peek = NULL,
slice = NULL,
list_accessors = NULL,
estimate_cost = NULL,
provenance = NULL,
validate_action = NULL,
render_summary = NULL,
render_inspection = NULL
)
name |
Adapter name. |
supports |
Function that returns |
capabilities |
Character vector of supported capabilities. |
priority |
Numeric priority; higher values win during dispatch. |
describe_identity |
Optional function returning identity metadata. |
describe_schema |
Optional function returning schema metadata. |
describe_semantics |
Optional function returning semantic summary metadata. |
peek |
Optional function for budget-aware preview generation. |
slice |
Optional function for budget-aware slicing. |
list_accessors |
Optional function returning recommended accessors. |
estimate_cost |
Optional function returning compute/token/I/O estimates. |
provenance |
Optional function returning provenance metadata. |
validate_action |
Optional function for safety validation. |
render_summary |
Optional function returning a human-readable summary. |
render_inspection |
Optional function returning a human-readable inspection. |
This constructor is part of the public semantic adapter authoring API for extension packages.
Adapter callbacks are optional unless noted otherwise.
supports(obj) should return a single TRUE or FALSE value and must not
error for unsupported objects.
The structured callbacks describe_identity(), describe_schema(),
describe_semantics(), estimate_cost(), and provenance() should return
named lists when supplied.
list_accessors() should return a character vector of recommended accessors.
validate_action() should return a named list with fields such as status,
reason, category, and expensive.
render_summary() and render_inspection() should return single character
strings suitable for user-facing output.
A SemanticAdapter object.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.