Skip to main content

OutputSpec

Struct OutputSpec 

Source
pub struct OutputSpec {
    pub name: String,
    pub description: String,
    pub schema: Value,
    pub keeps_tools: bool,
}
Expand description

The shape a turn must answer in.

The three fields describing that shape are all load-bearing, so they arrive together through one constructor: a spec missing any of them would describe a tool the model cannot use. with_tools is a builder because what it says is not part of the shape — it is what the turn wearing that shape is allowed to do on its way to filling it in.

Fields§

§name: String

What the answering tool is called, as the model sees it — report or submit_findings rather than an internal identifier. mentra derives the tool’s actual name from this and makes it unique per call, so a run’s stream will not show this string verbatim.

§description: String

What the tool is for, in the imperative. The model reads this to decide what a complete answer looks like, so “one entry per problem you saw on the last turn” is worth more than “returns findings”.

Whether it may also ask for work is with_tools. By default the turn holds no tool but this one, so a description asking the model to go and read something describes work it cannot do — describe the answer, not a task. A turn that kept its tools has the opposite exposure, since nothing makes it stop working and answer, and this is where the condition for stopping belongs: “call this once you have read every changed file and have nothing further to check”.

§schema: Value

JSON Schema for the answer. The field descriptions in it are read by the model, not just validated against.

§keeps_tools: bool

Whether the turn keeps its ordinary tools while it answers. False unless with_tools says otherwise.

Implementations§

Source§

impl OutputSpec

Source

pub fn new( name: impl Into<String>, description: impl Into<String>, schema: Value, ) -> Self

Source

pub fn with_tools(self) -> Self

Lets the turn work before it answers, instead of only shaping what the conversation already holds.

A shaping turn asked for something it has not been told answers from nothing it looked at: well-formed, empty, and reported as a success. The way around that has been to spend two turns on every read-then-answer job, one to gather and one to shape. This spends one — the run keeps the whole toolset beside the terminal tool, works as many rounds as it needs, and ends the turn by calling it.

The cost is that nothing forces the ending. A model that works and then answers in prose, or that runs out of budget mid-gather, produces no value at all; PreparedRun::output says what comes back instead. Two turns also remain the better shape when the reading should not share a context with the answering — one reader per reviewer, as in examples/review_workflow.rs.

Source

pub fn reserve(self) -> OutputReservation

Reserve the exact generated output tool for one future validated run.

Reservation has no runtime side effect. The generated name is exposed so a host can identify protocol events before the run starts.

Trait Implementations§

Source§

impl Clone for OutputSpec

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OutputSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for OutputSpec

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for OutputSpec

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more