---
name: "initializePanelAgentRoleBinding"
mode: "api"
versionRequirements:
  - { name: "@tuya-miniapp/cloud-api", version: "1.0.6" }
---

## initializePanelAgentRoleBinding

> [VERSION] @tuya-miniapp/cloud-api >= 1.0.6

> 💡 This API relies on cloud capabilities. Grant authorization in Development Settings - Cloud Capabilities on the [Mini App Developer Platform](https://platform.tuya.com/miniapp/).

### Description

Initialize role-agent binding.

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `params` | `InitializePanelAgentRoleBindingParams` | Yes | Request body |

### Return Value

Type: `Promise<PanelAgentRoleDetail>`

InitializePanelAgentRoleBindingResult (see type definitions and minituya response parameters for field meanings)

##### PanelAgentRoleDetail

| Property | Type | Description |
| --- | --- | --- |
| `roleId` | `string` | Role ID |
| `roleName` | `string` | Role name |
| `roleDesc` | `string` | Role description |
| `roleIntroduce` | `string` | Role introduction |
| `roleImgUrl` | `string` | Role image |
| `useLangCode` | `string` | Role language code |
| `useLangName` | `string` | Role language name |
| `useTimbreId` | `string` | Role timbre |
| `isUserCloneTimbre` | `boolean` | Whether it is a custom cloned timbre |
| `useTimbreName` | `string` | Role timbre name |
| `useTimbreSupportLangs` | `string` | Timbre languages supported by the role, separated by commas |
| `useTimbreSupportLangList` | `string[]` | List of timbre languages supported by the role |
| `useTimbreTags` | `string[]` | Role tags |
| `useLlmId` | `string` | Role language model |
| `useLlmName` | `string` | Role language model name |
| `inBind` | `boolean` | Whether bound |
| `memoryInfo` | `string` | Memory |
| `speed` | `number` | Timbre speed |
| `tone` | `number` | Timbre tone |
| `templateId` | `string` | Template ID |
| `bindRoleType` | `number` | Bound role type |
| `lastTextAnswer` | `string` | Most recent reply text |
| `llmSupportFuncTags` | `string` | Function tags supported by the language model, separated by commas |

### Referenced Types

##### `interface` InitializePanelAgentRoleBindingParams

| Property | Type | Description |
| --- | --- | --- |
| `devId` | `string` | Device ID |


### Examples

#### Request example

```typescript
import { initializePanelAgentRoleBinding } from '@tuya-miniapp/cloud-api';

const params = {
  devId: 'your_device_id',
};

initializePanelAgentRoleBinding(params)
  .then(result => {
    console.log('Initialization result:', result);
  })
  .catch(error => {
    console.error('Failed to initialize binding relationship:', error);
  });
```

#### Response example

```json
{
  "roleId": "role_initialized_001",
  "roleName": "Initialized smart assistant",
  "roleDesc": "Default smart assistant initialized by the system",
  "roleIntroduce": "I am the smart assistant initialized by the system for you",
  "roleImgUrl": "https://example.com/default_avatar.jpg",
  "useLangCode": "zh-CN",
  "useLangName": "Chinese (Simplified)",
  "useTimbreId": "timbre_default_001",
  "isUserCloneTimbre": false,
  "useTimbreName": "Default timbre",
  "useTimbreSupportLangs": "zh-CN",
  "useTimbreSupportLangList": ["zh-CN"],
  "useTimbreTags": ["Default", "Initial"],
  "useLlmId": "1001",
  "useLlmName": "GPT-3.5-turbo",
  "inBind": true,
  "memoryInfo": "Initialization memory info",
  "speed": 1.0,
  "tone": 0.5,
  "templateId": "default_template",
  "bindRoleType": 2,
  "lastTextAnswer": "Hello, I am your smart assistant. Glad to serve you!",
  "llmSupportFuncTags": "text"
}
```
