Skip to main content

Model

This is ready-to-use AI model.

Declaration

final class Model

Overview

The Model class represents a ready to use AI Model on the aiXplain Platform. It provides functionality to run the Model and handle its execution.

Usage

  1. Initialize a Model object with the necessary parameters.
  2. Call the run(_:id:parameters:) method to execute the pipeline.

Example

let model = ModelProvider.get("ModelID")
let input = "Hello World"
do {
let output = try await model.run(input)
// Handle model output
} catch {
// Handle errors
}

Topics

Initializers

init(from: Decoder) throws

Creates a new Model instance from the provided decoder. Mainly used to decode JSON data.

init(id: String, name: String, description: String, supplier: Supplier, version: String, license: License?, privacy: Privacy?, pricing: Pricing, networking: Networking)

Creates a new MLModel instance with the provided parameters.

Instance Properties

var description: String

var id: String

Unique identifier for the model.

let license: License?

Optional license information associated with the model.

let modelDescription: String

Description of the model’s functionality.

let name: String

Name of the model.

let pricing: Pricing

Information about the model’s pricing.

let privacy: Privacy?

Optional privacy information associated with the model.

let supplier: Supplier

The entity that provides the model.

let version: String

Version of the model.

Instance Methods

func run(ModelInput, id: String, parameters: ModelRunParameters) async throws -> ModelOutput