TealConverse
@available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *)
class TealConverse
Class for model loading and prediction
-
Undocumented
Declaration
Swift
let model: MLModel -
URL of model assuming it was installed in the same bundle as this class
Declaration
Swift
class var urlOfModelInThisBundle: URL { get } -
Construct TealConverse instance with an existing MLModel object.
Usually the application does not use this initializer unless it makes a subclass of TealConverse. Such application may want to use
MLModel(contentsOfURL:configuration:)andTealConverse.urlOfModelInThisBundleto create a MLModel object to pass-in.Declaration
Swift
init(model: MLModel)Parameters
modelMLModel object
-
Construct TealConverse instance by automatically loading the model from the app’s bundle.
Declaration
Swift
@available(*, deprecated, message: "Use init(configuration:﹚ instead and handle errors appropriately.") convenience init() -
Construct a model with configuration
Throws
an NSError object that describes the problem
Declaration
Swift
@available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 5.0, *) convenience init(configuration: MLModelConfiguration) throwsParameters
configurationthe desired model configuration
-
Construct TealConverse instance with explicit path to mlmodelc file
Throws
an NSError object that describes the problem
Declaration
Swift
convenience init(contentsOf modelURL: URL) throwsParameters
modelURLthe file url of the model
-
Construct a model with URL of the .mlmodelc directory and configuration
Throws
an NSError object that describes the problem
Declaration
Swift
@available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 5.0, *) convenience init(contentsOf modelURL: URL, configuration: MLModelConfiguration) throwsParameters
modelURLthe file url of the model
configurationthe desired model configuration
-
Construct TealConverse instance asynchronously with optional configuration.
Model loading may take time when the model content is not immediately available (e.g. encrypted model). Use this factory method especially when the caller is on the main thread.
Declaration
Swift
@available(macOS 11.0, iOS 14.0, tvOS 14.0, watchOS 7.0, *) class func load(configuration: MLModelConfiguration = MLModelConfiguration(), completionHandler handler: @escaping (Swift.Result<TealConverse, Error>) -> Void)Parameters
configurationthe desired model configuration
handlerthe completion handler to be called when the model loading completes successfully or unsuccessfully
-
Construct TealConverse instance asynchronously with URL of the .mlmodelc directory with optional configuration.
Model loading may take time when the model content is not immediately available (e.g. encrypted model). Use this factory method especially when the caller is on the main thread.
Declaration
Swift
@available(macOS 11.0, iOS 14.0, tvOS 14.0, watchOS 7.0, *) class func load(contentsOf modelURL: URL, configuration: MLModelConfiguration = MLModelConfiguration(), completionHandler handler: @escaping (Swift.Result<TealConverse, Error>) -> Void)Parameters
modelURLthe URL to the model
configurationthe desired model configuration
handlerthe completion handler to be called when the model loading completes successfully or unsuccessfully
-
Make a prediction using the structured interface
Throws
an NSError object that describes the problem
Declaration
Swift
func prediction(input: TealConverseInput) throws -> TealConverseOutputParameters
inputthe input to the prediction as TealConverseInput
Return Value
the result of the prediction as TealConverseOutput
-
Make a prediction using the structured interface
Throws
an NSError object that describes the problem
Declaration
Swift
func prediction(input: TealConverseInput, options: MLPredictionOptions) throws -> TealConverseOutputParameters
inputthe input to the prediction as TealConverseInput
optionsprediction options
Return Value
the result of the prediction as TealConverseOutput
-
prediction(canEscape:nearExit: nearInput: inputActive: inputRelevant: requiresObject: requiresCostume: wearingCostume: hasObject: nearObject: allInputsActive: ) Make a prediction using the convenience interface
Throws
an NSError object that describes the problem
Declaration
Swift
func prediction(canEscape: String, nearExit: String, nearInput: String, inputActive: String, inputRelevant: String, requiresObject: String, requiresCostume: String, wearingCostume: String, hasObject: String, nearObject: String, allInputsActive: String) throws -> TealConverseOutputReturn Value
the result of the prediction as TealConverseOutput
-
Make a batch prediction using the structured interface
Throws
an NSError object that describes the problem
Declaration
Swift
@available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 5.0, *) func predictions(inputs: [TealConverseInput], options: MLPredictionOptions = MLPredictionOptions()) throws -> [TealConverseOutput]Parameters
inputsthe inputs to the prediction as [TealConverseInput]
optionsprediction options
Return Value
the result of the prediction as [TealConverseOutput]