openharmony 鸿蒙 insight-intent-definition

2026-08-25 浏览 (1)

Intent Development Overview

There are two methods to define intents.

MethodDescriptionUsage Scenario
Accessing Standard IntentsSystem-provided, predefined invocation specifications with unified definitions for intent parameter and execution result formats. The system matches intents based on the schema and intentVersion fields in the decorator, referencing a JSON Schema file stored in the SDK.Use for common functions already defined in standard intents, such as playing music or navigation.
Creating Custom IntentsDeveloper-defined invocation specifications for scenarios not covered by standard intents.Necessary when your application's feature is not included in the standard intents.

Accessing Standard Intents

If your application's feature aligns with predefined standard intents (for example, playing music or navigation), you can directly use the standard intents to avoid redundant definitions.

For the current standard intent specifications, see Appendix: Standard Intent Access Specifications.

Each intent contains the following elements:

  • Intent name: unique identifier of an intent.
  • Intent version: for compatibility control.
  • Parameter type definition: unified parameter format.
  • Result type definition: unified execution result format.

Creating Custom Intents

If standard intents do not cover your application's features, you can create custom intents. The system parses the intent descriptions and parameter specifications, triggering execution when it matches user semantics. Custom intents are defined via IntentDecoratorInfo and its child classes, including:

  • LLM description: a precise, comprehensive natural language description of the intent's function for semantic parsing. It should cover capabilities, definitions, and constraints.
  • Parameter type definition: custom parameter format following the JSON Schema specification, including parameter descriptions, types, and whether they are mandatory or optional.
  • Result type definition: custom execution result format following the JSON Schema specification, specifying the result type.

For example, for an application with weather query capabilities, the model description could be: "Query real-time weather conditions of a geographical location by inputting longitude and latitude coordinates."

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 create-pageability

openharmony 鸿蒙 lifecycleform-switch

openharmony 鸿蒙 mission-management-launch-type-sys

openharmony 鸿蒙 bind-serviceability-from-stage

openharmony 鸿蒙 lifecycleservice-switch

openharmony 鸿蒙 pageability-launch-type

openharmony 鸿蒙 pageability-overview

openharmony 鸿蒙 uiserviceextension-sys

openharmony 鸿蒙 uiability-launch-type

openharmony 鸿蒙 application-context-fa

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/y6yGYDUH