@microsoft/agents-activity package
Classes
Activity |
Represents an activity in a conversation. |
Interfaces
AIEntity |
Represents a generic Entity. |
AdaptiveCardInvokeAction |
Represents an adaptive card invoke action. |
Attachment |
Represents an attachment. |
CardAction |
Represents a card action. |
ChannelAccount |
Represents a channel account. |
ClientCitation |
Represents a Teams client citation to be included in a message. |
ConversationAccount |
Represents a conversation account. |
ConversationParameters |
Represents the parameters for creating a conversation. |
ConversationReference |
Represents a reference to a conversation. |
Entity |
Represents a generic Entity. |
ExpectedReplies |
Represents expected replies in a conversation. |
GeoCoordinates |
Represents geographical coordinates. |
Mention |
Represents a Mention entity. |
MessageReaction |
Represents a message reaction. |
Place |
Represents a Place entity. |
SemanticAction |
Represents a semantic action. |
SensitivityUsageInfo |
Sensitivity usage info for content sent to the user. |
SuggestedActions |
Represents suggested actions. |
TextHighlight |
Represents a text highlight. |
Thing |
Represents a Thing entity. |
Type Aliases
ClientCitationIconName |
Supported icon names for client citations. These icons are displayed in Teams to help users identify the type of content being referenced in AI-generated responses. |
Enums
ActionTypes |
Enum representing the types of actions. |
ActivityEventNames |
Enum representing activity event names. |
ActivityImportance |
Enum representing activity importance levels. |
ActivityTreatments |
Enum representing treatment types for the activity. |
ActivityTypes |
Enum representing activity types. |
AttachmentLayoutTypes |
Enum representing the layout types for attachments. |
Channels |
Enum representing the different channels an agent can communicate through. |
DeliveryModes |
Enum representing delivery modes. |
EndOfConversationCodes |
Enum representing the different end of conversation codes. |
InputHints |
Enum representing input hints. |
MessageReactionTypes |
Enum representing message reaction types. |
RoleTypes |
Enum representing the different role types in a conversation. |
SemanticActionStateTypes |
Enum representing the state types of a semantic action. |
TextFormatTypes |
Enum representing text format types. |
Functions
add |
Adds an AI entity to an activity to indicate that the content was generated by AI. |
debug(string) | Creates a new Logger instance with the specified namespace. |
Function Details
addAIToActivity(Activity, ClientCitation[], SensitivityUsageInfo)
Adds an AI entity to an activity to indicate that the content was generated by AI.
function addAIToActivity(activity: Activity, citations?: ClientCitation[], usageInfo?: SensitivityUsageInfo)
Parameters
- activity
- Activity
The activity to which the AI entity will be added. The activity's entities array will be initialized if it doesn't exist.
- citations
Optional array of client citations to include with the AI-generated content. Citations provide references to sources used in generating the content and are displayed in Teams.
- usageInfo
- SensitivityUsageInfo
Optional sensitivity usage information that provides context about the content's sensitivity level. This helps users understand any special handling requirements for the content.
Remarks
This function enhances the activity with metadata that helps clients (like Microsoft Teams)understand that the content is AI-generated and optionally includes citations and sensitivity information. Example
const activity: Activity = {
type: 'message',
text: 'Based on the documents, here are the key findings...'
};
const citations: ClientCitation[] = [{
'@type': 'Claim',
position: 1,
appearance: {
'@type': 'DigitalDocument',
name: 'Research Report 2024',
abstract: 'Key findings from the annual research report',
url: 'https://example.com/report.pdf',
image: {
'@type': 'ImageObject',
name: 'PDF'
}
}
}];
// Add AI entity with citations addAIToActivity(activity, citations); ```
debug(string)
Creates a new Logger instance with the specified namespace.
function debug(namespace: string): Logger
Parameters
- namespace
-
string
The namespace to use for the logger
Returns
Logger
A new Logger instance