pub struct AssistantService { /* private fields */ }Expand description
A conversational assistant over one runtime, multiplexed by session_id.
Implementations§
Source§impl AssistantService
impl AssistantService
pub fn new( generator: Arc<dyn TurnGenerator>, runtime: Arc<Runtime>, cfg: AssistantConfig, system: String, ) -> Self
pub fn new_durable( generator: Arc<dyn TurnGenerator>, runtime: Arc<Runtime>, cfg: AssistantConfig, system: String, durability: Arc<dyn AssistantDurability>, repository_root: PathBuf, ) -> Self
Sourcepub fn cancel(&self, session_id: &str)
pub fn cancel(&self, session_id: &str)
Signal the session’s in-flight turn to stop before its next model call.
Sourcepub fn resolve_approval(&self, approval_id: &str, approved: bool) -> bool
pub fn resolve_approval(&self, approval_id: &str, approved: bool) -> bool
Resolve a pending approval (from an agent.chat.approve reverse-call).
Returns true if an approval by that id was waiting.
Sourcepub async fn handle_turn<E, Fut>(
&self,
session_id: &str,
prompt: &str,
attachments: Option<Vec<Value>>,
emit: E,
)
pub async fn handle_turn<E, Fut>( &self, session_id: &str, prompt: &str, attachments: Option<Vec<Value>>, emit: E, )
Run one chat turn for session_id, streaming agent.chat.event payloads
(each already stamped with session_id) through emit. Returns when the
turn reaches a terminal state. attachments are image ContentBlocks
(image_base64/image_url) forwarded to a vision model on the first
model call. The caller should have already acked the agent.chat request
and spawned this on its own task.
Sourcepub async fn handle_turn_with_model<E, Fut>(
&self,
session_id: &str,
prompt: &str,
attachments: Option<Vec<Value>>,
model: Option<&str>,
emit: E,
)
pub async fn handle_turn_with_model<E, Fut>( &self, session_id: &str, prompt: &str, attachments: Option<Vec<Value>>, model: Option<&str>, emit: E, )
Run one chat turn with an optional host-selected CAR model. A missing selector preserves the supervised agent’s configured model; a supplied selector is strict so the explicit native choice cannot silently fall back to a different model.
Sourcepub async fn handle_goal_turn<E, Fut>(
&self,
session_id: &str,
prompt: &str,
_attachments: Option<Vec<Value>>,
goal: ChatGoal,
emit: E,
)
pub async fn handle_goal_turn<E, Fut>( &self, session_id: &str, prompt: &str, _attachments: Option<Vec<Value>>, goal: ChatGoal, emit: E, )
Run one chat turn as a deterministic goal loop. The user prompt is the
pinned objective; completion is decided by goal.check exiting 0 through
the runtime, and every verifier pass streams goal_evaluated.
Auto Trait Implementations§
impl !Freeze for AssistantService
impl !RefUnwindSafe for AssistantService
impl !UnwindSafe for AssistantService
impl Send for AssistantService
impl Sync for AssistantService
impl Unpin for AssistantService
impl UnsafeUnpin for AssistantService
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
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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