crewplus 0.2.2__py3-none-any.whl → 0.2.3__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 crewplus might be problematic. Click here for more details.
- crewplus/vectorstores/milvus/vdb_service.py +45 -11
- {crewplus-0.2.2.dist-info → crewplus-0.2.3.dist-info}/METADATA +1 -1
- {crewplus-0.2.2.dist-info → crewplus-0.2.3.dist-info}/RECORD +6 -6
- {crewplus-0.2.2.dist-info → crewplus-0.2.3.dist-info}/WHEEL +0 -0
- {crewplus-0.2.2.dist-info → crewplus-0.2.3.dist-info}/entry_points.txt +0 -0
- {crewplus-0.2.2.dist-info → crewplus-0.2.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -22,17 +22,22 @@ class VDBService(object):
|
|
|
22
22
|
and provides helper methods to get embedding functions and vector store instances.
|
|
23
23
|
|
|
24
24
|
Args:
|
|
25
|
-
settings (dict): A dictionary containing configuration for the vector store
|
|
25
|
+
settings (dict, optional): A dictionary containing configuration for the vector store
|
|
26
26
|
and embedding models.
|
|
27
|
+
endpoint (str, optional): The URI for the Zilliz cluster. Can be used for simple
|
|
28
|
+
initialization instead of `settings`.
|
|
29
|
+
token (str, optional): The token for authenticating with Zilliz. Must be provided
|
|
30
|
+
with `endpoint`.
|
|
27
31
|
schema (str, optional): The schema definition for a collection. Defaults to None.
|
|
28
32
|
logger (logging.Logger, optional): An optional logger instance. Defaults to None.
|
|
29
33
|
|
|
30
34
|
Raises:
|
|
31
|
-
ValueError: If required configurations are missing
|
|
35
|
+
ValueError: If required configurations are missing.
|
|
32
36
|
NotImplementedError: If an unsupported provider is specified.
|
|
33
37
|
RuntimeError: If the MilvusClient fails to initialize after a retry.
|
|
34
38
|
|
|
35
39
|
Example:
|
|
40
|
+
>>> # Initialize with a full settings dictionary
|
|
36
41
|
>>> settings = {
|
|
37
42
|
... "embedder": {
|
|
38
43
|
... "provider": "azure-openai",
|
|
@@ -61,6 +66,10 @@ class VDBService(object):
|
|
|
61
66
|
... }
|
|
62
67
|
... }
|
|
63
68
|
>>> vdb_service = VDBService(settings=settings)
|
|
69
|
+
>>>
|
|
70
|
+
>>> # Alternatively, initialize with an endpoint and token for Zilliz
|
|
71
|
+
>>> # vdb_service_zilliz = VDBService(endpoint="YOUR_ZILLIZ_ENDPOINT", token="YOUR_ZILLIZ_TOKEN")
|
|
72
|
+
>>>
|
|
64
73
|
>>> # Get the raw Milvus client
|
|
65
74
|
>>> client = vdb_service.get_vector_client()
|
|
66
75
|
>>> print(client.list_collections())
|
|
@@ -82,17 +91,41 @@ class VDBService(object):
|
|
|
82
91
|
connection_args: dict
|
|
83
92
|
settings: dict
|
|
84
93
|
|
|
85
|
-
def __init__(self, settings: dict, schema: str = None, logger: logging.Logger = None):
|
|
94
|
+
def __init__(self, settings: dict = None, endpoint: str = None, token: str = None, schema: str = None, logger: logging.Logger = None):
|
|
86
95
|
"""
|
|
87
96
|
Initializes the VDBService.
|
|
97
|
+
|
|
98
|
+
Can be initialized in two ways:
|
|
99
|
+
1. By providing a full `settings` dictionary for complex configurations.
|
|
100
|
+
2. By providing `endpoint` and `token` for a direct Zilliz connection.
|
|
101
|
+
Note: When using this method, an `embedder` configuration is not created.
|
|
102
|
+
You must either use the `ModelLoadBalancer` or pass an `Embeddings` object
|
|
103
|
+
directly to methods like `get_vector_store`.
|
|
88
104
|
|
|
89
105
|
Args:
|
|
90
|
-
settings (dict): Configuration dictionary for the service.
|
|
106
|
+
settings (dict, optional): Configuration dictionary for the service. Defaults to None.
|
|
107
|
+
endpoint (str, optional): The URI for the Zilliz cluster. Used if `settings` is not provided.
|
|
108
|
+
token (str, optional): The token for authenticating with the Zilliz cluster.
|
|
91
109
|
schema (str, optional): Default schema for new collections. Defaults to None.
|
|
92
110
|
logger (logging.Logger, optional): Logger instance. Defaults to None.
|
|
93
111
|
"""
|
|
94
112
|
self.logger = logger or logging.getLogger(__name__)
|
|
95
|
-
|
|
113
|
+
|
|
114
|
+
if settings:
|
|
115
|
+
self.settings = settings
|
|
116
|
+
elif endpoint and token:
|
|
117
|
+
self.logger.info("Initializing VDBService with endpoint and token for a Zilliz connection.")
|
|
118
|
+
self.settings = {
|
|
119
|
+
"vector_store": {
|
|
120
|
+
"provider": "zilliz",
|
|
121
|
+
"config": {
|
|
122
|
+
"uri": endpoint,
|
|
123
|
+
"token": token
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else:
|
|
128
|
+
raise ValueError("VDBService must be initialized with either a 'settings' dictionary or both 'endpoint' and 'token'.")
|
|
96
129
|
|
|
97
130
|
vector_store_settings = self.settings.get("vector_store")
|
|
98
131
|
if not vector_store_settings:
|
|
@@ -262,6 +295,7 @@ class VDBService(object):
|
|
|
262
295
|
|
|
263
296
|
Args:
|
|
264
297
|
url (str): source url
|
|
298
|
+
vdb (Zilliz): Zilliz instance
|
|
265
299
|
"""
|
|
266
300
|
self.logger.info(f"Delete old indexes of the same source_url:{url}")
|
|
267
301
|
|
|
@@ -269,7 +303,7 @@ class VDBService(object):
|
|
|
269
303
|
return None
|
|
270
304
|
|
|
271
305
|
# Delete indexes of the same source_url
|
|
272
|
-
expr =
|
|
306
|
+
expr = f'source_url == "{url}" or source == "{url}"'
|
|
273
307
|
pks = vdb.get_pks(expr)
|
|
274
308
|
|
|
275
309
|
# Delete entities by pks
|
|
@@ -278,19 +312,19 @@ class VDBService(object):
|
|
|
278
312
|
self.logger.info("Deleted old indexes result: " + str(res))
|
|
279
313
|
return res
|
|
280
314
|
|
|
281
|
-
def delete_old_indexes_by_id(self,
|
|
315
|
+
def delete_old_indexes_by_id(self, source_id: str = None, vdb: Zilliz = None) -> (bool | None):
|
|
282
316
|
""" Delete old indexes of the same source_id
|
|
283
317
|
|
|
284
318
|
Args:
|
|
285
|
-
|
|
319
|
+
source_id (str): source id
|
|
286
320
|
"""
|
|
287
|
-
self.logger.info(f"Delete old indexes of the same source_id:{
|
|
321
|
+
self.logger.info(f"Delete old indexes of the same source_id:{source_id}")
|
|
288
322
|
|
|
289
|
-
if
|
|
323
|
+
if source_id is None or vdb is None:
|
|
290
324
|
return None
|
|
291
325
|
|
|
292
326
|
# Delete indexes of the same source_id
|
|
293
|
-
expr =
|
|
327
|
+
expr = f'source_id == "{source_id}"'
|
|
294
328
|
pks = vdb.get_pks(expr)
|
|
295
329
|
|
|
296
330
|
# Delete entities by pks
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
crewplus-0.2.
|
|
2
|
-
crewplus-0.2.
|
|
3
|
-
crewplus-0.2.
|
|
4
|
-
crewplus-0.2.
|
|
1
|
+
crewplus-0.2.3.dist-info/METADATA,sha256=3kbzrxbpcbp1zW-lV4j4rYmxnOV5iFiF1oDi5bQ1K-I,4909
|
|
2
|
+
crewplus-0.2.3.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
|
|
3
|
+
crewplus-0.2.3.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
|
4
|
+
crewplus-0.2.3.dist-info/licenses/LICENSE,sha256=2_NHSHRTKB_cTcT_GXgcenOCtIZku8j343mOgAguTfc,1087
|
|
5
5
|
crewplus/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
crewplus/services/__init__.py,sha256=MmH2v3N0ZMsuqFNAupkXENjUqvgf5ehQ99H6EzPqLZU,48
|
|
7
7
|
crewplus/services/gemini_chat_model.py,sha256=i9p5KvSJYaHSUBLPKM_bpyGVLWCDQoNeah_WjQVJRXs,26227
|
|
@@ -12,5 +12,5 @@ crewplus/utils/schema_document_updater.py,sha256=frvffxn2vbi71fHFPoGb9hq7gH2azmm
|
|
|
12
12
|
crewplus/vectorstores/milvus/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
crewplus/vectorstores/milvus/milvus_schema_manager.py,sha256=qHMVIM0NS3rLfACb8d3-tQS9hJo6_7_YP8AxVx4t1Cc,9019
|
|
14
14
|
crewplus/vectorstores/milvus/schema_milvus.py,sha256=GhHTtCH5HsIJc3RHa25RXl3aZdkS3Rba5KeuUk_Hi0k,11425
|
|
15
|
-
crewplus/vectorstores/milvus/vdb_service.py,sha256=
|
|
16
|
-
crewplus-0.2.
|
|
15
|
+
crewplus/vectorstores/milvus/vdb_service.py,sha256=J7B6TOZmJl9_K2euJFKJFvSYqvruKbXuYkFiugWnXXs,16657
|
|
16
|
+
crewplus-0.2.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|