bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 16쪽
ab" alt=""><figcaption><p>Melo TTS</p></figcaption></figure>
`AnyWidgetConfig`
| Field's Name | JSON Type (Required/Optional) | Description | Example |
| ------------ | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| widget\_id | string (Required) | Creators can select their desired widget in the Workshop, and copy the widget id. | '1743340032770445312' |
| output\_name | string (Required) | Specifies the name of the output in AnyWidgetConfig. | 'result' |
| cache | boolean (Optional) | <p>Flag to enable cache mode. When set to true, the state will run only once and store the result.<br>Default to false.</p> | |
# Prompt Widget
### Widgets in Workshop

### Config
Fields besides `widget_id` and `output_name`
| Field's Name | JSON Type (Required/Optional) | Description | Example |
| ------------ | ----------------------------- | ------------------------------------------------ | -------- |
| content | string (Required) | User input message processed by language models. | ‘Hello.’ |
### Example
```json
{
"id": "test",
"initial": "home_state",
"states": {
"home_state": {
"inputs": {
"input_message": {
"type": "text",
"user_input": true
}
},
"tasks": [
{
"name": "any_module_test_task",
"module_type": "AnyWidgetModule",
"module_config": {
"widget_id": "1743157315558707200",
"content": "{{input_message}}",
"output_name": "result"
}
}
],
"render": {
"text": "{{result}}",
"buttons": [
{
"content":"Chat Again",
"description":"",
"on_click":"chat"
}
]
},
"transitions": {
"chat": "home_state"
}
}
}
}
```
# LLM Widget
### Widgets in Workshop

