crewplus 0.2.1__tar.gz → 0.2.3__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.
Potentially problematic release.
This version of crewplus might be problematic. Click here for more details.
- {crewplus-0.2.1 → crewplus-0.2.3}/PKG-INFO +2 -2
- {crewplus-0.2.1 → crewplus-0.2.3}/README.md +1 -1
- {crewplus-0.2.1 → crewplus-0.2.3}/crewplus/vectorstores/milvus/vdb_service.py +60 -21
- {crewplus-0.2.1 → crewplus-0.2.3}/pyproject.toml +1 -1
- {crewplus-0.2.1 → crewplus-0.2.3}/LICENSE +0 -0
- {crewplus-0.2.1 → crewplus-0.2.3}/crewplus/__init__.py +0 -0
- {crewplus-0.2.1 → crewplus-0.2.3}/crewplus/services/__init__.py +0 -0
- {crewplus-0.2.1 → crewplus-0.2.3}/crewplus/services/gemini_chat_model.py +0 -0
- {crewplus-0.2.1 → crewplus-0.2.3}/crewplus/services/init_services.py +0 -0
- {crewplus-0.2.1 → crewplus-0.2.3}/crewplus/services/model_load_balancer.py +0 -0
- {crewplus-0.2.1 → crewplus-0.2.3}/crewplus/utils/schema_action.py +0 -0
- {crewplus-0.2.1 → crewplus-0.2.3}/crewplus/utils/schema_document_updater.py +0 -0
- {crewplus-0.2.1 → crewplus-0.2.3}/crewplus/vectorstores/milvus/__init__.py +0 -0
- {crewplus-0.2.1 → crewplus-0.2.3}/crewplus/vectorstores/milvus/milvus_schema_manager.py +0 -0
- {crewplus-0.2.1 → crewplus-0.2.3}/crewplus/vectorstores/milvus/schema_milvus.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: crewplus
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Base services for CrewPlus AI applications
|
|
5
5
|
Author-Email: Tim Liu <tim@opsmateai.com>
|
|
6
6
|
License: MIT
|
|
@@ -45,7 +45,7 @@ CrewPlus is designed as a modular and extensible ecosystem of packages. This all
|
|
|
45
45
|
|
|
46
46
|
- **Chat Services:** A unified interface for interacting with various chat models (e.g., `GeminiChatModel`).
|
|
47
47
|
- **Model Load Balancer:** Intelligently distribute requests across multiple LLM endpoints.
|
|
48
|
-
- **Vector DB Services:**
|
|
48
|
+
- **Vector DB Services:** working with popular vector stores (e.g. Milvus, Zilliz Cloud) for retrieval-augmented generation (RAG) and agent memory.
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
## Documentation
|
|
@@ -25,7 +25,7 @@ CrewPlus is designed as a modular and extensible ecosystem of packages. This all
|
|
|
25
25
|
|
|
26
26
|
- **Chat Services:** A unified interface for interacting with various chat models (e.g., `GeminiChatModel`).
|
|
27
27
|
- **Model Load Balancer:** Intelligently distribute requests across multiple LLM endpoints.
|
|
28
|
-
- **Vector DB Services:**
|
|
28
|
+
- **Vector DB Services:** working with popular vector stores (e.g. Milvus, Zilliz Cloud) for retrieval-augmented generation (RAG) and agent memory.
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
## Documentation
|
|
@@ -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:
|
|
@@ -257,43 +290,48 @@ class VDBService(object):
|
|
|
257
290
|
|
|
258
291
|
return vdb
|
|
259
292
|
|
|
260
|
-
def delete_old_indexes(self, url: str = None, vdb: Zilliz = None) -> None:
|
|
293
|
+
def delete_old_indexes(self, url: str = None, vdb: Zilliz = None) -> (bool | None):
|
|
261
294
|
""" Delete old indexes of the same source_url
|
|
262
295
|
|
|
263
296
|
Args:
|
|
264
297
|
url (str): source url
|
|
298
|
+
vdb (Zilliz): Zilliz instance
|
|
265
299
|
"""
|
|
300
|
+
self.logger.info(f"Delete old indexes of the same source_url:{url}")
|
|
301
|
+
|
|
266
302
|
if url is None or vdb is None:
|
|
267
|
-
return
|
|
303
|
+
return None
|
|
268
304
|
|
|
269
305
|
# Delete indexes of the same source_url
|
|
270
|
-
expr =
|
|
306
|
+
expr = f'source_url == "{url}" or source == "{url}"'
|
|
271
307
|
pks = vdb.get_pks(expr)
|
|
272
308
|
|
|
273
309
|
# Delete entities by pks
|
|
274
310
|
if pks is not None and len(pks) > 0 :
|
|
275
|
-
|
|
276
|
-
self.logger.info("
|
|
311
|
+
res = vdb.delete(pks)
|
|
312
|
+
self.logger.info("Deleted old indexes result: " + str(res))
|
|
313
|
+
return res
|
|
277
314
|
|
|
278
|
-
def delete_old_indexes_by_id(self,
|
|
315
|
+
def delete_old_indexes_by_id(self, source_id: str = None, vdb: Zilliz = None) -> (bool | None):
|
|
279
316
|
""" Delete old indexes of the same source_id
|
|
280
317
|
|
|
281
318
|
Args:
|
|
282
|
-
|
|
319
|
+
source_id (str): source id
|
|
283
320
|
"""
|
|
284
|
-
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}")
|
|
285
322
|
|
|
286
|
-
if
|
|
287
|
-
return
|
|
323
|
+
if source_id is None or vdb is None:
|
|
324
|
+
return None
|
|
288
325
|
|
|
289
326
|
# Delete indexes of the same source_id
|
|
290
|
-
expr =
|
|
327
|
+
expr = f'source_id == "{source_id}"'
|
|
291
328
|
pks = vdb.get_pks(expr)
|
|
292
329
|
|
|
293
330
|
# Delete entities by pks
|
|
294
331
|
if pks is not None and len(pks) > 0 :
|
|
295
|
-
|
|
296
|
-
self.logger.info("
|
|
332
|
+
res = vdb.delete(pks)
|
|
333
|
+
self.logger.info("Deleted old indexes result: " + str(res))
|
|
334
|
+
return res
|
|
297
335
|
|
|
298
336
|
def drop_collection(self, collection_name: str) -> None:
|
|
299
337
|
"""
|
|
@@ -326,12 +364,13 @@ class VDBService(object):
|
|
|
326
364
|
self.logger.info(f"Removed '{collection_name}' from instance cache.")
|
|
327
365
|
|
|
328
366
|
def delete_data_by_filter(self, collection_name: str = None, filter: str = None) -> None:
|
|
329
|
-
""" Delete
|
|
367
|
+
""" Delete data by filter
|
|
330
368
|
|
|
331
369
|
Args:
|
|
332
|
-
collection_name (str):
|
|
370
|
+
collection_name (str): collection_name
|
|
371
|
+
filter (str): filter
|
|
333
372
|
"""
|
|
334
|
-
self.logger.info(f"
|
|
373
|
+
self.logger.info(f"Delete data by filter:{filter}")
|
|
335
374
|
|
|
336
375
|
try:
|
|
337
376
|
client=self.get_vector_client()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|