Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(component): refactor defintion json files #945

Merged
merged 2 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 19 additions & 32 deletions pkg/component/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,26 +132,20 @@ should be in the format `TASK_NAME`.
```json
{
"TASK_GREET": {
"instillShortDescription": "Greet someone / something",
"shortDescription": "Greet someone / something",
"title": "Greet",
"input": {
"description": "Input",
"instillUIOrder": 0,
"uiOrder": 0,
"properties": {
"target": {
"instillUIOrder": 0,
"uiOrder": 0,
"description": "The target of the greeting",
"instillAcceptFormats": [
"acceptFormats": [
"string"
],
"instillUpstreamTypes": [
"value",
"reference",
"template"
],
"instillUIMultiline": true,
"title": "Greeting target",
"type": "string"
"format": "string"
}
},
"required": [
Expand All @@ -162,15 +156,15 @@ should be in the format `TASK_NAME`.
},
"output": {
"description": "The greeting sentence",
"instillUIOrder": 0,
"uiOrder": 0,
"properties": {
"greeting": {
"description": "A greeting sentence addressed to the target",
"instillUIOrder": 0,
"uiOrder": 0,
"required": [],
"title": "Greeting",
"type": "string",
"instillFormat": "string"
"format": "string"
}
},
"required": [
Expand All @@ -189,49 +183,42 @@ This file defines the input and output schema of each task:

- **`title`** is used by the console to provide the title of the task in the
component.
- **`description`** and **`instillShortDescription`** are used by the console to
- **`description`** and **`shortDescription`** are used by the console to
provide a description of the task in the component. If
**`instillShortDescription`** does not exist, it will be the same as
**`shortDescription`** does not exist, it will be the same as
**`description`**.
- **`input`** is a JSON Schema that describes the input of the task.
- **`output`** is a JSON Schema that describes the output of the task.

**Properties within `input` and `output` Objects**

- **`required`** indicates whether the property is required.
- **`type`**: describes the JSON type of this field, which could be `integer`,
`number`, `boolean`, `string`, `array`, or `object`.
- **`format`**: describes the format of this field, which could be `string`,
`number`, `boolean`, `file`, `document`, `image`, `video`, `audio`, `array`,
or `object`.
- **`title`** is used by the console to provide the title of the property in the component.
- **`description`** is used by the console to provide information about this
task in the component.
- **`instillShortDescription`**: is a concise version of `description`, used to
- **`shortDescription`**: is a concise version of `description`, used to
fit smaller spaces such as a component form field. If this value is empty, the
`description` value will be used.
- **`instillUIOrder`** defines the order in which the properties will be
- **`uiOrder`** defines the order in which the properties will be
rendered in the component.
- **`instillUIMultiline`** indicates whether the text field in the component is
multiline.

**Properties within `input` Objects**

- **`instillEditOnNodeFields`** determines whether this field will appear at the
forefront of the component. Optional properties can be set in the
advanced configuration.
- **`instillAcceptFormats`** is an array indicating the data types of acceptable
- **`acceptFormats`** is an array indicating the data types of acceptable
input fields. It should be an array of [**Instill
Format**](https://www.instill.tech/docs/vdp/instill-format).
- Currently, we do not support the `time` type. When the input is a `date` or `datetime`, it should be represented as a string. The `date` or `datetime` will be automatically parsed in UTC timezone by the YAML parser. Please ensure this point is noted in the documentation, specifically for the `start-to-read-date` in the Slack component.
- **`instillUpstreamTypes`** defines how an input property can be set: as a
direct value, a reference to another value in the pipeline, or a combination
of both (e.g., `${variable.name}` or `my dear ${variable.name}`).
- **`instillSecret`** indicates the data must reference the secrets and cannot
be used in plaintext.

**Properties within `output` Objects**

- **`instillFormat`** indicates the data type of the output field, which should
be one of `number`, `integer`, `string`, `object`, `boolean`, or MIME type.
Please refer to [**Instill
- **`format`** indicates the data type of the output field, which should be one
of `string`, `number`, `boolean`, `file`, `document`, `image`, `video`,
`audio`, `array`, or `object`. Please refer to [**Instill
Format**](https://www.instill.tech/docs/vdp/instill-format) for more details.

See the [example recipe](#example-recipe) to understand how these fields map to
Expand Down
14 changes: 7 additions & 7 deletions pkg/component/ai/anthropic/v0/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ${connection.<my-connection-id>}`.

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Field | Field ID | Type | Note |
| Field | Field ID | Format | Note |
| :--- | :--- | :--- | :--- |
| API Key | `api-key` | string | Fill in your Anthropic API key. To find your keys, visit the Anthropic console page. |

