pub struct ExtractBuilder { /* private fields */ }Expand description
Builder for an Extract record.
Implementations§
Source§impl ExtractBuilder
impl ExtractBuilder
Sourcepub fn field(self, name: impl Into<String>, recognizer: Recognizer) -> Self
pub fn field(self, name: impl Into<String>, recognizer: Recognizer) -> Self
Add a field filled by recognizer, promoted to a state key of the same name.
Sourcepub fn field_to(
self,
name: impl Into<String>,
state_key: impl Into<String>,
recognizer: Recognizer,
) -> Self
pub fn field_to( self, name: impl Into<String>, state_key: impl Into<String>, recognizer: Recognizer, ) -> Self
Add a field promoted to a custom state key.
Sourcepub fn field_resolve<I, S, F, Fut>(
self,
name: impl Into<String>,
args: I,
ttl: Option<Duration>,
fetch: F,
) -> Self
pub fn field_resolve<I, S, F, Fut>( self, name: impl Into<String>, args: I, ttl: Option<Duration>, fetch: F, ) -> Self
Add a field filled by an async resolver — a tool call, HTTP fetch, or
MCP request. args names the State keys bound into the JSON object
passed to fetch; the returned value becomes the field. With a ttl,
results are memoized by (field, canonical args) for that duration.
Sourcepub fn validate<F>(self, predicate: F) -> Self
pub fn validate<F>(self, predicate: F) -> Self
Attach a validator to the most recently added field: a recognized
value is promoted only when predicate returns true (else it is
rejected, as if no value was recognized this turn).
Sourcepub fn trigger(self, trigger: ExtractionTrigger) -> Self
pub fn trigger(self, trigger: ExtractionTrigger) -> Self
When the record runs (default EveryTurn).
Sourcepub fn on_complete(self, agent: Arc<dyn TextAgent>, mode: AgentMode) -> Self
pub fn on_complete(self, agent: Arc<dyn TextAgent>, mode: AgentMode) -> Self
Run agent (in mode) when this record lands fields in state — the
on_complete(dispatch(agent)) effect. Its result lands in {name}:result.