Struct LlmStarter
pub struct LlmStarter { /* private fields */ }Expand description
The start-only half of an LlmAgent: it turns the first user message
into the Conversation a run starts with, and needs neither a model nor
tools.
Register it with RuntimeBuilder::starter on a process that only accepts
requests, under the name of the LlmAgent that steps the runs on a
worker. init accepts exactly what LlmAgent::init accepts (payload
{"text": "..."} or a bare JSON string) and rejects what it rejects. So does
init_continuing, which carries the prior run’s conversation over exactly as
LlmAgent::init_continuing does (Conversation::continued).
Implementations§
§impl LlmStarter
impl LlmStarter
pub fn new(name: impl Into<String>) -> LlmStarter
pub fn new(name: impl Into<String>) -> LlmStarter
A starter for the agent called name.
Trait Implementations§
§impl AgentStarter for LlmStarter
impl AgentStarter for LlmStarter
§type State = Conversation
type State = Conversation
The state a new run starts with, stored as JSON. It is the same type as
the [
Agent::State] of the agent that steps the run, and so it decodes
too: a run that continues another starts from the prior run’s stored
state.§fn name(&self) -> &str
fn name(&self) -> &str
Stable name, stored as
RunRecord::agent. Equal to the name of the
[Agent] that steps these runs.§fn init(&self, input: Inbound) -> Result<Conversation, AgentError>
fn init(&self, input: Inbound) -> Result<Conversation, AgentError>
Initial state for a new run.
§fn init_continuing(
&self,
input: Inbound,
prior: &Conversation,
prior_run: RunId,
) -> Result<Conversation, AgentError>
fn init_continuing( &self, input: Inbound, prior: &Conversation, prior_run: RunId, ) -> Result<Conversation, AgentError>
Initial state for a new run that continues run
prior_run: the start-only half of
[Agent::init_continuing], and it must return what that does. The default ignores
prior and returns self.init(input).§fn split(&self, state: &Conversation) -> Option<(Conversation, Vec<Value>)>
fn split(&self, state: &Conversation) -> Option<(Conversation, Vec<Value>)>
The start-only half of [
Agent::split]: it must return what the agent of the same name
does, or a run it starts is never split. The default is [Agent::split]’s: no split. Read more§fn join(
&self,
head: Conversation,
rows: Vec<Value>,
) -> Result<Conversation, AgentError>
fn join( &self, head: Conversation, rows: Vec<Value>, ) -> Result<Conversation, AgentError>
The start-only half of [
Agent::join]: the inverse of split. The default
returns head, as [Agent::join]’s does.§impl Clone for LlmStarter
impl Clone for LlmStarter
§fn clone(&self) -> LlmStarter
fn clone(&self) -> LlmStarter
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 more§impl Debug for LlmStarter
impl Debug for LlmStarter
impl Eq for LlmStarter
§impl PartialEq for LlmStarter
impl PartialEq for LlmStarter
impl StructuralPartialEq for LlmStarter
Auto Trait Implementations§
impl Freeze for LlmStarter
impl RefUnwindSafe for LlmStarter
impl Send for LlmStarter
impl Sync for LlmStarter
impl Unpin for LlmStarter
impl UnsafeUnpin for LlmStarter
impl UnwindSafe for LlmStarter
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Apply a transformation to the response body. Read more
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using HTTP status codes. Read more
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using gRPC headers. Read more