### Config
Most fields are compatible with [OpenAI API](https://platform.openai.com/docs/api-reference/chat/create).
Fields besides `widget_id` and `output_name`
| Field's Name | JSON Type (Required/Optional) | Description | Example |
| ---------------------- | ------------------------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| temperature | number (Optional) | Controls randomness in the LLMConfig model's responses. | 0.6 |
| top\_p | number (Optional) | Controls diversity via nucleus sampling in LLMConfig. | 0.8 |
| max\_tokens | number (Optional) | Determines the maximum length of the model’s response in LLMConfig. | 150 |
| presence\_penalty | number (Optional) | Influences the likelihood of the model to talk about new topics in LLMConfig. | 0.6 |
| frequency\_penalty | number (Optional) | Controls how often the model makes use of infrequent words in LLMConfig. | 0.5 |
| memory | MemoryItem\[] (Optional) | Stores information acquired across multiple rounds of dialog in LLMConfig. | \[{ role: 'user', content: 'Hello World' }] |
| need\_memory | boolean (Optional) | Determines if memory usage is required in LLMConfig. | true |
| system\_prompt | string | Expression (Required) | Provides system prompt for the user in LLMConfig. |
| user\_prompt | string | Expression (Required) | Provides user prompt for the system in LLMConfig. |
| function\_name | string (Optional) | Specifies the name of the function in LLMFunctionConfig. | 'get\_current\_weather' |
| function\_description | string (Optional) | Provides a description of the function in LLMFunctionConfig. | 'Get the current weather in a given location' |
| function\_parameters | FunctionParameter\[] (Optional) | Specifies the parameters of the function in LLMFunctionConfig. | \[{name: 'city', type: 'string', description: 'The city, e.g. San Francisco, CA'}] |
| knowledge\_base\_token | string (Optional) | Specify the knowledge base the widget uses. | |
`FunctionParameter`
| Field's Name | JSON Type (Required/Optional) | Description | Example |
| ------------ | ----------------------------- | ---------------------------------------------------------------------- | ---------------------------------- |
| name | string (Required) | Specifies the name of the function parameter in FunctionParameter. | 'city' |
| type | string (Required) | Specifies the type of the function parameter in FunctionParameter. | 'list', 'string' or 'number' |
| description | string (Required) | Provides a description of the function parameter in FunctionParameter. | 'The city, e.g. San Francisco, CA' |
### Function Call
If you want to execute LLM function calls, you may specify `function_name`, `function_description` and `function_parameters` fields.
{% hint style="info" %}
Function calls can be seen as a formatting wrapper provided by LLM (currently only supports OpenAI series models), allowing parameters to be input via JSON, and outputting a serial JSON. 
Reference:
* <https://www.promptingguide.ai/applications/function_calling>
* <https://platform.openai.com/docs/api-reference/chat/create>
{% endhint %}
For LLM function calls, the output of the widget is a JSON object, which includes the LLM returned results and will be automatically output to the state machine output in the form of key-value pairs.
### Example
```json
{
"id": "prompt_widget_template",
"initial": "home_state",
"states": {
"home_state": {
"inputs": {
"input_message": {
"type": "IM",
"user_input": true
}
},
"tasks": [
{
"name": "llm_widget_example_task",
"module_type": "AnyWidgetModule",
"module_config": {
"widget_id": "1744214047475109888",
"user_prompt": "{{input_message}}", // the text inputted into prompt widget, you can get it from user input or upper state
"system_prompt": "Act as ...", // Optional field. You can input system prompt of bot.
"top_p": 0.5, // Optional field. Default value is 0.5
"temperature": 0.5, // Optional field. Default value is 0.5
"frequency_penalty": 0, // Optional field. Default value is 0
"presence_penalty": 0, // Optional field. Default value is 0
"output_name": "result"
}
}
],
"render": {
"text": "{{result}}", // it's a string produced by prompt widget.
"buttons": [
{
"content": "Chat Again",
"description": "",
"on_click": "rerun"
}
]
},
"transitions": {
"rerun": "home_state",
"CHAT": "home_state"
}
}
}
}
```
# TTS Widget
Widget in Workshop

Config
Fields besides `widget_id` and `output_name`
| Field's Name | JSON Type (Required/Optional) | Description | Example |
| ------------ | ----------------------------- | ----------------------------------------------------- | -------- |
| content | string (Required) | User input message processed by language models. | ‘Hello.’ |
| speed | number (Optional) | Speed of audio. The number should be between 0 and 2. | '1.5' |
Example
```json
{
"id": "test",
"initial": "home_state",
"states": {
"home_state": {
"inputs": {
"read_text": {
"type": "text",
"user_input": true
}
},
"tasks": [
{
"name": "any_module_test_task",
"module_type": "AnyWidgetModule",
"module_config": {
"widget_id": "1743159010695057408",
"content": "{{read_text}}",
"speed": 1,
"output_name": "result"
}
}
],
"render": {
"text": "{{read_text}}",
"audio": "{{result}}",
"buttons": [
{
"content":"Listen Again",
"description":"",
"on_click":"listen"
}
]
},
"transitions": {
"listen": "home_state"
}
}
}
}
```
# Code Runner Widget
### Widgets in Workshop

{% hint style="info" %}
Currently we only provide JavaScript code runner. The supported syntax remains consistent with [Common](/create/pro-config-mode/basic/common#expression), including ECMAScript 5.1 and certain 6+ features.\
We don't support third-party libraries or host-environment-specific API like `fetch.`
{% endhint %}
### Config
Fields besides `widget_id` and `output_name`
| Field's Name | JSON Type (Required/Optional) | Description | Example |
| ------------ | ----------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| code | string (Required) | A stringified code snippet. It should contain one or more function definitions. | "function main(params) {\n const { a, b } = params;\n const sum = a + b;\n return sum;\n}" |
| function | string (Optional) | The name of the function you want to call in the code snippet. Defaults to `main`. | 'main' |
| params | Object (Optional) | The parameters you pass to the calling function. | ‘Hello.’ |
{% hint style="info" %}
You can use the widget's 'Copy' button to get a stringified code snippet for `code` field.
{% endhint %}
<figure><img src="https://2975681513-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDtmZwLatyyBFLUK6P6Pj%2Fuploads%2FwykXLLRGtNmFngqM4uJ6%2Fcopy%20code.png?alt=media&token=da27878d-8683-4824-9fd4-3e231efb1545" alt=""><figcaption><p>Copy code</p></figcaption></figure>
### Example
{% code overflow="wrap" %}
```json
{
"id": "code_widget_template",
"initial": "home_state",
"states": {
"home_state": {
"tasks": [
{
"name": "code_widget_example_task",
"module_type": "AnyWidgetModule",
"module_config": {
"widget_id": "1751859390353202447",
"params": {
"a": "{{1}}",
"b": "{{2}}"
},
"code": "function main(params) {\n const { a, b } = params;\n const sum = a + b;\n return sum;\n}", // the text inputted into prompt widget, you can get it from user input or upper state
"output_name": "result"
}
}
],
"render": {
"text": "{{result}}", // it's a string produced by prompt widget.
"buttons": [
{
"content": "Run Again",
"description": "",
"on_click": "rerun"
}
]
},
"transitions": {
"rerun": "home_state",
"CHAT": "home_state"
}
}
}
}
```
{% endcode %}
# Melo TTS
### Widget
{% embed url="<https://app.myshell.ai/widget/32AnEr>" %}
### Config

### Example
```json
{
"id": "test",
"initial": "home_state",
"states": {
"home_state": {
"inputs": {
"input_message": {
"type": "text",
"user_input": true
}
},
"tasks": [
{
"name": "any_module_test_task",
"module_type": "AnyWidgetModule",
"module_config": {
"widget_id": "1745097608856756779",
"language": "en_us",
"speed": 1,
"text": "{{input_message}}",
"output_name": "result"
}
}
],
"render": {
"text": "My Voice",
"audio": "{{result.file_url}}",
"buttons": [
{
"content": "Listen Again",
"description": "",
"on_click": "listen"
}
]
},
"transitions": {
"listen": "home_state"
}
}
}
}
```
# Age Transformation
### Widget
{% embed url="<https://app.myshell.ai/widget/vEfYV3>" %}
### Config

### Example
```json
{
"id": "test",
"initial": "home_state",
"states": {
"home_state": {
"inputs": {
"your_face_image_url": {
"type": "image",
"user_input": true
}
},
"tasks": [
{
"name": "any_module_test_task",
"module_type": "AnyWidgetModule",
"module_config": {
"widget_id": "1743838658173079552",
"image": "{{your_face_image_url}}",
"target_age": "default",
"output_name": "result"
}
}
],
"render": {
"text": "Result",
"image": "{{result.file_url}}",
"buttons": [
{
"content": "Generate Again",
"description": "",
"on_click": "generate"
}
]
},
"transitions": {
"generate": "home_state"
}
}
}
}
```
# ChatImg
### Widget
{% embed url="<https://app.myshell.ai/widget/eemAzu>" %}
### Config

### Example
```json
{
"id": "test",
"initial": "home_state",
"states": {
"home_state": {
"inputs": {
"your_image_url": {
"type": "image",
"user_input": true
},
"your_question": {
"type": "text",
"user_input": true
}
},
"tasks": [
{
"name": "any_module_test_task",
"module_type": "AnyWidgetModule",
"module_config": {
"widget_id": "1743838640687026176",
"output_name": "result",
"image": "{{your_image_url}}",
"prompt": "{{your_question}}",
"top_p": 1,
"temperature": 0.2,
"max_tokens": 1024
}
}
],
"render": {
"text": "{{result.content}}",
"buttons": [
{
"content": "Generate Again",
"description": "",
"on_click": "generate"
}
]
},
"transitions": {
"generate": "home_state"
}
}
}
}
```
# GIF Generation
### GIF Generation
### Widget
{% embed url="<https://app.myshell.ai/widget/N32eA3>" %}
### Config

### Example
```json
{
"id": "test",
"initial": "home_state",
"states": {
"home_state": {
"inputs": {
"prompt": {
"type": "text",
"user_input": true
}
},
"tasks": [
{
"name": "any_module_test_task",
"module_type": "AnyWidgetModule",
"module_config": {
"widget_id": "1743838648844947456",
"output_name": "result",
"prompt": "{{prompt}}",
"negative_prompt": "blurry",
"width": 672,
"height": 384,
"scheduler": "EulerAncestralDiscreteScheduler",
"steps": 30,
"mp4": false,
"seed": 6226
}
}
],
"render": {
"text": "Result",
"image": "{{result.file_url}}",
"buttons": [
{
"content": "Generate Again",
"description": "",
"on_click": "generate"
}
]
},
"transitions": {
"generate": "home_state"
}
}
}
}
```
# Music Generation
### Widget
{% embed url="<https://app.myshell.ai/widget/MJBzEb>" %}
### Config

### Example
```json
{
"id": "test",
"initial": "home_state",
"states": {
"home_state": {
"inputs": {
"prompt_a": {
"type": "text",
"user_input": true
},
"prompt_b": {
"type": "text",
"user_input": true
}
},
"tasks": [
{
"name": "any_module_test_task",
"module_type": "AnyWidgetModule",
"module_config": {
"widget_id": "1743838636299784192",
"output_name": "result",
"prompt_a": "{{prompt_a}}",
"denoising": 0.75,
"prompt_b": "{{prompt_b}}",
"alpha": 0.5,
"num_inference_steps": 50,
"seed_image_id": "vibes"
}
}
],
"render": {
"text": "Result",
"audio": "{{result.audio}}",
"buttons": [
{
"content": "Generate Again",
"description": "",
"on_click": "generate"
}
]
},
"transitions": {
"generate": "home_state"
}
}
}
}
```
# LLM Module
Most fields are compatible with [OpenAI API](https://platform.openai.com/docs/api-reference/chat/create).
`LLMConfig`
| Field's Name | JSON Type (Required/Optional) | Description | Example |
| ------------------ | ----------------------------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------- |
| model | "gpt-35-turbo-16k" | "gpt-4-1116-preview" (Required) | Determines the OpenAI language model to be used in LLMConfig. |
| temperature | number (Optional) | Controls randomness in the LLMConfig model's responses. | 0.6 |
| top\_p | number (Optional) | Controls diversity via nucleus sampling in LLMConfig. | 0.8 |
| max\_tokens | number (Optional) | Determines the maximum length of the model’s response in LLMConfig. | 150 |
| presence\_penalty | number (Optional) | Influences the likelihood of the model to talk about new topics in LLMConfig. | 0.6 |
| frequency\_penalty | number (Optional) | Controls how often the model makes use of infrequent words in LLMConfig. | 0.5 |
| memory | MemoryItem\[] (Optional) | Stores information acquired across multiple rounds of dialog in LLMConfig. | \[{ role: 'user', content: 'Hello World' }] |
| need\_memory | boolean (Optional) | Determines if memory usage is required in LLMConfig. | true |
| system\_prompt | string | Expression (Required) | Provides system prompt for the user in LLMConfig. |
| user\_prompt | string | Expression (Required) | Provides user prompt for the system in LLMConfig. |
| output\_name | string (Required) | Determines the name of the module output in LLMConfig, defaults to 'reply'. | "reply" |
`MemoryItem`
| Field's Name | JSON Type (Required/Optional) | Description | Example |
| ------------ | ----------------------------- | --------------------- | ------------------------------------------------------------ |
| role | user | assistant (Required) | Specifies the source of the memory item in MemoryItem. |
| content | string | Expression (Required) | Specifies the actual value of the memory item in MemoryItem. |
####
# LLM Function Module
`LLMFunctionModule` is a module used for executing LLM function calls.
Function calls can be seen as a formatting wrapper provided by LLM (currently only supports OpenAI series models), allowing parameters to be input via JSON, and outputting a serial JSON as we defined in `function_parameters`.
Reference:
* <https://www.promptingguide.ai/applications/function_calling>
* <https://platform.openai.com/docs/api-reference/chat/create>
The module input can be specified by each parameter in the config.
The output of the module is a JSON object, which includes the LLM return results and will be automatically output to the state machine output in the form of key-value pairs.
`LLMFunctionConfig` is similar to `LLMConfig`. It only differs by:
* the lack of `output_name`
* three fields starting with `function_`, which are vital for the LLMFunctionModule as they control the function behavior. They will be placed in the tools field of the LLM Request Body.
`LLMFunctionConfig`
| Field's Name | JSON Type (Required/Optional) | Description | Example |
| --------------------- | ------------------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| function\_name | string (Required) | Specifies the name of the function in LLMFunctionConfig. | 'get\_current\_weather' |
| function\_description | string (Required) | Provides a description of the function in LLMFunctionConfig. | 'Get the current weather in a given location' |
| function\_parameters | FunctionParameter\[] (Required) | Specifies the parameters of the function in LLMFunctionConfig. | \[{name: 'city', type: 'string', description: 'The city, e.g. San Francisco, CA'}] |
`FunctionParameter`
| Field's Name | JSON Type (Required/Optional) | Description | Example |
| ------------ | ----------------------------- | ---------------------------------------------------------------------- | ---------------------------------- |
| nam프로젝트로 돌아가기