Model

The Model component is an AI component that allows users to connect the AI models served on the Model Platform. It can carry out the following tasks:

#Release Stage

Alpha

#Configuration

The component definition and tasks are defined in the definition.yaml and tasks.yaml files respectively.

#Supported Tasks

#Classification

Classify images into predefined categories.

InputField IDTypeDescription
Task ID (required)taskstringTASK_CLASSIFICATION
Model Name (required)model-namestringThe Model model to be used.
Image (required)image-base64stringImage base64.
OutputField IDTypeDescription
CategorycategoryanyThe predicted category of the input.
ScorescoreanyThe confidence score of the predicted category of the input.

#Instance Segmentation

Detect, localize and delineate multiple objects in images.

InputField IDTypeDescription
Task ID (required)taskstringTASK_INSTANCE_SEGMENTATION
Model Name (required)model-namestringThe Model model to be used.
Image (required)image-base64stringImage base64.
OutputField IDTypeDescription
ObjectsobjectsanyA list of detected instance bounding boxes.

#Keypoint

Detect and localize multiple keypoints of objects in images.

InputField IDTypeDescription
Task ID (required)taskstringTASK_KEYPOINT
Model Name (required)model-namestringThe Model model to be used.
Image (required)image-base64stringImage base64.
OutputField IDTypeDescription
ObjectsobjectsanyA list of keypoint objects, a keypoint object includes all the pre-defined keypoints of a detected object.

#Detection

Detect and localize multiple objects in images.

InputField IDTypeDescription
Task ID (required)taskstringTASK_DETECTION
Model Name (required)model-namestringThe Model model to be used.
Image (required)image-base64stringImage base64.
OutputField IDTypeDescription
ObjectsobjectsanyA list of detected objects.

#OCR

Detect and recognize text in images.

InputField IDTypeDescription
Task ID (required)taskstringTASK_OCR
Model Name (required)model-namestringThe Model model to be used.
Image (required)image-base64stringImage base64.
OutputField IDTypeDescription
ObjectsobjectsanyA list of detected bounding boxes.

#Semantic Segmentation

Classify image pixels into predefined categories.

InputField IDTypeDescription
Task ID (required)taskstringTASK_SEMANTIC_SEGMENTATION
Model Name (required)model-namestringThe Model model to be used.
Image (required)image-base64stringImage base64.
OutputField IDTypeDescription
StuffsstuffsanyA list of RLE binary masks.

#Text Generation

Generate texts from input text prompts.

InputField IDTypeDescription
Task ID (required)taskstringTASK_TEXT_GENERATION
Model Name (required)model-namestringThe Model model to be used.
Prompt (required)promptstringThe prompt text.
System Messagesystem-messagestringThe system message helps set the behavior of the assistant. For example, you can modify the personality of the assistant or provide specific instructions about how it should behave throughout the conversation. By default, the model’s behavior is using a generic message as "You are a helpful assistant.".
SeedseedintegerThe seed.
TemperaturetemperaturenumberThe temperature for sampling.
Max New Tokensmax-new-tokensintegerThe maximum number of tokens for model to generate.
OutputField IDTypeDescription
TexttextstringText.

#Text Generation Chat

Generate texts from input text prompts and chat history.

InputField IDTypeDescription
Task ID (required)taskstringTASK_TEXT_GENERATION_CHAT
Model Name (required)model-namestringThe Model model to be used.
Prompt (required)promptstringThe prompt text.
System Messagesystem-messagestringThe system message helps set the behavior of the assistant. For example, you can modify the personality of the assistant or provide specific instructions about how it should behave throughout the conversation. By default, the model’s behavior is using a generic message as "You are a helpful assistant.".
Prompt Imagesprompt-imagesarray[string]The prompt images.
Chat Historychat-historyarray[object]Incorporate external chat history, specifically previous messages within the conversation. Please note that System Message will be ignored and will not have any effect when this field is populated. Each message should adhere to the format: {"role": "The message role, i.e. 'system', 'user' or 'assistant'", "content": "message content"}.
SeedseedintegerThe seed.
TemperaturetemperaturenumberThe temperature for sampling.
Max New Tokensmax-new-tokensintegerThe maximum number of tokens for model to generate.
Input Objects in Text Generation Chat

Chat History

Incorporate external chat history, specifically previous messages within the conversation. Please note that System Message will be ignored and will not have any effect when this field is populated. Each message should adhere to the format: {"role": "The message role, i.e. 'system', 'user' or 'assistant'", "content": "message content"}.

FieldField IDTypeNote
ContentcontentThe message content.
RolerolestringThe message role, i.e. 'system', 'user' or 'assistant'.
OutputField IDTypeDescription
TexttextstringText.

#Text to Image

Generate images from input text prompts.

InputField IDTypeDescription
Task ID (required)taskstringTASK_TEXT_TO_IMAGE
Model Name (required)model-namestringThe Model model to be used.
Prompt (required)promptstringThe prompt text.
SamplessamplesintegerThe number of generated samples, default is 1.
SeedseedintegerThe seed, default is 0.
Aspect Rationegative-promptstringKeywords of what you do not wish to see in the output image.
Aspect Ratioaspect-ratiostringControls the aspect ratio of the generated image. Defaults to 1:1.
Enum values
  • 16:9
  • 1:1
  • 21:9
  • 2:3
  • 3:2
  • 4:5
  • 5:4
  • 9:16
  • 9:21
OutputField IDTypeDescription
Imagesimagesarray[image/jpeg]Images.

#Visual Question Answering

Answer questions based on a prompt and an image.

