Skip to main content

QueryRewriterAgent

Defined in the Specialized Agents module.
Rust AI Agent SDK Agent for rewriting queries

Fields

NameTypeDescription
configQueryRewriterConfig-

Methods

new

fn new() -> QueryRewriterAgentBuilder
Create a new builder

name

fn name(&self) -> &str
Get agent name

model

fn model(&self) -> &str
Get model

expand_abbreviations

fn expand_abbreviations(&self, query: &str) -> String
Expand abbreviations in query Parameters:
NameType
query&str

detect_strategy

fn detect_strategy(&self, query: &str, has_chat_history: bool) -> RewriteStrategy
Detect the best rewriting strategy for a query Parameters:
NameType
query&str
has_chat_historybool

rewrite_sync

fn rewrite_sync(
        &self,
        query: &str,
        strategy: RewriteStrategy,
        chat_history: Option<&[HashMap<String, String>]>,
        context: Option<&str>,
        num_queries: Option<usize>,
    ) -> RewriteResult
Rewrite a query (sync placeholder - actual implementation would use LLM) Parameters:
NameType
query&str
strategyRewriteStrategy
chat_historyOption&lt;&[HashMap&lt;String
contextOption&lt;&str&gt;
num_queriesOption&lt;usize&gt;

Source

View on GitHub

praisonai/src/specialized_agents.rs at line 722