#[non_exhaustive]pub struct ToolResultExpanded {
pub text_result_for_llm: String,
pub result_type: String,
pub binary_results_for_llm: Option<Vec<ToolBinaryResult>>,
pub session_log: Option<String>,
pub error: Option<String>,
pub tool_telemetry: Option<HashMap<String, Value>>,
pub tool_references: Option<Vec<String>>,
}Expand description
Expanded tool result with metadata for the LLM and session log.
This type is #[non_exhaustive]: it mirrors a growing wire shape, so
construct it via ToolResultExpanded::new plus the with_* chain
rather than a struct literal, allowing new fields to land without
breaking callers.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.text_result_for_llm: StringResult text sent back to the LLM.
result_type: String"success" or "failure".
binary_results_for_llm: Option<Vec<ToolBinaryResult>>Binary payloads sent back to the LLM.
session_log: Option<String>Optional log message for the session timeline.
error: Option<String>Error message, if the tool failed.
tool_telemetry: Option<HashMap<String, Value>>Tool-specific telemetry emitted with the result.
tool_references: Option<Vec<String>>Names of tools returned by a tool-search tool.
Implementations§
Source§impl ToolResultExpanded
impl ToolResultExpanded
Sourcepub fn new(
text_result_for_llm: impl Into<String>,
result_type: impl Into<String>,
) -> Self
pub fn new( text_result_for_llm: impl Into<String>, result_type: impl Into<String>, ) -> Self
Construct an expanded result with the required text_result_for_llm
and result_type ("success" or "failure"). All optional metadata
fields start unset; populate them with the with_* builders.
Sourcepub fn with_binary_results(self, results: Vec<ToolBinaryResult>) -> Self
pub fn with_binary_results(self, results: Vec<ToolBinaryResult>) -> Self
Set the binary payloads returned to the LLM.
Sourcepub fn with_session_log(self, session_log: impl Into<String>) -> Self
pub fn with_session_log(self, session_log: impl Into<String>) -> Self
Set the log message for the session timeline.
Sourcepub fn with_error(self, error: impl Into<String>) -> Self
pub fn with_error(self, error: impl Into<String>) -> Self
Set the error message, marking the tool as failed.
Sourcepub fn with_tool_telemetry(self, telemetry: HashMap<String, Value>) -> Self
pub fn with_tool_telemetry(self, telemetry: HashMap<String, Value>) -> Self
Set the tool-specific telemetry emitted with the result.
Sourcepub fn with_tool_references<I, S>(self, references: I) -> Self
pub fn with_tool_references<I, S>(self, references: I) -> Self
Set the names of tools returned by a tool-search tool.
Trait Implementations§
Source§impl Clone for ToolResultExpanded
impl Clone for ToolResultExpanded
Source§fn clone(&self) -> ToolResultExpanded
fn clone(&self) -> ToolResultExpanded
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more