pub struct SchemaBundle {
pub s2c: Value,
pub common_types: Value,
pub catalog: Value,
pub custom_cuttable_keys: Option<Vec<String>>,
}Expand description
The three schema documents describing one surface contract.
Fields§
§s2c: ValueThe server-to-client envelope schema.
common_types: ValueShared type definitions the other two reference.
catalog: ValueThe component and function catalog.
custom_cuttable_keys: Option<Vec<String>>Keys whose string values may be closed early while streaming.
None uses DEFAULT_CUTTABLE_KEYS. Override it when a catalog puts
long free text under a name the defaults do not cover.
Implementations§
Source§impl SchemaBundle
impl SchemaBundle
Sourcepub fn from_catalog(catalog: Value) -> Self
pub fn from_catalog(catalog: Value) -> Self
A bundle holding only a catalog document.
Sourcepub fn catalog_id(&self) -> Option<&str>
pub fn catalog_id(&self) -> Option<&str>
The catalogId this bundle’s catalog declares.
Sourcepub fn cuttable_keys(&self) -> Vec<String>
pub fn cuttable_keys(&self) -> Vec<String>
The keys whose string values may be closed early while streaming.
Sourcepub fn render_llm_instructions(&self) -> String
pub fn render_llm_instructions(&self) -> String
Renders the bundle as the schema block of a prompt.
The common-types section is dropped when it has nothing to say — no
$defs, or an empty one — so the model is not handed an empty document
to reason about.
Sourcepub fn prune(
self,
allowed_components: &[String],
allowed_messages: &[String],
) -> Self
pub fn prune( self, allowed_components: &[String], allowed_messages: &[String], ) -> Self
Restricts the bundle to a subset of components and message types.
Either list may be empty, meaning “keep everything of that kind”. After the restriction, unreferenced type definitions are dropped from both the envelope schema and the common types.
Trait Implementations§
Source§impl Clone for SchemaBundle
impl Clone for SchemaBundle
Source§fn clone(&self) -> SchemaBundle
fn clone(&self) -> SchemaBundle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SchemaBundle
impl Debug for SchemaBundle
Source§impl Default for SchemaBundle
impl Default for SchemaBundle
Source§fn default() -> SchemaBundle
fn default() -> SchemaBundle
Source§impl PartialEq for SchemaBundle
impl PartialEq for SchemaBundle
Source§fn eq(&self, other: &SchemaBundle) -> bool
fn eq(&self, other: &SchemaBundle) -> bool
self and other values to be equal, and is used by ==.