microsoft-agents-activity 0.7.0.dev0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. microsoft_agents/activity/__init__.py +200 -0
  2. microsoft_agents/activity/_channel_id_field_mixin.py +95 -0
  3. microsoft_agents/activity/_load_configuration.py +33 -0
  4. microsoft_agents/activity/_model_utils.py +64 -0
  5. microsoft_agents/activity/_type_aliases.py +7 -0
  6. microsoft_agents/activity/_utils/__init__.py +6 -0
  7. microsoft_agents/activity/_utils/_deferred_string.py +34 -0
  8. microsoft_agents/activity/action_types.py +17 -0
  9. microsoft_agents/activity/activity.py +787 -0
  10. microsoft_agents/activity/activity_event_names.py +9 -0
  11. microsoft_agents/activity/activity_importance.py +10 -0
  12. microsoft_agents/activity/activity_types.py +25 -0
  13. microsoft_agents/activity/adaptive_card_invoke_action.py +27 -0
  14. microsoft_agents/activity/adaptive_card_invoke_response.py +23 -0
  15. microsoft_agents/activity/adaptive_card_invoke_value.py +25 -0
  16. microsoft_agents/activity/agents_model.py +49 -0
  17. microsoft_agents/activity/animation_card.py +57 -0
  18. microsoft_agents/activity/attachment.py +27 -0
  19. microsoft_agents/activity/attachment_data.py +24 -0
  20. microsoft_agents/activity/attachment_info.py +22 -0
  21. microsoft_agents/activity/attachment_layout_types.py +9 -0
  22. microsoft_agents/activity/attachment_view.py +18 -0
  23. microsoft_agents/activity/audio_card.py +57 -0
  24. microsoft_agents/activity/basic_card.py +33 -0
  25. microsoft_agents/activity/caller_id_constants.py +10 -0
  26. microsoft_agents/activity/card_action.py +42 -0
  27. microsoft_agents/activity/card_image.py +22 -0
  28. microsoft_agents/activity/channel_account.py +39 -0
  29. microsoft_agents/activity/channel_adapter_protocol.py +79 -0
  30. microsoft_agents/activity/channel_id.py +95 -0
  31. microsoft_agents/activity/channels.py +161 -0
  32. microsoft_agents/activity/contact_relation_update_action_types.py +9 -0
  33. microsoft_agents/activity/conversation_account.py +41 -0
  34. microsoft_agents/activity/conversation_members.py +19 -0
  35. microsoft_agents/activity/conversation_parameters.py +40 -0
  36. microsoft_agents/activity/conversation_reference.py +69 -0
  37. microsoft_agents/activity/conversation_resource_response.py +22 -0
  38. microsoft_agents/activity/conversation_update_types.py +18 -0
  39. microsoft_agents/activity/conversations_result.py +20 -0
  40. microsoft_agents/activity/delivery_modes.py +12 -0
  41. microsoft_agents/activity/end_of_conversation_codes.py +13 -0
  42. microsoft_agents/activity/entity/__init__.py +36 -0
  43. microsoft_agents/activity/entity/ai_entity.py +111 -0
  44. microsoft_agents/activity/entity/entity.py +41 -0
  45. microsoft_agents/activity/entity/entity_types.py +14 -0
  46. microsoft_agents/activity/entity/geo_coordinates.py +33 -0
  47. microsoft_agents/activity/entity/mention.py +24 -0
  48. microsoft_agents/activity/entity/place.py +33 -0
  49. microsoft_agents/activity/entity/product_info.py +20 -0
  50. microsoft_agents/activity/entity/thing.py +21 -0
  51. microsoft_agents/activity/error.py +22 -0
  52. microsoft_agents/activity/error_response.py +15 -0
  53. microsoft_agents/activity/errors/__init__.py +14 -0
  54. microsoft_agents/activity/errors/error_message.py +64 -0
  55. microsoft_agents/activity/errors/error_resources.py +52 -0
  56. microsoft_agents/activity/expected_replies.py +16 -0
  57. microsoft_agents/activity/fact.py +21 -0
  58. microsoft_agents/activity/hero_card.py +33 -0
  59. microsoft_agents/activity/inner_http_error.py +17 -0
  60. microsoft_agents/activity/input_hints.py +10 -0
  61. microsoft_agents/activity/installation_update_action_types.py +9 -0
  62. microsoft_agents/activity/invoke_response.py +27 -0
  63. microsoft_agents/activity/media_card.py +57 -0
  64. microsoft_agents/activity/media_event_value.py +15 -0
  65. microsoft_agents/activity/media_url.py +19 -0
  66. microsoft_agents/activity/message_reaction.py +16 -0
  67. microsoft_agents/activity/message_reaction_types.py +14 -0
  68. microsoft_agents/activity/message_update_types.py +10 -0
  69. microsoft_agents/activity/oauth_card.py +27 -0
  70. microsoft_agents/activity/paged_members_result.py +19 -0
  71. microsoft_agents/activity/receipt_card.py +39 -0
  72. microsoft_agents/activity/receipt_item.py +38 -0
  73. microsoft_agents/activity/resource_response.py +15 -0
  74. microsoft_agents/activity/role_types.py +12 -0
  75. microsoft_agents/activity/semantic_action.py +21 -0
  76. microsoft_agents/activity/semantic_actions_states.py +10 -0
  77. microsoft_agents/activity/sign_in_constants.py +13 -0
  78. microsoft_agents/activity/sign_in_resource.py +17 -0
  79. microsoft_agents/activity/signin_card.py +19 -0
  80. microsoft_agents/activity/suggested_actions.py +21 -0
  81. microsoft_agents/activity/teams/__init__.py +198 -0
  82. microsoft_agents/activity/teams/app_based_link_query.py +18 -0
  83. microsoft_agents/activity/teams/batch_failed_entries_response.py +15 -0
  84. microsoft_agents/activity/teams/batch_failed_entry.py +16 -0
  85. microsoft_agents/activity/teams/batch_operation_response.py +13 -0
  86. microsoft_agents/activity/teams/batch_operation_state_response.py +24 -0
  87. microsoft_agents/activity/teams/bot_config_auth.py +18 -0
  88. microsoft_agents/activity/teams/cache_info.py +18 -0
  89. microsoft_agents/activity/teams/cancel_operation_response.py +19 -0
  90. microsoft_agents/activity/teams/channel_info.py +21 -0
  91. microsoft_agents/activity/teams/config_auth_response.py +17 -0
  92. microsoft_agents/activity/teams/config_response.py +18 -0
  93. microsoft_agents/activity/teams/config_response_base.py +14 -0
  94. microsoft_agents/activity/teams/config_task_response.py +18 -0
  95. microsoft_agents/activity/teams/conversation_list.py +17 -0
  96. microsoft_agents/activity/teams/file_consent_card.py +24 -0
  97. microsoft_agents/activity/teams/file_consent_card_response.py +21 -0
  98. microsoft_agents/activity/teams/file_download_info.py +24 -0
  99. microsoft_agents/activity/teams/file_info_card.py +21 -0
  100. microsoft_agents/activity/teams/file_upload_info.py +26 -0
  101. microsoft_agents/activity/teams/meeting_details.py +23 -0
  102. microsoft_agents/activity/teams/meeting_details_base.py +21 -0
  103. microsoft_agents/activity/teams/meeting_end_event_details.py +15 -0
  104. microsoft_agents/activity/teams/meeting_event_details.py +15 -0
  105. microsoft_agents/activity/teams/meeting_info.py +24 -0
  106. microsoft_agents/activity/teams/meeting_notification.py +15 -0
  107. microsoft_agents/activity/teams/meeting_notification_base.py +14 -0
  108. microsoft_agents/activity/teams/meeting_notification_channel_data.py +16 -0
  109. microsoft_agents/activity/teams/meeting_notification_recipient_failure_info.py +20 -0
  110. microsoft_agents/activity/teams/meeting_notification_response.py +20 -0
  111. microsoft_agents/activity/teams/meeting_participant_info.py +18 -0
  112. microsoft_agents/activity/teams/meeting_participants_event_details.py +16 -0
  113. microsoft_agents/activity/teams/meeting_stage_surface.py +25 -0
  114. microsoft_agents/activity/teams/meeting_start_event_details.py +15 -0
  115. microsoft_agents/activity/teams/meeting_tab_icon_surface.py +15 -0
  116. microsoft_agents/activity/teams/message_actions_payload.py +70 -0
  117. microsoft_agents/activity/teams/message_actions_payload_app.py +29 -0
  118. microsoft_agents/activity/teams/message_actions_payload_attachment.py +30 -0
  119. microsoft_agents/activity/teams/message_actions_payload_body.py +17 -0
  120. microsoft_agents/activity/teams/message_actions_payload_conversation.py +20 -0
  121. microsoft_agents/activity/teams/message_actions_payload_from.py +25 -0
  122. microsoft_agents/activity/teams/message_actions_payload_mention.py +23 -0
  123. microsoft_agents/activity/teams/message_actions_payload_reaction.py +23 -0
  124. microsoft_agents/activity/teams/message_actions_payload_user.py +27 -0
  125. microsoft_agents/activity/teams/messaging_extension_action.py +37 -0
  126. microsoft_agents/activity/teams/messaging_extension_action_response.py +24 -0
  127. microsoft_agents/activity/teams/messaging_extension_attachment.py +32 -0
  128. microsoft_agents/activity/teams/messaging_extension_parameter.py +17 -0
  129. microsoft_agents/activity/teams/messaging_extension_query.py +27 -0
  130. microsoft_agents/activity/teams/messaging_extension_query_options.py +17 -0
  131. microsoft_agents/activity/teams/messaging_extension_response.py +21 -0
  132. microsoft_agents/activity/teams/messaging_extension_result.py +34 -0
  133. microsoft_agents/activity/teams/messaging_extension_suggested_action.py +17 -0
  134. microsoft_agents/activity/teams/notification_info.py +21 -0
  135. microsoft_agents/activity/teams/o365_connector_card.py +32 -0
  136. microsoft_agents/activity/teams/o365_connector_card_action_base.py +21 -0
  137. microsoft_agents/activity/teams/o365_connector_card_action_card.py +30 -0
  138. microsoft_agents/activity/teams/o365_connector_card_action_query.py +15 -0
  139. microsoft_agents/activity/teams/o365_connector_card_date_input.py +30 -0
  140. microsoft_agents/activity/teams/o365_connector_card_fact.py +17 -0
  141. microsoft_agents/activity/teams/o365_connector_card_http_post.py +25 -0
  142. microsoft_agents/activity/teams/o365_connector_card_image.py +18 -0
  143. microsoft_agents/activity/teams/o365_connector_card_input_base.py +28 -0
  144. microsoft_agents/activity/teams/o365_connector_card_multichoice_input.py +40 -0
  145. microsoft_agents/activity/teams/o365_connector_card_multichoice_input_choice.py +17 -0
  146. microsoft_agents/activity/teams/o365_connector_card_open_uri.py +26 -0
  147. microsoft_agents/activity/teams/o365_connector_card_open_uri_target.py +17 -0
  148. microsoft_agents/activity/teams/o365_connector_card_section.py +42 -0
  149. microsoft_agents/activity/teams/o365_connector_card_text_input.py +31 -0
  150. microsoft_agents/activity/teams/o365_connector_card_view_action.py +25 -0
  151. microsoft_agents/activity/teams/on_behalf_of.py +23 -0
  152. microsoft_agents/activity/teams/read_receipt_info.py +47 -0
  153. microsoft_agents/activity/teams/signin_state_verification_query.py +14 -0
  154. microsoft_agents/activity/teams/surface.py +18 -0
  155. microsoft_agents/activity/teams/tab_context.py +14 -0
  156. microsoft_agents/activity/teams/tab_entity_context.py +15 -0
  157. microsoft_agents/activity/teams/tab_request.py +22 -0
  158. microsoft_agents/activity/teams/tab_response.py +16 -0
  159. microsoft_agents/activity/teams/tab_response_card.py +14 -0
  160. microsoft_agents/activity/teams/tab_response_cards.py +17 -0
  161. microsoft_agents/activity/teams/tab_response_payload.py +25 -0
  162. microsoft_agents/activity/teams/tab_submit.py +23 -0
  163. microsoft_agents/activity/teams/tab_submit_data.py +18 -0
  164. microsoft_agents/activity/teams/tab_suggested_actions.py +17 -0
  165. microsoft_agents/activity/teams/targeted_meeting_notification.py +19 -0
  166. microsoft_agents/activity/teams/targeted_meeting_notification_value.py +19 -0
  167. microsoft_agents/activity/teams/task_module_card_response.py +15 -0
  168. microsoft_agents/activity/teams/task_module_continue_response.py +19 -0
  169. microsoft_agents/activity/teams/task_module_message_response.py +18 -0
  170. microsoft_agents/activity/teams/task_module_request.py +25 -0
  171. microsoft_agents/activity/teams/task_module_request_context.py +15 -0
  172. microsoft_agents/activity/teams/task_module_response.py +20 -0
  173. microsoft_agents/activity/teams/task_module_response_base.py +17 -0
  174. microsoft_agents/activity/teams/task_module_task_info.py +30 -0
  175. microsoft_agents/activity/teams/team_details.py +29 -0
  176. microsoft_agents/activity/teams/team_info.py +20 -0
  177. microsoft_agents/activity/teams/teams_batch_operation_response.py +19 -0
  178. microsoft_agents/activity/teams/teams_channel_account.py +44 -0
  179. microsoft_agents/activity/teams/teams_channel_data.py +43 -0
  180. microsoft_agents/activity/teams/teams_channel_data_settings.py +15 -0
  181. microsoft_agents/activity/teams/teams_meeting_info.py +14 -0
  182. microsoft_agents/activity/teams/teams_meeting_member.py +19 -0
  183. microsoft_agents/activity/teams/teams_meeting_participant.py +24 -0
  184. microsoft_agents/activity/teams/teams_member.py +14 -0
  185. microsoft_agents/activity/teams/teams_paged_members_result.py +19 -0
  186. microsoft_agents/activity/teams/tenant_info.py +14 -0
  187. microsoft_agents/activity/teams/user_meeting_details.py +17 -0
  188. microsoft_agents/activity/text_format_types.py +10 -0
  189. microsoft_agents/activity/text_highlight.py +19 -0
  190. microsoft_agents/activity/thumbnail_card.py +33 -0
  191. microsoft_agents/activity/thumbnail_url.py +18 -0
  192. microsoft_agents/activity/token_exchange_invoke_request.py +24 -0
  193. microsoft_agents/activity/token_exchange_invoke_response.py +24 -0
  194. microsoft_agents/activity/token_exchange_resource.py +16 -0
  195. microsoft_agents/activity/token_exchange_state.py +41 -0
  196. microsoft_agents/activity/token_or_sign_in_resource_response.py +21 -0
  197. microsoft_agents/activity/token_post_resource.py +14 -0
  198. microsoft_agents/activity/token_request.py +19 -0
  199. microsoft_agents/activity/token_response.py +46 -0
  200. microsoft_agents/activity/token_status.py +32 -0
  201. microsoft_agents/activity/transcript.py +16 -0
  202. microsoft_agents/activity/turn_context_protocol.py +68 -0
  203. microsoft_agents/activity/video_card.py +57 -0
  204. microsoft_agents_activity-0.7.0.dev0.dist-info/METADATA +173 -0
  205. microsoft_agents_activity-0.7.0.dev0.dist-info/RECORD +208 -0
  206. microsoft_agents_activity-0.7.0.dev0.dist-info/WHEEL +5 -0
  207. microsoft_agents_activity-0.7.0.dev0.dist-info/licenses/LICENSE +21 -0
  208. microsoft_agents_activity-0.7.0.dev0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,95 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from __future__ import annotations
