microsoft-agents-storage-cosmos 0.6.1__py3-none-any.whl → 0.7.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.
- microsoft_agents/storage/cosmos/cosmos_db_storage.py +25 -24
- microsoft_agents/storage/cosmos/cosmos_db_storage_config.py +5 -9
- {microsoft_agents_storage_cosmos-0.6.1.dist-info → microsoft_agents_storage_cosmos-0.7.0.dist-info}/METADATA +22 -3
- {microsoft_agents_storage_cosmos-0.6.1.dist-info → microsoft_agents_storage_cosmos-0.7.0.dist-info}/RECORD +7 -7
- {microsoft_agents_storage_cosmos-0.6.1.dist-info → microsoft_agents_storage_cosmos-0.7.0.dist-info}/WHEEL +0 -0
- {microsoft_agents_storage_cosmos-0.6.1.dist-info → microsoft_agents_storage_cosmos-0.7.0.dist-info}/licenses/LICENSE +0 -0
- {microsoft_agents_storage_cosmos-0.6.1.dist-info → microsoft_agents_storage_cosmos-0.7.0.dist-info}/top_level.txt +0 -0
|
@@ -61,7 +61,7 @@ class CosmosDBStorage(AsyncStorageBase):
|
|
|
61
61
|
)
|
|
62
62
|
)
|
|
63
63
|
return CosmosClient(
|
|
64
|
-
|
|
64
|
+
url=self._config.url, credential=self._config.credential
|
|
65
65
|
)
|
|
66
66
|
|
|
67
67
|
connection_policy = self._config.cosmos_client_options.get(
|
|
@@ -139,32 +139,30 @@ class CosmosDBStorage(AsyncStorageBase):
|
|
|
139
139
|
"kind": documents.PartitionKind.Hash,
|
|
140
140
|
}
|
|
141
141
|
try:
|
|
142
|
+
kwargs = {}
|
|
143
|
+
if self._config.container_throughput:
|
|
144
|
+
kwargs["offer_throughput"] = self._config.container_throughput
|
|
142
145
|
self._container = await self._database.create_container(
|
|
143
|
-
self._config.container_id,
|
|
144
|
-
partition_key,
|
|
145
|
-
offer_throughput=self._config.container_throughput,
|
|
146
|
+
self._config.container_id, partition_key, **kwargs
|
|
146
147
|
)
|
|
147
|
-
except
|
|
148
|
-
|
|
149
|
-
self.
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
f"Custom Partition Key Paths are not supported. {self._config.container_id} has a custom Partition Key Path of {paths[0]}."
|
|
164
|
-
)
|
|
148
|
+
except Exception as err:
|
|
149
|
+
self._container = self._database.get_container_client(
|
|
150
|
+
self._config.container_id
|
|
151
|
+
)
|
|
152
|
+
properties = await self._container.read()
|
|
153
|
+
# if "partitionKey" not in properties:
|
|
154
|
+
# self._compatability_mode_partition_key = True
|
|
155
|
+
# else:
|
|
156
|
+
# containers created had no partition key, so the default was "/_partitionKey"
|
|
157
|
+
paths = properties["partitionKey"]["paths"]
|
|
158
|
+
if "/_partitionKey" in paths:
|
|
159
|
+
self._compatability_mode_partition_key = True
|
|
160
|
+
elif "/id" not in paths:
|
|
161
|
+
raise Exception(
|
|
162
|
+
storage_errors.InvalidConfiguration.format(
|
|
163
|
+
f"Custom Partition Key Paths are not supported. {self._config.container_id} has a custom Partition Key Path of {paths[0]}."
|
|
165
164
|
)
|
|
166
|
-
|
|
167
|
-
raise err
|
|
165
|
+
)
|
|
168
166
|
|
|
169
167
|
async def initialize(self) -> None:
|
|
170
168
|
if not self._container:
|
|
@@ -182,3 +180,6 @@ class CosmosDBStorage(AsyncStorageBase):
|
|
|
182
180
|
|
|
183
181
|
def _get_partition_key(self, key: str):
|
|
184
182
|
return NonePartitionKeyValue if self._compatability_mode_partition_key else key
|
|
183
|
+
|
|
184
|
+
async def _close(self) -> None:
|
|
185
|
+
await self._client.close()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import json
|
|
2
2
|
from typing import Union
|
|
3
3
|
|
|
4
|
-
from azure.core.
|
|
4
|
+
from azure.core.credentials_async import AsyncTokenCredential
|
|
5
5
|
from microsoft_agents.storage.cosmos.errors import storage_errors
|
|
6
6
|
|
|
7
7
|
from .key_ops import sanitize_key
|
|
@@ -17,11 +17,11 @@ class CosmosDBStorageConfig:
|
|
|
17
17
|
database_id: str = "",
|
|
18
18
|
container_id: str = "",
|
|
19
19
|
cosmos_client_options: dict = None,
|
|
20
|
-
container_throughput: int =
|
|
20
|
+
container_throughput: int | None = None,
|
|
21
21
|
key_suffix: str = "",
|
|
22
22
|
compatibility_mode: bool = False,
|
|
23
23
|
url: str = "",
|
|
24
|
-
credential: Union[
|
|
24
|
+
credential: Union[AsyncTokenCredential, None] = None,
|
|
25
25
|
**kwargs,
|
|
26
26
|
):
|
|
27
27
|
"""Create the Config object.
|
|
@@ -55,14 +55,14 @@ class CosmosDBStorageConfig:
|
|
|
55
55
|
"cosmos_client_options", {}
|
|
56
56
|
)
|
|
57
57
|
self.container_throughput: int = container_throughput or kwargs.get(
|
|
58
|
-
"container_throughput"
|
|
58
|
+
"container_throughput"
|
|
59
59
|
)
|
|
60
60
|
self.key_suffix: str = key_suffix or kwargs.get("key_suffix", "")
|
|
61
61
|
self.compatibility_mode: bool = compatibility_mode or kwargs.get(
|
|
62
62
|
"compatibility_mode", False
|
|
63
63
|
)
|
|
64
64
|
self.url = url or kwargs.get("url", "")
|
|
65
|
-
self.credential: Union[
|
|
65
|
+
self.credential: Union[AsyncTokenCredential, None] = credential
|
|
66
66
|
|
|
67
67
|
@staticmethod
|
|
68
68
|
def validate_cosmos_db_config(config: "CosmosDBStorageConfig") -> None:
|
|
@@ -71,10 +71,6 @@ class CosmosDBStorageConfig:
|
|
|
71
71
|
This is used prior to the creation of the CosmosDBStorage object."""
|
|
72
72
|
if not config:
|
|
73
73
|
raise ValueError(str(storage_errors.CosmosDbConfigRequired))
|
|
74
|
-
if not config.cosmos_db_endpoint:
|
|
75
|
-
raise ValueError(str(storage_errors.CosmosDbEndpointRequired))
|
|
76
|
-
if not config.auth_key:
|
|
77
|
-
raise ValueError(str(storage_errors.CosmosDbAuthKeyRequired))
|
|
78
74
|
if not config.database_id:
|
|
79
75
|
raise ValueError(str(storage_errors.CosmosDbDatabaseIdRequired))
|
|
80
76
|
if not config.container_id:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: microsoft-agents-storage-cosmos
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: A Cosmos DB storage library for Microsoft Agents
|
|
5
5
|
Author: Microsoft Corporation
|
|
6
6
|
License-Expression: MIT
|
|
@@ -15,9 +15,10 @@ 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.
|
|
18
|
+
Requires-Dist: microsoft-agents-hosting-core==0.7.0
|
|
19
19
|
Requires-Dist: azure-core
|
|
20
20
|
Requires-Dist: azure-cosmos
|
|
21
|
+
Requires-Dist: azure-identity
|
|
21
22
|
Dynamic: license-file
|
|
22
23
|
Dynamic: requires-dist
|
|
23
24
|
|
|
@@ -39,11 +40,29 @@ This library is part of the **Microsoft 365 Agents SDK for Python** - a comprehe
|
|
|
39
40
|
<th style="width:20%">Date</th>
|
|
40
41
|
<th style="width:60%">Release Notes</th>
|
|
41
42
|
</tr>
|
|
43
|
+
<tr>
|
|
44
|
+
<td>0.6.1</td>
|
|
45
|
+
<td>2025-12-01</td>
|
|
46
|
+
<td>
|
|
47
|
+
<a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md#microsoft-365-agents-sdk-for-python---release-notes-v061">
|
|
48
|
+
0.6.1 Release Notes
|
|
49
|
+
</a>
|
|
50
|
+
</td>
|
|
51
|
+
</tr>
|
|
52
|
+
<tr>
|
|
53
|
+
<td>0.6.0</td>
|
|
54
|
+
<td>2025-11-18</td>
|
|
55
|
+
<td>
|
|
56
|
+
<a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md#microsoft-365-agents-sdk-for-python---release-notes-v060">
|
|
57
|
+
0.6.0 Release Notes
|
|
58
|
+
</a>
|
|
59
|
+
</td>
|
|
60
|
+
</tr>
|
|
42
61
|
<tr>
|
|
43
62
|
<td>0.5.0</td>
|
|
44
63
|
<td>2025-10-22</td>
|
|
45
64
|
<td>
|
|
46
|
-
<a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md">
|
|
65
|
+
<a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md#microsoft-365-agents-sdk-for-python---release-notes-v050">
|
|
47
66
|
0.5.0 Release Notes
|
|
48
67
|
</a>
|
|
49
68
|
</td>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
microsoft_agents/storage/cosmos/__init__.py,sha256=2JVNhbohUB-Pm8LmgagHQH3vlEgljpUzbfPhdOS-rCQ,174
|
|
2
|
-
microsoft_agents/storage/cosmos/cosmos_db_storage.py,sha256=
|
|
3
|
-
microsoft_agents/storage/cosmos/cosmos_db_storage_config.py,sha256=
|
|
2
|
+
microsoft_agents/storage/cosmos/cosmos_db_storage.py,sha256=7AivID9eWk2XB_Ar7J3__T7fETqNiGqqUfdL6xWjo0w,6680
|
|
3
|
+
microsoft_agents/storage/cosmos/cosmos_db_storage_config.py,sha256=Qyt01_zXWLL6Ho8WBmWep9C0nqed8LrRC0YjUBC5PR8,4013
|
|
4
4
|
microsoft_agents/storage/cosmos/key_ops.py,sha256=2wnSdSpKzwoCvw4giNn68pBDOa1Gc1jyvEhk2tc_gPQ,1747
|
|
5
5
|
microsoft_agents/storage/cosmos/errors/__init__.py,sha256=3J6VOVCyB2NxCrodoLeVxLAtHMmsrZKKbz4LfUHfk-0,409
|
|
6
6
|
microsoft_agents/storage/cosmos/errors/error_resources.py,sha256=7mXt0Dj1LOGt2fg9h2iV5ZGPu480DMeFEGSN2uue4A0,2386
|
|
7
|
-
microsoft_agents_storage_cosmos-0.
|
|
8
|
-
microsoft_agents_storage_cosmos-0.
|
|
9
|
-
microsoft_agents_storage_cosmos-0.
|
|
10
|
-
microsoft_agents_storage_cosmos-0.
|
|
11
|
-
microsoft_agents_storage_cosmos-0.
|
|
7
|
+
microsoft_agents_storage_cosmos-0.7.0.dist-info/licenses/LICENSE,sha256=ws_MuBL-SCEBqPBFl9_FqZkaaydIJmxHrJG2parhU4M,1141
|
|
8
|
+
microsoft_agents_storage_cosmos-0.7.0.dist-info/METADATA,sha256=xll37oMmS4tEbhFS7FqCBEpC3K_WTn1ph3zNZ-EQQL0,8381
|
|
9
|
+
microsoft_agents_storage_cosmos-0.7.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
10
|
+
microsoft_agents_storage_cosmos-0.7.0.dist-info/top_level.txt,sha256=lWKcT4v6fTA_NgsuHdNvuMjSrkiBMXohn64ApY7Xi8A,17
|
|
11
|
+
microsoft_agents_storage_cosmos-0.7.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|