Skip to main content

DynamicGenerationSchema

Enum DynamicGenerationSchema 

Source
pub enum DynamicGenerationSchema {
Show 13 variants Object { name: String, description: Option<String>, represent_nil_explicitly_in_generated_content: bool, properties: BTreeMap<String, DynamicGenerationProperty>, }, Array { item: Box<DynamicGenerationSchema>, minimum_elements: Option<usize>, maximum_elements: Option<usize>, guides: Vec<GenerationGuide>, }, AnyOf { name: String, description: Option<String>, choices: Vec<DynamicGenerationSchema>, }, AnyOfStrings { name: String, description: Option<String>, choices: Vec<String>, }, String { description: Option<String>, guides: Vec<GenerationGuide>, }, Integer { description: Option<String>, guides: Vec<GenerationGuide>, }, Float { description: Option<String>, guides: Vec<GenerationGuide>, }, Number { description: Option<String>, guides: Vec<GenerationGuide>, }, Decimal { description: Option<String>, guides: Vec<GenerationGuide>, }, Boolean { description: Option<String>, }, GeneratedContent { description: Option<String>, }, Reference { name: String, }, Null,
}
Expand description

A dynamic FoundationModels schema description.

Variants§

§

Object

Fields

§name: String
§description: Option<String>
§represent_nil_explicitly_in_generated_content: bool
§

Array

Fields

§minimum_elements: Option<usize>
§maximum_elements: Option<usize>
§

AnyOf

Fields

§name: String
§description: Option<String>
§

AnyOfStrings

Fields

§name: String
§description: Option<String>
§choices: Vec<String>
§

String

Fields

§description: Option<String>
§

Integer

Fields

§description: Option<String>
§

Float

Fields

§description: Option<String>
§

Number

Fields

§description: Option<String>
§

Decimal

Fields

§description: Option<String>
§

Boolean

Fields

§description: Option<String>
§

GeneratedContent

Fields

§description: Option<String>
§

Reference

Fields

§name: String
§

Null

Implementations§

Source§

impl DynamicGenerationSchema

Source

pub const NULL: Self = Self::Null

The SDK’s typed DynamicGenerationSchema.null marker.

Source

pub fn object(name: impl Into<String>) -> Self

Create an object schema.

Source

pub fn new_with_nil_repr( name: impl Into<String>, description: Option<String>, represent_nil_explicitly_in_generated_content: bool, properties: impl IntoIterator<Item = (impl Into<String>, DynamicGenerationProperty)>, ) -> Self

Create an object schema that keeps optional properties as explicit nulls.

Source

pub const fn null() -> Self

Create the SDK’s typed DynamicGenerationSchema.null marker.

Source

pub fn string() -> Self

Create a string schema.

Source

pub fn integer() -> Self

Create an integer schema.

Source

pub fn float() -> Self

Create a floating-point schema.

Source

pub fn number() -> Self

Create a number schema.

Source

pub fn decimal() -> Self

Create a decimal schema.

Source

pub fn boolean() -> Self

Create a boolean schema.

Source

pub fn generated_content() -> Self

Create an arbitrary-JSON schema.

Source

pub fn array_of(item: Self) -> Self

Create an array schema.

Source

pub fn reference(name: impl Into<String>) -> Self

Create a reference to a named dependency.

Source

pub fn any_of(name: impl Into<String>, choices: Vec<Self>) -> Self

Create a named union of schemas.

Source

pub fn any_of_strings( name: impl Into<String>, choices: impl IntoIterator<Item = impl Into<String>>, ) -> Self

Create a named union of constant string choices.

Source

pub fn with_description(self, description: impl Into<String>) -> Self

Attach a description.

Source

pub fn with_property( self, name: impl Into<String>, property: DynamicGenerationProperty, ) -> Self

Add a property to an object schema.

Source

pub fn with_element_bounds( self, minimum: Option<usize>, maximum: Option<usize>, ) -> Self

Set the array bounds.

Source

pub fn with_guides( self, guides: impl IntoIterator<Item = GenerationGuide>, ) -> Self

Attach FoundationModels generation guides.

Trait Implementations§

Source§

impl Clone for DynamicGenerationSchema

Source§

fn clone(&self) -> DynamicGenerationSchema

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 DynamicGenerationSchema

Source§

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

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

impl PartialEq for DynamicGenerationSchema

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for DynamicGenerationSchema

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<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, 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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.