InputField IDTypeDescription
Task ID (required)taskstringTASK_VISUAL_QUESTION_ANSWERING
Model Name (required)model-namestringThe Model model to be used.
Prompt (required)promptstringThe prompt text.
System Messagesystem-messagestringThe system message helps set the behavior of the assistant. For example, you can modify the personality of the assistant or provide specific instructions about how it should behave throughout the conversation. By default, the model’s behavior is using a generic message as "You are a helpful assistant.".
Prompt Imagesprompt-imagesarray[string]The prompt images.
Chat Historychat-historyarray[object]Incorporate external chat history, specifically previous messages within the conversation. Please note that System Message will be ignored and will not have any effect when this field is populated. Each message should adhere to the format: {"role": "The message role, i.e. 'system', 'user' or 'assistant'", "content": "message content"}.
SeedseedintegerThe seed.
TemperaturetemperaturenumberThe temperature for sampling.
Max New Tokensmax-new-tokensintegerThe maximum number of tokens for model to generate.
Input Objects in Visual Question Answering

Chat History

Incorporate external chat history, specifically previous messages within the conversation. Please note that System Message will be ignored and will not have any effect when this field is populated. Each message should adhere to the format: {"role": "The message role, i.e. 'system', 'user' or 'assistant'", "content": "message content"}.

FieldField IDTypeNote
ContentcontentThe message content.
RolerolestringThe message role, i.e. 'system', 'user' or 'assistant'.
OutputField IDTypeDescription
TexttextstringText.

#Chat

Generate texts from input text prompts and chat history.

InputField IDTypeDescription
Task ID (required)taskstringTASK_CHAT
Model Name (required)model-namestringThe Model model to be used.
Prompt (required)promptstringThe prompt text.
System Messagesystem-messagestringThe system message helps set the behavior of the assistant. For example, you can modify the personality of the assistant or provide specific instructions about how it should behave throughout the conversation. By default, the model’s behavior is using a generic message as "You are a helpful assistant.".
Prompt Imagesprompt-imagesarray[string]The prompt images.
Chat Historychat-historyarray[object]Incorporate external chat history, specifically previous messages within the conversation. Please note that System Message will be ignored and will not have any effect when this field is populated. Each message should adhere to the format: {"role": "The message role, i.e. 'system', 'user' or 'assistant'", "content": "message content"}.
SeedseedintegerThe seed.
TemperaturetemperaturenumberThe temperature for sampling.
Max New Tokensmax-new-tokensintegerThe maximum number of tokens for model to generate.
Input Objects in Chat

Chat History

Incorporate external chat history, specifically previous messages within the conversation. Please note that System Message will be ignored and will not have any effect when this field is populated. Each message should adhere to the format: {"role": "The message role, i.e. 'system', 'user' or 'assistant'", "content": "message content"}.

FieldField IDTypeNote
ContentcontentThe message content.
RolerolestringThe message role, i.e. 'system', 'user' or 'assistant'.
OutputField IDTypeDescription
TexttextstringText.

#Embedding

This task refers to the process of generating vector embeddings from input data, which can be text or images. This transformation converts the data into a dense, fixed-length numerical representation that captures the essential features of the original input. These embeddings are typically used in machine learning tasks to represent complex data in a more structured, simplified form.

InputField IDTypeDescription
Task ID (required)taskstringTASK_EMBEDDING
Data (required)dataobjectInput data.
ParameterparameterobjectInput parameter.
Input Objects in Embedding

Data

Input data.

FieldField IDTypeNote
EmbeddingsembeddingsarrayList of input data to be embedded.
ModelmodelstringThe model to be used for generating embeddings. It should be namespace/model-name/version. i.e. abrc/yolov7-stomata/v0.1.0. You can see the version from the Versions tab of Model page.

Parameter

Input parameter.

FieldField IDTypeNote
DimensionsdimensionsintegerNumber of dimensions in the output embedding vectors.
Data FormatformatstringThe data format of the embeddings. Defaults to float.
Enum values
  • float
  • base64
Input Typeinput-typestringThe type of input data to be embedded (e.g., query, document).
TruncatetruncatestringHow to handle inputs longer than the max token length. Defaults to 'End'.
Enum values
  • None
  • End
  • Start
The embeddings Object

Embeddings

embeddings must fulfill one of the following schemas:

Text
FieldField IDTypeNote
Text ContenttextstringWhen the input is text, the raw text is tokenized and processed into a dense, fixed-length vector that captures semantic information such as word meanings and relationships. These text embeddings enable tasks like sentiment analysis, search, or classification.
TexttypestringMust be "text"
Image URL
FieldField IDTypeNote
Image URLimage-urlstringWhen the input is an image from a URL, the image is first fetched from the URL and then decoded into its original format. It is then processed into a fixed-length vector representing essential visual features like shapes and colors. These image embeddings are useful for tasks like image classification or similarity search, providing structured numerical data for complex visual inputs.
Image URLtypestringMust be "image-url"
Image Base64
FieldField IDTypeNote
Image Fileimage-base64stringWhen the input is an image in base64 format, the base64-encoded data is first decoded into its original image form. The image is then processed and transformed into a dense, fixed-length numerical vector, capturing key visual features like shapes, colors, or textures.
Image FiletypestringMust be "image-base64"
OutputField IDTypeDescription
DatadataobjectOutput data.
Output Objects in Embedding

Data

FieldField IDTypeNote
EmbeddingsembeddingsarrayList of generated embeddings.

Embeddings

FieldField IDTypeNote
CreatedcreatedintegerThe Unix timestamp (in seconds) of when the embedding was created.
IndexindexintegerThe index of the embedding vector in the array.
Embedding VectorvectorarrayThe embedding vector.