pub struct NativeTools { /* private fields */ }Expand description
A ToolRuntime whose tools are Rust closures.
use graphrt_core::tool::{ToolOutput, ToolSpec};
use graphrt_core::tool_node::NativeTools;
let tools = NativeTools::new().with(
ToolSpec {
name: "echo".into(),
description: "Echo the `text` argument".into(),
parameters: serde_json::json!({
"type": "object",
"properties": { "text": { "type": "string" } },
"required": ["text"]
}),
},
|args| async move { Ok(ToolOutput::text(args["text"].as_str().unwrap_or_default())) },
);Implementations§
Source§impl NativeTools
impl NativeTools
Trait Implementations§
Source§impl Clone for NativeTools
impl Clone for NativeTools
Source§impl Debug for NativeTools
impl Debug for NativeTools
Source§impl Default for NativeTools
impl Default for NativeTools
Auto Trait Implementations§
impl !RefUnwindSafe for NativeTools
impl !UnwindSafe for NativeTools
impl Forget for NativeTools
impl Freeze for NativeTools
impl Move for NativeTools
impl Send for NativeTools
impl Sync for NativeTools
impl Unpin for NativeTools
impl UnsafeUnpin for NativeTools
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