pub enum ToolInteractionResponse {
Submit {
id: ToolInteractionId,
content: Value,
},
Decline {
id: ToolInteractionId,
reason: Option<String>,
},
Cancel {
id: ToolInteractionId,
reason: Option<String>,
},
}Expand description
Caller response to a pending tool interaction.
Variants§
Submit
Supplies caller input and resumes execution.
Fields
§
id: ToolInteractionIdId of the interaction being resolved.
Decline
Declines to provide the requested input.
Fields
§
id: ToolInteractionIdId of the interaction being resolved.
Cancel
Cancels the pending interaction and invocation.
Fields
§
id: ToolInteractionIdId of the interaction being resolved.
Implementations§
Source§impl ToolInteractionResponse
impl ToolInteractionResponse
Sourcepub fn submit(id: ToolInteractionId, content: Value) -> Self
pub fn submit(id: ToolInteractionId, content: Value) -> Self
Creates a submitted interaction response.
§Examples
use tools_kit::interaction::{ToolInteractionId, ToolInteractionResponse};
let id = ToolInteractionId::new();
let response = ToolInteractionResponse::submit(id.clone(), serde_json::json!("Chicago"));
assert_eq!(response.interaction_id(), &id);Sourcepub fn decline(id: ToolInteractionId, reason: Option<String>) -> Self
pub fn decline(id: ToolInteractionId, reason: Option<String>) -> Self
Creates a declined interaction response.
§Examples
use tools_kit::interaction::{ToolInteractionId, ToolInteractionResponse};
let id = ToolInteractionId::new();
let response = ToolInteractionResponse::decline(id.clone(), Some("not available".into()));
assert_eq!(response.interaction_id(), &id);Sourcepub fn cancel(id: ToolInteractionId, reason: Option<String>) -> Self
pub fn cancel(id: ToolInteractionId, reason: Option<String>) -> Self
Creates a cancelled interaction response.
§Examples
use tools_kit::interaction::{ToolInteractionId, ToolInteractionResponse};
let id = ToolInteractionId::new();
let response = ToolInteractionResponse::cancel(id.clone(), None);
assert_eq!(response.interaction_id(), &id);Sourcepub fn interaction_id(&self) -> &ToolInteractionId
pub fn interaction_id(&self) -> &ToolInteractionId
Borrows the id of the interaction being resolved.
§Examples
use tools_kit::interaction::{ToolInteractionId, ToolInteractionResponse};
let id = ToolInteractionId::new();
let response = ToolInteractionResponse::submit(id.clone(), serde_json::json!({"approved":true}));
assert_eq!(response.interaction_id(), &id);Trait Implementations§
Source§impl Clone for ToolInteractionResponse
impl Clone for ToolInteractionResponse
Source§impl Debug for ToolInteractionResponse
impl Debug for ToolInteractionResponse
Source§impl<'de> Deserialize<'de> for ToolInteractionResponse
impl<'de> Deserialize<'de> for ToolInteractionResponse
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
Source§impl PartialEq for ToolInteractionResponse
impl PartialEq for ToolInteractionResponse
Source§impl Serialize for ToolInteractionResponse
impl Serialize for ToolInteractionResponse
impl StructuralPartialEq for ToolInteractionResponse
Auto Trait Implementations§
impl Freeze for ToolInteractionResponse
impl RefUnwindSafe for ToolInteractionResponse
impl Send for ToolInteractionResponse
impl Sync for ToolInteractionResponse
impl Unpin for ToolInteractionResponse
impl UnsafeUnpin for ToolInteractionResponse
impl UnwindSafe for ToolInteractionResponse
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