pub struct TurnRequest<'a> {
pub storage: Arc<dyn StorageAdapter>,
pub llm: LlmConfig,
pub max_iterations: u32,
pub conversation_id: &'a str,
pub request_id: &'a str,
pub user_message: &'a str,
pub access: AccessContext,
pub llm_provider: Option<Arc<dyn LlmProvider>>,
pub reranker: Option<Arc<dyn Reranker>>,
}Expand description
Everything one streaming turn needs. Bundled into a struct so the call sites
(the reference server’s handle_send_message and the lambda’s
send_message) stay readable and the security-critical access
field can never be silently dropped from a positional argument list.
Fields§
§storage: Arc<dyn StorageAdapter>The storage seam (conversations / messages / sessions / knowledge).
llm: LlmConfigThe resolved LLM config for this turn.
max_iterations: u32Agent-loop iteration cap.
conversation_id: &'a strThe conversation this turn belongs to.
request_id: &'a strThe protocol request id (streaming correlation).
user_message: &'a strThe inbound user message.
access: AccessContextThe requester’s document-level entitlements. Retrieval (the
auto-injected [Relevant knowledge] context AND the knowledge_search
tool) reads through storage.knowledge_for_access(&access), so a
restricted document is never surfaced to a requester who lacks the
entitlement. An AccessContext::anonymous sees only org-public docs
(fail closed for ACL’d content).
llm_provider: Option<Arc<dyn LlmProvider>>Optional test-injected LLM surface (a MockLlmClient) so the turn runs
deterministically offline. None in production (a live client is built
from llm).
reranker: Option<Arc<dyn Reranker>>Optional post-retrieval reranker (feature gap G8). When Some, the
knowledge_search tool overfetches candidates and reorders the top-K with
this reranker before they reach the model. None (the default) keeps the
retrieval order unchanged, so default behavior is byte-for-byte the same.
Selected by build_reranker.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for TurnRequest<'a>
impl<'a> !UnwindSafe for TurnRequest<'a>
impl<'a> Freeze for TurnRequest<'a>
impl<'a> Send for TurnRequest<'a>
impl<'a> Sync for TurnRequest<'a>
impl<'a> Unpin for TurnRequest<'a>
impl<'a> UnsafeUnpin for TurnRequest<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
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 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>
T in a tonic::Request