pub struct ToolOutputManager { /* private fields */ }Expand description
Manager for capping and storing large tool outputs.
Implementations§
Source§impl ToolOutputManager
impl ToolOutputManager
Sourcepub fn new(artifacts_dir: impl Into<PathBuf>, max_inline_tokens: u32) -> Self
pub fn new(artifacts_dir: impl Into<PathBuf>, max_inline_tokens: u32) -> Self
Create a new tool output manager.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create with default settings.
Uses ~/.bamboo/artifacts as the storage directory and 1000 tokens as the limit.
Sourcepub async fn cap_tool_result(
&self,
tool_call_id: &str,
result: String,
) -> Result<(String, Option<ArtifactRef>)>
pub async fn cap_tool_result( &self, tool_call_id: &str, result: String, ) -> Result<(String, Option<ArtifactRef>)>
Cap a tool result if it exceeds the token limit.
Returns a tuple of (capped_content, optional_artifact_ref). If the result fits within the budget, returns (result, None). If the result is too large, returns (truncated_result, Some(artifact_ref)).
Sourcepub async fn retrieve_artifact(
&self,
artifact_id: &str,
) -> Result<Option<String>>
pub async fn retrieve_artifact( &self, artifact_id: &str, ) -> Result<Option<String>>
Retrieve a stored artifact by ID.
Sourcepub async fn list_artifacts(&self) -> Result<Vec<ArtifactRef>>
pub async fn list_artifacts(&self) -> Result<Vec<ArtifactRef>>
List all stored artifacts.
Sourcepub async fn delete_artifact(&self, artifact_id: &str) -> Result<bool>
pub async fn delete_artifact(&self, artifact_id: &str) -> Result<bool>
Delete an artifact by ID.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ToolOutputManager
impl RefUnwindSafe for ToolOutputManager
impl Send for ToolOutputManager
impl Sync for ToolOutputManager
impl Unpin for ToolOutputManager
impl UnsafeUnpin for ToolOutputManager
impl UnwindSafe for ToolOutputManager
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