pub struct ConfidentStep {
pub action: Value,
pub confidence: f64,
pub alternatives: Vec<Alternative>,
pub verification: Option<Verification>,
pub description: Option<String>,
}Expand description
A step with confidence score and alternatives.
Fields§
§action: ValueThe primary action to execute.
confidence: f64Confidence score (0.0 to 1.0).
alternatives: Vec<Alternative>Alternative actions ranked by confidence.
verification: Option<Verification>Optional verification to run after the action.
description: Option<String>Brief description of the action.
Implementations§
Source§impl ConfidentStep
impl ConfidentStep
Sourcepub fn new(action: Value, confidence: f64) -> ConfidentStep
pub fn new(action: Value, confidence: f64) -> ConfidentStep
Create a new confident step.
Sourcepub fn with_alternative(self, alt: Alternative) -> ConfidentStep
pub fn with_alternative(self, alt: Alternative) -> ConfidentStep
Add an alternative action.
Sourcepub fn with_alternatives(self, alts: Vec<Alternative>) -> ConfidentStep
pub fn with_alternatives(self, alts: Vec<Alternative>) -> ConfidentStep
Add multiple alternatives.
Sourcepub fn with_verification(self, verification: Verification) -> ConfidentStep
pub fn with_verification(self, verification: Verification) -> ConfidentStep
Add a verification step.
Sourcepub fn with_description(self, desc: impl Into<String>) -> ConfidentStep
pub fn with_description(self, desc: impl Into<String>) -> ConfidentStep
Add a description.
Sourcepub fn is_confident(&self, threshold: f64) -> bool
pub fn is_confident(&self, threshold: f64) -> bool
Check if confidence is above a threshold.
Sourcepub fn has_alternatives(&self) -> bool
pub fn has_alternatives(&self) -> bool
Check if alternatives are available.
Sourcepub fn best_alternative(&self) -> Option<&Alternative>
pub fn best_alternative(&self) -> Option<&Alternative>
Get the next best alternative, if any.
Sourcepub fn sorted_alternatives(&self) -> Vec<&Alternative>
pub fn sorted_alternatives(&self) -> Vec<&Alternative>
Get alternatives sorted by confidence (highest first).
Sourcepub fn from_json(value: &Value) -> Option<ConfidentStep>
pub fn from_json(value: &Value) -> Option<ConfidentStep>
Parse a confident step from LLM JSON response.
Expected format:
{
"action": { "Click": "button" },
"confidence": 0.85,
"alternatives": [
{ "action": { "Click": ".btn" }, "confidence": 0.6 }
]
}Trait Implementations§
Source§impl Clone for ConfidentStep
impl Clone for ConfidentStep
Source§fn clone(&self) -> ConfidentStep
fn clone(&self) -> ConfidentStep
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConfidentStep
impl Debug for ConfidentStep
Source§impl<'de> Deserialize<'de> for ConfidentStep
impl<'de> Deserialize<'de> for ConfidentStep
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ConfidentStep, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ConfidentStep, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ConfidentStep
impl Serialize for ConfidentStep
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for ConfidentStep
impl RefUnwindSafe for ConfidentStep
impl Send for ConfidentStep
impl Sync for ConfidentStep
impl Unpin for ConfidentStep
impl UnsafeUnpin for ConfidentStep
impl UnwindSafe for ConfidentStep
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