pub struct OutputContract { /* private fields */ }Expand description
Typed structured-output contract attached to one invocation.
Implementations§
Source§impl OutputContract
impl OutputContract
pub fn new( contract_id: impl Into<String>, format: OutputFormat, fields: BTreeMap<String, OutputFieldRule>, ) -> Result<Self, DomainError>
Sourcepub fn new_with_schema(
contract_id: impl Into<String>,
format: OutputFormat,
fields: BTreeMap<String, OutputFieldRule>,
json_schema: impl Into<String>,
) -> Result<Self, DomainError>
pub fn new_with_schema( contract_id: impl Into<String>, format: OutputFormat, fields: BTreeMap<String, OutputFieldRule>, json_schema: impl Into<String>, ) -> Result<Self, DomainError>
Build a contract that also carries an embedded JSON Schema
body. The schema text is whitespace-trimmed and length-bounded
(MAX_JSON_SCHEMA_LEN = 256 KiB); validation that the body is
itself well-formed JSON / a valid JSON Schema document happens
at adapter wiring time (the core does not pull a schema
engine in).
pub fn json_object( contract_id: impl Into<String>, fields: BTreeMap<String, OutputFieldRule>, ) -> Result<Self, DomainError>
pub const fn contract_id(&self) -> &OutputContractId
pub const fn format(&self) -> OutputFormat
pub fn fields(&self) -> &BTreeMap<String, OutputFieldRule>
Sourcepub fn json_schema(&self) -> &str
pub fn json_schema(&self) -> &str
Embedded JSON Schema body. Empty string means “no schema — only field-level rules apply”; the JSON Schema validator adapter treats empty as a no-op.
Sourcepub fn with_evidence_grounding(self, rule: EvidenceGroundingRule) -> Self
pub fn with_evidence_grounding(self, rule: EvidenceGroundingRule) -> Self
Attach an evidence-grounding rule to this contract.
Sourcepub fn evidence_grounding(&self) -> Option<&EvidenceGroundingRule>
pub fn evidence_grounding(&self) -> Option<&EvidenceGroundingRule>
Evidence-grounding rule, when the contract declares one. None
means the grounding validator is a no-op for this invocation.
Trait Implementations§
Source§impl Clone for OutputContract
impl Clone for OutputContract
Source§impl Debug for OutputContract
impl Debug for OutputContract
Source§impl<'de> Deserialize<'de> for OutputContract
impl<'de> Deserialize<'de> for OutputContract
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for OutputContract
Source§impl PartialEq for OutputContract
impl PartialEq for OutputContract
Source§impl Serialize for OutputContract
impl Serialize for OutputContract
impl StructuralPartialEq for OutputContract
Auto Trait Implementations§
impl Freeze for OutputContract
impl RefUnwindSafe for OutputContract
impl Send for OutputContract
impl Sync for OutputContract
impl Unpin for OutputContract
impl UnsafeUnpin for OutputContract
impl UnwindSafe for OutputContract
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more