Skip to content

Commit

Permalink
chore: add enbedding task
Browse files Browse the repository at this point in the history
  • Loading branch information
heiruwu committed Aug 20, 2024
1 parent 4a5d28f commit d7d89a0
Show file tree
Hide file tree
Showing 2 changed files with 308 additions and 1 deletion.
306 changes: 306 additions & 0 deletions schema/ai-tasks.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,258 @@
{
"TASK_EMBEDDING": {
"title": "Embedding",
"instillShortDescription": "Generate embeddings based on input data",
"input": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Embedding input",
"description": "Input schema of the embedding task",
"instillShortDescription": "Input schema of the embedding task",
"type": "object",
"properties": {
"data": {
"description": "Input data",
"instillShortDescription": "Input data",
"type": "object",
"properties": {
"model": {
"description": "The model to be used for generating embeddings.",
"instillShortDescription": "The model to be used.",
"instillAcceptFormats": [
"string"
],
"title": "Model Name",
"type": "string"
},
"input": {
"title": "Embedding Input",
"type": "array",
"items": {
"type": "object",
"properties": {
"content": {
"description": "The content to be embedded.",
"instillShortDescription": "The content to be embedded.",
"title": "Content",
"type": "array",
"items": {
"oneOf": [
{
"type": "object",
"properties": {
"text": {
"title": "Text content",
"description": "Text content to be embedded",
"instillShortDescription": "Text content",
"instillAcceptFormats": [
"string"
],
"type": "string"
},
"type": {
"title": "Content type",
"description": "Input content type.",
"instillShortDescription": "Input content type.",
"instillAcceptFormats": [
"string"
],
"type": "string",
"const": "text"
}
},
"required": [
"text",
"type"
]
},
{
"type": "object",
"properties": {
"image-url": {
"title": "Image url",
"description": "Image content with URL.",
"instillShortDescription": "Image content url.",
"instillAcceptFormats": [
"string"
],
"type": "string"
},
"type": {
"title": "Content type",
"description": "Input content type",
"instillShortDescription": "Input content type",
"instillAcceptFormats": [
"string"
],
"type": "string",
"const": "image-url"
}
},
"required": [
"image-url",
"type"
]
},
{
"type": "object",
"properties": {
"image-base64": {
"title": "Image base64",
"description": "Image content with base64 encoded string.",
"instillShortDescription": "Image content with base64 encoded string.",
"instillAcceptFormats": [
"string"
],
"type": "string"
},
"type": {
"title": "Content type",
"description": "Input content type",
"instillShortDescription": "Input content type",
"instillAcceptFormats": [
"string"
],
"type": "string",
"const": "image-base64"
}
},
"required": [
"image-base64",
"type"
]
}
]
}
}
},
"required": [
"content"
]
}
}
},
"required": [
"model",
"input"
]
},
"parameter": {
"description": "Input parameter",
"instillShortDescription": "Input parameter",
"type": "object",
"properties": {
"format": {
"title": "Data format",
"type": "string",
"description": "The data format of the embeddings. Defaults to float.",
"instillShortDescription": "Data format",
"instillAcceptFormats": [
"string"
],
"enum": [
"float",
"base64"
],
"default": "float"
},
"dimensions": {
"title": "Dimensions",
"type": "integer",
"description": "Number of dimensions in the output embedding vectors.",
"instillShortDescription": "Number of dimensions",
"instillAcceptFormats": [
"integer"
],
"default": 512
},
"input-type": {
"title": "Input type",
"type": "string",
"description": "The type of input data to be embedded (e.g., query, document).",
"instillShortDescription": "Type of input data",
"instillAcceptFormats": [
"string"
]
},
"truncate": {
"title": "Truncate",
"type": "string",
"description": "How to handle inputs longer than the max token length. Defaults to 'End'.",
"instillShortDescription": "Truncation handling",
"instillAcceptFormats": [
"string"
],
"enum": [
"None",
"End",
"Start"
],
"default": "End"
}
}
}
},
"required": [
"data"
]
},
"output": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Embedding output",
"description": "Output schema of the embedding task",
"instillShortDescription": "Output schema of the embedding task",
"type": "object",
"properties": {
"data": {
"description": "Output data",
"instillShortDescription": "Output data",
"type": "object",
"properties": {
"embeddings": {
"title": "Embeddings",
"type": "array",
"description": "List of generated embeddings.",
"instillShortDescription": "List of embeddings",
"instillFormat": "array",
"items": {
"type": "object",
"properties": {
"index": {
"title": "Index",
"type": "integer",
"description": "The index of the embedding vector in the array.",
"instillShortDescription": "Index in the array",
"instillFormat": "integer"
},
"vector": {
"title": "Embedding Vector",
"type": "array",
"description": "The embedding vector.",
"instillShortDescription": "Embedding vector",
"instillFormat": "array"
},
"created": {
"title": "Created",
"type": "integer",
"description": "The Unix timestamp (in seconds) of when the embedding was created.",
"instillShortDescription": "Timestamp of creation",
"instillFormat": "integer"
}
},
"required": [
"index",
"vector",
"created"
]
}
}
},
"required": [
"embeddings"
]
}
}
}
},
"TASK_CHAT": {
"title": "Chat",
"instillShortDescription": "Generate response base on conversation input",
Expand Down Expand Up @@ -1112,5 +1366,57 @@
"data"
]
}
},
"TASK_CUSTOM": {
"title": "Custom",
"instillShortDescription": "Custom, with arbitrary input/output data",
"input": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Custom input",
"description": "Input schema of the custom task",
"instillShortDescription": "Input schema of the custom task",
"type": "object",
"properties": {
"data": {
"description": "Input data",
"instillShortDescription": "Input data",
"type": "object",
"properties": {}
},
"parameter": {
"description": "Input parameter",
"instillShortDescription": "Input parameter",
"type": "object",
"properties": {}
}
},
"required": [
"data"
]
},
"output": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Custom output",
"description": "Output schema of the custom task",
"instillShortDescription": "Output schema of the custom task",
"type": "object",
"properties": {
"data": {
"description": "Output data",
"instillShortDescription": "Output data",
"type": "object",
"properties": {}
},
"metadata": {
"description": "Output metadata",
"instillShortDescription": "Output metadata",
"type": "object",
"properties": {}
}
},
"required": [
"data"
]
}
}
}
3 changes: 2 additions & 1 deletion schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"description": "Input image data.",
"instillShortDescription": "Input image data.",
"instillAcceptFormats": [
"string"
"string",
"image/*"
],
"type": "string"
},
Expand Down

0 comments on commit d7d89a0

Please sign in to comment.