pub struct ToolResult {
pub tool_call_id: String,
pub content: String,
pub metadata: HashMap<String, Value>,
}
Expand description
A tool result returned by a tool
Fields§
§tool_call_id: String
The tool call ID this result corresponds to
content: String
The result content
metadata: HashMap<String, Value>
Additional metadata
Implementations§
Source§impl ToolResult
impl ToolResult
Sourcepub fn new(tool_call_id: impl Into<String>, content: impl Into<String>) -> Self
pub fn new(tool_call_id: impl Into<String>, content: impl Into<String>) -> Self
Create a new tool result
Sourcepub fn new_with_metadata(
tool_call_id: impl Into<String>,
content: impl Into<String>,
metadata: HashMap<String, Value>,
) -> Self
pub fn new_with_metadata( tool_call_id: impl Into<String>, content: impl Into<String>, metadata: HashMap<String, Value>, ) -> Self
Create a new tool result with metadata
Sourcepub fn add_metadata(&mut self, key: impl Into<String>, value: Value)
pub fn add_metadata(&mut self, key: impl Into<String>, value: Value)
Add metadata to the result
Trait Implementations§
Source§impl Clone for ToolResult
impl Clone for ToolResult
Source§fn clone(&self) -> ToolResult
fn clone(&self) -> ToolResult
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 ToolResult
impl Debug for ToolResult
Source§impl<'de> Deserialize<'de> for ToolResult
impl<'de> Deserialize<'de> for ToolResult
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 ToolResult
impl PartialEq for ToolResult
Source§impl<T> Runnable<HashMap<String, Value>, ToolResult> for RunnableTool<T>where
T: Tool,
impl<T> Runnable<HashMap<String, Value>, ToolResult> for RunnableTool<T>where
T: Tool,
Source§fn invoke<'life0, 'async_trait>(
&'life0 self,
input: HashMap<String, Value>,
config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn invoke<'life0, 'async_trait>(
&'life0 self,
input: HashMap<String, Value>,
config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Invoke the runnable with a single input
Source§fn invoke_simple<'life0, 'async_trait>(
&'life0 self,
input: Input,
) -> Pin<Box<dyn Future<Output = Result<Output>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn invoke_simple<'life0, 'async_trait>(
&'life0 self,
input: Input,
) -> Pin<Box<dyn Future<Output = Result<Output>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Invoke the runnable with a single input (convenience method with default config)
Source§fn batch<'life0, 'async_trait>(
&'life0 self,
inputs: Vec<Input>,
config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Output>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn batch<'life0, 'async_trait>(
&'life0 self,
inputs: Vec<Input>,
config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Output>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Batch invoke the runnable with multiple inputs
Source§fn stream<'life0, 'async_trait>(
&'life0 self,
input: Input,
config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Output>> + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stream<'life0, 'async_trait>(
&'life0 self,
input: Input,
config: Option<RunnableConfig>,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Output>> + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stream the output of the runnable
Source§fn input_schema(&self) -> Option<Value>
fn input_schema(&self) -> Option<Value>
Get the input schema for this runnable
Source§fn output_schema(&self) -> Option<Value>
fn output_schema(&self) -> Option<Value>
Get the output schema for this runnable
Source§fn config_schema(&self) -> Option<Value>
fn config_schema(&self) -> Option<Value>
Get the configuration schema for this runnable
Source§impl Serializable for ToolResult
impl Serializable for ToolResult
Source§fn is_serializable() -> bool
fn is_serializable() -> bool
Check if this object is serializable Read more
Source§fn to_json_pretty(&self) -> Result<String>
fn to_json_pretty(&self) -> Result<String>
Serialize this object to a pretty-printed JSON string
Source§fn to_dict(&self) -> Result<HashMap<String, Value>>
fn to_dict(&self) -> Result<HashMap<String, Value>>
Serialize this object to a dictionary (HashMap)
Source§impl Serialize for ToolResult
impl Serialize for ToolResult
impl StructuralPartialEq for ToolResult
Auto Trait Implementations§
impl Freeze for ToolResult
impl RefUnwindSafe for ToolResult
impl Send for ToolResult
impl Sync for ToolResult
impl Unpin for ToolResult
impl UnwindSafe for ToolResult
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