pub struct TurnInput {
pub turn_id: TurnId,
pub conversation_id: ConversationId,
pub actor: ActorContext,
pub text: Option<String>,
pub interaction_response: Option<InteractionResponse>,
pub attachments: Vec<AttachmentRef>,
pub origin: Option<OriginRef>,
pub locale: Locale,
pub effort: Option<Effort>,
}Expand description
One user turn as accepted by the runtime (spec §9).
Fields§
§turn_id: TurnIdIdentifier of this turn.
conversation_id: ConversationIdConversation the turn belongs to.
actor: ActorContextAuthenticated actor.
text: Option<String>Free text, if any.
interaction_response: Option<InteractionResponse>Structured card reply, if any. May coexist with text.
attachments: Vec<AttachmentRef>Attachments supplied with the turn.
origin: Option<OriginRef>Server-validated origin, if the UI supplied one.
locale: LocaleLocale of the user.
effort: Option<Effort>The effort this turn runs at, forced by the application; None takes the
configured default.
Implementations§
Source§impl TurnInput
impl TurnInput
Sourcepub fn validate_shape(&self) -> Result<(), InvalidInputError>
pub fn validate_shape(&self) -> Result<(), InvalidInputError>
Checks the structural rules of a turn against TurnLimits::conservative.
Sourcepub fn validate_shape_within(
&self,
limits: &TurnLimits,
) -> Result<(), InvalidInputError>
pub fn validate_shape_within( &self, limits: &TurnLimits, ) -> Result<(), InvalidInputError>
Checks the structural rules of a turn: at least one of text,
interaction response or attachment must be present, the locale and the
account must be non-empty, and the text and attachments must fit
limits.
Text and interaction response may coexist; this never rejects that.
Returns true when the turn is a pure card click: an interaction
response with no text and no attachments. Such turns need no model call
(spec §9).
Sourcepub fn account_id(&self) -> &AccountId
pub fn account_id(&self) -> &AccountId
Convenience accessor for the account.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TurnInput
impl<'de> Deserialize<'de> for TurnInput
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>,
impl Eq for TurnInput
impl StructuralPartialEq for TurnInput
Auto Trait Implementations§
impl Freeze for TurnInput
impl RefUnwindSafe for TurnInput
impl Send for TurnInput
impl Sync for TurnInput
impl Unpin for TurnInput
impl UnsafeUnpin for TurnInput
impl UnwindSafe for TurnInput
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.