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.
- microsoft_agents/activity/__init__.py +200 -0
- microsoft_agents/activity/_channel_id_field_mixin.py +95 -0
- microsoft_agents/activity/_load_configuration.py +33 -0
- microsoft_agents/activity/_model_utils.py +64 -0
- microsoft_agents/activity/_type_aliases.py +7 -0
- microsoft_agents/activity/_utils/__init__.py +6 -0
- microsoft_agents/activity/_utils/_deferred_string.py +34 -0
- microsoft_agents/activity/action_types.py +17 -0
- microsoft_agents/activity/activity.py +787 -0
- microsoft_agents/activity/activity_event_names.py +9 -0
- microsoft_agents/activity/activity_importance.py +10 -0
- microsoft_agents/activity/activity_types.py +25 -0
- microsoft_agents/activity/adaptive_card_invoke_action.py +27 -0
- microsoft_agents/activity/adaptive_card_invoke_response.py +23 -0
- microsoft_agents/activity/adaptive_card_invoke_value.py +25 -0
- microsoft_agents/activity/agents_model.py +49 -0
- microsoft_agents/activity/animation_card.py +57 -0
- microsoft_agents/activity/attachment.py +27 -0
- microsoft_agents/activity/attachment_data.py +24 -0
- microsoft_agents/activity/attachment_info.py +22 -0
- microsoft_agents/activity/attachment_layout_types.py +9 -0
- microsoft_agents/activity/attachment_view.py +18 -0
- microsoft_agents/activity/audio_card.py +57 -0
- microsoft_agents/activity/basic_card.py +33 -0
- microsoft_agents/activity/caller_id_constants.py +10 -0
- microsoft_agents/activity/card_action.py +42 -0
- microsoft_agents/activity/card_image.py +22 -0
- microsoft_agents/activity/channel_account.py +39 -0
- microsoft_agents/activity/channel_adapter_protocol.py +79 -0
- microsoft_agents/activity/channel_id.py +95 -0
- microsoft_agents/activity/channels.py +161 -0
- microsoft_agents/activity/contact_relation_update_action_types.py +9 -0
- microsoft_agents/activity/conversation_account.py +41 -0
- microsoft_agents/activity/conversation_members.py +19 -0
- microsoft_agents/activity/conversation_parameters.py +40 -0
- microsoft_agents/activity/conversation_reference.py +69 -0
- microsoft_agents/activity/conversation_resource_response.py +22 -0
- microsoft_agents/activity/conversation_update_types.py +18 -0
- microsoft_agents/activity/conversations_result.py +20 -0
- microsoft_agents/activity/delivery_modes.py +12 -0
- microsoft_agents/activity/end_of_conversation_codes.py +13 -0
- microsoft_agents/activity/entity/__init__.py +36 -0
- microsoft_agents/activity/entity/ai_entity.py +111 -0
- microsoft_agents/activity/entity/entity.py +41 -0
- microsoft_agents/activity/entity/entity_types.py +14 -0
- microsoft_agents/activity/entity/geo_coordinates.py +33 -0
- microsoft_agents/activity/entity/mention.py +24 -0
- microsoft_agents/activity/entity/place.py +33 -0
- microsoft_agents/activity/entity/product_info.py +20 -0
- microsoft_agents/activity/entity/thing.py +21 -0
- microsoft_agents/activity/error.py +22 -0
- microsoft_agents/activity/error_response.py +15 -0
- microsoft_agents/activity/errors/__init__.py +14 -0
- microsoft_agents/activity/errors/error_message.py +64 -0
- microsoft_agents/activity/errors/error_resources.py +52 -0
- microsoft_agents/activity/expected_replies.py +16 -0
- microsoft_agents/activity/fact.py +21 -0
- microsoft_agents/activity/hero_card.py +33 -0
- microsoft_agents/activity/inner_http_error.py +17 -0
- microsoft_agents/activity/input_hints.py +10 -0
- microsoft_agents/activity/installation_update_action_types.py +9 -0
- microsoft_agents/activity/invoke_response.py +27 -0
- microsoft_agents/activity/media_card.py +57 -0
- microsoft_agents/activity/media_event_value.py +15 -0
- microsoft_agents/activity/media_url.py +19 -0
- microsoft_agents/activity/message_reaction.py +16 -0
- microsoft_agents/activity/message_reaction_types.py +14 -0
- microsoft_agents/activity/message_update_types.py +10 -0
- microsoft_agents/activity/oauth_card.py +27 -0
- microsoft_agents/activity/paged_members_result.py +19 -0
- microsoft_agents/activity/receipt_card.py +39 -0
- microsoft_agents/activity/receipt_item.py +38 -0
- microsoft_agents/activity/resource_response.py +15 -0
- microsoft_agents/activity/role_types.py +12 -0
- microsoft_agents/activity/semantic_action.py +21 -0
- microsoft_agents/activity/semantic_actions_states.py +10 -0
- microsoft_agents/activity/sign_in_constants.py +13 -0
- microsoft_agents/activity/sign_in_resource.py +17 -0
- microsoft_agents/activity/signin_card.py +19 -0
- microsoft_agents/activity/suggested_actions.py +21 -0
- microsoft_agents/activity/teams/__init__.py +198 -0
- microsoft_agents/activity/teams/app_based_link_query.py +18 -0
- microsoft_agents/activity/teams/batch_failed_entries_response.py +15 -0
- microsoft_agents/activity/teams/batch_failed_entry.py +16 -0
- microsoft_agents/activity/teams/batch_operation_response.py +13 -0
- microsoft_agents/activity/teams/batch_operation_state_response.py +24 -0
- microsoft_agents/activity/teams/bot_config_auth.py +18 -0
- microsoft_agents/activity/teams/cache_info.py +18 -0
- microsoft_agents/activity/teams/cancel_operation_response.py +19 -0
- microsoft_agents/activity/teams/channel_info.py +21 -0
- microsoft_agents/activity/teams/config_auth_response.py +17 -0
- microsoft_agents/activity/teams/config_response.py +18 -0
- microsoft_agents/activity/teams/config_response_base.py +14 -0
- microsoft_agents/activity/teams/config_task_response.py +18 -0
- microsoft_agents/activity/teams/conversation_list.py +17 -0
- microsoft_agents/activity/teams/file_consent_card.py +24 -0
- microsoft_agents/activity/teams/file_consent_card_response.py +21 -0
- microsoft_agents/activity/teams/file_download_info.py +24 -0
- microsoft_agents/activity/teams/file_info_card.py +21 -0
- microsoft_agents/activity/teams/file_upload_info.py +26 -0
- microsoft_agents/activity/teams/meeting_details.py +23 -0
- microsoft_agents/activity/teams/meeting_details_base.py +21 -0
- microsoft_agents/activity/teams/meeting_end_event_details.py +15 -0
- microsoft_agents/activity/teams/meeting_event_details.py +15 -0
- microsoft_agents/activity/teams/meeting_info.py +24 -0
- microsoft_agents/activity/teams/meeting_notification.py +15 -0
- microsoft_agents/activity/teams/meeting_notification_base.py +14 -0
- microsoft_agents/activity/teams/meeting_notification_channel_data.py +16 -0
- microsoft_agents/activity/teams/meeting_notification_recipient_failure_info.py +20 -0
- microsoft_agents/activity/teams/meeting_notification_response.py +20 -0
- microsoft_agents/activity/teams/meeting_participant_info.py +18 -0
- microsoft_agents/activity/teams/meeting_participants_event_details.py +16 -0
- microsoft_agents/activity/teams/meeting_stage_surface.py +25 -0
- microsoft_agents/activity/teams/meeting_start_event_details.py +15 -0
- microsoft_agents/activity/teams/meeting_tab_icon_surface.py +15 -0
- microsoft_agents/activity/teams/message_actions_payload.py +70 -0
- microsoft_agents/activity/teams/message_actions_payload_app.py +29 -0
- microsoft_agents/activity/teams/message_actions_payload_attachment.py +30 -0
- microsoft_agents/activity/teams/message_actions_payload_body.py +17 -0
- microsoft_agents/activity/teams/message_actions_payload_conversation.py +20 -0
- microsoft_agents/activity/teams/message_actions_payload_from.py +25 -0
- microsoft_agents/activity/teams/message_actions_payload_mention.py +23 -0
- microsoft_agents/activity/teams/message_actions_payload_reaction.py +23 -0
- microsoft_agents/activity/teams/message_actions_payload_user.py +27 -0
- microsoft_agents/activity/teams/messaging_extension_action.py +37 -0
- microsoft_agents/activity/teams/messaging_extension_action_response.py +24 -0
- microsoft_agents/activity/teams/messaging_extension_attachment.py +32 -0
- microsoft_agents/activity/teams/messaging_extension_parameter.py +17 -0
- microsoft_agents/activity/teams/messaging_extension_query.py +27 -0
- microsoft_agents/activity/teams/messaging_extension_query_options.py +17 -0
- microsoft_agents/activity/teams/messaging_extension_response.py +21 -0
- microsoft_agents/activity/teams/messaging_extension_result.py +34 -0
- microsoft_agents/activity/teams/messaging_extension_suggested_action.py +17 -0
- microsoft_agents/activity/teams/notification_info.py +21 -0
- microsoft_agents/activity/teams/o365_connector_card.py +32 -0
- microsoft_agents/activity/teams/o365_connector_card_action_base.py +21 -0
- microsoft_agents/activity/teams/o365_connector_card_action_card.py +30 -0
- microsoft_agents/activity/teams/o365_connector_card_action_query.py +15 -0
- microsoft_agents/activity/teams/o365_connector_card_date_input.py +30 -0
- microsoft_agents/activity/teams/o365_connector_card_fact.py +17 -0
- microsoft_agents/activity/teams/o365_connector_card_http_post.py +25 -0
- microsoft_agents/activity/teams/o365_connector_card_image.py +18 -0
- microsoft_agents/activity/teams/o365_connector_card_input_base.py +28 -0
- microsoft_agents/activity/teams/o365_connector_card_multichoice_input.py +40 -0
- microsoft_agents/activity/teams/o365_connector_card_multichoice_input_choice.py +17 -0
- microsoft_agents/activity/teams/o365_connector_card_open_uri.py +26 -0
- microsoft_agents/activity/teams/o365_connector_card_open_uri_target.py +17 -0
- microsoft_agents/activity/teams/o365_connector_card_section.py +42 -0
- microsoft_agents/activity/teams/o365_connector_card_text_input.py +31 -0
- microsoft_agents/activity/teams/o365_connector_card_view_action.py +25 -0
- microsoft_agents/activity/teams/on_behalf_of.py +23 -0
- microsoft_agents/activity/teams/read_receipt_info.py +47 -0
- microsoft_agents/activity/teams/signin_state_verification_query.py +14 -0
- microsoft_agents/activity/teams/surface.py +18 -0
- microsoft_agents/activity/teams/tab_context.py +14 -0
- microsoft_agents/activity/teams/tab_entity_context.py +15 -0
- microsoft_agents/activity/teams/tab_request.py +22 -0
- microsoft_agents/activity/teams/tab_response.py +16 -0
- microsoft_agents/activity/teams/tab_response_card.py +14 -0
- microsoft_agents/activity/teams/tab_response_cards.py +17 -0
- microsoft_agents/activity/teams/tab_response_payload.py +25 -0
- microsoft_agents/activity/teams/tab_submit.py +23 -0
- microsoft_agents/activity/teams/tab_submit_data.py +18 -0
- microsoft_agents/activity/teams/tab_suggested_actions.py +17 -0
- microsoft_agents/activity/teams/targeted_meeting_notification.py +19 -0
- microsoft_agents/activity/teams/targeted_meeting_notification_value.py +19 -0
- microsoft_agents/activity/teams/task_module_card_response.py +15 -0
- microsoft_agents/activity/teams/task_module_continue_response.py +19 -0
- microsoft_agents/activity/teams/task_module_message_response.py +18 -0
- microsoft_agents/activity/teams/task_module_request.py +25 -0
- microsoft_agents/activity/teams/task_module_request_context.py +15 -0
- microsoft_agents/activity/teams/task_module_response.py +20 -0
- microsoft_agents/activity/teams/task_module_response_base.py +17 -0
- microsoft_agents/activity/teams/task_module_task_info.py +30 -0
- microsoft_agents/activity/teams/team_details.py +29 -0
- microsoft_agents/activity/teams/team_info.py +20 -0
- microsoft_agents/activity/teams/teams_batch_operation_response.py +19 -0
- microsoft_agents/activity/teams/teams_channel_account.py +44 -0
- microsoft_agents/activity/teams/teams_channel_data.py +43 -0
- microsoft_agents/activity/teams/teams_channel_data_settings.py +15 -0
- microsoft_agents/activity/teams/teams_meeting_info.py +14 -0
- microsoft_agents/activity/teams/teams_meeting_member.py +19 -0
- microsoft_agents/activity/teams/teams_meeting_participant.py +24 -0
- microsoft_agents/activity/teams/teams_member.py +14 -0
- microsoft_agents/activity/teams/teams_paged_members_result.py +19 -0
- microsoft_agents/activity/teams/tenant_info.py +14 -0
- microsoft_agents/activity/teams/user_meeting_details.py +17 -0
- microsoft_agents/activity/text_format_types.py +10 -0
- microsoft_agents/activity/text_highlight.py +19 -0
- microsoft_agents/activity/thumbnail_card.py +33 -0
- microsoft_agents/activity/thumbnail_url.py +18 -0
- microsoft_agents/activity/token_exchange_invoke_request.py +24 -0
- microsoft_agents/activity/token_exchange_invoke_response.py +24 -0
- microsoft_agents/activity/token_exchange_resource.py +16 -0
- microsoft_agents/activity/token_exchange_state.py +41 -0
- microsoft_agents/activity/token_or_sign_in_resource_response.py +21 -0
- microsoft_agents/activity/token_post_resource.py +14 -0
- microsoft_agents/activity/token_request.py +19 -0
- microsoft_agents/activity/token_response.py +46 -0
- microsoft_agents/activity/token_status.py +32 -0
- microsoft_agents/activity/transcript.py +16 -0
- microsoft_agents/activity/turn_context_protocol.py +68 -0
- microsoft_agents/activity/video_card.py +57 -0
- microsoft_agents_activity-0.7.0.dev0.dist-info/METADATA +173 -0
- microsoft_agents_activity-0.7.0.dev0.dist-info/RECORD +208 -0
- microsoft_agents_activity-0.7.0.dev0.dist-info/WHEEL +5 -0
- microsoft_agents_activity-0.7.0.dev0.dist-info/licenses/LICENSE +21 -0
- microsoft_agents_activity-0.7.0.dev0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from .agents_model import AgentsModel
|
|
5
|
+
from .action_types import ActionTypes
|
|
6
|
+
from .activity import Activity
|
|
7
|
+
from .activity_event_names import ActivityEventNames
|
|
8
|
+
from .activity_types import ActivityTypes
|
|
9
|
+
from .adaptive_card_invoke_action import AdaptiveCardInvokeAction
|
|
10
|
+
from .adaptive_card_invoke_response import AdaptiveCardInvokeResponse
|
|
11
|
+
from .adaptive_card_invoke_value import AdaptiveCardInvokeValue
|
|
12
|
+
from .animation_card import AnimationCard
|
|
13
|
+
from .attachment import Attachment
|
|
14
|
+
from .attachment_data import AttachmentData
|
|
15
|
+
from .attachment_info import AttachmentInfo
|
|
16
|
+
from .attachment_view import AttachmentView
|
|
17
|
+
from .audio_card import AudioCard
|
|
18
|
+
from .basic_card import BasicCard
|
|
19
|
+
from .card_action import CardAction
|
|
20
|
+
from .card_image import CardImage
|
|
21
|
+
from .channels import Channels
|
|
22
|
+
from .channel_account import ChannelAccount
|
|
23
|
+
from ._channel_id_field_mixin import _ChannelIdFieldMixin
|
|
24
|
+
from .channel_id import ChannelId
|
|
25
|
+
from .conversation_account import ConversationAccount
|
|
26
|
+
from .conversation_members import ConversationMembers
|
|
27
|
+
from .conversation_parameters import ConversationParameters
|
|
28
|
+
from .conversation_reference import ConversationReference
|
|
29
|
+
from .conversation_resource_response import ConversationResourceResponse
|
|
30
|
+
from .conversations_result import ConversationsResult
|
|
31
|
+
from .expected_replies import ExpectedReplies
|
|
32
|
+
from .entity import (
|
|
33
|
+
Entity,
|
|
34
|
+
EntityTypes,
|
|
35
|
+
AIEntity,
|
|
36
|
+
ClientCitation,
|
|
37
|
+
ClientCitationAppearance,
|
|
38
|
+
ClientCitationImage,
|
|
39
|
+
ClientCitationIconName,
|
|
40
|
+
Mention,
|
|
41
|
+
SensitivityUsageInfo,
|
|
42
|
+
SensitivityPattern,
|
|
43
|
+
GeoCoordinates,
|
|
44
|
+
Place,
|
|
45
|
+
ProductInfo,
|
|
46
|
+
Thing,
|
|
47
|
+
)
|
|
48
|
+
from .error import Error
|
|
49
|
+
from .error_response import ErrorResponse
|
|
50
|
+
from .fact import Fact
|
|
51
|
+
from .hero_card import HeroCard
|
|
52
|
+
from .inner_http_error import InnerHttpError
|
|
53
|
+
from .invoke_response import InvokeResponse
|
|
54
|
+
from .media_card import MediaCard
|
|
55
|
+
from .media_event_value import MediaEventValue
|
|
56
|
+
from .media_url import MediaUrl
|
|
57
|
+
from .message_reaction import MessageReaction
|
|
58
|
+
from .oauth_card import OAuthCard
|
|
59
|
+
from .paged_members_result import PagedMembersResult
|
|
60
|
+
from .receipt_card import ReceiptCard
|
|
61
|
+
from .receipt_item import ReceiptItem
|
|
62
|
+
from .resource_response import ResourceResponse
|
|
63
|
+
from .semantic_action import SemanticAction
|
|
64
|
+
from .signin_card import SigninCard
|
|
65
|
+
from .suggested_actions import SuggestedActions
|
|
66
|
+
from .text_highlight import TextHighlight
|
|
67
|
+
from .thumbnail_card import ThumbnailCard
|
|
68
|
+
from .thumbnail_url import ThumbnailUrl
|
|
69
|
+
from .token_exchange_invoke_request import TokenExchangeInvokeRequest
|
|
70
|
+
from .token_exchange_invoke_response import TokenExchangeInvokeResponse
|
|
71
|
+
from .token_exchange_state import TokenExchangeState
|
|
72
|
+
from .token_or_sign_in_resource_response import TokenOrSignInResourceResponse
|
|
73
|
+
from .token_request import TokenRequest
|
|
74
|
+
from .token_response import TokenResponse
|
|
75
|
+
from .token_status import TokenStatus
|
|
76
|
+
from .transcript import Transcript
|
|
77
|
+
from .video_card import VideoCard
|
|
78
|
+
|
|
79
|
+
from .activity_importance import ActivityImportance
|
|
80
|
+
from .attachment_layout_types import AttachmentLayoutTypes
|
|
81
|
+
from .contact_relation_update_action_types import ContactRelationUpdateActionTypes
|
|
82
|
+
from .delivery_modes import DeliveryModes
|
|
83
|
+
from .end_of_conversation_codes import EndOfConversationCodes
|
|
84
|
+
from .input_hints import InputHints
|
|
85
|
+
from .installation_update_action_types import InstallationUpdateActionTypes
|
|
86
|
+
from .message_reaction_types import MessageReactionTypes
|
|
87
|
+
from .role_types import RoleTypes
|
|
88
|
+
from .semantic_actions_states import SemanticActionsStates
|
|
89
|
+
from .text_format_types import TextFormatTypes
|
|
90
|
+
from .sign_in_constants import SignInConstants
|
|
91
|
+
|
|
92
|
+
from .sign_in_resource import SignInResource
|
|
93
|
+
from .token_exchange_resource import TokenExchangeResource
|
|
94
|
+
from .token_post_resource import TokenPostResource
|
|
95
|
+
|
|
96
|
+
from .delivery_modes import DeliveryModes
|
|
97
|
+
from .caller_id_constants import CallerIdConstants
|
|
98
|
+
|
|
99
|
+
from .conversation_update_types import ConversationUpdateTypes
|
|
100
|
+
from .message_update_types import MessageUpdateTypes
|
|
101
|
+
|
|
102
|
+
from .channel_adapter_protocol import ChannelAdapterProtocol
|
|
103
|
+
from .turn_context_protocol import TurnContextProtocol
|
|
104
|
+
from ._load_configuration import load_configuration_from_env
|
|
105
|
+
|
|
106
|
+
__all__ = [
|
|
107
|
+
"AgentsModel",
|
|
108
|
+
"Activity",
|
|
109
|
+
"ActionTypes",
|
|
110
|
+
"ActivityEventNames",
|
|
111
|
+
"AdaptiveCardInvokeAction",
|
|
112
|
+
"AdaptiveCardInvokeResponse",
|
|
113
|
+
"AdaptiveCardInvokeValue",
|
|
114
|
+
"AnimationCard",
|
|
115
|
+
"Attachment",
|
|
116
|
+
"AttachmentData",
|
|
117
|
+
"AttachmentInfo",
|
|
118
|
+
"AttachmentView",
|
|
119
|
+
"AudioCard",
|
|
120
|
+
"BasicCard",
|
|
121
|
+
"CardAction",
|
|
122
|
+
"CardImage",
|
|
123
|
+
"Channels",
|
|
124
|
+
"ChannelAccount",
|
|
125
|
+
"ChannelId",
|
|
126
|
+
"_ChannelIdFieldMixin",
|
|
127
|
+
"ConversationAccount",
|
|
128
|
+
"ConversationMembers",
|
|
129
|
+
"ConversationParameters",
|
|
130
|
+
"ConversationReference",
|
|
131
|
+
"ConversationResourceResponse",
|
|
132
|
+
"ConversationsResult",
|
|
133
|
+
"ExpectedReplies",
|
|
134
|
+
"Entity",
|
|
135
|
+
"AIEntity",
|
|
136
|
+
"ClientCitation",
|
|
137
|
+
"ClientCitationAppearance",
|
|
138
|
+
"ClientCitationImage",
|
|
139
|
+
"ClientCitationIconName",
|
|
140
|
+
"SensitivityUsageInfo",
|
|
141
|
+
"SensitivityPattern",
|
|
142
|
+
"Error",
|
|
143
|
+
"ErrorResponse",
|
|
144
|
+
"Fact",
|
|
145
|
+
"GeoCoordinates",
|
|
146
|
+
"HeroCard",
|
|
147
|
+
"InnerHttpError",
|
|
148
|
+
"InvokeResponse",
|
|
149
|
+
"MediaCard",
|
|
150
|
+
"MediaEventValue",
|
|
151
|
+
"MediaUrl",
|
|
152
|
+
"Mention",
|
|
153
|
+
"MessageReaction",
|
|
154
|
+
"OAuthCard",
|
|
155
|
+
"PagedMembersResult",
|
|
156
|
+
"Place",
|
|
157
|
+
"ProductInfo",
|
|
158
|
+
"ReceiptCard",
|
|
159
|
+
"ReceiptItem",
|
|
160
|
+
"ResourceResponse",
|
|
161
|
+
"SemanticAction",
|
|
162
|
+
"SigninCard",
|
|
163
|
+
"SuggestedActions",
|
|
164
|
+
"TextHighlight",
|
|
165
|
+
"Thing",
|
|
166
|
+
"ThumbnailCard",
|
|
167
|
+
"ThumbnailUrl",
|
|
168
|
+
"TokenExchangeInvokeRequest",
|
|
169
|
+
"TokenExchangeInvokeResponse",
|
|
170
|
+
"TokenExchangeState",
|
|
171
|
+
"TokenRequest",
|
|
172
|
+
"TokenResponse",
|
|
173
|
+
"TokenStatus",
|
|
174
|
+
"Transcript",
|
|
175
|
+
"VideoCard",
|
|
176
|
+
"ActivityTypes",
|
|
177
|
+
"ActivityImportance",
|
|
178
|
+
"AttachmentLayoutTypes",
|
|
179
|
+
"ContactRelationUpdateActionTypes",
|
|
180
|
+
"DeliveryModes",
|
|
181
|
+
"EndOfConversationCodes",
|
|
182
|
+
"InputHints",
|
|
183
|
+
"InstallationUpdateActionTypes",
|
|
184
|
+
"MessageReactionTypes",
|
|
185
|
+
"RoleTypes",
|
|
186
|
+
"SemanticActionsStates",
|
|
187
|
+
"TextFormatTypes",
|
|
188
|
+
"SignInConstants",
|
|
189
|
+
"SignInResource",
|
|
190
|
+
"TokenExchangeResource",
|
|
191
|
+
"TokenPostResource",
|
|
192
|
+
"DeliveryModes",
|
|
193
|
+
"CallerIdConstants",
|
|
194
|
+
"ConversationUpdateTypes",
|
|
195
|
+
"MessageUpdateTypes",
|
|
196
|
+
"load_configuration_from_env",
|
|
197
|
+
"ChannelAdapterProtocol",
|
|
198
|
+
"TurnContextProtocol",
|
|
199
|
+
"TokenOrSignInResourceResponse",
|
|
200
|
+
]
|
|
@@ -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
|
+
import logging
|
|
7
|
+
from typing import Optional, Any
|
|
8
|
+
|
|
9
|
+
from pydantic import (
|
|
10
|
+
ModelWrapValidatorHandler,
|
|
11
|
+
SerializerFunctionWrapHandler,
|
|
12
|
+
computed_field,
|
|
13
|
+
model_validator,
|
|
14
|
+
model_serializer,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
from microsoft_agents.activity.errors import activity_errors
|
|
18
|
+
|
|
19
|
+
from .channel_id import ChannelId
|
|
20
|
+
|
|
21
|
+
logger = logging.getLogger(__name__)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# can be generalized in the future, if needed
|
|
25
|
+
class _ChannelIdFieldMixin:
|
|
26
|
+
"""A mixin to add a computed field channel_id of type ChannelId to a Pydantic model."""
|
|
27
|
+
|
|
28
|
+
_channel_id: Optional[ChannelId] = None
|
|
29
|
+
|
|
30
|
+
# required to define the setter below
|
|
31
|
+
@computed_field(return_type=Optional[ChannelId], alias="channelId")
|
|
32
|
+
@property
|
|
33
|
+
def channel_id(self) -> Optional[ChannelId]:
|
|
34
|
+
"""Gets the _channel_id field"""
|
|
35
|
+
return self._channel_id
|
|
36
|
+
|
|
37
|
+
# necessary for backward compatibility
|
|
38
|
+
# previously, channel_id was directly assigned with strings
|
|
39
|
+
@channel_id.setter
|
|
40
|
+
def channel_id(self, value: Any):
|
|
41
|
+
"""Sets the channel_id after validating it as a ChannelId model."""
|
|
42
|
+
if isinstance(value, ChannelId):
|
|
43
|
+
self._channel_id = value
|
|
44
|
+
elif isinstance(value, str):
|
|
45
|
+
self._channel_id = ChannelId(value)
|
|
46
|
+
else:
|
|
47
|
+
raise ValueError(activity_errors.InvalidChannelIdType.format(type(value)))
|
|
48
|
+
|
|
49
|
+
def _set_validated_channel_id(self, data: Any) -> None:
|
|
50
|
+
"""Sets the channel_id after validating it as a ChannelId model."""
|
|
51
|
+
if "channelId" in data:
|
|
52
|
+
self.channel_id = data["channelId"]
|
|
53
|
+
elif "channel_id" in data:
|
|
54
|
+
self.channel_id = data["channel_id"]
|
|
55
|
+
|
|
56
|
+
@model_validator(mode="wrap")
|
|
57
|
+
@classmethod
|
|
58
|
+
def _validate_channel_id(
|
|
59
|
+
cls, data: Any, handler: ModelWrapValidatorHandler
|
|
60
|
+
) -> _ChannelIdFieldMixin:
|
|
61
|
+
"""Validate the _channel_id field after model initialization.
|
|
62
|
+
|
|
63
|
+
:return: The model instance itself.
|
|
64
|
+
"""
|
|
65
|
+
try:
|
|
66
|
+
model = handler(data)
|
|
67
|
+
model._set_validated_channel_id(data)
|
|
68
|
+
return model
|
|
69
|
+
except Exception:
|
|
70
|
+
logging.error("Model %s failed to validate with data %s", cls, data)
|
|
71
|
+
raise
|
|
72
|
+
|
|
73
|
+
def _remove_serialized_unset_channel_id(
|
|
74
|
+
self, serialized: dict[str, object]
|
|
75
|
+
) -> None:
|
|
76
|
+
"""Remove the _channel_id field if it is not set."""
|
|
77
|
+
if not self._channel_id:
|
|
78
|
+
if "channelId" in serialized:
|
|
79
|
+
del serialized["channelId"]
|
|
80
|
+
elif "channel_id" in serialized:
|
|
81
|
+
del serialized["channel_id"]
|
|
82
|
+
|
|
83
|
+
@model_serializer(mode="wrap")
|
|
84
|
+
def _serialize_channel_id(
|
|
85
|
+
self, handler: SerializerFunctionWrapHandler
|
|
86
|
+
) -> dict[str, object]:
|
|
87
|
+
"""Serialize the model using Pydantic's standard serialization.
|
|
88
|
+
|
|
89
|
+
:param handler: The serialization handler provided by Pydantic.
|
|
90
|
+
:return: A dictionary representing the serialized model.
|
|
91
|
+
"""
|
|
92
|
+
serialized = handler(self)
|
|
93
|
+
if self: # serialization can be called with None
|
|
94
|
+
self._remove_serialized_unset_channel_id(serialized)
|
|
95
|
+
return serialized
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def load_configuration_from_env(env_vars: dict[str, Any]) -> dict:
|
|
8
|
+
"""
|
|
9
|
+
Parses environment variables and returns a dictionary with the relevant configuration.
|
|
10
|
+
"""
|
|
11
|
+
vars = env_vars.copy()
|
|
12
|
+
result = {}
|
|
13
|
+
for key, value in vars.items():
|
|
14
|
+
levels = key.split("__")
|
|
15
|
+
current_level = result
|
|
16
|
+
last_level = None
|
|
17
|
+
for next_level in levels:
|
|
18
|
+
if next_level not in current_level:
|
|
19
|
+
current_level[next_level] = {}
|
|
20
|
+
last_level = current_level
|
|
21
|
+
current_level = current_level[next_level]
|
|
22
|
+
last_level[levels[-1]] = value
|
|
23
|
+
|
|
24
|
+
if result.get("CONNECTIONSMAP") and isinstance(result["CONNECTIONSMAP"], dict):
|
|
25
|
+
result["CONNECTIONSMAP"] = [
|
|
26
|
+
conn for conn in result.get("CONNECTIONSMAP", {}).values()
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
"AGENTAPPLICATION": result.get("AGENTAPPLICATION", {}),
|
|
31
|
+
"CONNECTIONS": result.get("CONNECTIONS", {}),
|
|
32
|
+
"CONNECTIONSMAP": result.get("CONNECTIONSMAP", {}),
|
|
33
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from abc import ABC
|
|
5
|
+
from typing import Any, Callable
|
|
6
|
+
|
|
7
|
+
from .agents_model import AgentsModel
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ModelFieldHelper(ABC):
|
|
11
|
+
"""Base class for model field processing prior to initialization of an AgentsModel"""
|
|
12
|
+
|
|
13
|
+
def process(self, key: str) -> dict[str, Any]:
|
|
14
|
+
"""Takes the key in the destination object and returns a dictionary of new fields to add"""
|
|
15
|
+
raise NotImplementedError()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class SkipIf(ModelFieldHelper):
|
|
19
|
+
"""Skip if the value meets the given condition."""
|
|
20
|
+
|
|
21
|
+
def __init__(self, value, skip_condition: Callable[[Any], bool]):
|
|
22
|
+
self.value = value
|
|
23
|
+
self._skip_condition = skip_condition
|
|
24
|
+
|
|
25
|
+
def process(self, key: str) -> dict[str, Any]:
|
|
26
|
+
if self._skip_condition(self.value):
|
|
27
|
+
return {}
|
|
28
|
+
return {key: self.value}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class SkipNone(SkipIf):
|
|
32
|
+
"""Skip if the value is None."""
|
|
33
|
+
|
|
34
|
+
def __init__(self, value):
|
|
35
|
+
super().__init__(value, lambda v: v is None)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def pick_model_dict(**kwargs):
|
|
39
|
+
"""Processes a list of keyword arguments, using ModelFieldHelper subclasses to determine which fields to include in the final model.
|
|
40
|
+
|
|
41
|
+
This function is useful for dynamically constructing models based on varying input data.
|
|
42
|
+
|
|
43
|
+
Usage:
|
|
44
|
+
activity_dict = pick_model_dict(type="message", id="123", text=SkipNone(text_variable))
|
|
45
|
+
activity = Activity.model_validate(activity_dict)
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
model_dict = {}
|
|
49
|
+
for key, value in kwargs.items():
|
|
50
|
+
if not isinstance(value, ModelFieldHelper):
|
|
51
|
+
model_dict[key] = value
|
|
52
|
+
else:
|
|
53
|
+
model_dict.update(value.process(key))
|
|
54
|
+
|
|
55
|
+
return model_dict
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def pick_model(model_class: type[AgentsModel], **kwargs) -> AgentsModel:
|
|
59
|
+
"""Picks model fields from the given keyword arguments.
|
|
60
|
+
|
|
61
|
+
Usage:
|
|
62
|
+
activity = pick_model(Activity, type="message", id="123", text=SkipNone(text_variable))
|
|
63
|
+
"""
|
|
64
|
+
return model_class(**pick_model_dict(**kwargs))
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import logging
|
|
5
|
+
from typing import Callable
|
|
6
|
+
|
|
7
|
+
logger = logging.getLogger(__name__)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class _DeferredString:
|
|
11
|
+
"""A wrapper around a function to allow for deferred evaluation.
|
|
12
|
+
|
|
13
|
+
The result of the function is converted to a string with str().
|
|
14
|
+
If an error occurs during evaluation, an error is logged and a default
|
|
15
|
+
string is returned.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
def __init__(self, func: Callable, *args, **kwargs):
|
|
19
|
+
"""Initializes a DeferredString instance.
|
|
20
|
+
|
|
21
|
+
:param func: The function to be called to get the string value.
|
|
22
|
+
:param args: Positional arguments to pass to the function.
|
|
23
|
+
:param kwargs: Keyword arguments to pass to the function.
|
|
24
|
+
"""
|
|
25
|
+
self.func = func
|
|
26
|
+
self.args = args
|
|
27
|
+
self.kwargs = kwargs
|
|
28
|
+
|
|
29
|
+
def __str__(self):
|
|
30
|
+
try:
|
|
31
|
+
return str(self.func(*self.args, **self.kwargs))
|
|
32
|
+
except Exception as e:
|
|
33
|
+
logger.error("Error evaluating deferred string", exc_info=e)
|
|
34
|
+
return "_DeferredString: error evaluating deferred string"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from enum import Enum
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ActionTypes(str, Enum):
|
|
8
|
+
open_url = "openUrl"
|
|
9
|
+
im_back = "imBack"
|
|
10
|
+
post_back = "postBack"
|
|
11
|
+
play_audio = "playAudio"
|
|
12
|
+
play_video = "playVideo"
|
|
13
|
+
show_image = "showImage"
|
|
14
|
+
download_file = "downloadFile"
|
|
15
|
+
signin = "signin"
|
|
16
|
+
call = "call"
|
|
17
|
+
message_back = "messageBack"
|