Skip to content

Commit

Permalink
add: TASK_TEXT_SUMMARIZATION_SEGMENT
Browse files Browse the repository at this point in the history
  • Loading branch information
namwoam committed Jul 12, 2024
1 parent b47bd3b commit 77c9ab3
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 11 deletions.
3 changes: 2 additions & 1 deletion ai/ai21labs/v0/config/definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"availableTasks": [
"TASK_TEXT_GENERATION_CHAT",
"TASK_CONTEXTUAL_ANSWERING",
"TASK_TEXT_SUMMARIZATION"
"TASK_TEXT_SUMMARIZATION",
"TASK_TEXT_SUMMARIZATION_SEGMENT"
],
"custom": false,
"documentationUrl": "https://www.instill.tech/docs/component/ai/ai21labs",
Expand Down
126 changes: 126 additions & 0 deletions ai/ai21labs/v0/config/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -461,5 +461,131 @@
"title": "Output",
"type": "object"
}
},
"TASK_TEXT_SUMMARIZATION_SEGMENT": {
"instillShortDescription": "Summarize text content by segments",
"description": "AI21 Studio's summarize models offer access to our world-class summarization engine. They have been specifically developed for providing a faithful summary of documents, meeting and call transcripts, chat correspondences, and more.",
"input": {
"description": "Input",
"instillEditOnNodeFields": [
"text",
"source"
],
"instillUIOrder": 0,
"properties": {
"text": {
"description": "The text content to be summarized",
"instillAcceptFormats": [
"string"
],
"instillUIMultiline": true,
"instillUIOrder": 1,
"instillUpstreamTypes": [
"value",
"reference",
"template"
],
"title": "Text",
"type": "string"
},
"focus": {
"description": "The focus of the summary",
"instillAcceptFormats": [
"string"
],
"instillUIMultiline": true,
"instillUIOrder": 2,
"instillUpstreamTypes": [
"value",
"reference",
"template"
],
"title": "Focus",
"type": "string"
},
"source": {
"description": "Whether the text is plain text or from a URL",
"enum": [
"TEXT",
"URL"
],
"example": "TEXT",
"instillAcceptFormats": [
"string"
],
"instillUIOrder": 3,
"instillUpstreamTypes": [
"value"
],
"title": "Source",
"type": "string"
}
},
"required": [
"text",
"source"
],
"title": "Input",
"type": "object"
},
"output": {
"description": "Output",
"instillUIOrder": 0,
"properties": {
"summerizations": {
"instillFormat": "array:string",
"items": {
"instillFormat": "string",
"title": "Summary",
"type": "string"
},
"type": "array",
"description": "Summeries for each segment of the input text",
"instillUIOrder": 0,
"title": "Summaries"
},
"segments": {
"instillFormat": "array:string",
"items": {
"instillFormat": "string",
"title": "Segemnt Text",
"type": "string"
},
"type": "array",
"description": "Origanl text for each segment of the input text",
"instillUIOrder": 0,
"title": "Segment Text"
},
"segment-htmls": {
"instillFormat": "array:string",
"items": {
"instillFormat": "string",
"title": "Segment HTML",
"type": "string"
},
"type": "array",
"description": "HTML for each segment of the input text",
"instillUIOrder": 0,
"title": "Segment HTML"
},
"types": {
"instillFormat": "array:string",
"items": {
"instillFormat": "string",
"title": "Segment Type",
"type": "string"
},
"type": "array",
"description": "Type of each segment of the input text",
"instillUIOrder": 0,
"title": "Segment Type"
}
},
"required": [
"summerizations"
],
"title": "Output",
"type": "object"
}
}
}
10 changes: 0 additions & 10 deletions ai/ai21labs/v0/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,6 @@ func (c *component) CreateExecution(sysVars map[string]any, setup *structpb.Stru
usesInstillCredentials: resolved,
}
switch task {
/**
"TASK_CONTEXTUAL_ANSWERING",
"TASK_SUMMARIZATION",
"TASK_SUMMARIZATION_SEGMENT",
"TASK_PARAPHRASING",
"TASK_GRAMMAR_CHECK",
"TASK_TEXT_IMPROVEMENT",
"TASK_TEXT_SEGMENTATION",
"TASK_TEXT_EMBEDDINGS"
*/
case "TASK_TEXT_GENERATION_CHAT":
e.execute = e.TaskTextGenerationChat
case "TASK_CONTEXTUAL_ANSWERING":
Expand Down

0 comments on commit 77c9ab3

Please sign in to comment.