microsoft-agents-hosting-core 0.6.1__tar.gz → 0.7.0__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_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/PKG-INFO +21 -3
- microsoft_agents_hosting_core-0.7.0/VERSION.txt +1 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/__init__.py +24 -1
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/agent_application.py +12 -24
- microsoft_agents_hosting_core-0.7.0/microsoft_agents/hosting/core/app/streaming/__init__.py +14 -0
- microsoft_agents_hosting_core-0.7.0/microsoft_agents/hosting/core/app/streaming/citation.py +22 -0
- microsoft_agents_hosting_core-0.7.0/microsoft_agents/hosting/core/app/streaming/citation_util.py +85 -0
- microsoft_agents_hosting_core-0.7.0/microsoft_agents/hosting/core/app/streaming/streaming_response.py +411 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/authorization/claims_identity.py +14 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/channel_service_adapter.py +28 -14
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/connector/client/connector_client.py +0 -1
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/connector/client/user_token_client.py +0 -1
- microsoft_agents_hosting_core-0.7.0/microsoft_agents/hosting/core/http/__init__.py +17 -0
- microsoft_agents_hosting_core-0.7.0/microsoft_agents/hosting/core/http/_channel_service_routes.py +202 -0
- microsoft_agents_hosting_core-0.7.0/microsoft_agents/hosting/core/http/_http_adapter_base.py +136 -0
- microsoft_agents_hosting_core-0.7.0/microsoft_agents/hosting/core/http/_http_request_protocol.py +36 -0
- microsoft_agents_hosting_core-0.7.0/microsoft_agents/hosting/core/http/_http_response.py +56 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/rest_channel_service_client_factory.py +2 -2
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/storage/memory_storage.py +0 -1
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/storage/storage.py +0 -1
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/storage/transcript_logger.py +0 -1
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents_hosting_core.egg-info/PKG-INFO +21 -3
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents_hosting_core.egg-info/SOURCES.txt +9 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents_hosting_core.egg-info/requires.txt +1 -1
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/readme.md +19 -1
- microsoft_agents_hosting_core-0.6.1/VERSION.txt +0 -1
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/LICENSE +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/MANIFEST.in +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/_oauth/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/_oauth/_flow_state.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/_oauth/_flow_storage_client.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/_oauth/_oauth_flow.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/activity_handler.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/agent.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/_routes/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/_routes/_route.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/_routes/_route_list.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/_routes/route_rank.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/_type_defs.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/app_error.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/app_options.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/input_file.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/oauth/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/oauth/_handlers/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/oauth/_handlers/_authorization_handler.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/oauth/_handlers/_user_authorization.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/oauth/_handlers/agentic_user_authorization.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/oauth/_sign_in_response.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/oauth/_sign_in_state.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/oauth/auth_handler.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/oauth/authorization.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/query.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/state/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/state/conversation_state.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/state/state.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/state/temp_state.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/state/turn_state.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/app/typing_indicator.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/authorization/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/authorization/access_token_provider_base.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/authorization/agent_auth_configuration.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/authorization/anonymous_token_provider.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/authorization/auth_types.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/authorization/authentication_constants.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/authorization/connections.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/authorization/jwt_token_validator.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/card_factory.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/channel_adapter.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/channel_api_handler_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/channel_service_client_factory_base.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/client/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/client/agent_conversation_reference.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/client/channel_factory_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/client/channel_host_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/client/channel_info_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/client/channel_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/client/channels_configuration.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/client/configuration_channel_host.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/client/conversation_constants.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/client/conversation_id_factory.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/client/conversation_id_factory_options.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/client/conversation_id_factory_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/client/http_agent_channel.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/client/http_agent_channel_factory.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/connector/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/connector/agent_sign_in_base.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/connector/attachments_base.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/connector/client/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/connector/connector_client_base.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/connector/conversations_base.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/connector/get_product_info.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/connector/teams/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/connector/teams/teams_connector_client.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/connector/user_token_base.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/connector/user_token_client_base.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/errors/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/errors/error_resources.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/message_factory.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/middleware_set.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/state/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/state/agent_state.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/state/state_property_accessor.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/state/user_state.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/storage/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/storage/_type_aliases.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/storage/error_handling.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/storage/store_item.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/storage/transcript_file_store.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/storage/transcript_info.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/storage/transcript_memory_store.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/storage/transcript_store.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents/hosting/core/turn_context.py +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents_hosting_core.egg-info/dependency_links.txt +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/microsoft_agents_hosting_core.egg-info/top_level.txt +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/pyproject.toml +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/setup.cfg +0 -0
- {microsoft_agents_hosting_core-0.6.1 → microsoft_agents_hosting_core-0.7.0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: microsoft-agents-hosting-core
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: Core library for Microsoft Agents
|
|
5
5
|
Author: Microsoft Corporation
|
|
6
6
|
License-Expression: MIT
|
|
@@ -15,7 +15,7 @@ Classifier: Operating System :: OS Independent
|
|
|
15
15
|
Requires-Python: >=3.10
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
|
-
Requires-Dist: microsoft-agents-activity==0.
|
|
18
|
+
Requires-Dist: microsoft-agents-activity==0.7.0
|
|
19
19
|
Requires-Dist: pyjwt>=2.10.1
|
|
20
20
|
Requires-Dist: isodate>=0.6.1
|
|
21
21
|
Requires-Dist: azure-core>=1.30.0
|
|
@@ -41,11 +41,29 @@ This library is part of the **Microsoft 365 Agents SDK for Python** - a comprehe
|
|
|
41
41
|
<th style="width:20%">Date</th>
|
|
42
42
|
<th style="width:60%">Release Notes</th>
|
|
43
43
|
</tr>
|
|
44
|
+
<tr>
|
|
45
|
+
<td>0.6.1</td>
|
|
46
|
+
<td>2025-12-01</td>
|
|
47
|
+
<td>
|
|
48
|
+
<a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md#microsoft-365-agents-sdk-for-python---release-notes-v061">
|
|
49
|
+
0.6.1 Release Notes
|
|
50
|
+
</a>
|
|
51
|
+
</td>
|
|
52
|
+
</tr>
|
|
53
|
+
<tr>
|
|
54
|
+
<td>0.6.0</td>
|
|
55
|
+
<td>2025-11-18</td>
|
|
56
|
+
<td>
|
|
57
|
+
<a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md#microsoft-365-agents-sdk-for-python---release-notes-v060">
|
|
58
|
+
0.6.0 Release Notes
|
|
59
|
+
</a>
|
|
60
|
+
</td>
|
|
61
|
+
</tr>
|
|
44
62
|
<tr>
|
|
45
63
|
<td>0.5.0</td>
|
|
46
64
|
<td>2025-10-22</td>
|
|
47
65
|
<td>
|
|
48
|
-
<a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md">
|
|
66
|
+
<a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md#microsoft-365-agents-sdk-for-python---release-notes-v050">
|
|
49
67
|
0.5.0 Release Notes
|
|
50
68
|
</a>
|
|
51
69
|
</td>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.7.0
|
|
@@ -10,6 +10,15 @@ from .middleware_set import Middleware
|
|
|
10
10
|
from .rest_channel_service_client_factory import RestChannelServiceClientFactory
|
|
11
11
|
from .turn_context import TurnContext
|
|
12
12
|
|
|
13
|
+
# HTTP abstractions
|
|
14
|
+
from .http import (
|
|
15
|
+
HttpRequestProtocol,
|
|
16
|
+
HttpResponse,
|
|
17
|
+
HttpResponseFactory,
|
|
18
|
+
HttpAdapterBase,
|
|
19
|
+
ChannelServiceRoutes,
|
|
20
|
+
)
|
|
21
|
+
|
|
13
22
|
# Application Style
|
|
14
23
|
from .app._type_defs import RouteHandler, RouteSelector, StateT
|
|
15
24
|
from .app.agent_application import AgentApplication
|
|
@@ -20,6 +29,13 @@ from .app.query import Query
|
|
|
20
29
|
from .app._routes import _Route, _RouteList, RouteRank
|
|
21
30
|
from .app.typing_indicator import TypingIndicator
|
|
22
31
|
|
|
32
|
+
# App Streaming
|
|
33
|
+
from .app.streaming import (
|
|
34
|
+
Citation,
|
|
35
|
+
CitationUtil,
|
|
36
|
+
StreamingResponse,
|
|
37
|
+
)
|
|
38
|
+
|
|
23
39
|
# App Auth
|
|
24
40
|
from .app.oauth import (
|
|
25
41
|
Authorization,
|
|
@@ -85,7 +101,6 @@ from .storage.memory_storage import MemoryStorage
|
|
|
85
101
|
# Error Resources
|
|
86
102
|
from .errors import error_resources, ErrorMessage, ErrorResources
|
|
87
103
|
|
|
88
|
-
|
|
89
104
|
# Define the package's public interface
|
|
90
105
|
__all__ = [
|
|
91
106
|
"ActivityHandler",
|
|
@@ -99,6 +114,11 @@ __all__ = [
|
|
|
99
114
|
"Middleware",
|
|
100
115
|
"RestChannelServiceClientFactory",
|
|
101
116
|
"TurnContext",
|
|
117
|
+
"HttpRequestProtocol",
|
|
118
|
+
"HttpResponse",
|
|
119
|
+
"HttpResponseFactory",
|
|
120
|
+
"HttpAdapterBase",
|
|
121
|
+
"ChannelServiceRoutes",
|
|
102
122
|
"AgentApplication",
|
|
103
123
|
"ApplicationError",
|
|
104
124
|
"ApplicationOptions",
|
|
@@ -108,6 +128,9 @@ __all__ = [
|
|
|
108
128
|
"Route",
|
|
109
129
|
"RouteHandler",
|
|
110
130
|
"TypingIndicator",
|
|
131
|
+
"Citation",
|
|
132
|
+
"CitationUtil",
|
|
133
|
+
"StreamingResponse",
|
|
111
134
|
"ConversationState",
|
|
112
135
|
"state",
|
|
113
136
|
"State",
|
|
@@ -120,11 +120,9 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
120
120
|
"ApplicationOptions.storage is required and was not configured.",
|
|
121
121
|
stack_info=True,
|
|
122
122
|
)
|
|
123
|
-
raise ApplicationError(
|
|
124
|
-
"""
|
|
123
|
+
raise ApplicationError("""
|
|
125
124
|
The `ApplicationOptions.storage` property is required and was not configured.
|
|
126
|
-
"""
|
|
127
|
-
)
|
|
125
|
+
""")
|
|
128
126
|
|
|
129
127
|
if options.long_running_messages and (
|
|
130
128
|
not options.adapter or not options.bot_app_id
|
|
@@ -133,12 +131,10 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
133
131
|
"ApplicationOptions.long_running_messages requires an adapter and bot_app_id.",
|
|
134
132
|
stack_info=True,
|
|
135
133
|
)
|
|
136
|
-
raise ApplicationError(
|
|
137
|
-
"""
|
|
134
|
+
raise ApplicationError("""
|
|
138
135
|
The `ApplicationOptions.long_running_messages` property is unavailable because
|
|
139
136
|
no adapter or `bot_app_id` was configured.
|
|
140
|
-
"""
|
|
141
|
-
)
|
|
137
|
+
""")
|
|
142
138
|
|
|
143
139
|
if options.adapter:
|
|
144
140
|
self._adapter = options.adapter
|
|
@@ -180,12 +176,10 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
180
176
|
"AgentApplication.adapter(): self._adapter is not configured.",
|
|
181
177
|
stack_info=True,
|
|
182
178
|
)
|
|
183
|
-
raise ApplicationError(
|
|
184
|
-
"""
|
|
179
|
+
raise ApplicationError("""
|
|
185
180
|
The AgentApplication.adapter property is unavailable because it was
|
|
186
181
|
not configured when creating the AgentApplication.
|
|
187
|
-
"""
|
|
188
|
-
)
|
|
182
|
+
""")
|
|
189
183
|
|
|
190
184
|
return self._adapter
|
|
191
185
|
|
|
@@ -203,12 +197,10 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
203
197
|
"AgentApplication.auth(): self._auth is not configured.",
|
|
204
198
|
stack_info=True,
|
|
205
199
|
)
|
|
206
|
-
raise ApplicationError(
|
|
207
|
-
"""
|
|
200
|
+
raise ApplicationError("""
|
|
208
201
|
The `AgentApplication.auth` property is unavailable because
|
|
209
202
|
no Auth options were configured.
|
|
210
|
-
"""
|
|
211
|
-
)
|
|
203
|
+
""")
|
|
212
204
|
|
|
213
205
|
return self._auth
|
|
214
206
|
|
|
@@ -592,12 +584,10 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
592
584
|
f"Failed to register sign-in success handler for route handler {func.__name__}",
|
|
593
585
|
stack_info=True,
|
|
594
586
|
)
|
|
595
|
-
raise ApplicationError(
|
|
596
|
-
"""
|
|
587
|
+
raise ApplicationError("""
|
|
597
588
|
The `AgentApplication.on_sign_in_success` method is unavailable because
|
|
598
589
|
no Auth options were configured.
|
|
599
|
-
"""
|
|
600
|
-
)
|
|
590
|
+
""")
|
|
601
591
|
return func
|
|
602
592
|
|
|
603
593
|
def on_sign_in_failure(
|
|
@@ -628,12 +618,10 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
628
618
|
f"Failed to register sign-in failure handler for route handler {func.__name__}",
|
|
629
619
|
stack_info=True,
|
|
630
620
|
)
|
|
631
|
-
raise ApplicationError(
|
|
632
|
-
"""
|
|
621
|
+
raise ApplicationError("""
|
|
633
622
|
The `AgentApplication.on_sign_in_failure` method is unavailable because
|
|
634
623
|
no Auth options were configured.
|
|
635
|
-
"""
|
|
636
|
-
)
|
|
624
|
+
""")
|
|
637
625
|
return func
|
|
638
626
|
|
|
639
627
|
def error(
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
"""Streaming response utilities."""
|
|
5
|
+
|
|
6
|
+
from .citation import Citation
|
|
7
|
+
from .citation_util import CitationUtil
|
|
8
|
+
from .streaming_response import StreamingResponse
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"Citation",
|
|
12
|
+
"CitationUtil",
|
|
13
|
+
"StreamingResponse",
|
|
14
|
+
]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from typing import Optional
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class Citation:
|
|
10
|
+
"""Citations returned by the model."""
|
|
11
|
+
|
|
12
|
+
content: str
|
|
13
|
+
"""The content of the citation."""
|
|
14
|
+
|
|
15
|
+
title: Optional[str] = None
|
|
16
|
+
"""The title of the citation."""
|
|
17
|
+
|
|
18
|
+
url: Optional[str] = None
|
|
19
|
+
"""The URL of the citation."""
|
|
20
|
+
|
|
21
|
+
filepath: Optional[str] = None
|
|
22
|
+
"""The filepath of the document."""
|
microsoft_agents_hosting_core-0.7.0/microsoft_agents/hosting/core/app/streaming/citation_util.py
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import re
|
|
5
|
+
from typing import List, Optional
|
|
6
|
+
|
|
7
|
+
from microsoft_agents.activity import ClientCitation
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class CitationUtil:
|
|
11
|
+
"""Utility functions for manipulating text and citations."""
|
|
12
|
+
|
|
13
|
+
@staticmethod
|
|
14
|
+
def snippet(text: str, max_length: int) -> str:
|
|
15
|
+
"""
|
|
16
|
+
Clips the text to a maximum length in case it exceeds the limit.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
text: The text to clip.
|
|
20
|
+
max_length: The maximum length of the text to return, cutting off the last whole word.
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
The modified text
|
|
24
|
+
"""
|
|
25
|
+
if len(text) <= max_length:
|
|
26
|
+
return text
|
|
27
|
+
|
|
28
|
+
snippet = text[:max_length]
|
|
29
|
+
snippet = snippet[: min(len(snippet), snippet.rfind(" "))]
|
|
30
|
+
snippet += "..."
|
|
31
|
+
return snippet
|
|
32
|
+
|
|
33
|
+
@staticmethod
|
|
34
|
+
def format_citations_response(text: str) -> str:
|
|
35
|
+
"""
|
|
36
|
+
Convert citation tags `[doc(s)n]` to `[n]` where n is a number.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
text: The text to format.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
The formatted text.
|
|
43
|
+
"""
|
|
44
|
+
return re.sub(r"\[docs?(\d+)\]", r"[\1]", text, flags=re.IGNORECASE)
|
|
45
|
+
|
|
46
|
+
@staticmethod
|
|
47
|
+
def get_used_citations(
|
|
48
|
+
text: str, citations: List[ClientCitation]
|
|
49
|
+
) -> Optional[List[ClientCitation]]:
|
|
50
|
+
"""
|
|
51
|
+
Get the citations used in the text. This will remove any citations that are
|
|
52
|
+
included in the citations array from the response but not referenced in the text.
|
|
53
|
+
|
|
54
|
+
Args:
|
|
55
|
+
text: The text to search for citation references, i.e. [1], [2], etc.
|
|
56
|
+
citations: The list of citations to search for.
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
The list of citations used in the text.
|
|
60
|
+
"""
|
|
61
|
+
regex = re.compile(r"\[(\d+)\]", re.IGNORECASE)
|
|
62
|
+
matches = regex.findall(text)
|
|
63
|
+
|
|
64
|
+
if not matches:
|
|
65
|
+
return None
|
|
66
|
+
|
|
67
|
+
# Remove duplicates
|
|
68
|
+
filtered_matches = set(matches)
|
|
69
|
+
|
|
70
|
+
# Add citations
|
|
71
|
+
used_citations = []
|
|
72
|
+
for match in filtered_matches:
|
|
73
|
+
citation_ref = f"[{match}]"
|
|
74
|
+
found = next(
|
|
75
|
+
(
|
|
76
|
+
citation
|
|
77
|
+
for citation in citations
|
|
78
|
+
if f"[{citation.position}]" == citation_ref
|
|
79
|
+
),
|
|
80
|
+
None,
|
|
81
|
+
)
|
|
82
|
+
if found:
|
|
83
|
+
used_citations.append(found)
|
|
84
|
+
|
|
85
|
+
return used_citations if used_citations else None
|