crewplus 0.2.13__py3-none-any.whl → 0.2.14__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 +12 -12
- {crewplus-0.2.13.dist-info → crewplus-0.2.14.dist-info}/METADATA +1 -1
- {crewplus-0.2.13.dist-info → crewplus-0.2.14.dist-info}/RECORD +6 -6
- {crewplus-0.2.13.dist-info → crewplus-0.2.14.dist-info}/WHEEL +0 -0
- {crewplus-0.2.13.dist-info → crewplus-0.2.14.dist-info}/entry_points.txt +0 -0
- {crewplus-0.2.13.dist-info → crewplus-0.2.14.dist-info}/licenses/LICENSE +0 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import logging
|
|
8
8
|
from typing import List, Dict, Union, Optional
|
|
9
|
-
from langchain_milvus import
|
|
9
|
+
from langchain_milvus import Milvus
|
|
10
10
|
from langchain_core.embeddings import Embeddings
|
|
11
11
|
from langchain_openai import AzureOpenAIEmbeddings
|
|
12
12
|
from pymilvus import MilvusClient
|
|
@@ -60,8 +60,8 @@ class VDBService(object):
|
|
|
60
60
|
... }
|
|
61
61
|
... },
|
|
62
62
|
... "index_params": {
|
|
63
|
-
... "metric_type": "
|
|
64
|
-
... "index_type": "
|
|
63
|
+
... "metric_type": "IP",
|
|
64
|
+
... "index_type": "HNSW",
|
|
65
65
|
... "params": {}
|
|
66
66
|
... }
|
|
67
67
|
... }
|
|
@@ -83,7 +83,7 @@ class VDBService(object):
|
|
|
83
83
|
>>> assert vector_store is same_vector_store
|
|
84
84
|
"""
|
|
85
85
|
_client: MilvusClient
|
|
86
|
-
_instances: Dict[str,
|
|
86
|
+
_instances: Dict[str, Milvus] = {}
|
|
87
87
|
|
|
88
88
|
schema: str
|
|
89
89
|
embedding_function: Embeddings
|
|
@@ -275,7 +275,7 @@ class VDBService(object):
|
|
|
275
275
|
self.logger.error(f"An error occurred while ensuring collection '{collection_name}' : {e}")
|
|
276
276
|
raise RuntimeError(f"Failed to ensure collection '{collection_name}' .") from e
|
|
277
277
|
|
|
278
|
-
def get_vector_store(self, collection_name: str, embeddings: Embeddings = None, metric_type: str = "
|
|
278
|
+
def get_vector_store(self, collection_name: str, embeddings: Embeddings = None, metric_type: str = "IP") -> Milvus:
|
|
279
279
|
"""
|
|
280
280
|
Gets a vector store instance, creating it if it doesn't exist for the collection.
|
|
281
281
|
This method validates both the embedding function and the vector store connection
|
|
@@ -284,10 +284,10 @@ class VDBService(object):
|
|
|
284
284
|
Args:
|
|
285
285
|
collection_name (str): The name of the collection in the vector database.
|
|
286
286
|
embeddings (Embeddings, optional): An embedding model instance. If None, one is created.
|
|
287
|
-
metric_type (str): The distance metric for the index. Defaults to "
|
|
287
|
+
metric_type (str): The distance metric for the index. Defaults to "IP".
|
|
288
288
|
|
|
289
289
|
Returns:
|
|
290
|
-
|
|
290
|
+
Milvus: LangChain Milvus instance, which is compatible with both Zilliz and Milvus.
|
|
291
291
|
"""
|
|
292
292
|
if not collection_name:
|
|
293
293
|
self.logger.error("get_vector_store called with no collection_name.")
|
|
@@ -317,14 +317,14 @@ class VDBService(object):
|
|
|
317
317
|
)
|
|
318
318
|
raise RuntimeError(f"Invalid embedding function provided.") from e
|
|
319
319
|
|
|
320
|
-
# If embeddings are valid, proceed to create the
|
|
320
|
+
# If embeddings are valid, proceed to create the Milvus instance.
|
|
321
321
|
index_params = self.index_params or {
|
|
322
322
|
"metric_type": metric_type,
|
|
323
323
|
"index_type": "AUTOINDEX",
|
|
324
324
|
"params": {}
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
-
vdb =
|
|
327
|
+
vdb = Milvus(
|
|
328
328
|
embedding_function=embeddings,
|
|
329
329
|
collection_name=collection_name,
|
|
330
330
|
connection_args=self.connection_args,
|
|
@@ -336,12 +336,12 @@ class VDBService(object):
|
|
|
336
336
|
|
|
337
337
|
return vdb
|
|
338
338
|
|
|
339
|
-
def delete_old_indexes(self, url: str = None, vdb:
|
|
339
|
+
def delete_old_indexes(self, url: str = None, vdb: Milvus = None) -> (bool | None):
|
|
340
340
|
""" Delete old indexes of the same source_url
|
|
341
341
|
|
|
342
342
|
Args:
|
|
343
343
|
url (str): source url
|
|
344
|
-
vdb (
|
|
344
|
+
vdb (Milvus): Milvus/Zilliz instance
|
|
345
345
|
"""
|
|
346
346
|
self.logger.info(f"Delete old indexes of the same source_url:{url}")
|
|
347
347
|
|
|
@@ -358,7 +358,7 @@ class VDBService(object):
|
|
|
358
358
|
self.logger.info("Deleted old indexes result: " + str(res))
|
|
359
359
|
return res
|
|
360
360
|
|
|
361
|
-
def delete_old_indexes_by_id(self, source_id: str = None, vdb:
|
|
361
|
+
def delete_old_indexes_by_id(self, source_id: str = None, vdb: Milvus = None) -> (bool | None):
|
|
362
362
|
""" Delete old indexes of the same source_id
|
|
363
363
|
|
|
364
364
|
Args:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
crewplus-0.2.
|
|
2
|
-
crewplus-0.2.
|
|
3
|
-
crewplus-0.2.
|
|
4
|
-
crewplus-0.2.
|
|
1
|
+
crewplus-0.2.14.dist-info/METADATA,sha256=r1Czargd06hF_rDNnysOU4sH2mFoq6qczAb_fSQijoU,5087
|
|
2
|
+
crewplus-0.2.14.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
|
|
3
|
+
crewplus-0.2.14.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
|
4
|
+
crewplus-0.2.14.dist-info/licenses/LICENSE,sha256=2_NHSHRTKB_cTcT_GXgcenOCtIZku8j343mOgAguTfc,1087
|
|
5
5
|
crewplus/__init__.py,sha256=m46HkZL1Y4toD619NL47Sn2Qe084WFFSFD7e6VoYKZc,284
|
|
6
6
|
crewplus/services/__init__.py,sha256=ra_ciHcJN_sbv7q8UCP2kY91SbD32-QBpQLRgIosEcE,267
|
|
7
7
|
crewplus/services/gemini_chat_model.py,sha256=i9p5KvSJYaHSUBLPKM_bpyGVLWCDQoNeah_WjQVJRXs,26227
|
|
@@ -13,9 +13,9 @@ crewplus/utils/schema_document_updater.py,sha256=frvffxn2vbi71fHFPoGb9hq7gH2azmm
|
|
|
13
13
|
crewplus/vectorstores/milvus/__init__.py,sha256=egGncAdjlXG6ekTQvKMKqhvKBifrUrPlsSB0-bpvq4A,229
|
|
14
14
|
crewplus/vectorstores/milvus/milvus_schema_manager.py,sha256=2IZT61LVui21Pt5Z3y8YYS2dYcwzkgUKxMq2NA0-lQE,9222
|
|
15
15
|
crewplus/vectorstores/milvus/schema_milvus.py,sha256=IvKdUCH451HJ-F3TUR5jDjqwQlQs4SEXAQ_th4JAnfc,12117
|
|
16
|
-
crewplus/vectorstores/milvus/vdb_service.py,sha256=
|
|
16
|
+
crewplus/vectorstores/milvus/vdb_service.py,sha256=i-imqk4tnIXkf5O406lHaq5H7YSPy8UZhqN1o5NpanI,19194
|
|
17
17
|
docs/GeminiChatModel.md,sha256=_IQyup3ofAa2HxfSurO1GYUEezTHYYt5Q1khYNVThGM,8040
|
|
18
18
|
docs/ModelLoadBalancer.md,sha256=aGHES1dcXPz4c7Y8kB5-vsCNJjriH2SWmjBkSGoYKiI,4398
|
|
19
19
|
docs/VDBService.md,sha256=Dw286Rrf_fsi13jyD3Bo4Sy7nZ_G7tYm7d8MZ2j9hxk,9375
|
|
20
20
|
docs/index.md,sha256=3tlc15uR8lzFNM5WjdoZLw0Y9o1P1gwgbEnOdIBspqc,1643
|
|
21
|
-
crewplus-0.2.
|
|
21
|
+
crewplus-0.2.14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|