Compartir a través de


About reusable bot functionality with component packages in Composer

APPLIES TO: Composer v2.x

Component packages provide a mechanism for bot developers to create, share, and consume useful bundles of bot functionality, such as custom actions and triggers, dialogs, language understanding, and response generation files. You can use Composer's package manager to discover, install, and manage packages for bot projects. When creating bots for Microsoft Teams, for example, there's a package to add custom actions and triggers for working with Teams-specific concepts like messaging extensions and task modules.

Packages are the preferred method for adding (or sharing) context-specific features to a bot. Packages are compressed (zipped) folders described by a manifest file with information about the package like the publisher, version, and any dependencies the package has.

The package lifecycle

Composer bots support working with two types of packages - NuGet for C#/.NET bots and npm for Node.js/JavaScript bots. Regardless of type, package creators package up the functionality they want to share, then publish them to a package feed. Package feeds can be public, like the NuGet feed, private like those offered through a service like MyGet, or just a folder on a local drive or server share. Package consumers then use a tool like package manager in Composer to discover packages, and install them into their bot projects.

Package lifecycle

How bots consume packages

Packages for Composer bots require some extra steps for npm and NuGet packages in order to work seamlessly with a bot project. Package manager performs these steps when working with packages, but it's important to understand the results of those steps.

Declarative files (.dialog, .lu, .lg, and .qna files) in a package will be copied into an exported folder at the root of the bot project. The bot references the copied files rather than the versions in the package itself. This is to support editing of those files directly—a bot developer might need to customize them to meet their exact scenario.

Schema files (.schema and .uischema files) in a package will be merged into the schema files for the bot project, so that Composer can consume them appropriately.

Finally, references will be added to the components array in the appsettings.json file for any components in the package, such as coded extensions like custom actions, middleware, and adapters. This allows the runtime to inject the component at initialization time appropriately.

Note

Azure QnA Maker will be retired on 31 March 2025. Beginning 1 October 2022, you won't be able to create new QnA Maker resources or knowledge bases. A newer version of the question and answering capability is now available as part of Azure AI Language.

Custom question answering, a feature of Azure AI Language, is the updated version of the QnA Maker service. For more information about question-and-answer support in Composer, see Natural language processing.

Next steps