microsoft-agents-copilotstudio-client 0.7.0.dev8__py3-none-any.whl → 0.7.0.dev12__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- microsoft_agents/copilotstudio/client/__init__.py +3 -0
- microsoft_agents/copilotstudio/client/agent_type.py +3 -0
- microsoft_agents/copilotstudio/client/connection_settings.py +19 -3
- microsoft_agents/copilotstudio/client/copilot_client.py +36 -1
- microsoft_agents/copilotstudio/client/direct_to_engine_connection_settings_protocol.py +3 -0
- microsoft_agents/copilotstudio/client/execute_turn_request.py +3 -0
- microsoft_agents/copilotstudio/client/power_platform_cloud.py +3 -0
- microsoft_agents/copilotstudio/client/power_platform_environment.py +3 -0
- {microsoft_agents_copilotstudio_client-0.7.0.dev8.dist-info → microsoft_agents_copilotstudio_client-0.7.0.dev12.dist-info}/METADATA +2 -2
- microsoft_agents_copilotstudio_client-0.7.0.dev12.dist-info/RECORD +15 -0
- microsoft_agents_copilotstudio_client-0.7.0.dev8.dist-info/RECORD +0 -15
- {microsoft_agents_copilotstudio_client-0.7.0.dev8.dist-info → microsoft_agents_copilotstudio_client-0.7.0.dev12.dist-info}/WHEEL +0 -0
- {microsoft_agents_copilotstudio_client-0.7.0.dev8.dist-info → microsoft_agents_copilotstudio_client-0.7.0.dev12.dist-info}/licenses/LICENSE +0 -0
- {microsoft_agents_copilotstudio_client-0.7.0.dev8.dist-info → microsoft_agents_copilotstudio_client-0.7.0.dev12.dist-info}/top_level.txt +0 -0
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
1
4
|
from typing import Optional
|
|
2
5
|
from .direct_to_engine_connection_settings_protocol import (
|
|
3
6
|
DirectToEngineConnectionSettingsProtocol,
|
|
@@ -15,10 +18,22 @@ class ConnectionSettings(DirectToEngineConnectionSettingsProtocol):
|
|
|
15
18
|
self,
|
|
16
19
|
environment_id: str,
|
|
17
20
|
agent_identifier: str,
|
|
18
|
-
cloud: Optional[PowerPlatformCloud],
|
|
19
|
-
copilot_agent_type: Optional[AgentType],
|
|
20
|
-
custom_power_platform_cloud: Optional[str],
|
|
21
|
+
cloud: Optional[PowerPlatformCloud] = None,
|
|
22
|
+
copilot_agent_type: Optional[AgentType] = None,
|
|
23
|
+
custom_power_platform_cloud: Optional[str] = None,
|
|
24
|
+
client_session_settings: Optional[dict] = None,
|
|
21
25
|
) -> None:
|
|
26
|
+
"""Initialize connection settings.
|
|
27
|
+
|
|
28
|
+
:param environment_id: The ID of the environment to connect to.
|
|
29
|
+
:param agent_identifier: The identifier of the agent to use for the connection.
|
|
30
|
+
:param cloud: The PowerPlatformCloud to use for the connection.
|
|
31
|
+
:param copilot_agent_type: The AgentType to use for the Copilot.
|
|
32
|
+
:param custom_power_platform_cloud: The custom PowerPlatformCloud URL.
|
|
33
|
+
:param client_session_settings: Additional arguments for initialization
|
|
34
|
+
of the underlying Aiohttp ClientSession.
|
|
35
|
+
"""
|
|
36
|
+
|
|
22
37
|
self.environment_id = environment_id
|
|
23
38
|
self.agent_identifier = agent_identifier
|
|
24
39
|
|
|
@@ -30,3 +45,4 @@ class ConnectionSettings(DirectToEngineConnectionSettingsProtocol):
|
|
|
30
45
|
self.cloud = cloud or PowerPlatformCloud.PROD
|
|
31
46
|
self.copilot_agent_type = copilot_agent_type or AgentType.PUBLISHED
|
|
32
47
|
self.custom_power_platform_cloud = custom_power_platform_cloud
|
|
48
|
+
self.client_session_settings = client_session_settings or {}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
1
4
|
import aiohttp
|
|
2
5
|
from typing import AsyncIterable, Callable, Optional
|
|
3
6
|
|
|
@@ -9,6 +12,8 @@ from .power_platform_environment import PowerPlatformEnvironment
|
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
class CopilotClient:
|
|
15
|
+
"""A client for interacting with the Copilot service."""
|
|
16
|
+
|
|
12
17
|
EVENT_STREAM_TYPE = "text/event-stream"
|
|
13
18
|
APPLICATION_JSON_TYPE = "application/json"
|
|
14
19
|
|
|
@@ -28,8 +33,19 @@ class CopilotClient:
|
|
|
28
33
|
async def post_request(
|
|
29
34
|
self, url: str, data: dict, headers: dict
|
|
30
35
|
) -> AsyncIterable[Activity]:
|
|
31
|
-
|
|
36
|
+
"""Send a POST request to the specified URL with the given data and headers.
|
|
37
|
+
|
|
38
|
+
:param url: The URL to which the POST request is sent.
|
|
39
|
+
:param data: The data to be sent in the POST request body.
|
|
40
|
+
:param headers: The headers to be included in the POST request.
|
|
41
|
+
:return: An asynchronous iterable of Activity objects received in the response.
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
async with aiohttp.ClientSession(
|
|
45
|
+
**self.settings.client_session_settings
|
|
46
|
+
) as session:
|
|
32
47
|
async with session.post(url, json=data, headers=headers) as response:
|
|
48
|
+
|
|
33
49
|
if response.status != 200:
|
|
34
50
|
# self.logger(f"Error sending request: {response.status}")
|
|
35
51
|
raise aiohttp.ClientError(
|
|
@@ -57,6 +73,12 @@ class CopilotClient:
|
|
|
57
73
|
async def start_conversation(
|
|
58
74
|
self, emit_start_conversation_event: bool = True
|
|
59
75
|
) -> AsyncIterable[Activity]:
|
|
76
|
+
"""Start a new conversation and optionally emit a start conversation event.
|
|
77
|
+
|
|
78
|
+
:param emit_start_conversation_event: A boolean flag indicating whether to emit a start conversation event.
|
|
79
|
+
:return: An asynchronous iterable of Activity objects received in the response.
|
|
80
|
+
"""
|
|
81
|
+
|
|
60
82
|
url = PowerPlatformEnvironment.get_copilot_studio_connection_url(
|
|
61
83
|
settings=self.settings
|
|
62
84
|
)
|
|
@@ -73,6 +95,13 @@ class CopilotClient:
|
|
|
73
95
|
async def ask_question(
|
|
74
96
|
self, question: str, conversation_id: Optional[str] = None
|
|
75
97
|
) -> AsyncIterable[Activity]:
|
|
98
|
+
"""Ask a question in the specified conversation.
|
|
99
|
+
|
|
100
|
+
:param question: The question to be asked.
|
|
101
|
+
:param conversation_id: The ID of the conversation in which the question is asked. If not provided, the current conversation ID is used.
|
|
102
|
+
:return: An asynchronous iterable of Activity objects received in the response.
|
|
103
|
+
"""
|
|
104
|
+
|
|
76
105
|
activity = Activity(
|
|
77
106
|
type="message",
|
|
78
107
|
text=question,
|
|
@@ -87,6 +116,12 @@ class CopilotClient:
|
|
|
87
116
|
async def ask_question_with_activity(
|
|
88
117
|
self, activity: Activity
|
|
89
118
|
) -> AsyncIterable[Activity]:
|
|
119
|
+
"""Ask a question using an Activity object.
|
|
120
|
+
|
|
121
|
+
:param activity: The Activity object representing the question to be asked.
|
|
122
|
+
:return: An asynchronous iterable of Activity objects received in the response.
|
|
123
|
+
"""
|
|
124
|
+
|
|
90
125
|
if not activity:
|
|
91
126
|
raise ValueError(
|
|
92
127
|
"CopilotClient.ask_question_with_activity: Activity cannot be None"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: microsoft-agents-copilotstudio-client
|
|
3
|
-
Version: 0.7.0.
|
|
3
|
+
Version: 0.7.0.dev12
|
|
4
4
|
Summary: A client 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-hosting-core==0.7.0.
|
|
18
|
+
Requires-Dist: microsoft-agents-hosting-core==0.7.0.dev12
|
|
19
19
|
Dynamic: license-file
|
|
20
20
|
Dynamic: requires-dist
|
|
21
21
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
microsoft_agents/copilotstudio/client/__init__.py,sha256=iZXgc_os1Br-ZvQwixmR7zPRLu6tvhRW17_myMYj1D0,714
|
|
2
|
+
microsoft_agents/copilotstudio/client/agent_type.py,sha256=1jX5-rxlpEUCXemlWLtaMEc2rA4uFX6yhUTVM5tqeg8,201
|
|
3
|
+
microsoft_agents/copilotstudio/client/connection_settings.py,sha256=v0NWvuSwIoGdxHpQWXe9ZclXhv4VROR1stptoM7oPKc,1951
|
|
4
|
+
microsoft_agents/copilotstudio/client/copilot_client.py,sha256=jQiBko9V1x9m3Il8mvwjuILy4vU7ksSD_rs6Y1KLwZc,5662
|
|
5
|
+
microsoft_agents/copilotstudio/client/direct_to_engine_connection_settings_protocol.py,sha256=ACw1MUSHBSQVvlE30_bJGXKAbfWQ-c9Ob5mG38Rk2ss,880
|
|
6
|
+
microsoft_agents/copilotstudio/client/execute_turn_request.py,sha256=vqRQbtr5LkE3IptJpepNkBzalnPB_rVOgVTqN8nlwaI,220
|
|
7
|
+
microsoft_agents/copilotstudio/client/power_platform_cloud.py,sha256=QNNrxus-dmAnKlVGOCoi_DJw-5r716jd8j-AcJHVDnQ,560
|
|
8
|
+
microsoft_agents/copilotstudio/client/power_platform_environment.py,sha256=LMZr4Z1BZfmMLMs_kfxYmkv4ad5Gt-yoWg7Hq0mzv2U,6923
|
|
9
|
+
microsoft_agents/copilotstudio/client/errors/__init__.py,sha256=o-OHGAnaYY8diahW9rrRn18WNeLL2hnUVtlV20HWeh8,448
|
|
10
|
+
microsoft_agents/copilotstudio/client/errors/error_resources.py,sha256=mhsmdShrHtUeMOuCi84a_vJmqyidbygArPdwM-mSHHw,1482
|
|
11
|
+
microsoft_agents_copilotstudio_client-0.7.0.dev12.dist-info/licenses/LICENSE,sha256=ws_MuBL-SCEBqPBFl9_FqZkaaydIJmxHrJG2parhU4M,1141
|
|
12
|
+
microsoft_agents_copilotstudio_client-0.7.0.dev12.dist-info/METADATA,sha256=MWwaYJnZqop_cBqC3N8fxXKhQShXyRKcAAYF1Cv0mws,9459
|
|
13
|
+
microsoft_agents_copilotstudio_client-0.7.0.dev12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
+
microsoft_agents_copilotstudio_client-0.7.0.dev12.dist-info/top_level.txt,sha256=lWKcT4v6fTA_NgsuHdNvuMjSrkiBMXohn64ApY7Xi8A,17
|
|
15
|
+
microsoft_agents_copilotstudio_client-0.7.0.dev12.dist-info/RECORD,,
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
microsoft_agents/copilotstudio/client/__init__.py,sha256=I--hf_7nZaw2xv_7Fm7UPrn-uk4ZF1pVTaLaSKfpuIA,619
|
|
2
|
-
microsoft_agents/copilotstudio/client/agent_type.py,sha256=dhoU4sEoju8lInJX5LWf2AyNpyaW5lfGRN9BfL6TuYI,106
|
|
3
|
-
microsoft_agents/copilotstudio/client/connection_settings.py,sha256=fG5q-Z-OizxMREdU3T499JSa88XufcVRnw3oMaGzHCY,1136
|
|
4
|
-
microsoft_agents/copilotstudio/client/copilot_client.py,sha256=YuOi-aOt_gM-l7CYdcFvUG_n4DD_gz4Fca4vAml6Ykg,4159
|
|
5
|
-
microsoft_agents/copilotstudio/client/direct_to_engine_connection_settings_protocol.py,sha256=JBBGSI5TfzO5QjTQpNORbX0blBY88jz7v9egtFd_7Yw,785
|
|
6
|
-
microsoft_agents/copilotstudio/client/execute_turn_request.py,sha256=Gi8KPODVAaISjMtBbdbHvWSq56VAt_I7D9-U1YyEL00,125
|
|
7
|
-
microsoft_agents/copilotstudio/client/power_platform_cloud.py,sha256=YrwAmxpeSuWpuQ1VnDc2_4m_r6T6sjbHMugBrIEF4iQ,465
|
|
8
|
-
microsoft_agents/copilotstudio/client/power_platform_environment.py,sha256=es9KQ52usUyCPq0DSn-IKRxIv1fhnhBPAC6mmpYiENs,6828
|
|
9
|
-
microsoft_agents/copilotstudio/client/errors/__init__.py,sha256=o-OHGAnaYY8diahW9rrRn18WNeLL2hnUVtlV20HWeh8,448
|
|
10
|
-
microsoft_agents/copilotstudio/client/errors/error_resources.py,sha256=mhsmdShrHtUeMOuCi84a_vJmqyidbygArPdwM-mSHHw,1482
|
|
11
|
-
microsoft_agents_copilotstudio_client-0.7.0.dev8.dist-info/licenses/LICENSE,sha256=ws_MuBL-SCEBqPBFl9_FqZkaaydIJmxHrJG2parhU4M,1141
|
|
12
|
-
microsoft_agents_copilotstudio_client-0.7.0.dev8.dist-info/METADATA,sha256=xO4Iz05xhzh729ETJY5erARffzgjcqfphCWKbYhaiKY,9457
|
|
13
|
-
microsoft_agents_copilotstudio_client-0.7.0.dev8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
-
microsoft_agents_copilotstudio_client-0.7.0.dev8.dist-info/top_level.txt,sha256=lWKcT4v6fTA_NgsuHdNvuMjSrkiBMXohn64ApY7Xi8A,17
|
|
15
|
-
microsoft_agents_copilotstudio_client-0.7.0.dev8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|