pub struct ApiQueryHookConfig<TResult> {
pub name: String,
pub should_run: Box<dyn Fn(&ReplHookContext) -> Pin<Box<dyn Future<Output = bool> + Send>> + Send + Sync>,
pub build_messages: Box<dyn Fn(&ReplHookContext) -> Vec<Message> + Send + Sync>,
pub system_prompt: Option<SystemPrompt>,
pub use_tools: Option<bool>,
pub parse_response: Box<dyn Fn(&str, &ReplHookContext) -> TResult + Send + Sync>,
pub log_result: Box<dyn Fn(ApiQueryResult<TResult>, &ReplHookContext) + Send + Sync>,
pub get_model: Box<dyn Fn(&ReplHookContext) -> String + Send + Sync>,
}Expand description
Configuration for an API query hook
Fields§
§name: StringQuery source name
should_run: Box<dyn Fn(&ReplHookContext) -> Pin<Box<dyn Future<Output = bool> + Send>> + Send + Sync>Whether this hook should run
build_messages: Box<dyn Fn(&ReplHookContext) -> Vec<Message> + Send + Sync>Build the complete message list to send to the API
system_prompt: Option<SystemPrompt>Optional: override system prompt (defaults to context.system_prompt)
use_tools: Option<bool>Optional: whether to use tools from context (defaults to true)
parse_response: Box<dyn Fn(&str, &ReplHookContext) -> TResult + Send + Sync>Parse the response content into a result
log_result: Box<dyn Fn(ApiQueryResult<TResult>, &ReplHookContext) + Send + Sync>Log the result
get_model: Box<dyn Fn(&ReplHookContext) -> String + Send + Sync>Get the model to use (lazy loaded)
Auto Trait Implementations§
impl<TResult> Freeze for ApiQueryHookConfig<TResult>
impl<TResult> !RefUnwindSafe for ApiQueryHookConfig<TResult>
impl<TResult> Send for ApiQueryHookConfig<TResult>
impl<TResult> Sync for ApiQueryHookConfig<TResult>
impl<TResult> Unpin for ApiQueryHookConfig<TResult>
impl<TResult> UnsafeUnpin for ApiQueryHookConfig<TResult>
impl<TResult> !UnwindSafe for ApiQueryHookConfig<TResult>
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