pub struct Specialist {
pub name: String,
pub provider: String,
pub model: String,
pub system_prompt: String,
pub tools: Vec<String>,
pub constraint: Option<String>,
pub reasoning: Reasoning,
pub stream: bool,
}Expand description
A defined specialist (spawningpool define specialist): the (provider, model, system prompt,
tools) template that gets instantiated with a user prompt and called.
Fields§
§name: String§provider: StringReferences a ProviderDef by name.
model: StringReferences a ModelDef by id.
system_prompt: String§tools: Vec<String>References ToolDefs by name.
constraint: Option<String>A tool the model is forced to call (via the tool-call trick, or true constrained decoding when the provider declares it). Consumed when the specialist is run, not when its context is built.
reasoning: Reasoning§stream: boolStream the response incrementally rather than awaiting the full completion. A property of the specialist, not a per-run flag.
Implementations§
Source§impl Specialist
impl Specialist
Sourcepub fn complete_options(&self) -> CompleteOptions
pub fn complete_options(&self) -> CompleteOptions
The per-request options this specialist implies: its reasoning effort and,
from Specialist::constraint, a forced tool choice. max_tokens and
api_key are left at their defaults for the caller to fill in.
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
A specialist exposes EITHER a set of freely-callable Specialist::tools
(the model decides what to call, and the runner loops until it stops) OR a
single forced Specialist::constraint (one guaranteed call) — never
both. A forced tool can’t be combined with cursory ones at the provider
level, so this rejects the clash up front rather than producing a request
the model can’t satisfy.
A constraint is also incompatible with reasoning: a forced tool_choice
combined with extended thinking is rejected by Anthropic (see
crate::ai::CompleteOptions::tool_choice), so this rejects the pairing
at define time instead of letting it fail as a runtime API error.
Sourcepub fn tool_names(&self) -> &[String]
pub fn tool_names(&self) -> &[String]
The tools to expose to the model: the freely-callable Specialist::tools,
or — when a Specialist::constraint is set — just that single forced
tool. A forced tool_choice requires its tool to be present in the
request, so the constraint case still needs the tool resolved.
Trait Implementations§
Source§impl Clone for Specialist
impl Clone for Specialist
Source§impl Debug for Specialist
impl Debug for Specialist
Source§impl<'de> Deserialize<'de> for Specialist
impl<'de> Deserialize<'de> for Specialist
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Specialist
Source§impl PartialEq for Specialist
impl PartialEq for Specialist
Source§impl Serialize for Specialist
impl Serialize for Specialist
impl StructuralPartialEq for Specialist
Auto Trait Implementations§
impl Forget for Specialist
impl Freeze for Specialist
impl RefUnwindSafe for Specialist
impl Send for Specialist
impl Sync for Specialist
impl Unpin for Specialist
impl UnsafeUnpin for Specialist
impl UnwindSafe for Specialist
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.