pub struct TaskSchema {
pub entities: Option<EntityTask>,
pub classifications: Vec<ClassificationTask>,
pub structures: Vec<StructureTask>,
}Expand description
Schema defining what to extract.
Use builder methods to construct complex schemas:
ⓘ
let schema = TaskSchema::new()
.with_entities(&["person", "organization"])
.with_classification("sentiment", &["positive", "negative"], false)
.with_structure(
StructureTask::new("product")
.with_field("name", FieldType::String)
.with_field("price", FieldType::String)
);Fields§
§entities: Option<EntityTask>Entity types to extract
classifications: Vec<ClassificationTask>Classification tasks
structures: Vec<StructureTask>Structure extraction tasks
Implementations§
Source§impl TaskSchema
impl TaskSchema
Sourcepub fn with_entities(self, types: &[&str]) -> Self
pub fn with_entities(self, types: &[&str]) -> Self
Add entity types to extract.
Sourcepub fn with_entities_described(
self,
types_with_desc: HashMap<String, String>,
) -> Self
pub fn with_entities_described( self, types_with_desc: HashMap<String, String>, ) -> Self
Add entity types with descriptions for better zero-shot.
Sourcepub fn with_classification(
self,
name: &str,
labels: &[&str],
multi_label: bool,
) -> Self
pub fn with_classification( self, name: &str, labels: &[&str], multi_label: bool, ) -> Self
Add a classification task.
Sourcepub fn with_structure(self, task: StructureTask) -> Self
pub fn with_structure(self, task: StructureTask) -> Self
Add a structure extraction task.
Trait Implementations§
Source§impl Clone for TaskSchema
impl Clone for TaskSchema
Source§fn clone(&self) -> TaskSchema
fn clone(&self) -> TaskSchema
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TaskSchema
impl Debug for TaskSchema
Source§impl Default for TaskSchema
impl Default for TaskSchema
Source§fn default() -> TaskSchema
fn default() -> TaskSchema
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for TaskSchema
impl<'de> Deserialize<'de> for TaskSchema
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TaskSchema
impl RefUnwindSafe for TaskSchema
impl Send for TaskSchema
impl Sync for TaskSchema
impl Unpin for TaskSchema
impl UnsafeUnpin for TaskSchema
impl UnwindSafe for TaskSchema
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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