pub struct AsyncLlmAgent { /* private fields */ }Expand description
An async agent powered by an LLM.
This agent uses an LLM broker to generate responses. It can be configured with a system prompt (behaviour), optional tools, and a response model for structured output.
§Examples
ⓘ
use mojentic::agents::AsyncLlmAgent;
use mojentic::llm::LlmBroker;
let broker = Arc::new(LlmBroker::new("model-name", gateway, None));
let agent = AsyncLlmAgent::new(
broker,
"You are a helpful assistant.",
None, // tools
);Implementations§
Source§impl AsyncLlmAgent
impl AsyncLlmAgent
Sourcepub fn new(
broker: Arc<LlmBroker>,
behaviour: impl Into<String>,
tools: Option<Vec<Box<dyn LlmTool>>>,
) -> Self
pub fn new( broker: Arc<LlmBroker>, behaviour: impl Into<String>, tools: Option<Vec<Box<dyn LlmTool>>>, ) -> Self
Create a new AsyncLlmAgent.
§Arguments
broker- The LLM broker to use for generating responsesbehaviour- System prompt defining the agent’s personality and behaviortools- Optional tools available to the LLM
Sourcepub async fn generate_response(
&self,
content: &str,
correlation_id: Option<String>,
) -> Result<String>
pub async fn generate_response( &self, content: &str, correlation_id: Option<String>, ) -> Result<String>
Trait Implementations§
Source§impl BaseAsyncAgent for AsyncLlmAgent
impl BaseAsyncAgent for AsyncLlmAgent
Auto Trait Implementations§
impl Freeze for AsyncLlmAgent
impl !RefUnwindSafe for AsyncLlmAgent
impl Send for AsyncLlmAgent
impl Sync for AsyncLlmAgent
impl Unpin for AsyncLlmAgent
impl !UnwindSafe for AsyncLlmAgent
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