• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.app.ability.InsightIntentDecorator (Intent Decorator)
2
3<!--Kit: Ability Kit-->
4<!--Subsystem: Ability-->
5<!--Owner: @linjunjie6-->
6<!--Designer: @li-weifeng2-->
7<!--Tester: @lixueqing513-->
8<!--Adviser: @huipeizi-->
9
10The InsightIntentDecorator module provides various intent decorators that allow you to define application functionalities as intents and integrate them into AI-driven features like intelligent Q&A, search, and recommendations.
11
12- [@InsightIntentLink](#insightintentlink): decorates a URI in your application as an intent, enabling AI systems to quickly jump to your application via this intent. For details on the parameters supported by this decorator, see [LinkIntentDecoratorInfo](#linkintentdecoratorinfo).
13- [@InsightIntentPage](#insightintentpage): decorates a page in your application as an intent, enabling AI systems to swiftly navigate to that page. For details on the parameters supported by this decorator, see [PageIntentDecoratorInfo](#pageintentdecoratorinfo).
14- [@InsightIntentFunction](#insightintentfunction) and [@InsightIntentFunctionMethod](#insightintentfunctionmethod): The two decorators must be used together. [@InsightIntentFunction](#insightintentfunction) is used to decorate a class, and [@InsightIntentFunctionMethod](#insightintentfunctionmethod) is used to decorate a static function in that class. This setup defines the static function as an intent, enabling AI systems to execute it rapidly.
15- [@InsightIntentEntry](#insightintententry): decorates a class that inherits from [InsightIntentEntryExecutor](./js-apis-app-ability-InsightIntentEntryExecutor.md) to specify the execution mode supported when the ability is started. This helps the AI entry point to easily invoke the bound ability and perform the intended action. For details on the parameters supported by this decorator, see [EntryIntentDecoratorInfo](#entryintentdecoratorinfo).
16- [@InsightIntentForm](#insightintentform): decorates a [FormExtensionAbility](../apis-form-kit/js-apis-app-form-formExtensionAbility.md) to specify the name of the widget bound to the FormExtensionAbility. This enables the widget to be added to the AI entry point via intent calls. For details on the parameters supported by this decorator, see [FormIntentDecoratorInfo](#formintentdecoratorinfo).
17- [@InsightIntentEntity](#insightintententity): decorates a class that inherits from [IntentEntity](./js-apis-app-ability-insightIntent.md#intententity20) to define the class as an intent entity, which can pass parameters required for intent calls. For details on the parameters supported by this decorator, see [IntentEntityDecoratorInfo](#intententitydecoratorinfo).
18
19> **NOTE**
20>
21> The initial APIs of this module are supported since API version 20. Newly added APIs will be marked with a superscript to indicate their earliest API version.
22
23## Basic Concepts
24
25Intents are divided into two types: standard intents and custom intents.
26
27The system queries the standard intent list for a matching intent based on the **schema** and **intentVersion** fields in [IntentDecoratorInfo](#intentdecoratorinfo).
28
29- If a match is found, the intent is identified as a standard intent.
30- If no match is found, the intent is identified as a custom intent.
31
32## Modules to Import
33
34```ts
35import { InsightIntentLink, InsightIntentPage, InsightIntentFunctionMethod, InsightIntentFunction, InsightIntentEntry } from '@kit.AbilityKit';
36```
37
38## Constraints
39
40The intent decorators provided by this module can be used only in.ets files of HAP or HSP modules.
41
42## @InsightIntentLink
43
44Decorates a URI in the application as an intent, enabling AI systems to quickly jump to the application via this intent. For details on the parameters supported by this decorator, see [LinkIntentDecoratorInfo](#linkintentdecoratorinfo).
45
46> **NOTE**
47>
48> The URI format must adhere to the requirements described in [Application Link Description](../../application-models/app-uri-config.md).
49
50**Model restriction**: This API can be used only in the stage model.
51
52**System capability**: SystemCapability.Ability.AbilityRuntime.Core
53
54**Atomic service API**: This API can be used in atomic services since API version 20.
55
56**Example**
57
58Custom intent: The parameters of a custom intent must be passed in as a standard JSON schema data structure.
59
60```ts
61import { InsightIntentLink, LinkParamCategory } from '@kit.AbilityKit';
62
63@InsightIntentLink({
64  intentName: 'PlayMusic',
65  domain: 'MusicDomain',
66  intentVersion: '1.0.1',
67  displayName: 'Play Music',
68  displayDescription: 'Intent to play music',
69  icon: $r('sys.float.window_shadow_config'),
70  llmDescription: 'Supports passing song names to play music',
71  keywords: ['music playback', 'play music', 'PlayMusic'],
72  uri: 'https://www.example.com/music/',
73  paramMappings: [{
74    paramName: 'songName',
75    paramMappingName: 'music',
76    paramCategory: LinkParamCategory.LINK
77  }],
78  parameters: {
79    'schema': 'http://json-schema.org/draft-07/schema#',
80    'type': 'object',
81    'title': 'Song Schema',
82    'description': 'A schema for describing songs and their artists',
83    'properties': {
84      'songName': {
85        'type': 'string',
86        'description': 'The name of the song',
87        'minLength': 1
88      }
89    },
90    'required': ['songName'],
91    'additionalProperties': false
92  },
93  result: {
94    'type': 'object',
95    'propertyNames': {
96      'enum': [
97        'code',
98        'result'
99      ]
100    },
101    'required': [
102      'code',
103      'result'
104    ],
105    'properties': {
106      'code': {
107        'description': 'Result code for job execution',
108        'type': 'number'
109      },
110      'result': {}
111    }
112  }
113})
114export class ClassForLink {
115  private _playback: string = 'intention_test';
116
117  public set playback(value: string) {
118    this._playback = value;
119  }
120
121  public get playback(): string {
122    return this._playback;
123  }
124
125  constructor(playback: string) {
126    this._playback = playback;
127  }
128
129  static Function1(playbackProgress: number, playback?: number): void {
130    console.log('Function1' + playbackProgress);
131  }
132}
133```
134
135## IntentDecoratorInfo
136
137Common properties for intent decorators, used to define basic information about an intent (including the intent name and version number). It applies to all decorators provided by this module.
138
139**Model restriction**: This API can be used only in the stage model.
140
141**System capability**: SystemCapability.Ability.AbilityRuntime.Core
142
143**Atomic service API**: This API can be used in atomic services since API version 20.
144
145**Properties**
146
147> **NOTE**
148>
149> If a matching intent is found in the standard intent list based on the **schema** and **intentVersion** fields, the system automatically populates the **intentName**, **domain**, **llmDescription**, **keywords**, **parameters**, and **result** fields with the values from the matching standard intent.
150
151| Name              | Type           | Read-Only        | Optional| Description                                                        |
152| ------------------ | ----------------| ---------- | ---- | ------------------------------------------------------------ |
153| intentName         | string          | No      | No  | Intent name. For a standard intent, the value of this field is the value defined in the standard intent for the corresponding field.                  |
154| domain             | string          | No      | No  | Vertical domain of the intent. It is used to categorize intents by vertical fields (for example, video, music, and games). For details about the value range, see the vertical domain fields in [smart distribution features in different vertical domains](https://developer.huawei.com/consumer/en/doc/service/intents-ai-distribution-characteristic-0000001901922213#section2656133582215).   |
155| intentVersion      | string          | No      | No  | Version number of the intent. It is used to distinguish and manage intents when their capabilities evolve.                       |
156| displayName        | string          | No      | No  | Name of the intent displayed in the InsightIntent framework.                                      |
157| displayDescription | string         | No       | Yes  | Description of the intent displayed in the InsightIntent framework.                                      |
158| schema             | string         | No       | Yes  | Standard intent name.                 |
159| icon               | ResourceStr | No  | Yes  | Icon of the intent.<br>- If the value is a string, the icon is read from a network resource.<br>- If the value is a [resource](../../reference/apis-localization-kit/js-apis-resource-manager.md), the icon is read from a local resource.|
160| llmDescription     | string      | No          | Yes  | Function of an intent, which helps large language models understand the intent.                 |
161| keywords           | string[]     | No         | Yes  | Search keywords for the intent.                                      |
162| parameters         | Record<string, Object>| No| Yes  | Data format of intent parameters, which is used to define the input data format during intent calls.  |
163| result           | Record<string, Object>     | No         | Yes  | Data format for the results returned by intent calls. It defines how the data should be structured.                                      |
164
165## LinkIntentDecoratorInfo
166
167**LinkIntentDecoratorInfo** inherits from [IntentDecoratorInfo](#intentdecoratorinfo) and describes the parameters supported by the [@InsightIntentLink](#insightintentlink) decorator, such as the URI information required for application redirection.
168
169**Model restriction**: This API can be used only in the stage model.
170
171**System capability**: SystemCapability.Ability.AbilityRuntime.Core
172
173**Atomic service API**: This API can be used in atomic services since API version 20.
174
175**Properties**
176
177| Name       | Type             | Read-Only| Optional| Description                                                        |
178| ----------- | -----------------| ------ | ---- | ------------------------------------------------------------ |
179| uri                | string          | No         | No  | URI information associated with the intent.                                |
180| paramMappings      | [LinkIntentParamMapping](#linkintentparammapping)[] | No| Yes  | Mapping between intent parameters and URI information.   |
181
182## LinkIntentParamMapping
183
184**LinkIntentParamMapping** defines the mapping between intent parameters and URI information for the [@InsightIntentLink](#insightintentlink) decorator.
185
186**Model restriction**: This API can be used only in the stage model.
187
188**System capability**: SystemCapability.Ability.AbilityRuntime.Core
189
190**Atomic service API**: This API can be used in atomic services since API version 20.
191
192**Properties**
193
194| Name            | Type  | Read-Only| Optional| Description                                  |
195| ---------------- | ------ | ----| ---- | -------------------------------------- |
196| paramName        | string | No| No  | Name of the intent parameter.                      |
197| paramMappingName | string | No| Yes  | Mapping name of the intent parameter.                    |
198| paramCategory    | [LinkParamCategory](#linkparamcategory) | No| Yes  | Category of the intent parameter.<br>If an intent parameter is of the [LINK](#linkparamcategory) category, the system retrieves **paramMappingName** corresponding to **paramName** and appends it to the URI as a key-value pair (where **key** is the value of **paramMappingName**, and **value** is the intent parameter value).<br>If an intent parameter is of the [WANT](#linkparamcategory) category, the system retrieves **paramMappingName** corresponding to **paramName** and passes the mapping name and value using the **parameters** field in [Want](./js-apis-app-ability-want.md). |
199
200## LinkParamCategory
201
202Enumerates the intent parameter categories available for the [@InsightIntentLink](#insightintentlink) decorator. The enum is used to define how intent parameters should be passed.
203
204**Model restriction**: This API can be used only in the stage model.
205
206**System capability**: SystemCapability.Ability.AbilityRuntime.Core
207
208**Atomic service API**: This API can be used in atomic services since API version 20.
209
210| Name| Value| Description|
211| -------- | -------- | -------- |
212| LINK  | 'link' | Category of link. Intent parameters are appended to the end of a URI link and passed to the application via the URI.|
213| WANT  | 'want' | Category of want. Intent parameters are passed to the application through the **parameters** field in [Want](./js-apis-app-ability-want.md).|
214
215## @InsightIntentPage
216
217Decorates a page in the application as an intent, enabling AI systems to swiftly navigate to that page. For details on the parameters supported by this decorator, see [PageIntentDecoratorInfo](#pageintentdecoratorinfo).
218
219> **NOTE**
220>
221> This decorator is only applicable to struct pages.
222
223**Model restriction**: This API can be used only in the stage model.
224
225**System capability**: SystemCapability.Ability.AbilityRuntime.Core
226
227**Atomic service API**: This API can be used in atomic services since API version 20.
228
229**Example**
230
231```ts
232import { InsightIntentPage } from '@kit.AbilityKit';
233
234@Entry
235@Component
236@InsightIntentPage({
237  intentName: 'SearchMusic',
238  domain: 'MusicDomain',
239  intentVersion: '1.0.1',
240  displayName: 'Search Music',
241  displayDescription: 'Intent to search music',
242  schema: 'SearchMusic',
243  uiAbility: 'Entry',
244  pagePath: './ets/pages/Index',
245  navigationId: '1',
246  navDestinationName: 'PageOne',
247})
248struct Index {
249  @State message: string = 'Hello World';
250
251  build() {
252    RelativeContainer() {
253      Text(this.message)
254        .id('HelloWorld')
255        .fontSize(50)
256        .fontWeight(FontWeight.Bold)
257        .alignRules({
258          center: { anchor: '__container__', align: VerticalAlign.Center },
259          middle: { anchor: '__container__', align: HorizontalAlign.Center }
260        })
261    }
262    .height('100%')
263    .width('100%')
264  }
265}
266```
267
268## PageIntentDecoratorInfo
269
270**PageIntentDecoratorInfo** inherits from [IntentDecoratorInfo](#intentdecoratorinfo) and describes the parameters supported by the [@InsightIntentPage](#insightintentpage) decorator, such as the name of [NavDestination](../apis-arkui/arkui-ts/ts-basic-components-navigation.md#navdestination10) of the target page.
271
272**Model restriction**: This API can be used only in the stage model.
273
274**System capability**: SystemCapability.Ability.AbilityRuntime.Core
275
276**Atomic service API**: This API can be used in atomic services since API version 20.
277
278**Properties**
279
280| Name              | Type        | Read-Only      | Optional| Description                                                        |
281| ------------------ | -------------| --------- | ---- | ------------------------------------------------------------ |
282| uiAbility          | string       | No          | Yes  | Name of the UIAbility bound to the intent.                                 |
283| pagePath           | string        | No         | No  | Path of the page bound to the intent. The page must be a file that actually exists.|
284| navigationId       | string        | No       | Yes  | ID of the [Navigation](../apis-arkui/arkui-ts/ts-basic-components-navigation.md#attributes) component bound to the intent.|
285| navDestinationName | string         | No      | Yes  | Name of the [NavDestination](../apis-arkui/arkui-ts/ts-basic-components-navigation.md#navdestination10) component bound to the intent.|
286
287## @InsightIntentFunction
288
289This decorator must be used together with the [@InsightIntentFunctionMethod](#insightintentfunctionmethod) decorator.
290
291This decorate is used to decorate a class, and [@InsightIntentFunctionMethod](#insightintentfunctionmethod) is used to decorate a static function in that class. This setup defines the static function as an intent, enabling AI systems to execute it rapidly.
292
293**Model restriction**: This API can be used only in the stage model.
294
295**System capability**: SystemCapability.Ability.AbilityRuntime.Core
296
297**Atomic service API**: This API can be used in atomic services since API version 20.
298
299## @InsightIntentFunctionMethod
300
301This decorator must be used together with the [@InsightIntentFunction](#insightintentfunction) decorator.
302
303[@InsightIntentFunction](#insightintentfunction) is used to decorate a class, and this decorator is used to decorate a static function in that class. This setup defines the static function as an intent, enabling AI systems to execute it rapidly.
304
305> **NOTE**
306>
307> The class containing static methods must be exported using **export**.
308>
309> Parameter names and types of a function must align with those specified in the intent definition.
310
311**Model restriction**: This API can be used only in the stage model.
312
313**System capability**: SystemCapability.Ability.AbilityRuntime.Core
314
315**Atomic service API**: This API can be used in atomic services since API version 20.
316
317**Example**
318
319```ts
320import { InsightIntentFunction, InsightIntentFunctionMethod } from '@kit.AbilityKit';
321
322@InsightIntentFunction()
323export class ClassForFuncDemo {
324  @InsightIntentFunctionMethod({
325  intentName: 'GetWeather',
326  domain: 'LifeDomain',
327  intentVersion: '1.0.1',
328  displayName: 'Query weather',
329  displayDescription: 'Display weather information',
330  icon: $r('sys.plural.selecttitlebar_accessibility_message_desc_new'),
331  llmDescription: 'Get weather of an location',
332  parameters: {
333    'schema': 'http://json-schema.org/draft-07/schema#',
334    'type': 'object',
335    'title': 'Weather Schema',
336    'description': 'A schema for get weather of an location',
337    'properties': {
338      'location': {
339        'type': 'string',
340        'description': 'The city and state, e.g. Hangzhou',
341        'minLength': 1
342      }
343    },
344    'required': ['location'],
345    'additionalProperties': false
346  }
347})
348  static getWeather(location: string): string {
349    console.log('location' + location);
350    return 'The current temperature in Hangzhou is 24℃';
351  }
352}
353```
354
355## FunctionIntentDecoratorInfo
356
357Parameter type of the [@InsightIntentFunctionMethod](#insightintentfunctionmethod) decorator. All properties inherit from [IntentDecoratorInfo](#intentdecoratorinfo).
358
359**Model restriction**: This API can be used only in the stage model.
360
361**System capability**: SystemCapability.Ability.AbilityRuntime.Core
362
363**Atomic service API**: This API can be used in atomic services since API version 20.
364
365## @InsightIntentEntry
366
367Decorates a class that inherits from [InsightIntentEntryExecutor](./js-apis-app-ability-InsightIntentEntryExecutor.md) to specify the execution mode supported when the ability is started. This helps the AI entry point to easily invoke the bound ability and perform the intended action. For details on the parameters supported by this decorator, see [EntryIntentDecoratorInfo](#entryintentdecoratorinfo).
368
369> **NOTE**
370>
371> - If this decorator is used to access a standard intent, all mandatory parameters defined in the standard intent JSON schema must be implemented and their parameter types must match.
372> - If this decorator is used to access a custom intent, all mandatory parameters defined in **parameters** must be implemented and their parameter types must match.
373> - Classes decorated by this decorator must be exported using **export default**. Class properties are limited to basic types or intent entities, and the return value must be intent entities.
374
375**Model restriction**: This API can be used only in the stage model.
376
377**System capability**: SystemCapability.Ability.AbilityRuntime.Core
378
379**Atomic service API**: This API can be used in atomic services since API version 20.
380
381**Example**
382
383```ts
384import { insightIntent, InsightIntentEntry, InsightIntentEntryExecutor } from '@kit.AbilityKit';
385import { hilog } from '@kit.PerformanceAnalysisKit';
386
387const LOG_TAG: string = 'testTag-EntryIntent';
388
389// Use the @InsightIntentEntry decorator to define an intent.
390@InsightIntentEntry({
391  intentName: 'PlayMusic',
392  domain: 'MusicDomain',
393  intentVersion: '1.0.1',
394  displayName: 'Play Music',
395  displayDescription: 'Intent to play music',
396  icon: $r('app.media.app_icon'),
397  llmDescription: 'Supports passing song names to play music',
398  keywords: ['music playback', 'play music', 'PlayMusic'],
399  abilityName: 'EntryAbility',
400  executeMode: [insightIntent.ExecuteMode.UI_ABILITY_FOREGROUND],
401  parameters: {
402    'schema': 'http://json-schema.org/draft-07/schema#',
403    'type': 'object',
404    'title': 'Song Schema',
405    'description': 'A schema for describing songs and their artists',
406    'properties': {
407      'songName': {
408        'type': 'string',
409        'description': 'The name of the song',
410        'minLength': 1
411      }
412    },
413    'required': ['songName']
414  }
415})
416export default class PlayMusicDemo extends InsightIntentEntryExecutor<string> {
417  songName: string = '';
418
419  onExecute(): Promise<insightIntent.IntentResult<string>> {
420    hilog.info(0x0000, LOG_TAG, 'PlayMusicDemo executeMode %{public}s', JSON.stringify(this.executeMode));
421    hilog.info(0x0000, LOG_TAG, '%{public}s', JSON.stringify(this));
422    let storage = new LocalStorage();
423    storage.setOrCreate('songName', this.songName);
424    // Start the PlayMusicPage page based on the executeMode parameter.
425    if (this.executeMode == insightIntent.ExecuteMode.UI_ABILITY_FOREGROUND) {
426      this.windowStage?.loadContent('pages/PlayMusicPage', storage);
427    } else if (this.executeMode == insightIntent.ExecuteMode.UI_EXTENSION_ABILITY) {
428      this.uiExtensionSession?.loadContent('pages/PlayMusicPage', storage);
429    }
430    // Define the intent execution result.
431    let result: insightIntent.IntentResult<string> = {
432      code: 123,
433      result: 'result'
434    }
435    hilog.info(0x0000, LOG_TAG, 'PlayMusicDemo return %{public}s', JSON.stringify(result));
436    // Return the intent execution result in Promise mode.
437    return Promise.reject(result);
438  }
439}
440```
441
442## EntryIntentDecoratorInfo
443
444Inherits from [IntentDecoratorInfo](#intentdecoratorinfo) and is used to describe the parameters supported by the [@InsightIntentEntry](#insightintententry) decorator.
445
446**Model restriction**: This API can be used only in the stage model.
447
448**System capability**: SystemCapability.Ability.AbilityRuntime.Core
449
450**Atomic service API**: This API can be used in atomic services since API version 20.
451
452**Properties**
453
454| Name              | Type        | Read-Only      | Optional| Description                                                        |
455| ------------------ | -------------| --------- | ---- | ------------------------------------------------------------ |
456| abilityName        | string       | No       | No  | Name of the ability bound to the intent.                                 |
457| executeMode        | [insightIntent.ExecuteMode](./js-apis-app-ability-insightIntent.md#executemode)[]| No       | No  | Execution mode of the intent call, that is, execution mode supported when the bound ability is started.|
458
459## @InsightIntentForm
460
461Decorates a [FormExtensionAbility](../apis-form-kit/js-apis-app-form-formExtensionAbility.md) to specify the name of the widget bound to the FormExtensionAbility. This enables the widget to be added to the AI entry point via intent calls. For details on the parameters supported by this decorator, see [FormIntentDecoratorInfo](#formintentdecoratorinfo).
462
463> **NOTE**
464>
465> For details about the requirements for defining widget names, see [Widget Configuration](../../form/arkts-ui-widget-configuration.md#widget-configuration).
466
467**Model restriction**: This API can be used only in the stage model.
468
469**System capability**: SystemCapability.Ability.AbilityRuntime.Core
470
471**Atomic service API**: This API can be used in atomic services since API version 20.
472
473**Example**
474
475```ts
476import { formBindingData, FormExtensionAbility, formInfo } from '@kit.FormKit';
477import { insightIntent, Want, InsightIntentForm } from '@kit.AbilityKit';
478
479// Use the @InsightIntentForm decorator to define a widget of the FormExtensionAbility as an intent.
480@InsightIntentForm({
481  intentName: 'PlayMusic78',
482  domain: 'MusicDomain',
483  intentVersion: '1.0.1',
484  displayName: 'Play Music',
485  displayDescription: 'Intent to play music',
486  icon: $r('app.media.app_icon'),
487  llmDescription: 'Supports passing song names to play music',
488  keywords: ['music playback', 'play music', 'PlayMusic'],
489  parameters: {
490    '$schema': 'http://json-schema.org/draft-07/schema#',
491    'type': 'object',
492    'title': 'Song Schema',
493    'description': 'A schema for describing songs and their artists',
494    'properties': {
495      'songName': {
496        'type': 'string',
497        'description': 'The name of the song',
498        'minLength': 1
499      },
500      'artist': {
501        'type': 'object',
502        'description': 'Information about the artist',
503        'properties': {
504          'country': {
505            'type': 'string',
506            'description': 'The artist\'s country of origin',
507            'default': 'zh'
508          },
509          'city': {
510            'type': 'object',
511            'description': 'The artist\' city of origin'
512          },
513          'name': {
514            'type': 'string',
515            'description': 'The name of the artist',
516            'minLength': 1
517          }
518        },
519        'required': ['name']
520      }
521    },
522    'required': ['songName']
523  },
524  formName: 'widget'
525})
526export default class EntryFormAbility extends FormExtensionAbility {
527  songName: string = '';
528
529  onAddForm(want: Want) {
530    // This API is called to return the FormBindingData object.
531    let formData = '';
532    return formBindingData.createFormBindingData(formData);
533  }
534}
535```
536
537## FormIntentDecoratorInfo
538
539Inherits from [IntentDecoratorInfo](#intentdecoratorinfo) and is used to describe the parameters supported by the [@InsightIntentForm](#insightintentform) decorator.
540
541**Model restriction**: This API can be used only in the stage model.
542
543**System capability**: SystemCapability.Ability.AbilityRuntime.Core
544
545**Atomic service API**: This API can be used in atomic services since API version 20.
546
547**Properties**
548
549| Name              | Type        | Read-Only      | Optional| Description                                                        |
550| ------------------ | -------------| --------- | ---- | ------------------------------------------------------------ |
551| formName        | string       | No       | No  | Name of the widget bound to the FormExtensionAbility.                                 |
552
553## @InsightIntentEntity
554
555Decorates a class that inherits from [IntentEntity](./js-apis-app-ability-insightIntent.md#intententity20) to define the class as an intent entity, which can pass parameters required for intent calls. For details on the parameters supported by this decorator, see [IntentEntityDecoratorInfo](#intententitydecoratorinfo).
556
557**Model restriction**: This API can be used only in the stage model.
558
559**System capability**: SystemCapability.Ability.AbilityRuntime.Core
560
561**Atomic service API**: This API can be used in atomic services since API version 20.
562
563**Example**
564
565```ts
566import { insightIntent, InsightIntentEntity } from '@kit.AbilityKit';
567
568@InsightIntentEntity({
569  entityCategory: 'artist entity category',
570  parameters: {
571    '$id': '/schemas/ArtistClassDef',
572    'type': 'object',
573    'description': 'Information about the artist',
574    'properties': {
575      'country': {
576        'type': 'string',
577        'description': 'The artist\'s country of origin',
578        'default': 'zh'
579      },
580      'city': {
581        'type': 'string',
582        'description': 'The artist\'s city of origin'
583      },
584      'name': {
585        'type': 'string',
586        'description': 'The name of the artist',
587        'minLength': 1
588      }
589    },
590    'required': ['name']
591  }
592})
593export class ArtistClassDef implements insightIntent.IntentEntity {
594  entityId: string = 'id';
595  name: string = '';
596}
597```
598
599## IntentEntityDecoratorInfo
600
601Describes the parameters supported by the [@InsightIntentEntity](#insightintententity) decorator.
602
603**Model restriction**: This API can be used only in the stage model.
604
605**System capability**: SystemCapability.Ability.AbilityRuntime.Core
606
607**Atomic service API**: This API can be used in atomic services since API version 20.
608
609**Properties**
610
611| Name              | Type        | Read-Only      | Optional| Description                                                        |
612| ------------------ | -------------| --------- | ---- | ------------------------------------------------------------ |
613| entityCategory        | string       | No       | No  | Category of the intent entity. Intents can be classified based on intent entity categories.                  |
614| parameters        | Record<string, Object> | No       | Yes  | Data format of the intent entity.  |
615