pub enum Format {
Numerical(NumericalFormat),
Vector(VectorFormat),
Categorical(CategoricalFormat),
Selection(SelectionFormat),
Utterance(UtteranceFormat),
}Expand description
A question’s answer shape. from_json returns whichever kind the JSON names.
Variants§
Numerical(NumericalFormat)
Vector(VectorFormat)
Categorical(CategoricalFormat)
Selection(SelectionFormat)
Utterance(UtteranceFormat)
Implementations§
Source§impl Format
impl Format
pub fn instruction(&self) -> &str
pub fn tool(&self) -> &Tool
Sourcepub fn answer(&mut self, response: Value)
pub fn answer(&mut self, response: Value)
Sets the answer from its JSON; a value of the wrong shape clears it.
pub fn to_json(&self) -> Value
Sourcepub fn to_vector(&self) -> Vec<f64>
pub fn to_vector(&self) -> Vec<f64>
Returns a unit-length numerical representation of the format’s current response. Used by the research agent’s per-scope rank-dedup matrix to detect linearly-dependent rows (duplicates). Concatenated across an entity’s atomic fields, the resulting vector is the row’s identifier.
Contract: all implementations return a vector with L2 norm == 1 when a response is present. If the response is missing or empty, an implementation may return a zero-length array; callers MUST skip such fields when concatenating (they correspond to optional / unfilled fields and are excluded from the rank check).
pub async fn llm( &mut self, authorization: &CredentialsOrApiKey, model: Text, options: LlmOptions, ) -> Result<TextResponse>
pub fn get_response(&self) -> Option<Value>
pub fn optional(format: &Format) -> Format
pub fn calculate_distance(a: &Format, b: &Format) -> Result<f64>
pub fn from_json(json: &Value) -> Result<Format>
Auto Trait Implementations§
impl !RefUnwindSafe for Format
impl !UnwindSafe for Format
impl Forget for Format
impl Freeze for Formatwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Schema>: Freeze,
*const LeafNode<String, Schema> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Schema)>>: Freeze,
PhantomData<String>: Freeze,
*const Schema is !null: Freeze,
PhantomData<Value>: Freeze,
PhantomData<usize>: Freeze,
PhantomData<Bucket<String, Value>>: Freeze,
*const ArcInner<dyn Fn(Value, Arc<dyn Fn(Value) + Sync + Send>) -> Pin<Box<dyn Future<Output = Result<Map<String, Value>, Error>> + Send>> + Sync + Send> is !null: Freeze,
PhantomData<ArcInner<dyn Fn(Value, Arc<dyn Fn(Value) + Sync + Send>) -> Pin<Box<dyn Future<Output = Result<Map<String, Value>, Error>> + Send>> + Sync + Send>>: Freeze,
PhantomData<f64>: Freeze,
PhantomData<Option<[Option<f64>; 2]>>: Freeze,
impl Move for Format
impl Send for Formatwhere
RawVecInner: Send,
NodeRef<Owned, String, Schema, LeafOrInternal>: Send,
BoxRaw<(String, Schema)>: Send,
BoxRaw<Schema>: Send,
RawTable<usize>: Send,
Arc<dyn Fn(Value, Arc<dyn Fn(Value) + Sync + Send>) -> Pin<Box<dyn Future<Output = Result<Map<String, Value>, Error>> + Send>> + Sync + Send>: Send,
impl Sync for Formatwhere
RawVecInner: Sync,
NodeRef<Owned, String, Schema, LeafOrInternal>: Sync,
BoxRaw<(String, Schema)>: Sync,
BoxRaw<Schema>: Sync,
RawTable<usize>: Sync,
Arc<dyn Fn(Value, Arc<dyn Fn(Value) + Sync + Send>) -> Pin<Box<dyn Future<Output = Result<Map<String, Value>, Error>> + Send>> + Sync + Send>: Sync,
impl Unpin for Format
impl UnsafeUnpin for Formatwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Schema>: UnsafeUnpin,
*const LeafNode<String, Schema> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Schema)>>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
*const Schema is !null: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
PhantomData<usize>: UnsafeUnpin,
PhantomData<Bucket<String, Value>>: UnsafeUnpin,
*const ArcInner<dyn Fn(Value, Arc<dyn Fn(Value) + Sync + Send>) -> Pin<Box<dyn Future<Output = Result<Map<String, Value>, Error>> + Send>> + Sync + Send> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Fn(Value, Arc<dyn Fn(Value) + Sync + Send>) -> Pin<Box<dyn Future<Output = Result<Map<String, Value>, Error>> + Send>> + Sync + Send>>: UnsafeUnpin,
PhantomData<f64>: UnsafeUnpin,
PhantomData<Option<[Option<f64>; 2]>>: UnsafeUnpin,
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