pub struct LlmConditionalAgentBuilder { /* private fields */ }Available on crate feature
agents only.Implementations§
Source§impl LlmConditionalAgentBuilder
impl LlmConditionalAgentBuilder
Sourcepub fn new(
name: impl Into<String>,
model: Arc<dyn Llm>,
) -> LlmConditionalAgentBuilder
pub fn new( name: impl Into<String>, model: Arc<dyn Llm>, ) -> LlmConditionalAgentBuilder
Create a new builder with the given name and model.
Sourcepub fn description(self, desc: impl Into<String>) -> LlmConditionalAgentBuilder
pub fn description(self, desc: impl Into<String>) -> LlmConditionalAgentBuilder
Set a description for the agent.
Sourcepub fn instruction(
self,
instruction: impl Into<String>,
) -> LlmConditionalAgentBuilder
pub fn instruction( self, instruction: impl Into<String>, ) -> LlmConditionalAgentBuilder
Set the classification instruction.
The instruction should tell the LLM to classify the user’s input and respond with ONLY the category name (matching a route key).
Sourcepub fn route(
self,
label: impl Into<String>,
agent: Arc<dyn Agent>,
) -> LlmConditionalAgentBuilder
pub fn route( self, label: impl Into<String>, agent: Arc<dyn Agent>, ) -> LlmConditionalAgentBuilder
Add a route mapping a classification label to an agent.
When the LLM’s response contains this label, execution transfers to the specified agent.
Sourcepub fn default_route(self, agent: Arc<dyn Agent>) -> LlmConditionalAgentBuilder
pub fn default_route(self, agent: Arc<dyn Agent>) -> LlmConditionalAgentBuilder
Set the default agent to use when no route matches.
pub fn with_skills(self, index: SkillIndex) -> LlmConditionalAgentBuilder
pub fn with_auto_skills(self) -> Result<LlmConditionalAgentBuilder, AdkError>
pub fn with_skills_from_root( self, root: impl AsRef<Path>, ) -> Result<LlmConditionalAgentBuilder, AdkError>
pub fn with_skill_policy( self, policy: SelectionPolicy, ) -> LlmConditionalAgentBuilder
pub fn with_skill_budget(self, max_chars: usize) -> LlmConditionalAgentBuilder
Sourcepub fn before_callback(
self,
callback: Box<dyn Fn(Arc<dyn CallbackContext>) -> Pin<Box<dyn Future<Output = Result<Option<Content>, AdkError>> + Send>> + Send + Sync>,
) -> LlmConditionalAgentBuilder
pub fn before_callback( self, callback: Box<dyn Fn(Arc<dyn CallbackContext>) -> Pin<Box<dyn Future<Output = Result<Option<Content>, AdkError>> + Send>> + Send + Sync>, ) -> LlmConditionalAgentBuilder
Add a before-agent callback.
Sourcepub fn after_callback(
self,
callback: Box<dyn Fn(Arc<dyn CallbackContext>) -> Pin<Box<dyn Future<Output = Result<Option<Content>, AdkError>> + Send>> + Send + Sync>,
) -> LlmConditionalAgentBuilder
pub fn after_callback( self, callback: Box<dyn Fn(Arc<dyn CallbackContext>) -> Pin<Box<dyn Future<Output = Result<Option<Content>, AdkError>> + Send>> + Send + Sync>, ) -> LlmConditionalAgentBuilder
Add an after-agent callback.
Sourcepub fn build(self) -> Result<LlmConditionalAgent, AdkError>
pub fn build(self) -> Result<LlmConditionalAgent, AdkError>
Build the LlmConditionalAgent.
Auto Trait Implementations§
impl Freeze for LlmConditionalAgentBuilder
impl !RefUnwindSafe for LlmConditionalAgentBuilder
impl Send for LlmConditionalAgentBuilder
impl Sync for LlmConditionalAgentBuilder
impl Unpin for LlmConditionalAgentBuilder
impl UnsafeUnpin for LlmConditionalAgentBuilder
impl !UnwindSafe for LlmConditionalAgentBuilder
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestCreates a shared type from an unshared type.