microsoft-agents-hosting-dialogs 0.10.0.dev2__tar.gz
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_hosting_dialogs-0.10.0.dev2/LICENSE +21 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/PKG-INFO +87 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/__init__.py +76 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/_component_registration.py +30 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/_telemetry_client.py +78 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/choices/__init__.py +38 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/choices/channel.py +121 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/choices/choice_factory.py +262 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/choices/choice_recognizer.py +148 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/choices/find.py +242 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/choices/models/__init__.py +23 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/choices/models/choice.py +14 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/choices/models/choice_factory_options.py +13 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/choices/models/find_choices_options.py +28 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/choices/models/find_values_options.py +31 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/choices/models/found_choice.py +22 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/choices/models/found_value.py +20 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/choices/models/list_style.py +15 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/choices/models/model_result.py +16 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/choices/models/sorted_value.py +16 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/choices/models/token.py +20 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/choices/tokenizer.py +92 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/component_dialog.py +284 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/dialog.py +198 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/dialog_component_registration.py +52 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/dialog_container.py +31 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/dialog_context.py +426 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/dialog_extensions.py +201 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/dialog_manager.py +189 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/dialog_manager_result.py +17 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/dialog_set.py +174 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/dialog_state.py +20 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/__init__.py +24 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/component_memory_scopes_base.py +14 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/component_path_resolvers_base.py +15 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/dialog_path.py +33 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/dialog_state_manager.py +563 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/dialog_state_manager_configuration.py +11 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/path_resolver_base.py +8 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/path_resolvers/__init__.py +19 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/path_resolvers/alias_path_resolver.py +53 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/path_resolvers/at_at_path_resolver.py +9 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/path_resolvers/at_path_resolver.py +44 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/path_resolvers/dollar_path_resolver.py +9 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/path_resolvers/hash_path_resolver.py +9 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/path_resolvers/percent_path_resolver.py +9 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/scope_path.py +38 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/scopes/__init__.py +31 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/scopes/bot_state_memory_scope.py +66 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/scopes/class_memory_scope.py +64 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/scopes/conversation_memory_scope.py +12 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/scopes/dialog_class_memory_scope.py +52 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/scopes/dialog_context_memory_scope.py +68 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/scopes/dialog_memory_scope.py +75 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/scopes/memory_scope.py +91 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/scopes/settings_memory_scope.py +38 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/scopes/this_memory_scope.py +36 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/scopes/turn_memory_scope.py +86 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/memory/scopes/user_memory_scope.py +12 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/models/__init__.py +15 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/models/dialog_event.py +13 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/models/dialog_events.py +12 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/models/dialog_instance.py +28 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/models/dialog_reason.py +34 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/models/dialog_turn_result.py +17 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/models/dialog_turn_status.py +26 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/object_path.py +315 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/persisted_state.py +22 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/persisted_state_keys.py +8 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/prompts/__init__.py +41 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/prompts/activity_prompt.py +203 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/prompts/attachment_prompt.py +87 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/prompts/choice_prompt.py +156 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/prompts/confirm_prompt.py +161 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/prompts/datetime_prompt.py +90 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/prompts/datetime_resolution.py +16 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/prompts/number_prompt.py +81 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/prompts/oauth_prompt.py +569 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/prompts/oauth_prompt_settings.py +43 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/prompts/prompt.py +224 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/prompts/prompt_culture_models.py +222 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/prompts/prompt_options.py +42 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/prompts/prompt_recognizer_result.py +11 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/prompts/prompt_validator.py +0 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/prompts/prompt_validator_context.py +44 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/prompts/text_prompt.py +82 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/waterfall_dialog.py +266 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/waterfall_step_context.py +109 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents_hosting_dialogs.egg-info/PKG-INFO +87 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents_hosting_dialogs.egg-info/SOURCES.txt +95 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents_hosting_dialogs.egg-info/dependency_links.txt +1 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents_hosting_dialogs.egg-info/requires.txt +6 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents_hosting_dialogs.egg-info/top_level.txt +1 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/pyproject.toml +25 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/readme.md +61 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/setup.cfg +4 -0
- microsoft_agents_hosting_dialogs-0.10.0.dev2/setup.py +22 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: microsoft-agents-hosting-dialogs
|
|
3
|
+
Version: 0.10.0.dev2
|
|
4
|
+
Summary: Dialog system for Microsoft Agents (waterfall dialogs, prompts, choices)
|
|
5
|
+
Author: Microsoft Corporation
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/microsoft/Agents
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: microsoft-agents-hosting-core==0.10.0.dev2
|
|
19
|
+
Requires-Dist: recognizers-text-number>=1.0.1a0
|
|
20
|
+
Requires-Dist: recognizers-text-choice>=1.0.1a0
|
|
21
|
+
Requires-Dist: recognizers-text-date-time>=1.0.1a0
|
|
22
|
+
Requires-Dist: babel>=2.9.0
|
|
23
|
+
Requires-Dist: emoji<2.0.0
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
Dynamic: requires-dist
|
|
26
|
+
|
|
27
|
+
# Microsoft Agents Hosting - Dialogs
|
|
28
|
+
|
|
29
|
+
[](https://pypi.org/project/microsoft-agents-hosting-dialogs/)
|
|
30
|
+
|
|
31
|
+
Dialog system for the Microsoft 365 Agents SDK. Provides waterfall dialogs, prompts, choice recognition, and multi-turn conversation management.
|
|
32
|
+
|
|
33
|
+
This library is a port of the botbuilder-dialogs library to the new Microsoft 365 Agents SDK. It provides the same dialog primitives (WaterfallDialog, ComponentDialog, DialogSet, DialogContext) and prompts (TextPrompt, NumberPrompt, ChoicePrompt, ConfirmPrompt, DateTimePrompt, OAuthPrompt, etc.) with updated imports and patterns for the new SDK.
|
|
34
|
+
|
|
35
|
+
## What is this?
|
|
36
|
+
|
|
37
|
+
This library is part of the **Microsoft 365 Agents SDK for Python** - a comprehensive framework for building enterprise-grade conversational AI agents. The dialogs library enables developers to structure multi-turn conversations with reusable, composable dialog primitives.
|
|
38
|
+
|
|
39
|
+
## Key Features
|
|
40
|
+
|
|
41
|
+
- **WaterfallDialog**: Sequential step-by-step conversation flows
|
|
42
|
+
- **ComponentDialog**: Composable, encapsulated dialog components
|
|
43
|
+
- **Prompts**: Built-in prompts for text, numbers, choices, confirmations, dates, attachments, and OAuth
|
|
44
|
+
- **Choice recognition**: Locale-aware choice matching and recognition
|
|
45
|
+
- **Dialog memory**: Scoped memory management (conversation, user, dialog, class, settings)
|
|
46
|
+
- **DialogManager**: High-level dialog orchestration with state management
|
|
47
|
+
|
|
48
|
+
## Installation
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install microsoft-agents-hosting-dialogs
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Quick Start
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from microsoft_agents.hosting.dialogs import (
|
|
58
|
+
WaterfallDialog,
|
|
59
|
+
WaterfallStepContext,
|
|
60
|
+
DialogSet,
|
|
61
|
+
DialogTurnStatus,
|
|
62
|
+
)
|
|
63
|
+
from microsoft_agents.hosting.dialogs.prompts import TextPrompt, PromptOptions
|
|
64
|
+
from microsoft_agents.hosting.core import ConversationState, MemoryStorage
|
|
65
|
+
|
|
66
|
+
storage = MemoryStorage()
|
|
67
|
+
conversation_state = ConversationState(storage)
|
|
68
|
+
dialog_state = conversation_state.create_property("DialogState")
|
|
69
|
+
dialogs = DialogSet(dialog_state)
|
|
70
|
+
|
|
71
|
+
async def step1(step: WaterfallStepContext):
|
|
72
|
+
return await step.prompt(
|
|
73
|
+
"text_prompt",
|
|
74
|
+
PromptOptions(prompt=MessageFactory.text("What is your name?"))
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
async def step2(step: WaterfallStepContext):
|
|
78
|
+
await step.context.send_activity(f"Hello, {step.result}!")
|
|
79
|
+
return await step.end_dialog()
|
|
80
|
+
|
|
81
|
+
dialogs.add(TextPrompt("text_prompt"))
|
|
82
|
+
dialogs.add(WaterfallDialog("main", [step1, step2]))
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Release Notes
|
|
86
|
+
|
|
87
|
+
See [CHANGELOG.md](https://github.com/microsoft/Agents/blob/main/CHANGELOG.md) for release history.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
# --------------------------------------------------------------------------
|
|
3
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
# Licensed under the MIT License. See License.txt in the project root for
|
|
5
|
+
# license information.
|
|
6
|
+
# --------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
__version__ = "0.0.0"
|
|
9
|
+
|
|
10
|
+
from .component_dialog import ComponentDialog
|
|
11
|
+
from .dialog_container import DialogContainer
|
|
12
|
+
from .dialog_context import DialogContext
|
|
13
|
+
from .models.dialog_event import DialogEvent
|
|
14
|
+
from .models.dialog_events import DialogEvents
|
|
15
|
+
from .models.dialog_instance import DialogInstance
|
|
16
|
+
from .models.dialog_reason import DialogReason
|
|
17
|
+
from .dialog_set import DialogSet
|
|
18
|
+
from .dialog_state import DialogState
|
|
19
|
+
from .models.dialog_turn_result import DialogTurnResult
|
|
20
|
+
from .models.dialog_turn_status import DialogTurnStatus
|
|
21
|
+
from .dialog_manager import DialogManager
|
|
22
|
+
from .dialog_manager_result import DialogManagerResult
|
|
23
|
+
from .dialog import Dialog
|
|
24
|
+
from .dialog_component_registration import DialogsComponentRegistration
|
|
25
|
+
from .persisted_state_keys import PersistedStateKeys
|
|
26
|
+
from .persisted_state import PersistedState
|
|
27
|
+
from .waterfall_dialog import WaterfallDialog
|
|
28
|
+
from .waterfall_step_context import WaterfallStepContext
|
|
29
|
+
from .dialog_extensions import DialogExtensions
|
|
30
|
+
from .prompts import *
|
|
31
|
+
from .choices import *
|
|
32
|
+
from .object_path import ObjectPath
|
|
33
|
+
from .models import (
|
|
34
|
+
DialogEvent,
|
|
35
|
+
DialogEvents,
|
|
36
|
+
DialogInstance,
|
|
37
|
+
DialogReason,
|
|
38
|
+
DialogTurnResult,
|
|
39
|
+
DialogTurnStatus,
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
__all__ = [
|
|
43
|
+
"ComponentDialog",
|
|
44
|
+
"DialogContainer",
|
|
45
|
+
"DialogContext",
|
|
46
|
+
"DialogEvent",
|
|
47
|
+
"DialogEvents",
|
|
48
|
+
"DialogInstance",
|
|
49
|
+
"DialogReason",
|
|
50
|
+
"DialogSet",
|
|
51
|
+
"DialogState",
|
|
52
|
+
"DialogTurnResult",
|
|
53
|
+
"DialogTurnStatus",
|
|
54
|
+
"DialogManager",
|
|
55
|
+
"DialogManagerResult",
|
|
56
|
+
"Dialog",
|
|
57
|
+
"DialogsComponentRegistration",
|
|
58
|
+
"WaterfallDialog",
|
|
59
|
+
"WaterfallStepContext",
|
|
60
|
+
"ConfirmPrompt",
|
|
61
|
+
"DateTimePrompt",
|
|
62
|
+
"DateTimeResolution",
|
|
63
|
+
"NumberPrompt",
|
|
64
|
+
"OAuthPrompt",
|
|
65
|
+
"OAuthPromptSettings",
|
|
66
|
+
"PersistedStateKeys",
|
|
67
|
+
"PersistedState",
|
|
68
|
+
"PromptRecognizerResult",
|
|
69
|
+
"PromptValidatorContext",
|
|
70
|
+
"Prompt",
|
|
71
|
+
"PromptOptions",
|
|
72
|
+
"TextPrompt",
|
|
73
|
+
"DialogExtensions",
|
|
74
|
+
"ObjectPath",
|
|
75
|
+
"__version__",
|
|
76
|
+
]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from typing import List
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ComponentRegistration:
|
|
8
|
+
"""
|
|
9
|
+
Simple component registration that allows dialogs and other components
|
|
10
|
+
to register memory scopes and path resolvers.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
_components: List = []
|
|
14
|
+
|
|
15
|
+
@classmethod
|
|
16
|
+
def add(cls, component: object) -> None:
|
|
17
|
+
"""
|
|
18
|
+
Register a component. Duplicate types are ignored.
|
|
19
|
+
:param component: The component instance to register.
|
|
20
|
+
"""
|
|
21
|
+
if not any(type(c) == type(component) for c in cls._components):
|
|
22
|
+
cls._components.append(component)
|
|
23
|
+
|
|
24
|
+
@classmethod
|
|
25
|
+
def get_components(cls) -> List:
|
|
26
|
+
"""
|
|
27
|
+
Gets all registered components.
|
|
28
|
+
:return: List of registered component instances.
|
|
29
|
+
"""
|
|
30
|
+
return list(cls._components)
|
microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/_telemetry_client.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class AgentTelemetryClient:
|
|
6
|
+
"""
|
|
7
|
+
Interface for telemetry logging. Override to send telemetry to a custom sink.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
def track_event(
|
|
11
|
+
self,
|
|
12
|
+
name: str,
|
|
13
|
+
properties: dict[str, str] | None = None,
|
|
14
|
+
metrics: dict[str, float] | None = None,
|
|
15
|
+
) -> None:
|
|
16
|
+
pass
|
|
17
|
+
|
|
18
|
+
def track_exception(
|
|
19
|
+
self,
|
|
20
|
+
exception: Exception,
|
|
21
|
+
properties: dict[str, str] | None = None,
|
|
22
|
+
measurements: dict[str, float] | None = None,
|
|
23
|
+
) -> None:
|
|
24
|
+
pass
|
|
25
|
+
|
|
26
|
+
def track_dependency(
|
|
27
|
+
self,
|
|
28
|
+
name: str,
|
|
29
|
+
data: str | None = None,
|
|
30
|
+
type_name: str | None = None,
|
|
31
|
+
target: str | None = None,
|
|
32
|
+
duration: int | None = None,
|
|
33
|
+
success: bool = True,
|
|
34
|
+
result_code: str | None = None,
|
|
35
|
+
properties: dict[str, str] | None = None,
|
|
36
|
+
) -> None:
|
|
37
|
+
pass
|
|
38
|
+
|
|
39
|
+
def flush(self) -> None:
|
|
40
|
+
pass
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class NullTelemetryClient(AgentTelemetryClient):
|
|
44
|
+
"""
|
|
45
|
+
No-op telemetry client. All calls are silently discarded.
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
def track_event(
|
|
49
|
+
self,
|
|
50
|
+
name: str,
|
|
51
|
+
properties: dict[str, str] | None = None,
|
|
52
|
+
metrics: dict[str, float] | None = None,
|
|
53
|
+
) -> None:
|
|
54
|
+
pass
|
|
55
|
+
|
|
56
|
+
def track_exception(
|
|
57
|
+
self,
|
|
58
|
+
exception: Exception,
|
|
59
|
+
properties: dict[str, str] | None = None,
|
|
60
|
+
measurements: dict[str, float] | None = None,
|
|
61
|
+
) -> None:
|
|
62
|
+
pass
|
|
63
|
+
|
|
64
|
+
def track_dependency(
|
|
65
|
+
self,
|
|
66
|
+
name: str,
|
|
67
|
+
data: str | None = None,
|
|
68
|
+
type_name: str | None = None,
|
|
69
|
+
target: str | None = None,
|
|
70
|
+
duration: int | None = None,
|
|
71
|
+
success: bool = True,
|
|
72
|
+
result_code: str | None = None,
|
|
73
|
+
properties: dict[str, str] | None = None,
|
|
74
|
+
) -> None:
|
|
75
|
+
pass
|
|
76
|
+
|
|
77
|
+
def flush(self) -> None:
|
|
78
|
+
pass
|
microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/choices/__init__.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
# --------------------------------------------------------------------------
|
|
3
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
# Licensed under the MIT License. See License.txt in the project root for
|
|
5
|
+
# license information.
|
|
6
|
+
# --------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
from .channel import Channel
|
|
9
|
+
from .models.choice import Choice
|
|
10
|
+
from .models.choice_factory_options import ChoiceFactoryOptions
|
|
11
|
+
from .choice_factory import ChoiceFactory
|
|
12
|
+
from .choice_recognizer import ChoiceRecognizers
|
|
13
|
+
from .find import Find
|
|
14
|
+
from .models.find_choices_options import FindChoicesOptions, FindValuesOptions
|
|
15
|
+
from .models.found_choice import FoundChoice
|
|
16
|
+
from .models.found_value import FoundValue
|
|
17
|
+
from .models.list_style import ListStyle
|
|
18
|
+
from .models.model_result import ModelResult
|
|
19
|
+
from .models.sorted_value import SortedValue
|
|
20
|
+
from .models.token import Token
|
|
21
|
+
from .tokenizer import Tokenizer
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
"Channel",
|
|
25
|
+
"Choice",
|
|
26
|
+
"ChoiceFactory",
|
|
27
|
+
"ChoiceFactoryOptions",
|
|
28
|
+
"ChoiceRecognizers",
|
|
29
|
+
"Find",
|
|
30
|
+
"FindChoicesOptions",
|
|
31
|
+
"FindValuesOptions",
|
|
32
|
+
"FoundChoice",
|
|
33
|
+
"ListStyle",
|
|
34
|
+
"ModelResult",
|
|
35
|
+
"SortedValue",
|
|
36
|
+
"Token",
|
|
37
|
+
"Tokenizer",
|
|
38
|
+
]
|
microsoft_agents_hosting_dialogs-0.10.0.dev2/microsoft_agents/hosting/dialogs/choices/channel.py
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from microsoft_agents.hosting.core import TurnContext
|
|
5
|
+
from microsoft_agents.activity import Channels
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Channel:
|
|
9
|
+
"""
|
|
10
|
+
Methods for determining channel-specific functionality.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
@staticmethod
|
|
14
|
+
def supports_suggested_actions(channel_id: str, button_cnt: int = 100) -> bool:
|
|
15
|
+
"""Determine if a number of Suggested Actions are supported by a Channel.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
channel_id (str): The Channel to check the if Suggested Actions are supported in.
|
|
19
|
+
button_cnt (int, optional): Defaults to 100. The number of Suggested Actions to check for the Channel.
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
bool: True if the Channel supports the button_cnt total Suggested Actions, False if the Channel does not
|
|
23
|
+
support that number of Suggested Actions.
|
|
24
|
+
"""
|
|
25
|
+
if isinstance(channel_id, Channels):
|
|
26
|
+
channel_id = channel_id.value
|
|
27
|
+
|
|
28
|
+
max_actions = {
|
|
29
|
+
# https://developers.facebook.com/docs/messenger-platform/send-messages/quick-replies
|
|
30
|
+
Channels.facebook.value: 10,
|
|
31
|
+
Channels.skype.value: 10,
|
|
32
|
+
# https://developers.line.biz/en/reference/messaging-api/#items-object
|
|
33
|
+
Channels.line.value: 13,
|
|
34
|
+
# https://dev.kik.com/#/docs/messaging#text-response-object
|
|
35
|
+
Channels.kik.value: 20,
|
|
36
|
+
Channels.telegram.value: 100,
|
|
37
|
+
Channels.emulator.value: 100,
|
|
38
|
+
Channels.direct_line.value: 100,
|
|
39
|
+
Channels.direct_line_speech.value: 100,
|
|
40
|
+
Channels.webchat.value: 100,
|
|
41
|
+
}
|
|
42
|
+
return (
|
|
43
|
+
button_cnt <= max_actions[channel_id]
|
|
44
|
+
if channel_id in max_actions
|
|
45
|
+
else False
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
@staticmethod
|
|
49
|
+
def supports_card_actions(channel_id: str, button_cnt: int = 100) -> bool:
|
|
50
|
+
"""Determine if a number of Card Actions are supported by a Channel.
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
channel_id (str): The Channel to check if the Card Actions are supported in.
|
|
54
|
+
button_cnt (int, optional): Defaults to 100. The number of Card Actions to check for the Channel.
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
bool: True if the Channel supports the button_cnt total Card Actions, False if the Channel does not support
|
|
58
|
+
that number of Card Actions.
|
|
59
|
+
"""
|
|
60
|
+
if isinstance(channel_id, Channels):
|
|
61
|
+
channel_id = channel_id.value
|
|
62
|
+
|
|
63
|
+
max_actions = {
|
|
64
|
+
Channels.facebook.value: 3,
|
|
65
|
+
Channels.skype.value: 3,
|
|
66
|
+
Channels.ms_teams.value: 3,
|
|
67
|
+
Channels.line.value: 99,
|
|
68
|
+
Channels.slack.value: 100,
|
|
69
|
+
Channels.telegram.value: 100,
|
|
70
|
+
Channels.emulator.value: 100,
|
|
71
|
+
Channels.direct_line.value: 100,
|
|
72
|
+
Channels.direct_line_speech.value: 100,
|
|
73
|
+
Channels.webchat.value: 100,
|
|
74
|
+
}
|
|
75
|
+
return (
|
|
76
|
+
button_cnt <= max_actions[channel_id]
|
|
77
|
+
if channel_id in max_actions
|
|
78
|
+
else False
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
@staticmethod
|
|
82
|
+
def has_message_feed(_: str) -> bool:
|
|
83
|
+
"""Determine if a Channel has a Message Feed.
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
channel_id (str): The Channel to check for Message Feed.
|
|
87
|
+
|
|
88
|
+
Returns:
|
|
89
|
+
bool: True if the Channel has a Message Feed, False if it does not.
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
return True
|
|
93
|
+
|
|
94
|
+
@staticmethod
|
|
95
|
+
def get_channel_id(turn_context: TurnContext) -> str:
|
|
96
|
+
"""Get the channel ID from the TurnContext's activity.
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
turn_context (TurnContext): The current turn context.
|
|
100
|
+
|
|
101
|
+
Returns:
|
|
102
|
+
str: The channel ID, or an empty string if not set.
|
|
103
|
+
"""
|
|
104
|
+
if turn_context.activity and turn_context.activity.channel_id:
|
|
105
|
+
return turn_context.activity.channel_id
|
|
106
|
+
return ""
|
|
107
|
+
|
|
108
|
+
@staticmethod
|
|
109
|
+
def max_action_title_length( # pylint: disable=unused-argument
|
|
110
|
+
channel_id: str,
|
|
111
|
+
) -> int:
|
|
112
|
+
"""Maximum length allowed for Action Titles.
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
channel_id (str): The Channel to determine Maximum Action Title Length.
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
int: The total number of characters allowed for an Action Title on a specific Channel.
|
|
119
|
+
"""
|
|
120
|
+
|
|
121
|
+
return 20
|