pub struct UnderstandingBuilder { /* private fields */ }Expand description
Builds an Understanding of one message from quotes of it.
use turnframe_test::providers::UnderstandingBuilder;
let understanding = UnderstandingBuilder::of("set the name to Lisbon")
.apply("trip.set_name", "tok_1", serde_json::json!({"value": "Lisbon"}), "set the name to Lisbon")
.build()
.unwrap();
assert_eq!(understanding.acts[0].arguments["value"].excerpt.unwrap().words.first, 4);Implementations§
Source§impl UnderstandingBuilder
impl UnderstandingBuilder
Sourcepub fn apply(
self,
operation: impl Into<OperationKey>,
target: impl Into<TargetToken>,
arguments: Value,
quote: &str,
) -> Self
pub fn apply( self, operation: impl Into<OperationKey>, target: impl Into<TargetToken>, arguments: Value, quote: &str, ) -> Self
An act applying operation to the record target names, asked for in quote.
Sourcepub fn apply_to(
self,
operation: impl Into<OperationKey>,
target: ActTarget,
arguments: Value,
quote: &str,
) -> Self
pub fn apply_to( self, operation: impl Into<OperationKey>, target: ActTarget, arguments: Value, quote: &str, ) -> Self
An act applying operation to any target.
Sourcepub fn apply_to_unlisted(
self,
operation: impl Into<OperationKey>,
workflow: impl Into<WorkflowKey>,
named: &str,
arguments: Value,
quote: &str,
) -> Self
pub fn apply_to_unlisted( self, operation: impl Into<OperationKey>, workflow: impl Into<WorkflowKey>, named: &str, arguments: Value, quote: &str, ) -> Self
An act applying operation to a record of workflow the user named in
named that is not in view, for the directory to look up.
Sourcepub fn open(
self,
operation: impl Into<OperationKey>,
workflow: impl Into<WorkflowKey>,
arguments: Value,
quote: &str,
) -> Self
pub fn open( self, operation: impl Into<OperationKey>, workflow: impl Into<WorkflowKey>, arguments: Value, quote: &str, ) -> Self
An act applying operation to a record of workflow it creates.
Sourcepub fn start(self, workflow: impl Into<WorkflowKey>, quote: &str) -> Self
pub fn start(self, workflow: impl Into<WorkflowKey>, quote: &str) -> Self
An act starting a new case of workflow.
Sourcepub fn with_record(self, name: &str, record: RecordValue) -> Self
pub fn with_record(self, name: &str, record: RecordValue) -> Self
Gives the last act an argument naming a record. A record an earlier act of the turn creates makes that act a prerequisite.
Sourcepub fn with_status(self, status: ActStatus) -> Self
pub fn with_status(self, status: ActStatus) -> Self
Replaces the last act’s status.
Sourcepub fn superseded_by_next(self) -> Self
pub fn superseded_by_next(self) -> Self
Marks the last act as superseded by a later unit, removing it from the acts.
Sourcepub fn ask_about(
self,
basis: AnswerBasis,
record: Option<TargetToken>,
subjects: &[&str],
quote: &str,
) -> Self
pub fn ask_about( self, basis: AnswerBasis, record: Option<TargetToken>, subjects: &[&str], quote: &str, ) -> Self
A question with its basis, record and subjects; one on general domain knowledge is
about the domain, the rest about a record, until Self::about says otherwise.
Sourcepub fn following_up(self) -> Self
pub fn following_up(self) -> Self
Marks the last question as following up the assistant’s last message.
Sourcepub fn about(self, topic: QuestionTopic) -> Self
pub fn about(self, topic: QuestionTopic) -> Self
Sets what kind of thing the last question asks.
Sourcepub fn constrain(self, kind: ConstraintKind, quote: &str) -> Self
pub fn constrain(self, kind: ConstraintKind, quote: &str) -> Self
A turn-wide constraint stated in quote.
Sourcepub fn answer_card(self, option: impl Into<OptionId>, quote: &str) -> Self
pub fn answer_card(self, option: impl Into<OptionId>, quote: &str) -> Self
A typed answer to the card on screen.
Sourcepub fn dispute(self, receipt: Option<&str>, quote: &str) -> Self
pub fn dispute(self, receipt: Option<&str>, quote: &str) -> Self
A dispute of the receipt shown under receipt, when it names one.
Sourcepub fn not_understood(self, reason: NotUnderstoodReason, quote: &str) -> Self
pub fn not_understood(self, reason: NotUnderstoodReason, quote: &str) -> Self
Words that produced nothing to act on.