pub struct LlmClientAdapter { /* private fields */ }Expand description
Adapt a generic Arc<dyn LlmClient> into the narrow
ExtractMemoriesLlm surface so the boot loop can construct
an ExtractMemories from any provider’s concrete client.
The adapter packages the system prompt + serialized
transcript into a ChatRequest, calls the upstream LLM, and
pulls the first ResponseContent::Text block out. The trait’s
max_tokens argument lands on ChatRequest::max_tokens so
the extractor’s per-call cap reaches the provider — important
when the conversation is long and the extract prompt itself
already consumed a lot of input tokens.
Provider-agnostic: the adapter has no Anthropic / MiniMax /
OpenAI / Gemini / DeepSeek / xAI / Mistral specifics. Switch
the underlying LlmClient impl at agent boot and the same
extract behaviour runs unchanged.
Splitting via LlmClientAdapter keeps the trait surface narrow
and lets the driver-loop crate stay decoupled from the binary’s
LlmAgentBehavior call sites.
Implementations§
Trait Implementations§
Source§impl ExtractMemoriesLlm for LlmClientAdapter
impl ExtractMemoriesLlm for LlmClientAdapter
Source§fn chat<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
system_prompt: &'life1 str,
user_messages: &'life2 str,
max_tokens: u32,
) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn chat<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
system_prompt: &'life1 str,
user_messages: &'life2 str,
max_tokens: u32,
) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Auto 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
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>
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>
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 more