pub struct ContextQuery {
pub query: String,
pub context_types: Vec<ContextType>,
pub depth: ContextDepth,
pub max_results: usize,
pub max_tokens: usize,
pub session_id: Option<String>,
pub params: HashMap<String, Value>,
}Expand description
Query to a context provider
Fields§
§query: StringThe query string to search for relevant context
context_types: Vec<ContextType>Types of context to retrieve
depth: ContextDepthDesired retrieval depth
max_results: usizeMaximum number of results to return
max_tokens: usizeMaximum total tokens across all results
session_id: Option<String>Optional session ID for session-specific context
params: HashMap<String, Value>Additional provider-specific parameters
Implementations§
Source§impl ContextQuery
impl ContextQuery
Sourcepub fn with_types(self, types: impl IntoIterator<Item = ContextType>) -> Self
pub fn with_types(self, types: impl IntoIterator<Item = ContextType>) -> Self
Set the context types to retrieve
Sourcepub fn with_depth(self, depth: ContextDepth) -> Self
pub fn with_depth(self, depth: ContextDepth) -> Self
Set the retrieval depth
Sourcepub fn with_max_results(self, max: usize) -> Self
pub fn with_max_results(self, max: usize) -> Self
Set the maximum number of results
Sourcepub fn with_max_tokens(self, max: usize) -> Self
pub fn with_max_tokens(self, max: usize) -> Self
Set the maximum total tokens
Sourcepub fn with_session_id(self, id: impl Into<String>) -> Self
pub fn with_session_id(self, id: impl Into<String>) -> Self
Set the session ID
Sourcepub fn with_param(self, key: impl Into<String>, value: Value) -> Self
pub fn with_param(self, key: impl Into<String>, value: Value) -> Self
Add a custom parameter
Trait Implementations§
Source§impl Clone for ContextQuery
impl Clone for ContextQuery
Source§fn clone(&self) -> ContextQuery
fn clone(&self) -> ContextQuery
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContextQuery
impl Debug for ContextQuery
Source§impl<'de> Deserialize<'de> for ContextQuery
impl<'de> Deserialize<'de> for ContextQuery
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ContextQuery
impl RefUnwindSafe for ContextQuery
impl Send for ContextQuery
impl Sync for ContextQuery
impl Unpin for ContextQuery
impl UnsafeUnpin for ContextQuery
impl UnwindSafe for ContextQuery
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