pub struct LlmClientAdapter { /* private fields */ }Expand description
Shared adapter for streaming LLM clients.
Implementations§
Source§impl LlmClientAdapter
impl LlmClientAdapter
pub fn new(client: Arc<dyn LlmClient>, model: String) -> LlmClientAdapter
Sourcepub fn with_event_channel(
client: Arc<dyn LlmClient>,
model: String,
event_tx: Sender<AgentEvent>,
) -> LlmClientAdapter
pub fn with_event_channel( client: Arc<dyn LlmClient>, model: String, event_tx: Sender<AgentEvent>, ) -> LlmClientAdapter
Create an adapter with streaming event support.
Sourcepub fn with_provider_params(
self,
params: Option<ProviderTag>,
) -> LlmClientAdapter
pub fn with_provider_params( self, params: Option<ProviderTag>, ) -> LlmClientAdapter
Set default typed provider-specific parameters to apply on every
request. Per-call typed overrides from
AgentLlmClient::stream_response take precedence when present.
Sourcepub fn with_event_tap(
self,
tap: Arc<Mutex<RawMutex, Option<EventTapState>>>,
) -> LlmClientAdapter
pub fn with_event_tap( self, tap: Arc<Mutex<RawMutex, Option<EventTapState>>>, ) -> LlmClientAdapter
Set the event tap for interaction-scoped streaming.
Trait Implementations§
Source§impl AgentLlmClient for LlmClientAdapter
impl AgentLlmClient for LlmClientAdapter
Source§fn stream_response<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [Arc<ToolDef>],
max_tokens: u32,
temperature: Option<f32>,
provider_params: Option<&'life3 ProviderParamsOverride>,
) -> Pin<Box<dyn Future<Output = Result<LlmStreamResult, AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
LlmClientAdapter: 'async_trait,
fn stream_response<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [Arc<ToolDef>],
max_tokens: u32,
temperature: Option<f32>,
provider_params: Option<&'life3 ProviderParamsOverride>,
) -> Pin<Box<dyn Future<Output = Result<LlmStreamResult, AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
LlmClientAdapter: 'async_trait,
Stream a response from the LLM
Source§fn compile_schema(
&self,
output_schema: &OutputSchema,
) -> Result<CompiledSchema, SchemaError>
fn compile_schema( &self, output_schema: &OutputSchema, ) -> Result<CompiledSchema, SchemaError>
Compile an output schema for this provider. Read more
Source§impl Clone for LlmClientAdapter
impl Clone for LlmClientAdapter
Source§fn clone(&self) -> LlmClientAdapter
fn clone(&self) -> LlmClientAdapter
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for LlmClientAdapter
impl !RefUnwindSafe for LlmClientAdapter
impl Send for LlmClientAdapter
impl Sync for LlmClientAdapter
impl Unpin for LlmClientAdapter
impl UnsafeUnpin for LlmClientAdapter
impl !UnwindSafe for LlmClientAdapter
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