microsoft-agents-activity 0.0.0__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.
Potentially problematic release.
This version of microsoft-agents-activity might be problematic. Click here for more details.
- microsoft/agents/activity/__init__.py +191 -0
- microsoft/agents/activity/_load_configuration.py +25 -0
- microsoft/agents/activity/_type_aliases.py +5 -0
- microsoft/agents/activity/action_types.py +14 -0
- microsoft/agents/activity/activity.py +613 -0
- microsoft/agents/activity/activity_event_names.py +6 -0
- microsoft/agents/activity/activity_importance.py +7 -0
- microsoft/agents/activity/activity_types.py +22 -0
- microsoft/agents/activity/adaptive_card_invoke_action.py +24 -0
- microsoft/agents/activity/adaptive_card_invoke_response.py +20 -0
- microsoft/agents/activity/adaptive_card_invoke_value.py +22 -0
- microsoft/agents/activity/agents_model.py +18 -0
- microsoft/agents/activity/ai_entity.py +142 -0
- microsoft/agents/activity/animation_card.py +54 -0
- microsoft/agents/activity/attachment.py +24 -0
- microsoft/agents/activity/attachment_data.py +21 -0
- microsoft/agents/activity/attachment_info.py +19 -0
- microsoft/agents/activity/attachment_layout_types.py +6 -0
- microsoft/agents/activity/attachment_view.py +15 -0
- microsoft/agents/activity/audio_card.py +54 -0
- microsoft/agents/activity/basic_card.py +30 -0
- microsoft/agents/activity/caller_id_constants.py +7 -0
- microsoft/agents/activity/card_action.py +39 -0
- microsoft/agents/activity/card_image.py +19 -0
- microsoft/agents/activity/channel_account.py +33 -0
- microsoft/agents/activity/channel_adapter_protocol.py +76 -0
- microsoft/agents/activity/channels.py +158 -0
- microsoft/agents/activity/contact_relation_update_action_types.py +6 -0
- microsoft/agents/activity/conversation_account.py +38 -0
- microsoft/agents/activity/conversation_members.py +16 -0
- microsoft/agents/activity/conversation_parameters.py +37 -0
- microsoft/agents/activity/conversation_reference.py +60 -0
- microsoft/agents/activity/conversation_resource_response.py +19 -0
- microsoft/agents/activity/conversation_update_types.py +15 -0
- microsoft/agents/activity/conversations_result.py +17 -0
- microsoft/agents/activity/delivery_modes.py +9 -0
- microsoft/agents/activity/end_of_conversation_codes.py +10 -0
- microsoft/agents/activity/entity.py +38 -0
- microsoft/agents/activity/error.py +19 -0
- microsoft/agents/activity/error_response.py +12 -0
- microsoft/agents/activity/expected_replies.py +13 -0
- microsoft/agents/activity/fact.py +18 -0
- microsoft/agents/activity/geo_coordinates.py +27 -0
- microsoft/agents/activity/hero_card.py +30 -0
- microsoft/agents/activity/inner_http_error.py +14 -0
- microsoft/agents/activity/input_hints.py +10 -0
- microsoft/agents/activity/installation_update_action_types.py +6 -0
- microsoft/agents/activity/invoke_response.py +24 -0
- microsoft/agents/activity/media_card.py +54 -0
- microsoft/agents/activity/media_event_value.py +12 -0
- microsoft/agents/activity/media_url.py +16 -0
- microsoft/agents/activity/mention.py +19 -0
- microsoft/agents/activity/message_reaction.py +13 -0
- microsoft/agents/activity/message_reaction_types.py +11 -0
- microsoft/agents/activity/message_update_types.py +7 -0
- microsoft/agents/activity/oauth_card.py +24 -0
- microsoft/agents/activity/paged_members_result.py +16 -0
- microsoft/agents/activity/place.py +27 -0
- microsoft/agents/activity/receipt_card.py +36 -0
- microsoft/agents/activity/receipt_item.py +35 -0
- microsoft/agents/activity/resource_response.py +12 -0
- microsoft/agents/activity/role_types.py +7 -0
- microsoft/agents/activity/semantic_action.py +18 -0
- microsoft/agents/activity/semantic_actions_states.py +7 -0
- microsoft/agents/activity/sign_in_constants.py +13 -0
- microsoft/agents/activity/sign_in_resource.py +14 -0
- microsoft/agents/activity/signin_card.py +16 -0
- microsoft/agents/activity/suggested_actions.py +18 -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 +7 -0
- microsoft/agents/activity/text_highlight.py +16 -0
- microsoft/agents/activity/thing.py +15 -0
- microsoft/agents/activity/thumbnail_card.py +30 -0
- microsoft/agents/activity/thumbnail_url.py +15 -0
- microsoft/agents/activity/token_exchange_invoke_request.py +21 -0
- microsoft/agents/activity/token_exchange_invoke_response.py +21 -0
- microsoft/agents/activity/token_exchange_resource.py +13 -0
- microsoft/agents/activity/token_exchange_state.py +38 -0
- microsoft/agents/activity/token_post_resource.py +11 -0
- microsoft/agents/activity/token_request.py +16 -0
- microsoft/agents/activity/token_response.py +25 -0
- microsoft/agents/activity/token_status.py +32 -0
- microsoft/agents/activity/transcript.py +13 -0
- microsoft/agents/activity/turn_context_protocol.py +65 -0
- microsoft/agents/activity/video_card.py +54 -0
- microsoft_agents_activity-0.0.0.dist-info/METADATA +11 -0
- microsoft_agents_activity-0.0.0.dist-info/RECORD +195 -0
- microsoft_agents_activity-0.0.0.dist-info/WHEEL +5 -0
- microsoft_agents_activity-0.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,158 @@
|
|
|
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
|
+
console = "console"
|
|
14
|
+
"""Console channel."""
|
|
15
|
+
|
|
16
|
+
cortana = "cortana"
|
|
17
|
+
"""Cortana channel."""
|
|
18
|
+
|
|
19
|
+
direct_line = "directline"
|
|
20
|
+
"""Direct Line channel."""
|
|
21
|
+
|
|
22
|
+
direct_line_speech = "directlinespeech"
|
|
23
|
+
"""Direct Line Speech channel."""
|
|
24
|
+
|
|
25
|
+
email = "email"
|
|
26
|
+
"""Email channel."""
|
|
27
|
+
|
|
28
|
+
emulator = "emulator"
|
|
29
|
+
"""Emulator channel."""
|
|
30
|
+
|
|
31
|
+
facebook = "facebook"
|
|
32
|
+
"""Facebook channel."""
|
|
33
|
+
|
|
34
|
+
groupme = "groupme"
|
|
35
|
+
"""Group Me channel."""
|
|
36
|
+
|
|
37
|
+
kik = "kik"
|
|
38
|
+
"""Kik channel."""
|
|
39
|
+
|
|
40
|
+
line = "line"
|
|
41
|
+
"""Line channel."""
|
|
42
|
+
|
|
43
|
+
ms_teams = "msteams"
|
|
44
|
+
"""MS Teams channel."""
|
|
45
|
+
|
|
46
|
+
skype = "skype"
|
|
47
|
+
"""Skype channel."""
|
|
48
|
+
|
|
49
|
+
skype_for_business = "skypeforbusiness"
|
|
50
|
+
"""Skype for Business channel."""
|
|
51
|
+
|
|
52
|
+
slack = "slack"
|
|
53
|
+
"""Slack channel."""
|
|
54
|
+
|
|
55
|
+
sms = "sms"
|
|
56
|
+
"""SMS (Twilio) channel."""
|
|
57
|
+
|
|
58
|
+
telegram = "telegram"
|
|
59
|
+
"""Telegram channel."""
|
|
60
|
+
|
|
61
|
+
test = "test"
|
|
62
|
+
"""Test channel."""
|
|
63
|
+
|
|
64
|
+
webchat = "webchat"
|
|
65
|
+
"""WebChat channel."""
|
|
66
|
+
|
|
67
|
+
# TODO: validate the need of Self annotations in the following methods
|
|
68
|
+
@staticmethod
|
|
69
|
+
def supports_suggested_actions(channel_id: Self, button_cnt: int = 100) -> bool:
|
|
70
|
+
"""Determine if a number of Suggested Actions are supported by a Channel.
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
channel_id (str): The Channel to check the if Suggested Actions are supported in.
|
|
74
|
+
button_cnt (int, optional): Defaults to 100. The number of Suggested Actions to check for the Channel.
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
bool: True if the Channel supports the button_cnt total Suggested Actions, False if the Channel does not
|
|
78
|
+
support that number of Suggested Actions.
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
max_actions = {
|
|
82
|
+
# https://developers.facebook.com/docs/messenger-platform/send-messages/quick-replies
|
|
83
|
+
Channels.facebook: 10,
|
|
84
|
+
Channels.skype: 10,
|
|
85
|
+
# https://developers.line.biz/en/reference/messaging-api/#items-object
|
|
86
|
+
Channels.line: 13,
|
|
87
|
+
# https://dev.kik.com/#/docs/messaging#text-response-object
|
|
88
|
+
Channels.kik: 20,
|
|
89
|
+
Channels.telegram: 100,
|
|
90
|
+
Channels.emulator: 100,
|
|
91
|
+
Channels.direct_line: 100,
|
|
92
|
+
Channels.direct_line_speech: 100,
|
|
93
|
+
Channels.webchat: 100,
|
|
94
|
+
}
|
|
95
|
+
return (
|
|
96
|
+
button_cnt <= max_actions[channel_id]
|
|
97
|
+
if channel_id in max_actions
|
|
98
|
+
else False
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
@staticmethod
|
|
102
|
+
def supports_card_actions(channel_id: Self, button_cnt: int = 100) -> bool:
|
|
103
|
+
"""Determine if a number of Card Actions are supported by a Channel.
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
channel_id (str): The Channel to check if the Card Actions are supported in.
|
|
107
|
+
button_cnt (int, optional): Defaults to 100. The number of Card Actions to check for the Channel.
|
|
108
|
+
|
|
109
|
+
Returns:
|
|
110
|
+
bool: True if the Channel supports the button_cnt total Card Actions, False if the Channel does not support
|
|
111
|
+
that number of Card Actions.
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
max_actions = {
|
|
115
|
+
Channels.facebook: 3,
|
|
116
|
+
Channels.skype: 3,
|
|
117
|
+
Channels.ms_teams: 3,
|
|
118
|
+
Channels.line: 99,
|
|
119
|
+
Channels.slack: 100,
|
|
120
|
+
Channels.telegram: 100,
|
|
121
|
+
Channels.emulator: 100,
|
|
122
|
+
Channels.direct_line: 100,
|
|
123
|
+
Channels.direct_line_speech: 100,
|
|
124
|
+
Channels.webchat: 100,
|
|
125
|
+
}
|
|
126
|
+
return (
|
|
127
|
+
button_cnt <= max_actions[channel_id]
|
|
128
|
+
if channel_id in max_actions
|
|
129
|
+
else False
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
@staticmethod
|
|
133
|
+
def has_message_feed(_: str) -> bool:
|
|
134
|
+
"""Determine if a Channel has a Message Feed.
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
channel_id (str): The Channel to check for Message Feed.
|
|
138
|
+
|
|
139
|
+
Returns:
|
|
140
|
+
bool: True if the Channel has a Message Feed, False if it does not.
|
|
141
|
+
"""
|
|
142
|
+
|
|
143
|
+
return True
|
|
144
|
+
|
|
145
|
+
@staticmethod
|
|
146
|
+
def max_action_title_length( # pylint: disable=unused-argument
|
|
147
|
+
channel_id: Self,
|
|
148
|
+
) -> int:
|
|
149
|
+
"""Maximum length allowed for Action Titles.
|
|
150
|
+
|
|
151
|
+
Args:
|
|
152
|
+
channel_id (str): The Channel to determine Maximum Action Title Length.
|
|
153
|
+
|
|
154
|
+
Returns:
|
|
155
|
+
int: The total number of characters allowed for an Action Title on a specific Channel.
|
|
156
|
+
"""
|
|
157
|
+
|
|
158
|
+
return 20
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
from .agents_model import AgentsModel
|
|
3
|
+
from ._type_aliases import NonEmptyString
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ConversationAccount(AgentsModel):
|
|
7
|
+
"""Conversation account represents the identity of the conversation within a channel.
|
|
8
|
+
|
|
9
|
+
:param is_group: Indicates whether the conversation contains more than two
|
|
10
|
+
participants at the time the activity was generated
|
|
11
|
+
:type is_group: bool
|
|
12
|
+
:param conversation_type: Indicates the type of the conversation in
|
|
13
|
+
channels that distinguish between conversation types
|
|
14
|
+
:type conversation_type: str
|
|
15
|
+
:param id: Channel id for the user or agent on this channel (Example:
|
|
16
|
+
joe@smith.com, or @joesmith or 123456)
|
|
17
|
+
:type id: str
|
|
18
|
+
:param name: Display friendly name
|
|
19
|
+
:type name: str
|
|
20
|
+
:param aad_object_id: This account's object ID within Azure Active
|
|
21
|
+
Directory (AAD)
|
|
22
|
+
:type aad_object_id: str
|
|
23
|
+
:param role: Role of the entity behind the account
|
|
24
|
+
:type role: str or ~microsoft.agents.protocols.models.RoleTypes
|
|
25
|
+
:param tenant_id: This conversation's tenant ID
|
|
26
|
+
:type tenant_id: str
|
|
27
|
+
:param properties: This conversation's properties
|
|
28
|
+
:type properties: object
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
is_group: bool = None
|
|
32
|
+
conversation_type: NonEmptyString = None
|
|
33
|
+
id: NonEmptyString
|
|
34
|
+
name: NonEmptyString = None
|
|
35
|
+
aad_object_id: NonEmptyString = None
|
|
36
|
+
role: NonEmptyString = None
|
|
37
|
+
tenant_id: Optional[NonEmptyString] = None
|
|
38
|
+
properties: object = None
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from .channel_account import ChannelAccount
|
|
2
|
+
from .agents_model import AgentsModel
|
|
3
|
+
from ._type_aliases import NonEmptyString
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ConversationMembers(AgentsModel):
|
|
7
|
+
"""Conversation and its members.
|
|
8
|
+
|
|
9
|
+
:param id: Conversation ID
|
|
10
|
+
:type id: str
|
|
11
|
+
:param members: List of members in this conversation
|
|
12
|
+
:type members: list[~microsoft.agents.protocols.models.ChannelAccount]
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
id: NonEmptyString = None
|
|
16
|
+
members: list[ChannelAccount] = None
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from pydantic import Field
|
|
2
|
+
|
|
3
|
+
from .channel_account import ChannelAccount
|
|
4
|
+
from .activity import Activity
|
|
5
|
+
from .agents_model import AgentsModel
|
|
6
|
+
from ._type_aliases import NonEmptyString
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ConversationParameters(AgentsModel):
|
|
10
|
+
"""Parameters for creating a new conversation.
|
|
11
|
+
|
|
12
|
+
:param is_group: IsGroup
|
|
13
|
+
:type is_group: bool
|
|
14
|
+
:param agent: The agent address for this conversation
|
|
15
|
+
:type agent: ~microsoft.agents.protocols.models.ChannelAccount
|
|
16
|
+
:param members: Members to add to the conversation
|
|
17
|
+
:type members: list[~microsoft.agents.protocols.models.ChannelAccount]
|
|
18
|
+
:param topic_name: (Optional) Topic of the conversation (if supported by
|
|
19
|
+
the channel)
|
|
20
|
+
:type topic_name: str
|
|
21
|
+
:param activity: (Optional) When creating a new conversation, use this
|
|
22
|
+
activity as the initial message to the conversation
|
|
23
|
+
:type activity: ~microsoft.agents.protocols.models.Activity
|
|
24
|
+
:param channel_data: Channel specific payload for creating the
|
|
25
|
+
conversation
|
|
26
|
+
:type channel_data: object
|
|
27
|
+
:param tenant_id: (Optional) The tenant ID in which the conversation should be created
|
|
28
|
+
:type tenant_id: str
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
is_group: bool = None
|
|
32
|
+
agent: ChannelAccount = Field(None, alias="bot")
|
|
33
|
+
members: list[ChannelAccount] = None
|
|
34
|
+
topic_name: NonEmptyString = None
|
|
35
|
+
activity: Activity = None
|
|
36
|
+
channel_data: object = None
|
|
37
|
+
tenant_id: NonEmptyString = None
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from uuid import uuid4 as uuid
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
from pydantic import Field
|
|
5
|
+
|
|
6
|
+
from .channel_account import ChannelAccount
|
|
7
|
+
from .conversation_account import ConversationAccount
|
|
8
|
+
from .agents_model import AgentsModel
|
|
9
|
+
from ._type_aliases import NonEmptyString
|
|
10
|
+
from .activity_types import ActivityTypes
|
|
11
|
+
from .activity_event_names import ActivityEventNames
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ConversationReference(AgentsModel):
|
|
15
|
+
"""An object relating to a particular point in a conversation.
|
|
16
|
+
|
|
17
|
+
:param activity_id: (Optional) ID of the activity to refer to
|
|
18
|
+
:type activity_id: str
|
|
19
|
+
:param user: (Optional) User participating in this conversation
|
|
20
|
+
:type user: ~microsoft.agents.protocols.models.ChannelAccount
|
|
21
|
+
:param agent: Agent participating in this conversation
|
|
22
|
+
:type agent: ~microsoft.agents.protocols.models.ChannelAccount
|
|
23
|
+
:param conversation: Conversation reference
|
|
24
|
+
:type conversation: ~microsoft.agents.protocols.models.ConversationAccount
|
|
25
|
+
:param channel_id: Channel ID
|
|
26
|
+
:type channel_id: str
|
|
27
|
+
:param locale: A locale name for the contents of the text field.
|
|
28
|
+
The locale name is a combination of an ISO 639 two- or three-letter
|
|
29
|
+
culture code associated with a language and an ISO 3166 two-letter
|
|
30
|
+
subculture code associated with a country or region.
|
|
31
|
+
The locale name can also correspond to a valid BCP-47 language tag.
|
|
32
|
+
:type locale: str
|
|
33
|
+
:param service_url: Service endpoint where operations concerning the
|
|
34
|
+
referenced conversation may be performed
|
|
35
|
+
:type service_url: str
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
# optionals here are due to webchat
|
|
39
|
+
activity_id: Optional[NonEmptyString] = None
|
|
40
|
+
user: Optional[ChannelAccount] = None
|
|
41
|
+
agent: ChannelAccount = Field(None, alias="bot")
|
|
42
|
+
conversation: ConversationAccount
|
|
43
|
+
channel_id: NonEmptyString
|
|
44
|
+
locale: Optional[NonEmptyString] = None
|
|
45
|
+
service_url: NonEmptyString
|
|
46
|
+
|
|
47
|
+
def get_continuation_activity(self) -> "Activity": # type: ignore
|
|
48
|
+
from .activity import Activity
|
|
49
|
+
|
|
50
|
+
return Activity(
|
|
51
|
+
type=ActivityTypes.event,
|
|
52
|
+
name=ActivityEventNames.continue_conversation,
|
|
53
|
+
id=str(uuid()),
|
|
54
|
+
channel_id=self.channel_id,
|
|
55
|
+
service_url=self.service_url,
|
|
56
|
+
conversation=self.conversation,
|
|
57
|
+
recipient=self.agent,
|
|
58
|
+
from_property=self.user,
|
|
59
|
+
relates_to=self,
|
|
60
|
+
)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from .agents_model import AgentsModel
|
|
2
|
+
from ._type_aliases import NonEmptyString
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class ConversationResourceResponse(AgentsModel):
|
|
6
|
+
"""A response containing a resource.
|
|
7
|
+
|
|
8
|
+
:param activity_id: ID of the Activity (if sent)
|
|
9
|
+
:type activity_id: str
|
|
10
|
+
:param service_url: Service endpoint where operations concerning the
|
|
11
|
+
conversation may be performed
|
|
12
|
+
:type service_url: str
|
|
13
|
+
:param id: Id of the resource
|
|
14
|
+
:type id: str
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
activity_id: NonEmptyString = None
|
|
18
|
+
service_url: NonEmptyString = None
|
|
19
|
+
id: NonEmptyString = None
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ConversationUpdateTypes(str, Enum):
|
|
5
|
+
CHANNEL_CREATED = "channelCreated"
|
|
6
|
+
CHANNEL_RENAMED = "channelRenamed"
|
|
7
|
+
CHANNEL_DELETED = "channelDeleted"
|
|
8
|
+
CHANNEL_RESTORED = "channelRestored"
|
|
9
|
+
MEMBERS_ADDED = "membersAdded"
|
|
10
|
+
MEMBERS_REMOVED = "membersRemoved"
|
|
11
|
+
TEAM_RENAMED = "teamRenamed"
|
|
12
|
+
TEAM_DELETED = "teamDeleted"
|
|
13
|
+
TEAM_ARCHIVED = "teamArchived"
|
|
14
|
+
TEAM_UNARCHIVED = "teamUnarchived"
|
|
15
|
+
TEAM_RESTORED = "teamRestored"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from .conversation_members import ConversationMembers
|
|
2
|
+
from .agents_model import AgentsModel
|
|
3
|
+
from ._type_aliases import NonEmptyString
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ConversationsResult(AgentsModel):
|
|
7
|
+
"""Conversations result.
|
|
8
|
+
|
|
9
|
+
:param continuation_token: Paging token
|
|
10
|
+
:type continuation_token: str
|
|
11
|
+
:param conversations: List of conversations
|
|
12
|
+
:type conversations:
|
|
13
|
+
list[~microsoft.agents.protocols.models.ConversationMembers]
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
continuation_token: NonEmptyString = None
|
|
17
|
+
conversations: list[ConversationMembers] = None
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class EndOfConversationCodes(str, Enum):
|
|
5
|
+
unknown = "unknown"
|
|
6
|
+
completed_successfully = "completedSuccessfully"
|
|
7
|
+
user_cancelled = "userCancelled"
|
|
8
|
+
timed_out = "botTimedOut"
|
|
9
|
+
issued_invalid_message = "botIssuedInvalidMessage"
|
|
10
|
+
channel_failed = "channelFailed"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from typing import Any, Optional
|
|
2
|
+
|
|
3
|
+
from pydantic import model_serializer, model_validator
|
|
4
|
+
from .agents_model import AgentsModel, ConfigDict
|
|
5
|
+
from pydantic.alias_generators import to_camel, to_snake
|
|
6
|
+
from ._type_aliases import NonEmptyString
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Entity(AgentsModel):
|
|
10
|
+
"""Metadata object pertaining to an activity.
|
|
11
|
+
|
|
12
|
+
:param type: Type of this entity (RFC 3987 IRI)
|
|
13
|
+
:type type: str
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
model_config = ConfigDict(extra="allow")
|
|
17
|
+
|
|
18
|
+
type: NonEmptyString
|
|
19
|
+
|
|
20
|
+
@property
|
|
21
|
+
def additional_properties(self) -> dict[str, Any]:
|
|
22
|
+
"""Returns the set of properties that are not None."""
|
|
23
|
+
return self.model_extra
|
|
24
|
+
|
|
25
|
+
@model_validator(mode="before")
|
|
26
|
+
@classmethod
|
|
27
|
+
def to_snake_for_all(cls, data):
|
|
28
|
+
ret = {to_snake(k): v for k, v in data.items()}
|
|
29
|
+
return ret
|
|
30
|
+
|
|
31
|
+
@model_serializer(mode="plain")
|
|
32
|
+
def to_camel_for_all(self, config):
|
|
33
|
+
if config.by_alias:
|
|
34
|
+
new_data = {}
|
|
35
|
+
for k, v in self:
|
|
36
|
+
new_data[to_camel(k)] = v
|
|
37
|
+
return new_data
|
|
38
|
+
return {k: v for k, v in self}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from .inner_http_error import InnerHttpError
|
|
2
|
+
from .agents_model import AgentsModel
|
|
3
|
+
from ._type_aliases import NonEmptyString
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Error(AgentsModel):
|
|
7
|
+
"""Object representing error information.
|
|
8
|
+
|
|
9
|
+
:param code: Error code
|
|
10
|
+
:type code: str
|
|
11
|
+
:param message: Error message
|
|
12
|
+
:type message: str
|
|
13
|
+
:param inner_http_error: Error from inner http call
|
|
14
|
+
:type inner_http_error: ~microsoft.agents.protocols.models.InnerHttpError
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
code: NonEmptyString = None
|
|
18
|
+
message: NonEmptyString = None
|
|
19
|
+
inner_http_error: InnerHttpError = None
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from .activity import Activity
|
|
2
|
+
from .agents_model import AgentsModel
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class ExpectedReplies(AgentsModel):
|
|
6
|
+
"""ExpectedReplies.
|
|
7
|
+
|
|
8
|
+
:param activities: A collection of Activities that conforms to the
|
|
9
|
+
ExpectedReplies schema.
|
|
10
|
+
:type activities: list[~microsoft.agents.protocols.models.Activity]
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
activities: list[Activity] = None
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from .agents_model import AgentsModel
|
|
2
|
+
from ._type_aliases import NonEmptyString
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Fact(AgentsModel):
|
|
6
|
+
"""Set of key-value pairs. Advantage of this section is that key and value
|
|
7
|
+
properties will be
|
|
8
|
+
rendered with default style information with some delimiter between them.
|
|
9
|
+
So there is no need for developer to specify style information.
|
|
10
|
+
|
|
11
|
+
:param key: The key for this Fact
|
|
12
|
+
:type key: str
|
|
13
|
+
:param value: The value for this Fact
|
|
14
|
+
:type value: str
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
key: NonEmptyString = None
|
|
18
|
+
value: NonEmptyString = None
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from .agents_model import AgentsModel
|
|
2
|
+
from ._type_aliases import NonEmptyString
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class GeoCoordinates(AgentsModel):
|
|
6
|
+
"""GeoCoordinates (entity type: "https://schema.org/GeoCoordinates").
|
|
7
|
+
|
|
8
|
+
:param elevation: Elevation of the location [WGS
|
|
9
|
+
84](https://en.wikipedia.org/wiki/World_Geodetic_System)
|
|
10
|
+
:type elevation: float
|
|
11
|
+
:param latitude: Latitude of the location [WGS
|
|
12
|
+
84](https://en.wikipedia.org/wiki/World_Geodetic_System)
|
|
13
|
+
:type latitude: float
|
|
14
|
+
:param longitude: Longitude of the location [WGS
|
|
15
|
+
84](https://en.wikipedia.org/wiki/World_Geodetic_System)
|
|
16
|
+
:type longitude: float
|
|
17
|
+
:param type: The type of the thing
|
|
18
|
+
:type type: str
|
|
19
|
+
:param name: The name of the thing
|
|
20
|
+
:type name: str
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
elevation: float = None
|
|
24
|
+
latitude: float = None
|
|
25
|
+
longitude: float = None
|
|
26
|
+
type: NonEmptyString = None
|
|
27
|
+
name: NonEmptyString = None
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from .card_action import CardAction
|
|
2
|
+
from .card_image import CardImage
|
|
3
|
+
from .agents_model import AgentsModel
|
|
4
|
+
from ._type_aliases import NonEmptyString
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class HeroCard(AgentsModel):
|
|
8
|
+
"""A Hero card (card with a single, large image).
|
|
9
|
+
|
|
10
|
+
:param title: Title of the card
|
|
11
|
+
:type title: str
|
|
12
|
+
:param subtitle: Subtitle of the card
|
|
13
|
+
:type subtitle: str
|
|
14
|
+
:param text: Text for the card
|
|
15
|
+
:type text: str
|
|
16
|
+
:param images: Array of images for the card
|
|
17
|
+
:type images: list[~microsoft.agents.protocols.models.CardImage]
|
|
18
|
+
:param buttons: Set of actions applicable to the current card
|
|
19
|
+
:type buttons: list[~microsoft.agents.protocols.models.CardAction]
|
|
20
|
+
:param tap: This action will be activated when user taps on the card
|
|
21
|
+
itself
|
|
22
|
+
:type tap: ~microsoft.agents.protocols.models.CardAction
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
title: NonEmptyString = None
|
|
26
|
+
subtitle: NonEmptyString = None
|
|
27
|
+
text: NonEmptyString = None
|
|
28
|
+
images: list[CardImage] = None
|
|
29
|
+
buttons: list[CardAction] = None
|
|
30
|
+
tap: CardAction = None
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from .agents_model import AgentsModel
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class InnerHttpError(AgentsModel):
|
|
5
|
+
"""Object representing inner http error.
|
|
6
|
+
|
|
7
|
+
:param status_code: HttpStatusCode from failed request
|
|
8
|
+
:type status_code: int
|
|
9
|
+
:param body: Body from failed request
|
|
10
|
+
:type body: object
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
status_code: int = None
|
|
14
|
+
body: object = None
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from enum import Enum
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class InputHints(str, Enum):
|
|
8
|
+
accepting_input = "acceptingInput"
|
|
9
|
+
ignoring_input = "ignoringInput"
|
|
10
|
+
expecting_input = "expectingInput"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from .agents_model import AgentsModel
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class InvokeResponse(AgentsModel):
|
|
5
|
+
"""
|
|
6
|
+
Tuple class containing an HTTP Status Code and a JSON serializable
|
|
7
|
+
object. The HTTP Status code is, in the invoke activity scenario, what will
|
|
8
|
+
be set in the resulting POST. The Body of the resulting POST will be
|
|
9
|
+
JSON serialized content.
|
|
10
|
+
|
|
11
|
+
The body content is defined by the producer. The caller must know what
|
|
12
|
+
the content is and deserialize as needed.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
status: int = None
|
|
16
|
+
body: object = None
|
|
17
|
+
|
|
18
|
+
def is_successful_status_code(self) -> bool:
|
|
19
|
+
"""
|
|
20
|
+
Gets a value indicating whether the invoke response was successful.
|
|
21
|
+
:return: A value that indicates if the HTTP response was successful. true if status is in
|
|
22
|
+
the Successful range (200-299); otherwise false.
|
|
23
|
+
"""
|
|
24
|
+
return 200 <= self.status <= 299
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from .thumbnail_url import ThumbnailUrl
|
|
2
|
+
from .media_url import MediaUrl
|
|
3
|
+
from .card_action import CardAction
|
|
4
|
+
from .agents_model import AgentsModel
|
|
5
|
+
from ._type_aliases import NonEmptyString
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class MediaCard(AgentsModel):
|
|
9
|
+
"""Media card.
|
|
10
|
+
|
|
11
|
+
:param title: Title of this card
|
|
12
|
+
:type title: str
|
|
13
|
+
:param subtitle: Subtitle of this card
|
|
14
|
+
:type subtitle: str
|
|
15
|
+
:param text: Text of this card
|
|
16
|
+
:type text: str
|
|
17
|
+
:param image: Thumbnail placeholder
|
|
18
|
+
:type image: ~microsoft.agents.protocols.models.ThumbnailUrl
|
|
19
|
+
:param media: Media URLs for this card. When this field contains more than
|
|
20
|
+
one URL, each URL is an alternative format of the same content.
|
|
21
|
+
:type media: list[~microsoft.agents.protocols.models.MediaUrl]
|
|
22
|
+
:param buttons: Actions on this card
|
|
23
|
+
:type buttons: list[~microsoft.agents.protocols.models.CardAction]
|
|
24
|
+
:param shareable: This content may be shared with others (default:true)
|
|
25
|
+
:type shareable: bool
|
|
26
|
+
:param autoloop: Should the client loop playback at end of content
|
|
27
|
+
(default:true)
|
|
28
|
+
:type autoloop: bool
|
|
29
|
+
:param autostart: Should the client automatically start playback of media
|
|
30
|
+
in this card (default:true)
|
|
31
|
+
:type autostart: bool
|
|
32
|
+
:param aspect: Aspect ratio of thumbnail/media placeholder. Allowed values
|
|
33
|
+
are "16:9" and "4:3"
|
|
34
|
+
:type aspect: str
|
|
35
|
+
:param duration: Describes the length of the media content without
|
|
36
|
+
requiring a receiver to open the content. Formatted as an ISO 8601
|
|
37
|
+
Duration field.
|
|
38
|
+
:type duration: str
|
|
39
|
+
:param value: Supplementary parameter for this card
|
|
40
|
+
:type value: object
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
title: NonEmptyString = None
|
|
44
|
+
subtitle: NonEmptyString = None
|
|
45
|
+
text: NonEmptyString = None
|
|
46
|
+
image: ThumbnailUrl = None
|
|
47
|
+
media: list[MediaUrl] = None
|
|
48
|
+
buttons: list[CardAction] = None
|
|
49
|
+
shareable: bool = None
|
|
50
|
+
autoloop: bool = None
|
|
51
|
+
autostart: bool = None
|
|
52
|
+
aspect: NonEmptyString = None
|
|
53
|
+
duration: NonEmptyString = None
|
|
54
|
+
value: object = None
|