pub struct QueryEngine { /* private fields */ }Implementations§
Source§impl QueryEngine
impl QueryEngine
pub fn new(config: QueryEngineConfig) -> Self
Sourcepub fn register_tool<F>(&mut self, name: String, executor: F)where
F: Fn(Value, &ToolContext) -> Pin<Box<dyn Future<Output = Result<ToolResult, AgentError>> + Send>> + Send + Sync + 'static,
pub fn register_tool<F>(&mut self, name: String, executor: F)where
F: Fn(Value, &ToolContext) -> Pin<Box<dyn Future<Output = Result<ToolResult, AgentError>> + Send>> + Send + Sync + 'static,
Register a tool executor
Sourcepub fn set_messages(&mut self, messages: Vec<Message>)
pub fn set_messages(&mut self, messages: Vec<Message>)
Set initial messages (for continuing a conversation)
Sourcepub async fn execute_tool(
&mut self,
name: &str,
input: Value,
) -> Result<ToolResult, AgentError>
pub async fn execute_tool( &mut self, name: &str, input: Value, ) -> Result<ToolResult, AgentError>
Execute a tool by name
Sourcepub fn set_hook_registry(&self, registry: HookRegistry)
pub fn set_hook_registry(&self, registry: HookRegistry)
Set the hook registry
Sourcepub fn set_event_callback<F>(&mut self, callback: F)
pub fn set_event_callback<F>(&mut self, callback: F)
Set the event callback for agent events (tool start/complete/error, thinking, done)
pub fn get_turn_count(&self) -> u32
Sourcepub fn get_usage(&self) -> TokenUsage
pub fn get_usage(&self) -> TokenUsage
Get total token usage from all API calls
pub fn get_messages(&self) -> Vec<Message>
pub async fn submit_message( &mut self, prompt: &str, ) -> Result<(String, ExitReason), AgentError>
Auto Trait Implementations§
impl !Freeze for QueryEngine
impl !RefUnwindSafe for QueryEngine
impl Send for QueryEngine
impl Sync for QueryEngine
impl Unpin for QueryEngine
impl UnsafeUnpin for QueryEngine
impl !UnwindSafe for QueryEngine
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