pub struct ClassificationRequestBuilder {
pub classification_type: ClassificationType,
pub class: String,
pub classify_properties: Vec<String>,
pub based_on_properties: Option<Vec<String>>,
pub filters: Value,
pub settings: Option<Value>,
}Expand description
Builder for the ClassificationRequest
Fields§
§classification_type: ClassificationType§class: String§classify_properties: Vec<String>§based_on_properties: Option<Vec<String>>§filters: Value§settings: Option<Value>Implementations§
Source§impl ClassificationRequestBuilder
impl ClassificationRequestBuilder
Sourcepub fn new() -> ClassificationRequestBuilder
pub fn new() -> ClassificationRequestBuilder
Create a new builder for the ClassificationRequest.
This is the same as ClassificationRequestBuilder::new().
The resulting object will have no populated fields. These need filling out in accordance with the required classification type using the builder methods.
§Example
use weaviate_community::collections::classification::ClassificationRequestBuilder;
let builder = ClassificationRequestBuilder::new();Sourcepub fn with_type(
self,
classification_type: ClassificationType,
) -> ClassificationRequestBuilder
pub fn with_type( self, classification_type: ClassificationType, ) -> ClassificationRequestBuilder
Add a value to the classification_type property of the ClassificationRequest.
§Parameters
- classification_type: the classification_type to use for the property
§Example
use weaviate_community::collections::classification::{
ClassificationRequestBuilder,
ClassificationType
};
let builder = ClassificationRequestBuilder::new()
.with_type(ClassificationType::KNN);Sourcepub fn with_class(self, class_name: &str) -> ClassificationRequestBuilder
pub fn with_class(self, class_name: &str) -> ClassificationRequestBuilder
Add a value to the class property of the ClassificationRequest.
§Parameters
- class_name: the name of the class to run the classification on
§Example
use weaviate_community::collections::classification::ClassificationRequestBuilder;
let builder = ClassificationRequestBuilder::new()
.with_class("Article");Sourcepub fn with_classify_properties(
self,
classify_properties: Vec<&str>,
) -> ClassificationRequestBuilder
pub fn with_classify_properties( self, classify_properties: Vec<&str>, ) -> ClassificationRequestBuilder
Add a value to the classify_properties property of the ClassificationRequest.
§Parameters
- classify_properties: the properties to classify
§Example
use weaviate_community::collections::classification::ClassificationRequestBuilder;
let builder = ClassificationRequestBuilder::new()
.with_classify_properties(vec!["hasPopularity"]);Sourcepub fn with_based_on_properties(
self,
based_on_properties: Vec<&str>,
) -> ClassificationRequestBuilder
pub fn with_based_on_properties( self, based_on_properties: Vec<&str>, ) -> ClassificationRequestBuilder
Add a value to the based_on_properties property of the ClassificationRequest.
§Parameters
- based_on_properties: the ‘based on’ properties to classify against
§Example
use weaviate_community::collections::classification::ClassificationRequestBuilder;
let builder = ClassificationRequestBuilder::new()
.with_based_on_properties(vec!["summary"]);Sourcepub fn with_filters(self, filters: Value) -> ClassificationRequestBuilder
pub fn with_filters(self, filters: Value) -> ClassificationRequestBuilder
Add a value to the filters property of the ClassificationRequest.
§Parameters
- filters: the filters for the classifier to use when retrieving results
§Example
use weaviate_community::collections::classification::ClassificationRequestBuilder;
let builder = ClassificationRequestBuilder::new()
.with_filters(serde_json::json!(
{"path": ["wordCount"], "operator": "GreaterThan", "valueInt": 100}
));Sourcepub fn with_settings(self, settings: Value) -> ClassificationRequestBuilder
pub fn with_settings(self, settings: Value) -> ClassificationRequestBuilder
Add a value to the settings property of the ClassificationRequest.
§Parameters
- settings: the settings for the classifier
§Example
use weaviate_community::collections::classification::ClassificationRequestBuilder;
let builder = ClassificationRequestBuilder::new()
.with_settings(serde_json::json!({"k": 3}));Sourcepub fn build(self) -> ClassificationRequest
pub fn build(self) -> ClassificationRequest
Build the ClassificationRequest from the ClassificationRequestBuilder
§Example
Using ClassificationRequestBuilder
use weaviate_community::collections::classification::{
ClassificationRequestBuilder,
ClassificationType
};
let builder = ClassificationRequestBuilder::new()
.with_type(ClassificationType::KNN)
.with_class("Article")
.with_classify_properties(vec!["hasPopularity"])
.with_based_on_properties(vec!["summary"])
.with_filters(serde_json::json!(
{"path": ["wordCount"], "operator": "GreaterThan", "valueInt": 100}
))
.with_settings(serde_json::json!({"k": 3}))
.build();Using ClassificationRequest
use weaviate_community::collections::classification::{
ClassificationRequest,
ClassificationType
};
let builder = ClassificationRequest::builder()
.with_type(ClassificationType::KNN)
.with_class("Article")
.with_classify_properties(vec!["hasPopularity"])
.with_based_on_properties(vec!["summary"])
.with_filters(serde_json::json!(
{"path": ["wordCount"], "operator": "GreaterThan", "valueInt": 100}
))
.with_settings(serde_json::json!({"k": 3}))
.build();