5
+
6
+ from typing import Optional, Any
7
+
8
+ from pydantic_core import CoreSchema, core_schema
9
+ from pydantic import GetCoreSchemaHandler
10
+
11
+ from microsoft_agents.activity.errors import activity_errors
12
+
13
+
14
+ class ChannelId(str):
15
+ """A ChannelId represents a channel and optional sub-channel in the format 'channel:sub_channel'."""
16
+
17
+ def __init__(
18
+ self,
19
+ value: Optional[str] = None,
20
+ *,
21
+ channel: Optional[str] = None,
22
+ sub_channel: Optional[str] = None,
23
+ ) -> None:
24
+ """Initialize a ChannelId instance.
25
+
26
+ :param value: The full channel ID string in the format 'channel:sub_channel'. Must be provided if channel is not provided.
27
+ :param channel: The main channel string. Must be provided if value is not provided.
28
+ :param sub_channel: The sub-channel string.
29
+ :raises ValueError: If the input parameters are invalid. value and channel cannot both be provided.
30
+ """
31
+ super().__init__()
32
+ if not channel:
33
+ split = self.strip().split(":", 1)
34
+ self._channel = split[0].strip()
35
+ self._sub_channel = split[1].strip() if len(split) == 2 else None
36
+ else:
37
+ self._channel = channel
38
+ self._sub_channel = sub_channel
39
+
40
+ def __new__(
41
+ cls,
42
+ value: Optional[str] = None,
43
+ *,
44
+ channel: Optional[str] = None,
45
+ sub_channel: Optional[str] = None,
46
+ ) -> ChannelId:
47
+ """Create a new ChannelId instance.
48
+
49
+ :param value: The full channel ID string in the format 'channel:sub_channel'. Must be provided if channel is not provided.
50
+ :param channel: The main channel string. Must be provided if value is not provided. Must not contain ':', as it delimits channels and sub channels.
51
+ :param sub_channel: The sub-channel string.
52
+ :return: A new ChannelId instance.
53
+ :raises ValueError: If the input parameters are invalid. value and channel cannot both be provided.
54
+ """
55
+ if isinstance(value, str):
56
+ if channel or sub_channel:
57
+ raise ValueError(str(activity_errors.ChannelIdValueConflict))
58
+
59
+ value = value.strip()
60
+ if value:
61
+ return str.__new__(cls, value)
62
+ raise TypeError(str(activity_errors.ChannelIdValueMustBeNonEmpty))
63
+ else:
64
+ if (
65
+ not isinstance(channel, str)
66
+ or len(channel.strip()) == 0
67
+ or ":" in channel
68
+ ):
69
+ raise TypeError(
70
+ "channel must be a non empty string, and must not contain the ':' character"
71
+ )
72
+ if sub_channel is not None and (not isinstance(sub_channel, str)):
73
+ raise TypeError("sub_channel must be a string if provided")
74
+ channel = channel.strip()
75
+ sub_channel = sub_channel.strip() if sub_channel else None
76
+ if sub_channel:
77
+ return str.__new__(cls, f"{channel}:{sub_channel}")
78
+ return str.__new__(cls, channel)
79
+
80
+ @property
81
+ def channel(self) -> str:
82
+ """The main channel, e.g. 'email' in 'email:work'."""
83
+ return self._channel # type: ignore[return-value]
84
+
85
+ @property
86
+ def sub_channel(self) -> Optional[str]:
87
+ """The sub-channel, e.g. 'work' in 'email:work'. May be None."""
88
+ return self._sub_channel
89
+
90
+ # https://docs.pydantic.dev/dev/concepts/types/#customizing-validation-with-__get_pydantic_core_schema__
91
+ @classmethod
92
+ def __get_pydantic_core_schema__(
93
+ cls, source_type: Any, handler: GetCoreSchemaHandler
94
+ ) -> CoreSchema:
95
+ return core_schema.no_info_after_validator_function(cls, handler(str))
@@ -0,0 +1,161 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from enum import Enum
5
+ from typing_extensions import Self
6
+
7
+
8
+ class Channels(str, Enum):
9
+ """
10
+ Ids of channels supported by ABS.
11
+ """
12
+
13
+ """Agents channel."""
14
+ agents = "agents"
15
+
16
+ console = "console"
17
+ """Console channel."""
18
+
19
+ cortana = "cortana"
20
+ """Cortana channel."""
21
+
22
+ direct_line = "directline"
23
+ """Direct Line channel."""
24
+
25
+ direct_line_speech = "directlinespeech"
26
+ """Direct Line Speech channel."""
27
+
28
+ email = "email"
29
+ """Email channel."""
30
+
31
+ emulator = "emulator"
32
+ """Emulator channel."""
33
+
34
+ facebook = "facebook"
35
+ """Facebook channel."""
36
+
37
+ groupme = "groupme"
38
+ """Group Me channel."""
39
+
40
+ kik = "kik"
41
+ """Kik channel."""
42
+
43
+ line = "line"
44
+ """Line channel."""
45
+
46
+ ms_teams = "msteams"
47
+ """MS Teams channel."""
48
+
49
+ skype = "skype"
50
+ """Skype channel."""
51
+
52
+ skype_for_business = "skypeforbusiness"
53
+ """Skype for Business channel."""
54
+
55
+ slack = "slack"
56
+ """Slack channel."""
57
+
58
+ sms = "sms"
59
+ """SMS (Twilio) channel."""
60
+
61
+ telegram = "telegram"
62
+ """Telegram channel."""
63
+
64
+ test = "test"
65
+ """Test channel."""
66
+
67
+ webchat = "webchat"
68
+ """WebChat channel."""
69
+
70
+ # TODO: validate the need of Self annotations in the following methods
71
+ @staticmethod
72
+ def supports_suggested_actions(channel_id: Self, button_cnt: int = 100) -> bool:
73
+ """Determine if a number of Suggested Actions are supported by a Channel.
74
+
75
+ Args:
76
+ channel_id (str): The Channel to check the if Suggested Actions are supported in.
77
+ button_cnt (int, Optional): Defaults to 100. The number of Suggested Actions to check for the Channel.
78
+
79
+ Returns:
80
+ bool: True if the Channel supports the button_cnt total Suggested Actions, False if the Channel does not
81
+ support that number of Suggested Actions.
82
+ """
83
+
84
+ max_actions = {
85
+ # https://developers.facebook.com/docs/messenger-platform/send-messages/quick-replies
86
+ Channels.facebook: 10,
87
+ Channels.skype: 10,
88
+ # https://developers.line.biz/en/reference/messaging-api/#items-object
89
+ Channels.line: 13,
90
+ # https://dev.kik.com/#/docs/messaging#text-response-object
91
+ Channels.kik: 20,
92
+ Channels.telegram: 100,
93
+ Channels.emulator: 100,
94
+ Channels.direct_line: 100,
95
+ Channels.direct_line_speech: 100,
96
+ Channels.webchat: 100,
97
+ }
98
+ return (
99
+ button_cnt <= max_actions[channel_id]
100
+ if channel_id in max_actions
101
+ else False
102
+ )
103
+
104
+ @staticmethod
105
+ def supports_card_actions(channel_id: Self, button_cnt: int = 100) -> bool:
106
+ """Determine if a number of Card Actions are supported by a Channel.
107
+
108
+ Args:
109
+ channel_id (str): The Channel to check if the Card Actions are supported in.
110
+ button_cnt (int, Optional): Defaults to 100. The number of Card Actions to check for the Channel.
111
+
112
+ Returns:
113
+ bool: True if the Channel supports the button_cnt total Card Actions, False if the Channel does not support
114
+ that number of Card Actions.
115
+ """
116
+
117
+ max_actions = {
118
+ Channels.facebook: 3,
119
+ Channels.skype: 3,
120
+ Channels.ms_teams: 3,
121
+ Channels.line: 99,
122
+ Channels.slack: 100,
123
+ Channels.telegram: 100,
124
+ Channels.emulator: 100,
125
+ Channels.direct_line: 100,
126
+ Channels.direct_line_speech: 100,
127
+ Channels.webchat: 100,
128
+ }
129
+ return (
130
+ button_cnt <= max_actions[channel_id]
131
+ if channel_id in max_actions
132
+ else False
133
+ )
134
+
135
+ @staticmethod
136
+ def has_message_feed(_: str) -> bool:
137
+ """Determine if a Channel has a Message Feed.
138
+
139
+ Args:
140
+ channel_id (str): The Channel to check for Message Feed.
141
+
142
+ Returns:
143
+ bool: True if the Channel has a Message Feed, False if it does not.
144
+ """
145
+
146
+ return True
147
+
148
+ @staticmethod
149
+ def max_action_title_length( # pylint: disable=unused-argument
150
+ channel_id: Self,
151
+ ) -> int:
152
+ """Maximum length allowed for Action Titles.
153
+
154
+ Args:
155
+ channel_id (str): The Channel to determine Maximum Action Title Length.
156
+
157
+ Returns:
158
+ int: The total number of characters allowed for an Action Title on a specific Channel.
159
+ """
160
+
161
+ return 20
@@ -0,0 +1,9 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from enum import Enum
5
+
6
+
7
+ class ContactRelationUpdateActionTypes(str, Enum):
8
+ add = "add"
9
+ remove = "remove"
@@ -0,0 +1,41 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from typing import Optional
5
+ from .agents_model import AgentsModel
6
+ from ._type_aliases import NonEmptyString
7
+
8
+
9
+ class ConversationAccount(AgentsModel):
10
+ """Conversation account represents the identity of the conversation within a channel.
11
+
12
+ :param is_group: Indicates whether the conversation contains more than two
13
+ participants at the time the activity was generated
14
+ :type is_group: bool
15
+ :param conversation_type: Indicates the type of the conversation in
16
+ channels that distinguish between conversation types
17
+ :type conversation_type: str
18
+ :param id: Channel id for the user or agent on this channel (Example:
19
+ ``joe@smith.com``, or ``@joesmith`` or ``123456``)
20
+ :type id: str
21
+ :param name: Display friendly name
22
+ :type name: str
23
+ :param aad_object_id: This account's object ID within Azure Active
24
+ Directory (AAD)
25
+ :type aad_object_id: str
26
+ :param role: Role of the entity behind the account
27
+ :type role: str or ~microsoft_agents.activity.RoleTypes
28
+ :param tenant_id: This conversation's tenant ID
29
+ :type tenant_id: str
30
+ :param properties: This conversation's properties
31
+ :type properties: object
32
+ """
33
+
34
+ is_group: Optional[bool] = None
35
+ conversation_type: Optional[NonEmptyString] = None
36
+ id: NonEmptyString
37
+ name: Optional[NonEmptyString] = None
38
+ aad_object_id: Optional[NonEmptyString] = None
39
+ role: Optional[NonEmptyString] = None
40
+ tenant_id: Optional[NonEmptyString] = None
41
+ properties: object = None
@@ -0,0 +1,19 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from .channel_account import ChannelAccount
5
+ from .agents_model import AgentsModel
6
+ from ._type_aliases import NonEmptyString
7
+
8
+
9
+ class ConversationMembers(AgentsModel):
10
+ """Conversation and its members.
11
+
12
+ :param id: Conversation ID
13
+ :type id: str
14
+ :param members: List of members in this conversation
15
+ :type members: list[~microsoft_agents.activity.ChannelAccount]
16
+ """
17
+
18
+ id: NonEmptyString = None
19
+ members: list[ChannelAccount] = None
@@ -0,0 +1,40 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from pydantic import Field
5
+
6
+ from .channel_account import ChannelAccount
7
+ from .activity import Activity
8
+ from .agents_model import AgentsModel
9
+ from ._type_aliases import NonEmptyString
10
+
11
+
12
+ class ConversationParameters(AgentsModel):
13
+ """Parameters for creating a new conversation.
14
+
15
+ :param is_group: IsGroup
16
+ :type is_group: bool
17
+ :param agent: The agent address for this conversation
18
+ :type agent: ~microsoft_agents.activity.ChannelAccount
19
+ :param members: Members to add to the conversation
20
+ :type members: list[~microsoft_agents.activity.ChannelAccount]
21
+ :param topic_name: (Optional) Topic of the conversation (if supported by
22
+ the channel)
23
+ :type topic_name: str
24
+ :param activity: (Optional) When creating a new conversation, use this
25
+ activity as the initial message to the conversation
26
+ :type activity: ~microsoft_agents.activity.Activity
27
+ :param channel_data: Channel specific payload for creating the
28
+ conversation
29
+ :type channel_data: object
30
+ :param tenant_id: (Optional) The tenant ID in which the conversation should be created
31
+ :type tenant_id: str
32
+ """
33
+
34
+ is_group: bool = None
35
+ agent: ChannelAccount = Field(None, alias="bot")
36
+ members: list[ChannelAccount] = None
37
+ topic_name: NonEmptyString = None
38
+ activity: Activity = None
39
+ channel_data: object = None
40
+ tenant_id: NonEmptyString = None
@@ -0,0 +1,69 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from __future__ import annotations
5
+
6
+ from uuid import uuid4 as uuid
7
+ from typing import Optional
8
+ import logging
9
+
10
+ from pydantic import Field
11
+
12
+ from .channel_account import ChannelAccount
13
+ from ._channel_id_field_mixin import _ChannelIdFieldMixin
14
+ from .channel_id import ChannelId
15
+ from .conversation_account import ConversationAccount
16
+ from .agents_model import AgentsModel
17
+ from ._type_aliases import NonEmptyString
18
+ from .activity_types import ActivityTypes
19
+ from .activity_event_names import ActivityEventNames
20
+
21
+ logger = logging.getLogger(__name__)
22
+
23
+
24
+ class ConversationReference(AgentsModel, _ChannelIdFieldMixin):
25
+ """An object relating to a particular point in a conversation.
26
+
27
+ :param activity_id: (Optional) ID of the activity to refer to
28
+ :type activity_id: str
29
+ :param user: (Optional) User participating in this conversation
30
+ :type user: ~microsoft_agents.activity.ChannelAccount
31
+ :param agent: Agent participating in this conversation
32
+ :type agent: ~microsoft_agents.activity.ChannelAccount
33
+ :param conversation: Conversation reference
34
+ :type conversation: ~microsoft_agents.activity.ConversationAccount
35
+ :param channel_id: Channel ID
36
+ :type channel_id: ~microsoft_agents.activity.ChannelId
37
+ :param locale: A locale name for the contents of the text field.
38
+ The locale name is a combination of an ISO 639 two- or three-letter
39
+ culture code associated with a language and an ISO 3166 two-letter
40
+ subculture code associated with a country or region.
41
+ The locale name can also correspond to a valid BCP-47 language tag.
42
+ :type locale: str
43
+ :param service_url: Service endpoint where operations concerning the
44
+ referenced conversation may be performed
45
+ :type service_url: str
46
+ """
47
+
48
+ # optionals here are due to webchat
49
+ activity_id: Optional[NonEmptyString] = None
50
+ user: Optional[ChannelAccount] = None
51
+ agent: ChannelAccount = Field(None, alias="bot")
52
+ conversation: ConversationAccount
53
+ locale: Optional[NonEmptyString] = None
54
+ service_url: NonEmptyString = None
55
+
56
+ def get_continuation_activity(self) -> "Activity": # type: ignore
57
+ from .activity import Activity
58
+
59
+ return Activity(
60
+ type=ActivityTypes.event,
61
+ name=ActivityEventNames.continue_conversation,
62
+ id=str(uuid()),
63
+ channel_id=self.channel_id,
64
+ service_url=self.service_url,
65
+ conversation=self.conversation,
66
+ recipient=self.agent,
67
+ from_property=self.user,
68
+ relates_to=self,
69
+ )
@@ -0,0 +1,22 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from .agents_model import AgentsModel
5
+ from ._type_aliases import NonEmptyString
6
+
7
+
8
+ class ConversationResourceResponse(AgentsModel):
9
+ """A response containing a resource.
10
+
11
+ :param activity_id: ID of the Activity (if sent)
12
+ :type activity_id: str
13
+ :param service_url: Service endpoint where operations concerning the
14
+ conversation may be performed
15
+ :type service_url: str
16
+ :param id: Id of the resource
17
+ :type id: str
18
+ """
19
+
20
+ activity_id: NonEmptyString = None
21
+ service_url: NonEmptyString = None
22
+ id: NonEmptyString = None
@@ -0,0 +1,18 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from enum import Enum
5
+
6
+
7
+ class ConversationUpdateTypes(str, Enum):
8
+ CHANNEL_CREATED = "channelCreated"
9
+ CHANNEL_RENAMED = "channelRenamed"
10
+ CHANNEL_DELETED = "channelDeleted"
11
+ CHANNEL_RESTORED = "channelRestored"
12
+ MEMBERS_ADDED = "membersAdded"
13
+ MEMBERS_REMOVED = "membersRemoved"
14
+ TEAM_RENAMED = "teamRenamed"
15
+ TEAM_DELETED = "teamDeleted"
16
+ TEAM_ARCHIVED = "teamArchived"
17
+ TEAM_UNARCHIVED = "teamUnarchived"
18
+ TEAM_RESTORED = "teamRestored"
@@ -0,0 +1,20 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from .conversation_members import ConversationMembers
5
+ from .agents_model import AgentsModel
6
+ from ._type_aliases import NonEmptyString
7
+
8
+
9
+ class ConversationsResult(AgentsModel):
10
+ """Conversations result.
11
+
12
+ :param continuation_token: Paging token
13
+ :type continuation_token: str
14
+ :param conversations: List of conversations
15
+ :type conversations:
16
+ list[~microsoft_agents.activity.ConversationMembers]
17
+ """
18
+
19
+ continuation_token: NonEmptyString = None
20
+ conversations: list[ConversationMembers] = None
@@ -0,0 +1,12 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from enum import Enum
5
+
6
+
7
+ class DeliveryModes(str, Enum):
8
+ normal = "normal"
9
+ notification = "notification"
10
+ expect_replies = "expectReplies"
11
+ ephemeral = "ephemeral"
12
+ stream = "stream"
@@ -0,0 +1,13 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from enum import Enum
5
+
6
+
7
+ class EndOfConversationCodes(str, Enum):
8
+ unknown = "unknown"
9
+ completed_successfully = "completedSuccessfully"
10
+ user_cancelled = "userCancelled"
11
+ timed_out = "botTimedOut"
12
+ issued_invalid_message = "botIssuedInvalidMessage"
13
+ channel_failed = "channelFailed"
@@ -0,0 +1,36 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from .mention import Mention
5
+ from .entity import Entity
6
+ from .entity_types import EntityTypes
7
+ from .ai_entity import (
8
+ ClientCitation,
9
+ ClientCitationAppearance,
10
+ ClientCitationImage,
11
+ ClientCitationIconName,
12
+ AIEntity,
13
+ SensitivityPattern,
14
+ SensitivityUsageInfo,
15
+ )
16
+ from .geo_coordinates import GeoCoordinates
17
+ from .place import Place
18
+ from .product_info import ProductInfo
19
+ from .thing import Thing
20
+
21
+ __all__ = [
22
+ "Entity",
23
+ "EntityTypes",
24
+ "AIEntity",
25
+ "ClientCitation",
26
+ "ClientCitationAppearance",
27
+ "ClientCitationImage",
28
+ "ClientCitationIconName",
29
+ "Mention",
30
+ "SensitivityUsageInfo",
31
+ "SensitivityPattern",
32
+ "GeoCoordinates",
33
+ "Place",
34
+ "ProductInfo",
35
+ "Thing",
36
+ ]
@@ -0,0 +1,111 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from enum import Enum
5
+ from typing import List, Optional, Union, Literal
6
+ from dataclasses import dataclass
7
+
8
+ from ..agents_model import AgentsModel
9
+ from .entity import Entity
10
+
11
+
12
+ class ClientCitationIconName(str, Enum):
13
+ """Enumeration of supported citation icon names."""
14
+
15
+ MICROSOFT_WORD = "Microsoft Word"
16
+ MICROSOFT_EXCEL = "Microsoft Excel"
17
+ MICROSOFT_POWERPOINT = "Microsoft PowerPoint"
18
+ MICROSOFT_ONENOTE = "Microsoft OneNote"
19
+ MICROSOFT_SHAREPOINT = "Microsoft SharePoint"
20
+ MICROSOFT_VISIO = "Microsoft Visio"
21
+ MICROSOFT_LOOP = "Microsoft Loop"
22
+ MICROSOFT_WHITEBOARD = "Microsoft Whiteboard"
23
+ ADOBE_ILLUSTRATOR = "Adobe Illustrator"
24
+ ADOBE_PHOTOSHOP = "Adobe Photoshop"
25
+ ADOBE_INDESIGN = "Adobe InDesign"
26
+ ADOBE_FLASH = "Adobe Flash"
27
+ SKETCH = "Sketch"
28
+ SOURCE_CODE = "Source Code"
29
+ IMAGE = "Image"
30
+ GIF = "GIF"
31
+ VIDEO = "Video"
32
+ SOUND = "Sound"
33
+ ZIP = "ZIP"
34
+ TEXT = "Text"
35
+ PDF = "PDF"
36
+
37
+
38
+ class ClientCitationImage(AgentsModel):
39
+ """Information about the citation's icon."""
40
+
41
+ type: str = "ImageObject"
42
+ name: str = ""
43
+
44
+
45
+ class SensitivityPattern(AgentsModel):
46
+ """Pattern information for sensitivity usage info."""
47
+
48
+ type: str = "DefinedTerm"
49
+ in_defined_term_set: str = ""
50
+ name: str = ""
51
+ term_code: str = ""
52
+
53
+
54
+ class SensitivityUsageInfo(AgentsModel):
55
+ """
56
+ Sensitivity usage info for content sent to the user.
57
+ This is used to provide information about the content to the user.
58
+ """
59
+
60
+ type: str = "https://schema.org/Message"
61
+ schema_type: str = "CreativeWork"
62
+ description: Optional[str] = None
63
+ name: str = ""
64
+ position: Optional[int] = None
65
+ pattern: Optional[SensitivityPattern] = None
66
+
67
+
68
+ class ClientCitationAppearance(AgentsModel):
69
+ """Appearance information for a client citation."""
70
+
71
+ type: str = "DigitalDocument"
72
+ name: str = ""
73
+ text: Optional[str] = None
74
+ url: Optional[str] = None
75
+ abstract: str = ""
76
+ encoding_format: Optional[str] = None
77
+ image: Optional[ClientCitationImage] = None
78
+ keywords: Optional[List[str]] = None
79
+ usage_info: Optional[SensitivityUsageInfo] = None
80
+
81
+
82
+ class ClientCitation(AgentsModel):
83
+ """
84
+ Represents a Teams client citation to be included in a message.
85
+ See Bot messages with AI-generated content for more details.
86
+ https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/bot-messages-ai-generated-content?tabs=before%2Cbotmessage
87
+ """
88
+
89
+ type: str = "Claim"
90
+ position: int = 0
91
+ appearance: Optional[ClientCitationAppearance] = None
92
+
93
+ def __post_init__(self):
94
+ if self.appearance is None:
95
+ self.appearance = ClientCitationAppearance()
96
+
97
+
98
+ class AIEntity(Entity):
99
+ """Entity indicating AI-generated content."""
100
+
101
+ type: str = "https://schema.org/Message"
102
+ schema_type: str = "Message"
103
+ context: str = "https://schema.org"
104
+ id: str = ""
105
+ additional_type: Optional[List[str]] = None
106
+ citation: Optional[List[ClientCitation]] = None
107
+ usage_info: Optional[SensitivityUsageInfo] = None
108
+
109
+ def __post_init__(self):
110
+ if self.additional_type is None:
111
+ self.additional_type = ["AIGeneratedContent"]