From 13d5b2bb74ae6f24d233a31dc3d66f189af4f4b6 Mon Sep 17 00:00:00 2001 From: "Chang, Hui-Tang" Date: Thu, 26 Oct 2023 23:50:02 +0800 Subject: [PATCH] chore(huggingface): fix HuggingFace definition bug (#29) Because - missed the `model` config in definition - some small bugs in implementation This commit - fix HuggingFace definition bug --- go.mod | 2 +- go.sum | 4 +- pkg/airbyte/config/definitions.json | 286 ++++++------- .../config/seed/generate_definitions.py | 2 +- pkg/bigquery/config/definitions.json | 2 +- .../config/definitions.json | 4 +- pkg/huggingface/common.go | 9 +- pkg/huggingface/config/definitions.json | 7 +- pkg/huggingface/config/seed/tasks.json | 220 ++++++---- pkg/huggingface/config/tasks.json | 382 ++++++++++++------ pkg/huggingface/main.go | 120 +++--- pkg/instill/config/definitions.json | 2 +- pkg/numbers/config/definitions.json | 2 +- pkg/openai/config/definitions.json | 2 +- pkg/pinecone/config/definitions.json | 4 +- pkg/pinecone/config/tasks.json | 5 + pkg/stabilityai/config/definitions.json | 2 +- 17 files changed, 616 insertions(+), 439 deletions(-) diff --git a/go.mod b/go.mod index 9516305..fffde34 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/ghodss/yaml v1.0.0 github.com/gofrs/uuid v4.4.0+incompatible github.com/h2non/filetype v1.1.3 - github.com/instill-ai/component v0.6.0-alpha.0.20231026130206-961c654c4746 + github.com/instill-ai/component v0.6.0-alpha.0.20231026154255-a1903a066149 github.com/instill-ai/protogen-go v0.3.3-alpha.0.20231019202606-71607ddcd93f github.com/santhosh-tekuri/jsonschema/v5 v5.3.0 github.com/stretchr/testify v1.8.4 diff --git a/go.sum b/go.sum index 480f8fa..f53e1d3 100644 --- a/go.sum +++ b/go.sum @@ -124,8 +124,8 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.2 h1:I/pwhnUln5wbMnTyRbzswA0/JxpK github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.2/go.mod h1:lsuH8kb4GlMdSlI4alNIBBSAt5CHJtg3i+0WuN9J5YM= github.com/h2non/filetype v1.1.3 h1:FKkx9QbD7HR/zjK1Ia5XiBsq9zdLi5Kf3zGyFTAFkGg= github.com/h2non/filetype v1.1.3/go.mod h1:319b3zT68BvV+WRj7cwy856M2ehB3HqNOt6sy1HndBY= -github.com/instill-ai/component v0.6.0-alpha.0.20231026130206-961c654c4746 h1:HQ3YLmUjn5B0YU90dxAq4pvdQ7jZOnGLiQl4iydGfWY= -github.com/instill-ai/component v0.6.0-alpha.0.20231026130206-961c654c4746/go.mod h1:LAufWJ0hJGFaKhVMIES9XeN+TWdyOjDvAnV3Br6xKWs= +github.com/instill-ai/component v0.6.0-alpha.0.20231026154255-a1903a066149 h1:nxpyrka2zgbg2gtMliolzBpCZtUfatMWRi4MNXhPL28= +github.com/instill-ai/component v0.6.0-alpha.0.20231026154255-a1903a066149/go.mod h1:LAufWJ0hJGFaKhVMIES9XeN+TWdyOjDvAnV3Br6xKWs= github.com/instill-ai/protogen-go v0.3.3-alpha.0.20231019202606-71607ddcd93f h1:hweU93u6qsg8GH/YSogOfa+wOZEnkilGsijcy1xKX7E= github.com/instill-ai/protogen-go v0.3.3-alpha.0.20231019202606-71607ddcd93f/go.mod h1:q/YL5TZXD9nvmJ7Rih4gY3/B2HT2+GiFdxeZp9D+yE4= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= diff --git a/pkg/airbyte/config/definitions.json b/pkg/airbyte/config/definitions.json index 1ed797b..2f5d18d 100644 --- a/pkg/airbyte/config/definitions.json +++ b/pkg/airbyte/config/definitions.json @@ -15,11 +15,11 @@ "additionalProperties": false, "properties": { "access_key": { - "instillCredentialField": true, "description": "The Access Key ID of the AWS IAM Role to use for sending messages", "examples": [ "xxxxxHRNxxx3TBxxxxxx" ], + "instillCredentialField": true, "order": 3, "title": "AWS IAM Access Key ID", "type": "string" @@ -94,11 +94,11 @@ "type": "string" }, "secret_key": { - "instillCredentialField": true, "description": "The Secret Key of the AWS IAM Role to use for sending messages", "examples": [ "hu+qE5exxxxT6o/ZrKsxxxxxxBhxxXLexxxxxVKz" ], + "instillCredentialField": true, "order": 4, "title": "AWS IAM Secret Key", "type": "string" @@ -196,8 +196,8 @@ "type": "string" }, "role_arn": { - "instillCredentialField": false, "description": "Will assume this role to write data to s3", + "instillCredentialField": false, "title": "Target Role Arn", "type": "string" } @@ -212,14 +212,14 @@ { "properties": { "aws_access_key_id": { - "instillCredentialField": true, "description": "AWS User Access Key Id", + "instillCredentialField": true, "title": "Access Key Id", "type": "string" }, "aws_secret_access_key": { - "instillCredentialField": true, "description": "Secret Access Key", + "instillCredentialField": true, "title": "Secret Access Key", "type": "string" }, @@ -456,11 +456,11 @@ "additionalProperties": false, "properties": { "azure_blob_storage_account_key": { - "instillCredentialField": true, "description": "The Azure blob storage account key.", "examples": [ "Z8ZkZpteggFx394vm+PJHnGTvdRncaYS+JhLKdj789YNmD+iyGTnG+PV+POiuYNhBg/ACS+LKjd%4FG3FHGN12Nd==" ], + "instillCredentialField": true, "title": "Azure Blob Storage account key", "type": "string" }, @@ -653,9 +653,9 @@ }, "credentials_json": { "always_show": true, - "instillCredentialField": true, "description": "The contents of the JSON service account key. Check out the docs if you need help generating this key. Default credentials will be used if this field is left empty.", "group": "connection", + "instillCredentialField": true, "order": 4, "title": "Service Account Key JSON (Required for cloud, optional for open-source)", "type": "string" @@ -735,21 +735,21 @@ "type": "string" }, "hmac_key_access_id": { - "instillCredentialField": true, "description": "HMAC key access ID. When linked to a service account, this ID is 61 characters long; when linked to a user account, it is 24 characters long.", "examples": [ "1234567890abcdefghij1234" ], + "instillCredentialField": true, "order": 1, "title": "HMAC Key Access ID", "type": "string" }, "hmac_key_secret": { - "instillCredentialField": true, "description": "The corresponding secret for the access ID. It is a 40-character base-64 encoded string.", "examples": [ "1234567890abcdefghij1234567890ABCDEFGHIJ" ], + "instillCredentialField": true, "order": 2, "title": "HMAC Key Secret", "type": "string" @@ -958,8 +958,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "Password associated with Cassandra.", + "instillCredentialField": true, "order": 2, "title": "Password", "type": "string" @@ -1184,8 +1184,8 @@ "description": "Use a service that's compatible with the OpenAI API to embed text.", "properties": { "api_key": { - "instillCredentialField": true, "default": "", + "instillCredentialField": true, "title": "API key", "type": "string" }, @@ -1286,9 +1286,9 @@ "type": "string" }, "password": { - "instillCredentialField": true, "default": "", "description": "Password used in server/client mode only", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -1576,8 +1576,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "Password associated with the username.", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -1621,8 +1621,8 @@ { "properties": { "ssh_key": { - "instillCredentialField": true, "description": "OS-level user account ssh key credentials in RSA PEM format ( created with ssh-keygen -t rsa -m PEM -f myuser_rsa )", + "instillCredentialField": true, "multiline": true, "order": 4, "title": "SSH Private Key", @@ -1701,8 +1701,8 @@ "type": "string" }, "tunnel_user_password": { - "instillCredentialField": true, "description": "OS-level password for logging into the jump server host", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -1793,8 +1793,8 @@ "additionalProperties": false, "properties": { "access_key": { - "instillCredentialField": "true", "description": "API access key used to send data to a Convex deployment.", + "instillCredentialField": "true", "type": "string" }, "deployment_url": { @@ -1999,15 +1999,15 @@ "type": "string" }, "api_key": { - "instillCredentialField": true, "description": "An API key generated in Cumul.io's platform (can be generated here: https://app.cumul.io/start/profile/integration).", + "instillCredentialField": true, "order": 1, "title": "Cumul.io API Key", "type": "string" }, "api_token": { - "instillCredentialField": true, "description": "The corresponding API token generated in Cumul.io's platform (can be generated here: https://app.cumul.io/start/profile/integration).", + "instillCredentialField": true, "order": 2, "title": "Cumul.io API Token", "type": "string" @@ -2082,8 +2082,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "Password associated with the username.", + "instillCredentialField": true, "order": 6, "title": "Password", "type": "string" @@ -2215,11 +2215,11 @@ "type": "string" }, "s3_access_key_id": { - "instillCredentialField": true, "description": "The Access Key Id granting allow one to access the above S3 staging bucket. Airbyte requires Read and Write permissions to the given bucket.", "examples": [ "A012345678910EXAMPLE" ], + "instillCredentialField": true, "order": 5, "title": "S3 Access Key ID", "type": "string" @@ -2278,11 +2278,11 @@ "type": "string" }, "s3_secret_access_key": { - "instillCredentialField": true, "description": "The corresponding secret to the above access key id.", "examples": [ "a012345678910ABCDEFGH/AbCdEfGhEXAMPLEKEY" ], + "instillCredentialField": true, "order": 6, "title": "S3 Secret Access Key", "type": "string" @@ -2329,11 +2329,11 @@ "type": "string" }, "azure_blob_storage_sas_token": { - "instillCredentialField": true, "description": "Shared access signature (SAS) token to grant limited access to objects in your storage account.", "examples": [ "?sv=2016-05-31&ss=b&srt=sco&sp=rwdl&se=2018-06-27T10:05:50Z&st=2017-06-27T02:05:50Z&spr=https,http&sig=bgqQwoXwxzuD2GJfagRg7VOS8hzNr3QLT7rhS8OFRLQ%3D" ], + "instillCredentialField": true, "order": 4, "title": "SAS Token", "type": "string" @@ -2373,11 +2373,11 @@ "type": "string" }, "databricks_personal_access_token": { - "instillCredentialField": true, "description": "Databricks Personal Access Token for making authenticated requests.", "examples": [ "dapi0123456789abcdefghij0123456789AB" ], + "instillCredentialField": true, "order": 5, "title": "Access Token", "type": "string" @@ -2508,8 +2508,8 @@ "type": "integer" }, "password": { - "instillCredentialField": true, "description": "Password associated with the username.", + "instillCredentialField": true, "order": 5, "title": "Password", "type": "string" @@ -2615,8 +2615,8 @@ "type": "string" }, "motherduck_api_key": { - "instillCredentialField": true, "description": "API key to use for authentication to a MotherDuck database.", + "instillCredentialField": true, "title": "MotherDuck API Key", "type": "string" }, @@ -2682,11 +2682,11 @@ "additionalProperties": false, "properties": { "access_key_id": { - "instillCredentialField": true, "description": "The access key id to access the DynamoDB. Airbyte requires Read and Write permissions to the DynamoDB.", "examples": [ "A012345678910EXAMPLE" ], + "instillCredentialField": true, "title": "DynamoDB Key Id", "type": "string" }, @@ -2742,11 +2742,11 @@ "type": "string" }, "secret_access_key": { - "instillCredentialField": true, "description": "The corresponding secret to the access key id.", "examples": [ "a012345678910ABCDEFGH/AbCdEfGhEXAMPLEKEY" ], + "instillCredentialField": true, "title": "DynamoDB Access Key", "type": "string" } @@ -3085,8 +3085,8 @@ "type": "string" }, "apiKeySecret": { - "instillCredentialField": true, "description": "The secret associated with the API Key ID.", + "instillCredentialField": true, "title": "API Key Secret", "type": "string" }, @@ -3111,8 +3111,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "Basic auth password to access a secure Elasticsearch server", + "instillCredentialField": true, "title": "Password", "type": "string" }, @@ -3134,8 +3134,8 @@ "type": "object" }, "ca_certificate": { - "instillCredentialField": true, "description": "CA certificate", + "instillCredentialField": true, "multiline": true, "title": "CA certificate", "type": "string" @@ -3165,8 +3165,8 @@ { "properties": { "ssh_key": { - "instillCredentialField": true, "description": "OS-level user account ssh key credentials in RSA PEM format ( created with ssh-keygen -t rsa -m PEM -f myuser_rsa )", + "instillCredentialField": true, "multiline": true, "order": 4, "title": "SSH Private Key", @@ -3245,8 +3245,8 @@ "type": "string" }, "tunnel_user_password": { - "instillCredentialField": true, "description": "OS-level password for logging into the jump server host", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -3348,8 +3348,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "Password associated with the username.", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -3479,14 +3479,14 @@ "additionalProperties": false, "properties": { "aws_key_id": { - "instillCredentialField": true, "description": "AWS access key granting read and write access to S3.", + "instillCredentialField": true, "title": "AWS Key ID", "type": "string" }, "aws_key_secret": { - "instillCredentialField": true, "description": "Corresponding secret part of the AWS Key", + "instillCredentialField": true, "title": "AWS Key Secret", "type": "string" }, @@ -3522,8 +3522,8 @@ "type": "object" }, "password": { - "instillCredentialField": true, "description": "Firebolt password.", + "instillCredentialField": true, "order": 1, "title": "Password", "type": "string" @@ -3596,8 +3596,8 @@ "additionalProperties": false, "properties": { "credentials_json": { - "instillCredentialField": true, "description": "The contents of the JSON service account key. Check out the docs if you need help generating this key. Default credentials will be used if this field is left empty.", + "instillCredentialField": true, "title": "Credentials JSON", "type": "string" }, @@ -3673,21 +3673,21 @@ "type": "string" }, "hmac_key_access_id": { - "instillCredentialField": true, "description": "When linked to a service account, this ID is 61 characters long; when linked to a user account, it is 24 characters long. Read more here.", "examples": [ "1234567890abcdefghij1234" ], + "instillCredentialField": true, "order": 0, "title": "Access ID", "type": "string" }, "hmac_key_secret": { - "instillCredentialField": true, "description": "The corresponding secret for the access ID. It is a 40-character base-64 encoded string. Read more here.", "examples": [ "1234567890abcdefghij1234567890ABCDEFGHIJ" ], + "instillCredentialField": true, "order": 1, "title": "Secret", "type": "string" @@ -4173,20 +4173,20 @@ "description": "Google API Credentials for connecting to Google Sheets and Google Drive APIs", "properties": { "client_id": { - "instillCredentialField": true, "description": "The Client ID of your Google Sheets developer application.", + "instillCredentialField": true, "title": "Client ID", "type": "string" }, "client_secret": { - "instillCredentialField": true, "description": "The Client Secret of your Google Sheets developer application.", + "instillCredentialField": true, "title": "Client Secret", "type": "string" }, "refresh_token": { - "instillCredentialField": true, "description": "The token for obtaining new access token.", + "instillCredentialField": true, "title": "Refresh Token", "type": "string" } @@ -4416,8 +4416,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "Password associated with the username.", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -4454,19 +4454,19 @@ "type": "string" }, "rest_credential": { - "instillCredentialField": true, "examples": [ "username:password" ], + "instillCredentialField": true, "order": 2, "title": "A credential to exchange for a token in the OAuth2 client credentials flow.", "type": "string" }, "rest_token": { - "instillCredentialField": true, "examples": [ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" ], + "instillCredentialField": true, "order": 3, "title": "A Bearer token which will be used for interaction with the server.", "type": "string" @@ -4541,11 +4541,11 @@ "description": "S3 object storage", "properties": { "access_key_id": { - "instillCredentialField": true, "description": "The access key ID to access the S3 bucket. Airbyte requires Read and Write permissions to the given bucket. Read more here.", "examples": [ "A012345678910EXAMPLE" ], + "instillCredentialField": true, "order": 0, "title": "S3 Key ID", "type": "string" @@ -4617,11 +4617,11 @@ "type": "string" }, "secret_access_key": { - "instillCredentialField": true, "description": "The corresponding secret to the access key ID. Read more here", "examples": [ "a012345678910ABCDEFGH/AbCdEfGhEXAMPLEKEY" ], + "instillCredentialField": true, "order": 1, "title": "S3 Access Key", "type": "string" @@ -4865,9 +4865,9 @@ { "properties": { "sasl_jaas_config": { - "instillCredentialField": true, "default": "", "description": "JAAS login context parameters for SASL connections in the format used by JAAS configuration files.", + "instillCredentialField": true, "title": "SASL JAAS Config", "type": "string" }, @@ -4898,9 +4898,9 @@ { "properties": { "sasl_jaas_config": { - "instillCredentialField": true, "default": "", "description": "JAAS login context parameters for SASL connections in the format used by JAAS configuration files.", + "instillCredentialField": true, "title": "SASL JAAS Config", "type": "string" }, @@ -5081,11 +5081,11 @@ "additionalProperties": false, "properties": { "api_key": { - "instillCredentialField": true, "description": "To get Keen Master API Key, navigate to the Access tab from the left-hand, side panel and check the Project Details section.", "examples": [ "ABCDEFGHIJKLMNOPRSTUWXYZ" ], + "instillCredentialField": true, "title": "API Key", "type": "string" }, @@ -5160,8 +5160,8 @@ "additionalProperties": true, "properties": { "accessKey": { - "instillCredentialField": true, "description": "Generate the AWS Access Key for current user.", + "instillCredentialField": true, "order": 3, "title": "Access Key", "type": "string" @@ -5185,8 +5185,8 @@ "type": "string" }, "privateKey": { - "instillCredentialField": true, "description": "The AWS Private Key - a string of numbers and letters that are unique for each account, also known as a \"recovery phrase\".", + "instillCredentialField": true, "order": 4, "title": "Private Key", "type": "string" @@ -5616,8 +5616,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "The Password associated with the username.", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -5654,8 +5654,8 @@ { "properties": { "ssh_key": { - "instillCredentialField": true, "description": "OS-level user account ssh key credentials in RSA PEM format ( created with ssh-keygen -t rsa -m PEM -f myuser_rsa )", + "instillCredentialField": true, "multiline": true, "order": 4, "title": "SSH Private Key", @@ -5734,8 +5734,8 @@ "type": "string" }, "tunnel_user_password": { - "instillCredentialField": true, "description": "OS-level password for logging into the jump server host", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -5819,8 +5819,8 @@ "additionalProperties": false, "properties": { "api_key": { - "instillCredentialField": true, "description": "MeiliSearch API Key. See the docs for more information on how to obtain this key.", + "instillCredentialField": true, "order": 1, "title": "API Key", "type": "string" @@ -6045,8 +6045,8 @@ "type": "string" }, "openai_key": { - "instillCredentialField": true, "description": "The API key for your Azure OpenAI resource. You can find this in the Azure portal under your Azure OpenAI resource", + "instillCredentialField": true, "title": "Azure OpenAI API key", "type": "string" } @@ -6063,8 +6063,8 @@ "description": "Use a service that's compatible with the OpenAI API to embed text.", "properties": { "api_key": { - "instillCredentialField": true, "default": "", + "instillCredentialField": true, "title": "API key", "type": "string" }, @@ -6135,8 +6135,8 @@ "type": "string" }, "token": { - "instillCredentialField": true, "description": "API Token for the Milvus instance", + "instillCredentialField": true, "title": "API Token", "type": "string" } @@ -6160,8 +6160,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "Password for the Milvus instance", + "instillCredentialField": true, "order": 2, "title": "Password", "type": "string" @@ -6496,8 +6496,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "Password associated with the username.", + "instillCredentialField": true, "order": 2, "title": "Password", "type": "string" @@ -6650,8 +6650,8 @@ { "properties": { "ssh_key": { - "instillCredentialField": true, "description": "OS-level user account ssh key credentials in RSA PEM format ( created with ssh-keygen -t rsa -m PEM -f myuser_rsa )", + "instillCredentialField": true, "multiline": true, "order": 4, "title": "SSH Private Key", @@ -6730,8 +6730,8 @@ "type": "string" }, "tunnel_user_password": { - "instillCredentialField": true, "description": "OS-level password for logging into the jump server host", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -6859,8 +6859,8 @@ "type": "boolean" }, "password": { - "instillCredentialField": true, "description": "Password to use for the connection.", + "instillCredentialField": true, "title": "Password", "type": "string" }, @@ -6979,8 +6979,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "The password associated with this username.", + "instillCredentialField": true, "order": 5, "title": "Password", "type": "string" @@ -7097,8 +7097,8 @@ { "properties": { "ssh_key": { - "instillCredentialField": true, "description": "OS-level user account ssh key credentials in RSA PEM format ( created with ssh-keygen -t rsa -m PEM -f myuser_rsa )", + "instillCredentialField": true, "multiline": true, "order": 4, "title": "SSH Private Key", @@ -7177,8 +7177,8 @@ "type": "string" }, "tunnel_user_password": { - "instillCredentialField": true, "description": "OS-level password for logging into the jump server host", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -7288,8 +7288,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "Password associated with the username.", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -7333,8 +7333,8 @@ { "properties": { "ssh_key": { - "instillCredentialField": true, "description": "OS-level user account ssh key credentials in RSA PEM format ( created with ssh-keygen -t rsa -m PEM -f myuser_rsa )", + "instillCredentialField": true, "multiline": true, "order": 4, "title": "SSH Private Key", @@ -7413,8 +7413,8 @@ "type": "string" }, "tunnel_user_password": { - "instillCredentialField": true, "description": "OS-level password for logging into the jump server host", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -7563,8 +7563,8 @@ "type": "string" }, "ssl_certificate": { - "instillCredentialField": true, "description": "Privacy Enhanced Mail (PEM) files are concatenated certificate containers frequently used in certificate installations.", + "instillCredentialField": true, "multiline": true, "title": "SSL PEM file", "type": "string" @@ -7594,8 +7594,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "The password associated with the username.", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -7648,8 +7648,8 @@ { "properties": { "ssh_key": { - "instillCredentialField": true, "description": "OS-level user account ssh key credentials in RSA PEM format ( created with ssh-keygen -t rsa -m PEM -f myuser_rsa )", + "instillCredentialField": true, "multiline": true, "order": 4, "title": "SSH Private Key", @@ -7728,8 +7728,8 @@ "type": "string" }, "tunnel_user_password": { - "instillCredentialField": true, "description": "OS-level password for logging into the jump server host", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -7939,8 +7939,8 @@ "type": "string" }, "openai_key": { - "instillCredentialField": true, "description": "The API key for your Azure OpenAI resource. You can find this in the Azure portal under your Azure OpenAI resource", + "instillCredentialField": true, "title": "Azure OpenAI API key", "type": "string" } @@ -7957,8 +7957,8 @@ "description": "Use a service that's compatible with the OpenAI API to embed text.", "properties": { "api_key": { - "instillCredentialField": true, "default": "", + "instillCredentialField": true, "title": "API key", "type": "string" }, @@ -8028,8 +8028,8 @@ "type": "string" }, "pinecone_key": { - "instillCredentialField": true, "description": "The Pinecone API key to use matching the environment (copy from Pinecone console)", + "instillCredentialField": true, "title": "Pinecone API key", "type": "string" } @@ -8296,8 +8296,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "Password associated with the username.", + "instillCredentialField": true, "order": 5, "title": "Password", "type": "string" @@ -8415,16 +8415,16 @@ "description": "Verify-ca SSL mode.", "properties": { "ca_certificate": { - "instillCredentialField": true, "description": "CA certificate", + "instillCredentialField": true, "multiline": true, "order": 1, "title": "CA certificate", "type": "string" }, "client_key_password": { - "instillCredentialField": true, "description": "Password for keystorage. This field is optional. If you do not add it - the password will be generated automatically.", + "instillCredentialField": true, "order": 4, "title": "Client key password", "type": "string" @@ -8450,32 +8450,32 @@ "description": "Verify-full SSL mode.", "properties": { "ca_certificate": { - "instillCredentialField": true, "description": "CA certificate", + "instillCredentialField": true, "multiline": true, "order": 1, "title": "CA certificate", "type": "string" }, "client_certificate": { - "instillCredentialField": true, "description": "Client certificate", + "instillCredentialField": true, "multiline": true, "order": 2, "title": "Client certificate", "type": "string" }, "client_key": { - "instillCredentialField": true, "description": "Client key", + "instillCredentialField": true, "multiline": true, "order": 3, "title": "Client key", "type": "string" }, "client_key_password": { - "instillCredentialField": true, "description": "Password for keystorage. This field is optional. If you do not add it - the password will be generated automatically.", + "instillCredentialField": true, "order": 4, "title": "Client key password", "type": "string" @@ -8523,8 +8523,8 @@ { "properties": { "ssh_key": { - "instillCredentialField": true, "description": "OS-level user account ssh key credentials in RSA PEM format ( created with ssh-keygen -t rsa -m PEM -f myuser_rsa )", + "instillCredentialField": true, "multiline": true, "order": 4, "title": "SSH Private Key", @@ -8603,8 +8603,8 @@ "type": "string" }, "tunnel_user_password": { - "instillCredentialField": true, "description": "OS-level password for logging into the jump server host", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -8723,8 +8723,8 @@ "type": "integer" }, "credentials_json": { - "instillCredentialField": true, "description": "The contents of the JSON service account key. Check out the docs if you need help generating this key.", + "instillCredentialField": true, "title": "Credentials JSON", "type": "string" }, @@ -9153,8 +9153,8 @@ "type": "string" }, "openai_key": { - "instillCredentialField": true, "description": "The API key for your Azure OpenAI resource. You can find this in the Azure portal under your Azure OpenAI resource", + "instillCredentialField": true, "title": "Azure OpenAI API key", "type": "string" } @@ -9171,8 +9171,8 @@ "description": "Use a service that's compatible with the OpenAI API to embed text.", "properties": { "api_key": { - "instillCredentialField": true, "default": "", + "instillCredentialField": true, "title": "API key", "type": "string" }, @@ -9234,8 +9234,8 @@ { "properties": { "api_key": { - "instillCredentialField": true, "description": "API Key for the Qdrant instance", + "instillCredentialField": true, "title": "API Key", "type": "string" }, @@ -9564,11 +9564,11 @@ "$schema": "http://json-schema.org/draft-07/schema#", "properties": { "access_key_id": { - "instillCredentialField": true, "description": "The access key ID to access the R2 bucket. Airbyte requires Read and Write permissions to the given bucket. Read more here.", "examples": [ "A012345678910EXAMPLE" ], + "instillCredentialField": true, "order": 1, "title": "R2 Key ID *", "type": "string" @@ -9893,11 +9893,11 @@ "type": "string" }, "secret_access_key": { - "instillCredentialField": true, "description": "The corresponding secret to the access key ID. Read more here", "examples": [ "a012345678910ABCDEFGHAbCdEfGhEXAMPLEKEY" ], + "instillCredentialField": true, "order": 2, "title": "R2 Access Key *", "type": "string" @@ -9971,8 +9971,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "The password to connect.", + "instillCredentialField": true, "title": "Password", "type": "string" }, @@ -10072,8 +10072,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "Password associated with Redis.", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -10121,32 +10121,32 @@ "description": "Verify-full SSL mode.", "properties": { "ca_certificate": { - "instillCredentialField": true, "description": "CA certificate", + "instillCredentialField": true, "multiline": true, "order": 1, "title": "CA Certificate", "type": "string" }, "client_certificate": { - "instillCredentialField": true, "description": "Client certificate", + "instillCredentialField": true, "multiline": true, "order": 2, "title": "Client Certificate", "type": "string" }, "client_key": { - "instillCredentialField": true, "description": "Client key", + "instillCredentialField": true, "multiline": true, "order": 3, "title": "Client Key", "type": "string" }, "client_key_password": { - "instillCredentialField": true, "description": "Password for keystorage. If you do not add it - the password will be generated automatically.", + "instillCredentialField": true, "order": 4, "title": "Client key password", "type": "string" @@ -10194,8 +10194,8 @@ { "properties": { "ssh_key": { - "instillCredentialField": true, "description": "OS-level user account ssh key credentials in RSA PEM format ( created with ssh-keygen -t rsa -m PEM -f myuser_rsa )", + "instillCredentialField": true, "multiline": true, "order": 4, "title": "SSH Private Key", @@ -10274,8 +10274,8 @@ "type": "string" }, "tunnel_user_password": { - "instillCredentialField": true, "description": "OS-level password for logging into the jump server host", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -10518,9 +10518,9 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "Password associated with the username.", "group": "connection", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -10569,8 +10569,8 @@ { "properties": { "ssh_key": { - "instillCredentialField": true, "description": "OS-level user account ssh key credentials in RSA PEM format ( created with ssh-keygen -t rsa -m PEM -f myuser_rsa )", + "instillCredentialField": true, "multiline": true, "order": 4, "title": "SSH Private Key", @@ -10649,8 +10649,8 @@ "type": "string" }, "tunnel_user_password": { - "instillCredentialField": true, "description": "OS-level password for logging into the jump server host", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -10678,8 +10678,8 @@ "description": "(recommended) Uploads data to S3 and then uses a COPY to insert the data into Redshift. COPY is recommended for production workloads for better speed and scalability. See AWS docs for more details.", "properties": { "access_key_id": { - "instillCredentialField": true, "description": "This ID grants access to the above S3 staging bucket. Airbyte requires Read and Write permissions to the given bucket. See AWS docs on how to generate an access key ID and secret access key.", + "instillCredentialField": true, "title": "S3 Key Id", "type": "string" }, @@ -10719,8 +10719,8 @@ "type": "string" }, "key_encrypting_key": { - "instillCredentialField": true, "description": "The key, base64-encoded. Must be either 128, 192, or 256 bits. Leave blank to have Airbyte generate an ephemeral key for each sync.", + "instillCredentialField": true, "title": "Key", "type": "string" } @@ -10818,8 +10818,8 @@ "type": "string" }, "secret_access_key": { - "instillCredentialField": true, "description": "The corresponding secret to the above access key id. See AWS docs on how to generate an access key ID and secret access key.", + "instillCredentialField": true, "title": "S3 Access Key", "type": "string" } @@ -10935,29 +10935,29 @@ "additionalProperties": false, "properties": { "api_key": { - "instillCredentialField": true, "description": "Rockset api key", + "instillCredentialField": true, "order": 0, "title": "Api Key", "type": "string" }, "api_server": { - "instillCredentialField": false, "default": "https://api.rs2.usw2.rockset.com", "description": "Rockset api URL", + "instillCredentialField": false, "order": 2, "pattern": "^https:\\/\\/.*.rockset.com$", "title": "Api Server", "type": "string" }, "workspace": { - "instillCredentialField": false, "default": "commons", "description": "The Rockset workspace in which collections will be created + written to.", "examples": [ "commons", "my_workspace" ], + "instillCredentialField": false, "order": 1, "title": "Workspace", "type": "string" @@ -11018,11 +11018,11 @@ "$schema": "http://json-schema.org/draft-07/schema#", "properties": { "access_key_id": { - "instillCredentialField": true, "description": "The access key ID to access the S3 bucket. Airbyte requires Read and Write permissions to the given bucket. Read more here.", "examples": [ "A012345678910EXAMPLE" ], + "instillCredentialField": true, "order": 0, "title": "S3 Key ID", "type": "string" @@ -11200,11 +11200,11 @@ "type": "string" }, "secret_access_key": { - "instillCredentialField": true, "description": "The corresponding secret to the access key ID. Read more here", "examples": [ "a012345678910ABCDEFGH/AbCdEfGhEXAMPLEKEY" ], + "instillCredentialField": true, "order": 1, "title": "S3 Access Key", "type": "string" @@ -11269,11 +11269,11 @@ "$schema": "http://json-schema.org/draft-07/schema#", "properties": { "access_key_id": { - "instillCredentialField": true, "description": "The access key ID to access the S3 bucket. Airbyte requires Read and Write permissions to the given bucket. Read more here.", "examples": [ "A012345678910EXAMPLE" ], + "instillCredentialField": true, "order": 0, "title": "S3 Key ID", "type": "string" @@ -11717,11 +11717,11 @@ "type": "string" }, "secret_access_key": { - "instillCredentialField": true, "description": "The corresponding secret to the access key ID. Read more here", "examples": [ "a012345678910ABCDEFGH/AbCdEfGhEXAMPLEKEY" ], + "instillCredentialField": true, "order": 1, "title": "S3 Access Key", "type": "string" @@ -11807,8 +11807,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "Password associated with Scylla.", + "instillCredentialField": true, "order": 2, "title": "Password", "type": "string" @@ -11918,8 +11918,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "Password associated with the username.", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -12006,8 +12006,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "Password associated with the username.", + "instillCredentialField": true, "order": 3, "title": "Password", "type": "string" @@ -12110,8 +12110,8 @@ "order": 0, "properties": { "access_token": { - "instillCredentialField": true, "description": "Enter you application's Access Token", + "instillCredentialField": true, "title": "Access Token", "type": "string" }, @@ -12125,20 +12125,20 @@ "type": "string" }, "client_id": { - "instillCredentialField": true, "description": "Enter your application's Client ID", + "instillCredentialField": true, "title": "Client ID", "type": "string" }, "client_secret": { - "instillCredentialField": true, "description": "Enter your application's Client secret", + "instillCredentialField": true, "title": "Client Secret", "type": "string" }, "refresh_token": { - "instillCredentialField": true, "description": "Enter your application's Refresh Token", + "instillCredentialField": true, "title": "Refresh Token", "type": "string" } @@ -12163,15 +12163,15 @@ "type": "string" }, "private_key": { - "instillCredentialField": true, "description": "RSA Private key to use for Snowflake connection. See the docs for more information on how to obtain this key.", + "instillCredentialField": true, "multiline": true, "title": "Private Key", "type": "string" }, "private_key_password": { - "instillCredentialField": true, "description": "Passphrase for private key", + "instillCredentialField": true, "title": "Passphrase", "type": "string" } @@ -12195,8 +12195,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "Enter the password associated with the username.", + "instillCredentialField": true, "order": 1, "title": "Password", "type": "string" @@ -12510,11 +12510,11 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "Starburst Galaxy password for the specified user.", "examples": [ "password" ], + "instillCredentialField": true, "order": 5, "title": "Password", "type": "string" @@ -12559,11 +12559,11 @@ "type": "string" }, "s3_access_key_id": { - "instillCredentialField": true, "description": "Access key with access to the bucket. Airbyte requires read and write permissions to a given bucket.", "examples": [ "A012345678910EXAMPLE" ], + "instillCredentialField": true, "order": 4, "title": "Access key", "type": "string" @@ -12608,11 +12608,11 @@ "type": "string" }, "s3_secret_access_key": { - "instillCredentialField": true, "description": "Secret key used with the specified access key.", "examples": [ "a012345678910ABCDEFGH/AbCdEfGhEXAMPLEKEY" ], + "instillCredentialField": true, "order": 5, "title": "Secret key", "type": "string" @@ -12715,8 +12715,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "Password associated with the username.", + "instillCredentialField": true, "order": 2, "title": "Password", "type": "string" @@ -12831,8 +12831,8 @@ "type": "string" }, "ssl_ca_certificate": { - "instillCredentialField": true, "description": "Specifies the file name of a PEM file that contains Certificate Authority (CA) certificates for use with SSLMODE=verify-ca.\n See more information - in the docs.", + "instillCredentialField": true, "multiline": true, "order": 1, "title": "CA certificate", @@ -12859,8 +12859,8 @@ "type": "string" }, "ssl_ca_certificate": { - "instillCredentialField": true, "description": "Specifies the file name of a PEM file that contains Certificate Authority (CA) certificates for use with SSLMODE=verify-full.\n See more information - in the docs.", + "instillCredentialField": true, "multiline": true, "order": 1, "title": "CA certificate", @@ -12960,9 +12960,9 @@ "type": "string" }, "password": { - "instillCredentialField": true, "default": "", "description": "Password associated with the username.", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -13006,8 +13006,8 @@ { "properties": { "ssh_key": { - "instillCredentialField": true, "description": "OS-level user account ssh key credentials in RSA PEM format ( created with ssh-keygen -t rsa -m PEM -f myuser_rsa )", + "instillCredentialField": true, "multiline": true, "order": 4, "title": "SSH Private Key", @@ -13086,8 +13086,8 @@ "type": "string" }, "tunnel_user_password": { - "instillCredentialField": true, "description": "OS-level password for logging into the jump server host", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -13178,8 +13178,8 @@ "additionalProperties": false, "properties": { "apikey": { - "instillCredentialField": true, "description": "Personal API key", + "instillCredentialField": true, "order": 1, "title": "API key", "type": "string" @@ -13353,8 +13353,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "Password associated with the username.", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -13397,8 +13397,8 @@ { "properties": { "ssh_key": { - "instillCredentialField": true, "description": "OS-level user account ssh key credentials in RSA PEM format ( created with ssh-keygen -t rsa -m PEM -f myuser_rsa )", + "instillCredentialField": true, "multiline": true, "order": 4, "title": "SSH Private Key", @@ -13477,8 +13477,8 @@ "type": "string" }, "tunnel_user_password": { - "instillCredentialField": true, "description": "OS-level password for logging into the jump server host", + "instillCredentialField": true, "order": 4, "title": "Password", "type": "string" @@ -13643,8 +13643,8 @@ "type": "string" }, "openai_key": { - "instillCredentialField": true, "description": "The API key for your Azure OpenAI resource. You can find this in the Azure portal under your Azure OpenAI resource", + "instillCredentialField": true, "title": "Azure OpenAI API key", "type": "string" } @@ -13763,8 +13763,8 @@ "description": "Use a service that's compatible with the OpenAI API to embed text.", "properties": { "api_key": { - "instillCredentialField": true, "default": "", + "instillCredentialField": true, "title": "API key", "type": "string" }, @@ -13866,8 +13866,8 @@ "type": "string" }, "token": { - "instillCredentialField": true, "description": "API Token for the Weaviate instance", + "instillCredentialField": true, "title": "API Token", "type": "string" } @@ -13891,8 +13891,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "Password for the Weaviate cluster", + "instillCredentialField": true, "order": 2, "title": "Password", "type": "string" @@ -14205,8 +14205,8 @@ "additionalProperties": true, "properties": { "api_key": { - "instillCredentialField": true, "description": "API Key to connect.", + "instillCredentialField": true, "order": 0, "title": "API Key", "type": "string" @@ -14290,8 +14290,8 @@ "type": "string" }, "password": { - "instillCredentialField": true, "description": "The Password associated with the username.", + "instillCredentialField": true, "order": 5, "title": "Password", "type": "string" @@ -14384,8 +14384,8 @@ "additionalProperties": false, "properties": { "privateKey": { - "instillCredentialField": true, "description": "You private key on Streamr", + "instillCredentialField": true, "type": "string" }, "streamId": { diff --git a/pkg/airbyte/config/seed/generate_definitions.py b/pkg/airbyte/config/seed/generate_definitions.py index d561581..7648164 100644 --- a/pkg/airbyte/config/seed/generate_definitions.py +++ b/pkg/airbyte/config/seed/generate_definitions.py @@ -66,7 +66,7 @@ definitions_json = json.dumps(definitions, indent=2, sort_keys=True) definitions_json = definitions_json.replace( - "airbyte_secret", "credential_field") + "airbyte_secret", "instillCredentialField") with open('../definitions.json', 'w') as o: o.write(definitions_json) diff --git a/pkg/bigquery/config/definitions.json b/pkg/bigquery/config/definitions.json index b87a127..701d650 100644 --- a/pkg/bigquery/config/definitions.json +++ b/pkg/bigquery/config/definitions.json @@ -21,8 +21,8 @@ "type": "string" }, "json_key": { - "instillCredentialField": true, "description": "Contents of the JSON key file with access to the bucket.", + "instillCredentialField": true, "instillUIOrder": 0, "title": "JSON Key File contents", "type": "string" diff --git a/pkg/googlecloudstorage/config/definitions.json b/pkg/googlecloudstorage/config/definitions.json index e219617..71a3910 100644 --- a/pkg/googlecloudstorage/config/definitions.json +++ b/pkg/googlecloudstorage/config/definitions.json @@ -15,15 +15,15 @@ "additionalProperties": false, "properties": { "bucket_name": { - "instillCredentialField": false, "description": "Name of the bucket to be used for object storage.", + "instillCredentialField": false, "instillUIOrder": 0, "title": "Bucket Name", "type": "string" }, "json_key": { - "instillCredentialField": true, "description": "Contents of the JSON key file with access to the bucket.", + "instillCredentialField": true, "instillUIOrder": 1, "title": "JSON Key File contents", "type": "string" diff --git a/pkg/huggingface/common.go b/pkg/huggingface/common.go index cd743b7..1f36a9c 100644 --- a/pkg/huggingface/common.go +++ b/pkg/huggingface/common.go @@ -44,10 +44,13 @@ func (c *Client) MakeHFAPIRequest(body []byte, model string) ([]byte, error) { if err != nil { return nil, err } - err = checkRespForError(respBody) - if err != nil { - return nil, err + if resp.StatusCode != http.StatusOK { + err = checkRespForError(respBody) + if err != nil { + return nil, err + } } + return respBody, nil } diff --git a/pkg/huggingface/config/definitions.json b/pkg/huggingface/config/definitions.json index b45dccb..a1c5176 100644 --- a/pkg/huggingface/config/definitions.json +++ b/pkg/huggingface/config/definitions.json @@ -8,7 +8,6 @@ "TASK_TOKEN_CLASSIFICATION", "TASK_TRANSLATION", "TASK_ZERO_SHOT_CLASSIFICATION", - "TASK_FEATURE_EXTRACTION", "TASK_QUESTION_ANSWERING", "TASK_TABLE_QUESTION_ANSWERING", "TASK_SENTENCE_SIMILARITY", @@ -32,24 +31,24 @@ "additionalProperties": true, "properties": { "api_key": { - "instillCredentialField": true, "description": "Fill your Hugging face API token. To find your token, visit https://huggingface.co/settings/tokens.", + "instillCredentialField": true, "instillUIOrder": 0, "title": "API Key", "type": "string" }, "base_url": { - "instillCredentialField": false, "default": "https://api-inference.huggingface.co", "description": "Hostname for the endpoint. To use Inference API set to https://api-inference.huggingface.co, for Inference Endpoint set to your custom endpoint.", + "instillCredentialField": false, "instillUIOrder": 1, "title": "Base URL", "type": "string" }, "is_custom_endpoint": { - "instillCredentialField": false, "default": false, "description": "Fill true if you are using a custom Inference Endpoint and not the Inference API.", + "instillCredentialField": false, "instillUIOrder": 2, "title": "Is Custom Endpoint", "type": "boolean" diff --git a/pkg/huggingface/config/seed/tasks.json b/pkg/huggingface/config/seed/tasks.json index 55cf576..4fb9b77 100644 --- a/pkg/huggingface/config/seed/tasks.json +++ b/pkg/huggingface/config/seed/tasks.json @@ -1,5 +1,15 @@ { "$defs": { + "model": { + "instillFormat": "text", + "instillUpstreamTypes": [ + "value", + "reference", + "template" + ], + "title": "Model", + "type": "string" + }, "options": { "instillFormat": "object", "properties": { @@ -48,12 +58,16 @@ "properties": { "audio": { "instillFormat": "audio", - "instillUIOrder": 0, + "instillUIOrder": 1, "instillUpstreamTypes": [ "reference" ], "title": "Audio", "type": "string" + }, + "model": { + "$ref": "#/$defs/model", + "instillUIOrder": 0 } }, "required": [ @@ -108,7 +122,7 @@ "instillUIOrder": 0, "properties": { "inputs": { - "instillUIOrder": 0, + "instillUIOrder": 1, "properties": { "generated_responses": { "description": "A list of strings corresponding to the earlier replies from the model.", @@ -159,13 +173,17 @@ "title": "Inputs", "type": "object" }, + "model": { + "$ref": "#/$defs/model", + "instillUIOrder": 0 + }, "options": { "$ref": "#/$defs/options", - "instillUIOrder": 2 + "instillUIOrder": 3 }, "parameters": { "instillFormat": "object", - "instillUIOrder": 1, + "instillUIOrder": 2, "properties": { "max_length": { "description": "Integer to define the maximum length in tokens of the output summary.", @@ -316,52 +334,6 @@ "type": "object" } }, - "TASK_FEATURE_EXTRACTION": { - "input": { - "instillUIOrder": 0, - "properties": { - "inputs": { - "$ref": "#/$defs/string_input", - "description": "a string or a list of strings to get the features from.", - "instillUIOrder": 0 - }, - "options": { - "$ref": "#/$defs/options", - "instillUIOrder": 1 - } - }, - "required": [ - "inputs" - ], - "title": "Input", - "type": "object" - }, - "output": { - "instillUIOrder": 0, - "properties": { - "features": { - "description": "The numbers that are the representation features of the input.", - "instillFormat": "number_array", - "instillUIOrder": 0, - "items": { - "instillFormat": "number_array", - "items": { - "instillFormat": "number", - "type": "number" - }, - "type": "array" - }, - "title": "Features", - "type": "array" - } - }, - "required": [ - "features" - ], - "title": "Output", - "type": "object" - } - }, "TASK_FILL_MASK": { "input": { "instillUIOrder": 0, @@ -369,11 +341,15 @@ "inputs": { "$ref": "#/$defs/string_input", "description": "a string to be filled from, must contain the [MASK] token (check model card for exact name of the mask)", + "instillUIOrder": 1 + }, + "model": { + "$ref": "#/$defs/model", "instillUIOrder": 0 }, "options": { "$ref": "#/$defs/options", - "instillUIOrder": 1 + "instillUIOrder": 2 } }, "required": [ @@ -385,7 +361,7 @@ "output": { "instillUIOrder": 0, "properties": { - "masks": { + "results": { "instillFormat": "object_array", "instillUIOrder": 0, "items": { @@ -423,12 +399,12 @@ "required": [], "type": "object" }, - "title": "Masks", + "title": "Results", "type": "array" } }, "required": [ - "masks" + "results" ], "title": "Output", "type": "object" @@ -440,12 +416,16 @@ "properties": { "image": { "instillFormat": "image", - "instillUIOrder": 0, + "instillUIOrder": 1, "instillUpstreamTypes": [ "reference" ], "title": "Image", "type": "string" + }, + "model": { + "$ref": "#/$defs/model", + "instillUIOrder": 0 } }, "required": [ @@ -501,12 +481,16 @@ "properties": { "image": { "instillFormat": "image", - "instillUIOrder": 0, + "instillUIOrder": 1, "instillUpstreamTypes": [ "reference" ], "title": "Image", "type": "string" + }, + "model": { + "$ref": "#/$defs/model", + "instillUIOrder": 0 } }, "required": [ @@ -533,7 +517,7 @@ }, "mask": { "description": "A str (base64 str of a single channel black-and-white img) representing the mask of a segment.", - "instillFormat": "text", + "instillFormat": "image", "instillUIOrder": 1, "title": "Mask", "type": "string" @@ -576,6 +560,10 @@ ], "title": "Image", "type": "string" + }, + "model": { + "$ref": "#/$defs/model", + "instillUIOrder": 0 } }, "required": [ @@ -607,12 +595,16 @@ "properties": { "image": { "instillFormat": "image", - "instillUIOrder": 0, + "instillUIOrder": 1, "instillUpstreamTypes": [ "reference" ], "title": "Image", "type": "string" + }, + "model": { + "$ref": "#/$defs/model", + "instillUIOrder": 0 } }, "required": [ @@ -660,6 +652,12 @@ "type": "number" } }, + "required": [ + "xmax", + "xmin", + "ymax", + "ymin" + ], "title": "Box", "type": "object" }, @@ -678,6 +676,11 @@ "type": "number" } }, + "required": [ + "box", + "label", + "score" + ], "type": "object" }, "title": "Objects", @@ -696,7 +699,7 @@ "instillUIOrder": 0, "properties": { "inputs": { - "instillUIOrder": 0, + "instillUIOrder": 1, "properties": { "context": { "instillFormat": "text", @@ -728,9 +731,13 @@ "title": "Inputs", "type": "object" }, + "model": { + "$ref": "#/$defs/model", + "instillUIOrder": 0 + }, "options": { "$ref": "#/$defs/options", - "instillUIOrder": 1 + "instillUIOrder": 2 } }, "required": [ @@ -783,7 +790,7 @@ "instillUIOrder": 0, "properties": { "inputs": { - "instillUIOrder": 0, + "instillUIOrder": 1, "properties": { "sentences": { "description": "A list of strings which will be compared against the source_sentence.", @@ -819,6 +826,10 @@ "title": "Inputs", "type": "object" }, + "model": { + "$ref": "#/$defs/model", + "instillUIOrder": 0 + }, "options": { "$ref": "#/$defs/options", "instillUIOrder": 2 @@ -858,12 +869,16 @@ "properties": { "audio": { "instillFormat": "audio", - "instillUIOrder": 0, + "instillUIOrder": 1, "instillUpstreamTypes": [ "reference" ], "title": "Audio", "type": "string" + }, + "model": { + "$ref": "#/$defs/model", + "instillUIOrder": 0 } }, "required": [ @@ -896,14 +911,18 @@ "properties": { "inputs": { "$ref": "#/$defs/string_input", + "instillUIOrder": 1 + }, + "model": { + "$ref": "#/$defs/model", "instillUIOrder": 0 }, "options": { "$ref": "#/$defs/options", - "instillUIOrder": 2 + "instillUIOrder": 3 }, "parameters": { - "instillUIOrder": 1, + "instillUIOrder": 2, "properties": { "max_length": { "description": "Integer to define the maximum length in tokens of the output summary.", @@ -1023,7 +1042,7 @@ "instillUIOrder": 0, "properties": { "inputs": { - "instillUIOrder": 0, + "instillUIOrder": 1, "properties": { "query": { "description": "The query in plain text that you want to ask the table", @@ -1055,9 +1074,13 @@ "title": "Inputs", "type": "object" }, + "model": { + "$ref": "#/$defs/model", + "instillUIOrder": 0 + }, "options": { "$ref": "#/$defs/options", - "instillUIOrder": 1 + "instillUIOrder": 2 } }, "required": [ @@ -1123,11 +1146,15 @@ "properties": { "inputs": { "$ref": "#/$defs/string_input", + "instillUIOrder": 1 + }, + "model": { + "$ref": "#/$defs/model", "instillUIOrder": 0 }, "options": { "$ref": "#/$defs/options", - "instillUIOrder": 1 + "instillUIOrder": 2 } }, "required": [ @@ -1139,7 +1166,7 @@ "output": { "instillUIOrder": 0, "properties": { - "classes": { + "results": { "instillFormat": "object_array", "instillUIOrder": 0, "items": { @@ -1166,12 +1193,12 @@ ], "type": "object" }, - "title": "Classes", + "title": "Results", "type": "array" } }, "required": [ - "classes" + "results" ], "title": "Output", "type": "object" @@ -1183,14 +1210,18 @@ "properties": { "inputs": { "$ref": "#/$defs/string_input", + "instillUIOrder": 1 + }, + "model": { + "$ref": "#/$defs/model", "instillUIOrder": 0 }, "options": { "$ref": "#/$defs/options", - "instillUIOrder": 1 + "instillUIOrder": 3 }, "parameters": { - "instillUIOrder": 1, + "instillUIOrder": 2, "properties": { "do_sample": { "description": "Whether or not to use sampling, use greedy decoding otherwise.", @@ -1327,14 +1358,18 @@ "properties": { "inputs": { "$ref": "#/$defs/string_input", + "instillUIOrder": 1 + }, + "model": { + "$ref": "#/$defs/model", "instillUIOrder": 0 }, "options": { "$ref": "#/$defs/options", - "instillUIOrder": 2 + "instillUIOrder": 3 }, "parameters": { - "instillUIOrder": 1, + "instillUIOrder": 2, "properties": { "guidance_scale": { "instillFormat": "number", @@ -1422,14 +1457,18 @@ "properties": { "inputs": { "$ref": "#/$defs/string_input", + "instillUIOrder": 1 + }, + "model": { + "$ref": "#/$defs/model", "instillUIOrder": 0 }, "options": { "$ref": "#/$defs/options", - "instillUIOrder": 2 + "instillUIOrder": 3 }, "parameters": { - "instillUIOrder": 1, + "instillUIOrder": 2, "properties": { "aggregation_strategy": { "description": "There are several aggregation strategies:\nnone: Every token gets classified without further aggregation.\nsimple: Entities are grouped according to the default schema (B-, I- tags get merged when the tag is similar).\nfirst: Same as the simple strategy except words cannot end up with different tags. Words will use the tag of the first token when there is ambiguity.\naverage: Same as the simple strategy except words cannot end up with different tags. Scores are averaged across tokens and then the maximum label is applied.\nmax: Same as the simple strategy except words cannot end up with different tags. Word entity will be the token with the maximum score.", @@ -1458,7 +1497,7 @@ "output": { "instillUIOrder": 0, "properties": { - "masks": { + "results": { "instillFormat": "object_array", "instillUIOrder": 0, "items": { @@ -1503,12 +1542,12 @@ "required": [], "type": "object" }, - "title": "Masks", + "title": "Results", "type": "array" } }, "required": [ - "masks" + "results" ], "title": "Output", "type": "object" @@ -1520,11 +1559,15 @@ "properties": { "inputs": { "$ref": "#/$defs/string_input", + "instillUIOrder": 1 + }, + "model": { + "$ref": "#/$defs/model", "instillUIOrder": 0 }, "options": { "$ref": "#/$defs/options", - "instillUIOrder": 1 + "instillUIOrder": 2 } }, "required": [ @@ -1541,7 +1584,7 @@ "instillFormat": "text", "instillUIOrder": 0, "title": "Translation Text", - "type": "sting" + "type": "string" } }, "required": [ @@ -1557,14 +1600,18 @@ "properties": { "inputs": { "$ref": "#/$defs/string_input", + "instillUIOrder": 1 + }, + "model": { + "$ref": "#/$defs/model", "instillUIOrder": 0 }, "options": { "$ref": "#/$defs/options", - "instillUIOrder": 2 + "instillUIOrder": 3 }, "parameters": { - "instillUIOrder": 1, + "instillUIOrder": 2, "properties": { "candidate_labels": { "description": "a list of strings that are potential classes for inputs. (max 10 candidate_labels, for more, simply run multiple requests, results are going to be misleading if using too many candidate_labels anyway. If you want to keep the exact same, you can simply run multi_label=True and do the scaling on your end. )", @@ -1636,12 +1683,13 @@ "description": "The string sent as an input", "instillFormat": "text", "instillUIOrder": 1, - "title": "Texts", - "type": "array" + "title": "Sequence", + "type": "string" } }, "required": [ - "texts" + "labels", + "scores" ], "title": "Output", "type": "object" diff --git a/pkg/huggingface/config/tasks.json b/pkg/huggingface/config/tasks.json index da1d0be..a67e90b 100644 --- a/pkg/huggingface/config/tasks.json +++ b/pkg/huggingface/config/tasks.json @@ -1,5 +1,15 @@ { "$defs": { + "model": { + "instillFormat": "text", + "instillUpstreamTypes": [ + "value", + "reference", + "template" + ], + "title": "Model", + "type": "string" + }, "options": { "instillFormat": "object", "properties": { @@ -48,12 +58,23 @@ "properties": { "audio": { "instillFormat": "audio", - "instillUIOrder": 0, + "instillUIOrder": 1, "instillUpstreamTypes": [ "reference" ], "title": "Audio", "type": "string" + }, + "model": { + "instillFormat": "text", + "instillUIOrder": 0, + "instillUpstreamTypes": [ + "value", + "reference", + "template" + ], + "title": "Model", + "type": "string" } }, "required": [ @@ -108,7 +129,7 @@ "instillUIOrder": 0, "properties": { "inputs": { - "instillUIOrder": 0, + "instillUIOrder": 1, "properties": { "generated_responses": { "description": "A list of strings corresponding to the earlier replies from the model.", @@ -159,9 +180,20 @@ "title": "Inputs", "type": "object" }, + "model": { + "instillFormat": "text", + "instillUIOrder": 0, + "instillUpstreamTypes": [ + "value", + "reference", + "template" + ], + "title": "Model", + "type": "string" + }, "options": { "instillFormat": "object", - "instillUIOrder": 2, + "instillUIOrder": 3, "properties": { "use_cache": { "description": "There is a cache layer on the inference API to speedup requests we have already seen. Most models can use those results as is as models are deterministic (meaning the results will be the same anyway). However if you use a non deterministic model, you can set this parameter to prevent the caching mechanism from being used resulting in a real new query.", @@ -192,7 +224,7 @@ }, "parameters": { "instillFormat": "object", - "instillUIOrder": 1, + "instillUIOrder": 2, "properties": { "max_length": { "description": "Integer to define the maximum length in tokens of the output summary.", @@ -343,14 +375,14 @@ "type": "object" } }, - "TASK_FEATURE_EXTRACTION": { + "TASK_FILL_MASK": { "input": { "instillUIOrder": 0, "properties": { "inputs": { - "description": "a string or a list of strings to get the features from.", + "description": "a string to be filled from, must contain the [MASK] token (check model card for exact name of the mask)", "instillFormat": "text", - "instillUIOrder": 0, + "instillUIOrder": 1, "instillUpstreamTypes": [ "value", "reference", @@ -359,76 +391,7 @@ "title": "String Input", "type": "string" }, - "options": { - "instillFormat": "object", - "instillUIOrder": 1, - "properties": { - "use_cache": { - "description": "There is a cache layer on the inference API to speedup requests we have already seen. Most models can use those results as is as models are deterministic (meaning the results will be the same anyway). However if you use a non deterministic model, you can set this parameter to prevent the caching mechanism from being used resulting in a real new query.", - "instillFormat": "boolean", - "instillUIOrder": 0, - "instillUpstreamTypes": [ - "value", - "reference" - ], - "title": "Use Cache", - "type": "boolean" - }, - "wait_for_model": { - "description": "If the model is not ready, wait for it instead of receiving 503. It limits the number of requests required to get your inference done. It is advised to only set this flag to true after receiving a 503 error as it will limit hanging in your application to known places.", - "instillFormat": "boolean", - "instillUIOrder": 2, - "instillUpstreamTypes": [ - "value", - "reference" - ], - "title": "Wait For Model", - "type": "boolean" - } - }, - "required": [], - "title": "Options", - "type": "object" - } - }, - "required": [ - "inputs" - ], - "title": "Input", - "type": "object" - }, - "output": { - "instillUIOrder": 0, - "properties": { - "features": { - "description": "The numbers that are the representation features of the input.", - "instillFormat": "number_array", - "instillUIOrder": 0, - "items": { - "instillFormat": "number_array", - "items": { - "instillFormat": "number", - "type": "number" - }, - "type": "array" - }, - "title": "Features", - "type": "array" - } - }, - "required": [ - "features" - ], - "title": "Output", - "type": "object" - } - }, - "TASK_FILL_MASK": { - "input": { - "instillUIOrder": 0, - "properties": { - "inputs": { - "description": "a string to be filled from, must contain the [MASK] token (check model card for exact name of the mask)", + "model": { "instillFormat": "text", "instillUIOrder": 0, "instillUpstreamTypes": [ @@ -436,12 +399,12 @@ "reference", "template" ], - "title": "String Input", + "title": "Model", "type": "string" }, "options": { "instillFormat": "object", - "instillUIOrder": 1, + "instillUIOrder": 2, "properties": { "use_cache": { "description": "There is a cache layer on the inference API to speedup requests we have already seen. Most models can use those results as is as models are deterministic (meaning the results will be the same anyway). However if you use a non deterministic model, you can set this parameter to prevent the caching mechanism from being used resulting in a real new query.", @@ -480,7 +443,7 @@ "output": { "instillUIOrder": 0, "properties": { - "masks": { + "results": { "instillFormat": "object_array", "instillUIOrder": 0, "items": { @@ -518,12 +481,12 @@ "required": [], "type": "object" }, - "title": "Masks", + "title": "Results", "type": "array" } }, "required": [ - "masks" + "results" ], "title": "Output", "type": "object" @@ -535,12 +498,23 @@ "properties": { "image": { "instillFormat": "image", - "instillUIOrder": 0, + "instillUIOrder": 1, "instillUpstreamTypes": [ "reference" ], "title": "Image", "type": "string" + }, + "model": { + "instillFormat": "text", + "instillUIOrder": 0, + "instillUpstreamTypes": [ + "value", + "reference", + "template" + ], + "title": "Model", + "type": "string" } }, "required": [ @@ -596,12 +570,23 @@ "properties": { "image": { "instillFormat": "image", - "instillUIOrder": 0, + "instillUIOrder": 1, "instillUpstreamTypes": [ "reference" ], "title": "Image", "type": "string" + }, + "model": { + "instillFormat": "text", + "instillUIOrder": 0, + "instillUpstreamTypes": [ + "value", + "reference", + "template" + ], + "title": "Model", + "type": "string" } }, "required": [ @@ -628,7 +613,7 @@ }, "mask": { "description": "A str (base64 str of a single channel black-and-white img) representing the mask of a segment.", - "instillFormat": "text", + "instillFormat": "image", "instillUIOrder": 1, "title": "Mask", "type": "string" @@ -671,6 +656,17 @@ ], "title": "Image", "type": "string" + }, + "model": { + "instillFormat": "text", + "instillUIOrder": 0, + "instillUpstreamTypes": [ + "value", + "reference", + "template" + ], + "title": "Model", + "type": "string" } }, "required": [ @@ -702,12 +698,23 @@ "properties": { "image": { "instillFormat": "image", - "instillUIOrder": 0, + "instillUIOrder": 1, "instillUpstreamTypes": [ "reference" ], "title": "Image", "type": "string" + }, + "model": { + "instillFormat": "text", + "instillUIOrder": 0, + "instillUpstreamTypes": [ + "value", + "reference", + "template" + ], + "title": "Model", + "type": "string" } }, "required": [ @@ -755,6 +762,12 @@ "type": "number" } }, + "required": [ + "xmax", + "xmin", + "ymax", + "ymin" + ], "title": "Box", "type": "object" }, @@ -773,6 +786,11 @@ "type": "number" } }, + "required": [ + "box", + "label", + "score" + ], "type": "object" }, "title": "Objects", @@ -791,7 +809,7 @@ "instillUIOrder": 0, "properties": { "inputs": { - "instillUIOrder": 0, + "instillUIOrder": 1, "properties": { "context": { "instillFormat": "text", @@ -823,9 +841,20 @@ "title": "Inputs", "type": "object" }, + "model": { + "instillFormat": "text", + "instillUIOrder": 0, + "instillUpstreamTypes": [ + "value", + "reference", + "template" + ], + "title": "Model", + "type": "string" + }, "options": { "instillFormat": "object", - "instillUIOrder": 1, + "instillUIOrder": 2, "properties": { "use_cache": { "description": "There is a cache layer on the inference API to speedup requests we have already seen. Most models can use those results as is as models are deterministic (meaning the results will be the same anyway). However if you use a non deterministic model, you can set this parameter to prevent the caching mechanism from being used resulting in a real new query.", @@ -905,7 +934,7 @@ "instillUIOrder": 0, "properties": { "inputs": { - "instillUIOrder": 0, + "instillUIOrder": 1, "properties": { "sentences": { "description": "A list of strings which will be compared against the source_sentence.", @@ -941,6 +970,17 @@ "title": "Inputs", "type": "object" }, + "model": { + "instillFormat": "text", + "instillUIOrder": 0, + "instillUpstreamTypes": [ + "value", + "reference", + "template" + ], + "title": "Model", + "type": "string" + }, "options": { "instillFormat": "object", "instillUIOrder": 2, @@ -1007,12 +1047,23 @@ "properties": { "audio": { "instillFormat": "audio", - "instillUIOrder": 0, + "instillUIOrder": 1, "instillUpstreamTypes": [ "reference" ], "title": "Audio", "type": "string" + }, + "model": { + "instillFormat": "text", + "instillUIOrder": 0, + "instillUpstreamTypes": [ + "value", + "reference", + "template" + ], + "title": "Model", + "type": "string" } }, "required": [ @@ -1045,7 +1096,7 @@ "properties": { "inputs": { "instillFormat": "text", - "instillUIOrder": 0, + "instillUIOrder": 1, "instillUpstreamTypes": [ "value", "reference", @@ -1054,9 +1105,20 @@ "title": "String Input", "type": "string" }, + "model": { + "instillFormat": "text", + "instillUIOrder": 0, + "instillUpstreamTypes": [ + "value", + "reference", + "template" + ], + "title": "Model", + "type": "string" + }, "options": { "instillFormat": "object", - "instillUIOrder": 2, + "instillUIOrder": 3, "properties": { "use_cache": { "description": "There is a cache layer on the inference API to speedup requests we have already seen. Most models can use those results as is as models are deterministic (meaning the results will be the same anyway). However if you use a non deterministic model, you can set this parameter to prevent the caching mechanism from being used resulting in a real new query.", @@ -1086,7 +1148,7 @@ "type": "object" }, "parameters": { - "instillUIOrder": 1, + "instillUIOrder": 2, "properties": { "max_length": { "description": "Integer to define the maximum length in tokens of the output summary.", @@ -1206,7 +1268,7 @@ "instillUIOrder": 0, "properties": { "inputs": { - "instillUIOrder": 0, + "instillUIOrder": 1, "properties": { "query": { "description": "The query in plain text that you want to ask the table", @@ -1238,9 +1300,20 @@ "title": "Inputs", "type": "object" }, + "model": { + "instillFormat": "text", + "instillUIOrder": 0, + "instillUpstreamTypes": [ + "value", + "reference", + "template" + ], + "title": "Model", + "type": "string" + }, "options": { "instillFormat": "object", - "instillUIOrder": 1, + "instillUIOrder": 2, "properties": { "use_cache": { "description": "There is a cache layer on the inference API to speedup requests we have already seen. Most models can use those results as is as models are deterministic (meaning the results will be the same anyway). However if you use a non deterministic model, you can set this parameter to prevent the caching mechanism from being used resulting in a real new query.", @@ -1333,7 +1406,7 @@ "properties": { "inputs": { "instillFormat": "text", - "instillUIOrder": 0, + "instillUIOrder": 1, "instillUpstreamTypes": [ "value", "reference", @@ -1342,9 +1415,20 @@ "title": "String Input", "type": "string" }, + "model": { + "instillFormat": "text", + "instillUIOrder": 0, + "instillUpstreamTypes": [ + "value", + "reference", + "template" + ], + "title": "Model", + "type": "string" + }, "options": { "instillFormat": "object", - "instillUIOrder": 1, + "instillUIOrder": 2, "properties": { "use_cache": { "description": "There is a cache layer on the inference API to speedup requests we have already seen. Most models can use those results as is as models are deterministic (meaning the results will be the same anyway). However if you use a non deterministic model, you can set this parameter to prevent the caching mechanism from being used resulting in a real new query.", @@ -1383,7 +1467,7 @@ "output": { "instillUIOrder": 0, "properties": { - "classes": { + "results": { "instillFormat": "object_array", "instillUIOrder": 0, "items": { @@ -1410,12 +1494,12 @@ ], "type": "object" }, - "title": "Classes", + "title": "Results", "type": "array" } }, "required": [ - "classes" + "results" ], "title": "Output", "type": "object" @@ -1427,7 +1511,7 @@ "properties": { "inputs": { "instillFormat": "text", - "instillUIOrder": 0, + "instillUIOrder": 1, "instillUpstreamTypes": [ "value", "reference", @@ -1436,9 +1520,20 @@ "title": "String Input", "type": "string" }, + "model": { + "instillFormat": "text", + "instillUIOrder": 0, + "instillUpstreamTypes": [ + "value", + "reference", + "template" + ], + "title": "Model", + "type": "string" + }, "options": { "instillFormat": "object", - "instillUIOrder": 1, + "instillUIOrder": 3, "properties": { "use_cache": { "description": "There is a cache layer on the inference API to speedup requests we have already seen. Most models can use those results as is as models are deterministic (meaning the results will be the same anyway). However if you use a non deterministic model, you can set this parameter to prevent the caching mechanism from being used resulting in a real new query.", @@ -1468,7 +1563,7 @@ "type": "object" }, "parameters": { - "instillUIOrder": 1, + "instillUIOrder": 2, "properties": { "do_sample": { "description": "Whether or not to use sampling, use greedy decoding otherwise.", @@ -1605,7 +1700,7 @@ "properties": { "inputs": { "instillFormat": "text", - "instillUIOrder": 0, + "instillUIOrder": 1, "instillUpstreamTypes": [ "value", "reference", @@ -1614,9 +1709,20 @@ "title": "String Input", "type": "string" }, + "model": { + "instillFormat": "text", + "instillUIOrder": 0, + "instillUpstreamTypes": [ + "value", + "reference", + "template" + ], + "title": "Model", + "type": "string" + }, "options": { "instillFormat": "object", - "instillUIOrder": 2, + "instillUIOrder": 3, "properties": { "use_cache": { "description": "There is a cache layer on the inference API to speedup requests we have already seen. Most models can use those results as is as models are deterministic (meaning the results will be the same anyway). However if you use a non deterministic model, you can set this parameter to prevent the caching mechanism from being used resulting in a real new query.", @@ -1646,7 +1752,7 @@ "type": "object" }, "parameters": { - "instillUIOrder": 1, + "instillUIOrder": 2, "properties": { "guidance_scale": { "instillFormat": "number", @@ -1734,7 +1840,7 @@ "properties": { "inputs": { "instillFormat": "text", - "instillUIOrder": 0, + "instillUIOrder": 1, "instillUpstreamTypes": [ "value", "reference", @@ -1743,9 +1849,20 @@ "title": "String Input", "type": "string" }, + "model": { + "instillFormat": "text", + "instillUIOrder": 0, + "instillUpstreamTypes": [ + "value", + "reference", + "template" + ], + "title": "Model", + "type": "string" + }, "options": { "instillFormat": "object", - "instillUIOrder": 2, + "instillUIOrder": 3, "properties": { "use_cache": { "description": "There is a cache layer on the inference API to speedup requests we have already seen. Most models can use those results as is as models are deterministic (meaning the results will be the same anyway). However if you use a non deterministic model, you can set this parameter to prevent the caching mechanism from being used resulting in a real new query.", @@ -1775,7 +1892,7 @@ "type": "object" }, "parameters": { - "instillUIOrder": 1, + "instillUIOrder": 2, "properties": { "aggregation_strategy": { "description": "There are several aggregation strategies:\nnone: Every token gets classified without further aggregation.\nsimple: Entities are grouped according to the default schema (B-, I- tags get merged when the tag is similar).\nfirst: Same as the simple strategy except words cannot end up with different tags. Words will use the tag of the first token when there is ambiguity.\naverage: Same as the simple strategy except words cannot end up with different tags. Scores are averaged across tokens and then the maximum label is applied.\nmax: Same as the simple strategy except words cannot end up with different tags. Word entity will be the token with the maximum score.", @@ -1804,7 +1921,7 @@ "output": { "instillUIOrder": 0, "properties": { - "masks": { + "results": { "instillFormat": "object_array", "instillUIOrder": 0, "items": { @@ -1849,12 +1966,12 @@ "required": [], "type": "object" }, - "title": "Masks", + "title": "Results", "type": "array" } }, "required": [ - "masks" + "results" ], "title": "Output", "type": "object" @@ -1866,7 +1983,7 @@ "properties": { "inputs": { "instillFormat": "text", - "instillUIOrder": 0, + "instillUIOrder": 1, "instillUpstreamTypes": [ "value", "reference", @@ -1875,9 +1992,20 @@ "title": "String Input", "type": "string" }, + "model": { + "instillFormat": "text", + "instillUIOrder": 0, + "instillUpstreamTypes": [ + "value", + "reference", + "template" + ], + "title": "Model", + "type": "string" + }, "options": { "instillFormat": "object", - "instillUIOrder": 1, + "instillUIOrder": 2, "properties": { "use_cache": { "description": "There is a cache layer on the inference API to speedup requests we have already seen. Most models can use those results as is as models are deterministic (meaning the results will be the same anyway). However if you use a non deterministic model, you can set this parameter to prevent the caching mechanism from being used resulting in a real new query.", @@ -1921,7 +2049,7 @@ "instillFormat": "text", "instillUIOrder": 0, "title": "Translation Text", - "type": "sting" + "type": "string" } }, "required": [ @@ -1937,7 +2065,7 @@ "properties": { "inputs": { "instillFormat": "text", - "instillUIOrder": 0, + "instillUIOrder": 1, "instillUpstreamTypes": [ "value", "reference", @@ -1946,9 +2074,20 @@ "title": "String Input", "type": "string" }, + "model": { + "instillFormat": "text", + "instillUIOrder": 0, + "instillUpstreamTypes": [ + "value", + "reference", + "template" + ], + "title": "Model", + "type": "string" + }, "options": { "instillFormat": "object", - "instillUIOrder": 2, + "instillUIOrder": 3, "properties": { "use_cache": { "description": "There is a cache layer on the inference API to speedup requests we have already seen. Most models can use those results as is as models are deterministic (meaning the results will be the same anyway). However if you use a non deterministic model, you can set this parameter to prevent the caching mechanism from being used resulting in a real new query.", @@ -1978,7 +2117,7 @@ "type": "object" }, "parameters": { - "instillUIOrder": 1, + "instillUIOrder": 2, "properties": { "candidate_labels": { "description": "a list of strings that are potential classes for inputs. (max 10 candidate_labels, for more, simply run multiple requests, results are going to be misleading if using too many candidate_labels anyway. If you want to keep the exact same, you can simply run multi_label=True and do the scaling on your end. )", @@ -2050,12 +2189,13 @@ "description": "The string sent as an input", "instillFormat": "text", "instillUIOrder": 1, - "title": "Texts", - "type": "array" + "title": "Sequence", + "type": "string" } }, "required": [ - "texts" + "labels", + "scores" ], "title": "Output", "type": "object" diff --git a/pkg/huggingface/main.go b/pkg/huggingface/main.go index b42908e..d6e1b15 100644 --- a/pkg/huggingface/main.go +++ b/pkg/huggingface/main.go @@ -117,11 +117,10 @@ func isCustomEndpoint(config *structpb.Struct) bool { func (e *Execution) Execute(inputs []*structpb.Struct) ([]*structpb.Struct, error) { client := NewClient(getAPIKey(e.Config), getBaseURL(e.Config), isCustomEndpoint(e.Config)) outputs := []*structpb.Struct{} - task := inputs[0].GetFields()["task"].GetStringValue() model := inputs[0].GetFields()["model"].GetStringValue() for _, input := range inputs { - switch task { + switch e.Task { case textGenerationTask: inputStruct := TextGenerationRequest{} err := base.ConvertFromStructpb(input, &inputStruct) @@ -138,14 +137,8 @@ func (e *Execution) Execute(inputs []*structpb.Struct) ([]*structpb.Struct, erro if err != nil { return nil, err } - generatedTexts := structpb.ListValue{} - generatedTexts.Values = make([]*structpb.Value, len(outputArr)) - for i := range outputArr { - generatedTexts.Values[i] = &structpb.Value{Kind: &structpb.Value_StringValue{StringValue: outputArr[i].GeneratedText}} - } - output := structpb.Struct{ - Fields: map[string]*structpb.Value{"texts": {Kind: &structpb.Value_ListValue{ListValue: &generatedTexts}}}, - } + output := structpb.Struct{Fields: make(map[string]*structpb.Value)} + output.Fields["generated_text"] = structpb.NewStringValue(outputArr[0].GeneratedText) outputs = append(outputs, &output) case textToImageTask: inputStruct := TextToImageRequest{} @@ -185,10 +178,10 @@ func (e *Execution) Execute(inputs []*structpb.Struct) ([]*structpb.Struct, erro if err != nil { return nil, err } - masks := structpb.ListValue{} - masks.Values = make([]*structpb.Value, len(outputArr)) + results := structpb.ListValue{} + results.Values = make([]*structpb.Value, len(outputArr)) for i := range outputArr { - masks.Values[i] = &structpb.Value{Kind: &structpb.Value_StructValue{ + results.Values[i] = &structpb.Value{Kind: &structpb.Value_StructValue{ StructValue: &structpb.Struct{ Fields: map[string]*structpb.Value{ "sequence": {Kind: &structpb.Value_StringValue{StringValue: outputArr[i].Sequence}}, @@ -200,7 +193,7 @@ func (e *Execution) Execute(inputs []*structpb.Struct) ([]*structpb.Struct, erro }} } output := structpb.Struct{ - Fields: map[string]*structpb.Value{"masks": {Kind: &structpb.Value_ListValue{ListValue: &masks}}}, + Fields: map[string]*structpb.Value{"results": {Kind: &structpb.Value_ListValue{ListValue: &results}}}, } outputs = append(outputs, &output) case summarizationTask: @@ -219,14 +212,8 @@ func (e *Execution) Execute(inputs []*structpb.Struct) ([]*structpb.Struct, erro if err != nil { return nil, err } - summaries := structpb.ListValue{} - summaries.Values = make([]*structpb.Value, len(outputArr)) - for i := range outputArr { - summaries.Values[i] = &structpb.Value{Kind: &structpb.Value_StringValue{StringValue: outputArr[i].SummaryText}} - } - output := structpb.Struct{ - Fields: map[string]*structpb.Value{"texts": {Kind: &structpb.Value_ListValue{ListValue: &summaries}}}, - } + output := structpb.Struct{Fields: make(map[string]*structpb.Value)} + output.Fields["summary_text"] = structpb.NewStringValue(outputArr[0].SummaryText) outputs = append(outputs, &output) case textClassificationTask: inputStruct := TextClassificationRequest{} @@ -248,10 +235,10 @@ func (e *Execution) Execute(inputs []*structpb.Struct) ([]*structpb.Struct, erro return nil, errors.New("invalid response") } outputArr := nestedArr[0] - classes := structpb.ListValue{} - classes.Values = make([]*structpb.Value, len(outputArr)) + results := structpb.ListValue{} + results.Values = make([]*structpb.Value, len(outputArr)) for i := range outputArr { - classes.Values[i] = &structpb.Value{Kind: &structpb.Value_StructValue{ + results.Values[i] = &structpb.Value{Kind: &structpb.Value_StructValue{ StructValue: &structpb.Struct{ Fields: map[string]*structpb.Value{ "label": {Kind: &structpb.Value_StringValue{StringValue: outputArr[i].Label}}, @@ -261,7 +248,7 @@ func (e *Execution) Execute(inputs []*structpb.Struct) ([]*structpb.Struct, erro }} } output := structpb.Struct{ - Fields: map[string]*structpb.Value{"classes": {Kind: &structpb.Value_ListValue{ListValue: &classes}}}, + Fields: map[string]*structpb.Value{"results": {Kind: &structpb.Value_ListValue{ListValue: &results}}}, } outputs = append(outputs, &output) case tokenClassificationTask: @@ -296,7 +283,7 @@ func (e *Execution) Execute(inputs []*structpb.Struct) ([]*structpb.Struct, erro }} } output := structpb.Struct{ - Fields: map[string]*structpb.Value{"classes": {Kind: &structpb.Value_ListValue{ListValue: &classes}}}, + Fields: map[string]*structpb.Value{"results": {Kind: &structpb.Value_ListValue{ListValue: &classes}}}, } outputs = append(outputs, &output) case translationTask: @@ -315,14 +302,8 @@ func (e *Execution) Execute(inputs []*structpb.Struct) ([]*structpb.Struct, erro if err != nil { return nil, err } - translations := structpb.ListValue{} - translations.Values = make([]*structpb.Value, len(outputArr)) - for i := range outputArr { - translations.Values[i] = &structpb.Value{Kind: &structpb.Value_StringValue{StringValue: outputArr[i].TranslationText}} - } - output := structpb.Struct{ - Fields: map[string]*structpb.Value{"texts": {Kind: &structpb.Value_ListValue{ListValue: &translations}}}, - } + output := structpb.Struct{Fields: make(map[string]*structpb.Value)} + output.Fields["translation_text"] = structpb.NewStringValue(outputArr[0].TranslationText) outputs = append(outputs, &output) case zeroShotClassificationTask: inputStruct := ZeroShotRequest{} @@ -341,39 +322,40 @@ func (e *Execution) Execute(inputs []*structpb.Struct) ([]*structpb.Struct, erro return nil, err } outputs = append(outputs, &output) - case featureExtractionTask: - inputStruct := FeatureExtractionRequest{} - err := base.ConvertFromStructpb(input, &inputStruct) - if err != nil { - return nil, err - } - jsonBody, _ := json.Marshal(inputStruct) - resp, err := client.MakeHFAPIRequest(jsonBody, model) - if err != nil { - return nil, err - } - threeDArr := [][][]float64{} - err = json.Unmarshal(resp, &threeDArr) - if err != nil { - return nil, err - } - if len(threeDArr) <= 0 { - return nil, errors.New("invalid response") - } - nestedArr := threeDArr[0] - features := structpb.ListValue{} - features.Values = make([]*structpb.Value, len(nestedArr)) - for i, innerArr := range nestedArr { - innerValues := make([]*structpb.Value, len(innerArr)) - for j := range innerArr { - innerValues[j] = &structpb.Value{Kind: &structpb.Value_NumberValue{NumberValue: innerArr[j]}} - } - features.Values[i] = &structpb.Value{Kind: &structpb.Value_ListValue{ListValue: &structpb.ListValue{Values: innerValues}}} - } - output := structpb.Struct{ - Fields: map[string]*structpb.Value{"features": {Kind: &structpb.Value_ListValue{ListValue: &features}}}, - } - outputs = append(outputs, &output) + // TODO: fix this task + // case featureExtractionTask: + // inputStruct := FeatureExtractionRequest{} + // err := base.ConvertFromStructpb(input, &inputStruct) + // if err != nil { + // return nil, err + // } + // jsonBody, _ := json.Marshal(inputStruct) + // resp, err := client.MakeHFAPIRequest(jsonBody, model) + // if err != nil { + // return nil, err + // } + // threeDArr := [][][]float64{} + // err = json.Unmarshal(resp, &threeDArr) + // if err != nil { + // return nil, err + // } + // if len(threeDArr) <= 0 { + // return nil, errors.New("invalid response") + // } + // nestedArr := threeDArr[0] + // features := structpb.ListValue{} + // features.Values = make([]*structpb.Value, len(nestedArr)) + // for i, innerArr := range nestedArr { + // innerValues := make([]*structpb.Value, len(innerArr)) + // for j := range innerArr { + // innerValues[j] = &structpb.Value{Kind: &structpb.Value_NumberValue{NumberValue: innerArr[j]}} + // } + // features.Values[i] = &structpb.Value{Kind: &structpb.Value_ListValue{ListValue: &structpb.ListValue{Values: innerValues}}} + // } + // output := structpb.Struct{ + // Fields: map[string]*structpb.Value{"feature": {Kind: &structpb.Value_ListValue{ListValue: &features}}}, + // } + // outputs = append(outputs, &output) case questionAnsweringTask: inputStruct := QuestionAnsweringRequest{} err := base.ConvertFromStructpb(input, &inputStruct) @@ -644,7 +626,7 @@ func (e *Execution) Execute(inputs []*structpb.Struct) ([]*structpb.Struct, erro } outputs = append(outputs, &output) default: - return nil, fmt.Errorf("not supported task: %s", task) + return nil, fmt.Errorf("not supported task: %s", e.Task) } } diff --git a/pkg/instill/config/definitions.json b/pkg/instill/config/definitions.json index 657811b..426b48f 100644 --- a/pkg/instill/config/definitions.json +++ b/pkg/instill/config/definitions.json @@ -22,8 +22,8 @@ "additionalProperties": true, "properties": { "api_token": { - "instillCredentialField": true, "description": "To access models on Instill Cloud, enter your Instill Cloud API Token. You can find your tokens by visiting your Instill Cloud's Settings > API Tokens page. Leave this field empty to access models on your local Instill Model.", + "instillCredentialField": true, "instillUIOrder": 0, "title": "API Token", "type": "string" diff --git a/pkg/numbers/config/definitions.json b/pkg/numbers/config/definitions.json index bc9c6d6..4832f76 100644 --- a/pkg/numbers/config/definitions.json +++ b/pkg/numbers/config/definitions.json @@ -15,8 +15,8 @@ "additionalProperties": false, "properties": { "capture_token": { - "instillCredentialField": true, "description": "Fill your Capture token in the Capture App. To access your tokens, you need a Capture App account and you can sign in with email or wallet to acquire the Capture Token.", + "instillCredentialField": true, "instillUIOrder": 0, "title": "Capture token", "type": "string" diff --git a/pkg/openai/config/definitions.json b/pkg/openai/config/definitions.json index 51e7eab..3b0f0c2 100644 --- a/pkg/openai/config/definitions.json +++ b/pkg/openai/config/definitions.json @@ -17,8 +17,8 @@ "additionalProperties": true, "properties": { "api_key": { - "instillCredentialField": true, "description": "Fill your OpenAI API key. To find your keys, visit your OpenAI's API Keys page.", + "instillCredentialField": true, "instillUIOrder": 0, "title": "API Key", "type": "string" diff --git a/pkg/pinecone/config/definitions.json b/pkg/pinecone/config/definitions.json index 72b124d..c608535 100644 --- a/pkg/pinecone/config/definitions.json +++ b/pkg/pinecone/config/definitions.json @@ -16,15 +16,15 @@ "additionalProperties": false, "properties": { "api_key": { - "instillCredentialField": true, "description": "Fill your Pinecone AI API key. You can create a api key in [Pinecone Console](https://app.pinecone.io/)", + "instillCredentialField": true, "instillUIOrder": 0, "title": "API Key", "type": "string" }, "url": { - "instillCredentialField": false, "description": "Fill in your Pinecone base URL. It is in the form [https://index_name-project_id.svc.environment.pinecone.io]", + "instillCredentialField": false, "instillUIOrder": 1, "title": "Pinecone Base URL", "type": "string" diff --git a/pkg/pinecone/config/tasks.json b/pkg/pinecone/config/tasks.json index c65e15f..f0be465 100644 --- a/pkg/pinecone/config/tasks.json +++ b/pkg/pinecone/config/tasks.json @@ -106,6 +106,7 @@ "description": "Metadata", "instillFormat": "object", "instillUIOrder": 3, + "required": [], "title": "Metadata", "type": "object" }, @@ -128,6 +129,10 @@ "type": "array" } }, + "required": [ + "id", + "score" + ], "title": "Match", "type": "object" }, diff --git a/pkg/stabilityai/config/definitions.json b/pkg/stabilityai/config/definitions.json index 3198a28..912d9ca 100644 --- a/pkg/stabilityai/config/definitions.json +++ b/pkg/stabilityai/config/definitions.json @@ -16,8 +16,8 @@ "additionalProperties": false, "properties": { "api_key": { - "instillCredentialField": true, "description": "Fill your Stability AI API key. To find your keys, visit - https://platform.stability.ai/account/keys", + "instillCredentialField": true, "instillUIOrder": 0, "title": "API Key", "type": "string"