Expand All @@ -54,7 +54,7 @@ Anthropic's text generation models (often called generative pre-trained transfor

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Input | ID | Type | Description |
| Input | Field ID | Format | Description |
| :--- | :--- | :--- | :--- |
| Task ID (required) | `task` | string | `TASK_TEXT_GENERATION_CHAT` |
| Model Name (required) | `model-name` | string | The Anthropic model to be used. <br/><details><summary><strong>Enum values</strong></summary><ul><li>`claude-3-5-sonnet-latest`</li><li>`claude-3-5-sonnet-20241022`</li><li>`claude-3-5-sonnet-20240620`</li><li>`claude-3-opus-20240229`</li><li>`claude-3-sonnet-20240229`</li><li>`claude-3-haiku-20240307`</li></ul></details> |
Expand All @@ -78,7 +78,7 @@ Incorporate external chat history, specifically previous messages within the con

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Field | Field ID | Type | Note |
| Field | Field ID | Format | Note |
| :--- | :--- | :--- | :--- |
| [Content](#text-generation-chat-content) | `content` | array | The message content. |
| Role | `role` | string | The message role, i.e. 'system', 'user' or 'assistant'. |
Expand All @@ -89,7 +89,7 @@ The message content.

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Field | Field ID | Type | Note |
| Field | Field ID | Format | Note |
| :--- | :--- | :--- | :--- |
| [Image URL](#text-generation-chat-image-url) | `image-url` | object | The image URL. |
| Text | `text` | string | The text content. |
Expand All @@ -101,7 +101,7 @@ The image URL.

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Field | Field ID | Type | Note |
| Field | Field ID | Format | Note |
| :--- | :--- | :--- | :--- |
| URL | `url` | string | Either a URL of the image or the base64 encoded image data. |
</div>
Expand All @@ -111,7 +111,7 @@ The image URL.

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Output | ID | Type | Description |
| Output | Field ID | Format | Description |
| :--- | :--- | :--- | :--- |
| Text | `text` | string | Model Output. |
| [Usage](#text-generation-chat-usage) (optional) | `usage` | object | Usage tokens in Anthropic. |
Expand All @@ -124,7 +124,7 @@ The image URL.

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Field | Field ID | Type | Note |
| Field | Field ID | Format | Note |
| :--- | :--- | :--- | :--- |
| Input Tokens | `input-tokens` | number | The input tokens used by Anthropic. |
| Output Tokens | `output-tokens` | number | The output tokens used by Anthropic. |
Expand Down
14 changes: 4 additions & 10 deletions pkg/component/ai/anthropic/v0/config/setup.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,17 @@
"properties": {
"api-key": {
"description": "Fill in your Anthropic API key. To find your keys, visit the Anthropic console page.",
"instillUpstreamTypes": [
"reference"
],
"instillAcceptFormats": [
"acceptFormats": [
"string"
],
"instillSecret": true,
"instillCredential": true,
"instillUIOrder": 0,
"uiOrder": 0,
"title": "API Key",
"type": "string"
"format": "string"
}
},
"required": [],
"instillEditOnNodeFields": [
"api-key"
],
"title": "Anthropic Connection",
"type": "object"
"format": "object"
}
Loading
Loading