crewplus 0.2.61__tar.gz → 0.2.63__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.61 → crewplus-0.2.63}/PKG-INFO +1 -1
- {crewplus-0.2.61 → crewplus-0.2.63}/crewplus/vectorstores/milvus/vdb_service.py +31 -53
- {crewplus-0.2.61 → crewplus-0.2.63}/pyproject.toml +1 -1
- {crewplus-0.2.61 → crewplus-0.2.63}/LICENSE +0 -0
- {crewplus-0.2.61 → crewplus-0.2.63}/README.md +0 -0
- {crewplus-0.2.61 → crewplus-0.2.63}/crewplus/__init__.py +0 -0
- {crewplus-0.2.61 → crewplus-0.2.63}/crewplus/callbacks/__init__.py +0 -0
- {crewplus-0.2.61 → crewplus-0.2.63}/crewplus/callbacks/async_langfuse_handler.py +0 -0
- {crewplus-0.2.61 → crewplus-0.2.63}/crewplus/services/__init__.py +0 -0
- {crewplus-0.2.61 → crewplus-0.2.63}/crewplus/services/azure_chat_model.py +0 -0
- {crewplus-0.2.61 → crewplus-0.2.63}/crewplus/services/gemini_chat_model.py +0 -0
- {crewplus-0.2.61 → crewplus-0.2.63}/crewplus/services/init_services.py +0 -0
- {crewplus-0.2.61 → crewplus-0.2.63}/crewplus/services/model_load_balancer.py +0 -0
- {crewplus-0.2.61 → crewplus-0.2.63}/crewplus/services/tracing_manager.py +0 -0
- {crewplus-0.2.61 → crewplus-0.2.63}/crewplus/utils/__init__.py +0 -0
- {crewplus-0.2.61 → crewplus-0.2.63}/crewplus/utils/schema_action.py +0 -0
- {crewplus-0.2.61 → crewplus-0.2.63}/crewplus/utils/schema_document_updater.py +0 -0
- {crewplus-0.2.61 → crewplus-0.2.63}/crewplus/vectorstores/milvus/__init__.py +0 -0
- {crewplus-0.2.61 → crewplus-0.2.63}/crewplus/vectorstores/milvus/milvus_schema_manager.py +0 -0
- {crewplus-0.2.61 → crewplus-0.2.63}/crewplus/vectorstores/milvus/schema_milvus.py +0 -0
- {crewplus-0.2.61 → crewplus-0.2.63}/docs/GeminiChatModel.md +0 -0
- {crewplus-0.2.61 → crewplus-0.2.63}/docs/ModelLoadBalancer.md +0 -0
- {crewplus-0.2.61 → crewplus-0.2.63}/docs/VDBService.md +0 -0
- {crewplus-0.2.61 → crewplus-0.2.63}/docs/index.md +0 -0
|
@@ -454,41 +454,29 @@ class VDBService(object):
|
|
|
454
454
|
self.logger.error("get_vector_store called with no collection_name.")
|
|
455
455
|
raise ValueError("collection_name must be provided.")
|
|
456
456
|
|
|
457
|
-
|
|
458
|
-
# Check for a cached instance and validate its connection before returning.
|
|
457
|
+
# Check for a cached instance. If found, return it immediately.
|
|
459
458
|
if collection_name in self._instances:
|
|
460
|
-
instance
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
if is_connected and collection_exists:
|
|
464
|
-
self.logger.info(f"Returning existing vector store instance for collection: {collection_name}")
|
|
465
|
-
return instance
|
|
466
|
-
|
|
467
|
-
self.logger.warning(f"Cached instance for '{collection_name}' is invalid. Removing it from cache.")
|
|
468
|
-
del self._instances[collection_name]
|
|
469
|
-
|
|
470
|
-
if is_connected and not collection_exists:
|
|
471
|
-
# We know the collection doesn't exist, so no need to check again.
|
|
472
|
-
check_existence = False
|
|
459
|
+
self.logger.info(f"Returning existing vector store instance for collection: {collection_name}")
|
|
460
|
+
return self._instances[collection_name]
|
|
473
461
|
|
|
474
462
|
self.logger.info(f"Creating new vector store instance for collection: {collection_name}")
|
|
475
463
|
if embeddings is None:
|
|
476
464
|
embeddings = self.get_embeddings()
|
|
477
465
|
|
|
478
466
|
# Ensure the collection exists before proceeding.
|
|
479
|
-
self._ensure_collection_exists(collection_name, embeddings, check_existence=
|
|
480
|
-
|
|
481
|
-
# 1. Validate the embedding function before proceeding.
|
|
482
|
-
try:
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
except Exception as e:
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
467
|
+
self._ensure_collection_exists(collection_name, embeddings, check_existence=True)
|
|
468
|
+
|
|
469
|
+
# # 1. Validate the embedding function before proceeding.
|
|
470
|
+
# try:
|
|
471
|
+
# self.logger.info(f"Testing embedding function for collection '{collection_name}'...")
|
|
472
|
+
# embeddings.embed_query("validation_test_string")
|
|
473
|
+
# self.logger.info("Embedding function is valid.")
|
|
474
|
+
# except Exception as e:
|
|
475
|
+
# self.logger.error(
|
|
476
|
+
# f"The provided embedding function is invalid and failed with error: {e}. "
|
|
477
|
+
# f"Cannot create a vector store for collection '{collection_name}'."
|
|
478
|
+
# )
|
|
479
|
+
# raise RuntimeError(f"Invalid embedding function provided.") from e
|
|
492
480
|
|
|
493
481
|
# If embeddings are valid, proceed to create the Milvus instance.
|
|
494
482
|
index_params = self.index_params or {
|
|
@@ -545,37 +533,27 @@ class VDBService(object):
|
|
|
545
533
|
self.logger.error("aget_vector_store called with no collection_name.")
|
|
546
534
|
raise ValueError("collection_name must be provided.")
|
|
547
535
|
|
|
548
|
-
|
|
536
|
+
# Check for a cached instance. If found, return it immediately.
|
|
549
537
|
if collection_name in self._async_instances:
|
|
550
|
-
instance
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
if is_connected and collection_exists:
|
|
554
|
-
self.logger.info(f"Returning existing async vector store instance for collection: {collection_name}")
|
|
555
|
-
return instance
|
|
556
|
-
|
|
557
|
-
self.logger.warning(f"Cached async instance for '{collection_name}' is invalid. Removing it from cache.")
|
|
558
|
-
del self._async_instances[collection_name]
|
|
559
|
-
|
|
560
|
-
if is_connected and not collection_exists:
|
|
561
|
-
check_existence = False
|
|
538
|
+
self.logger.info(f"Returning existing async vector store instance for collection: {collection_name}")
|
|
539
|
+
return self._async_instances[collection_name]
|
|
562
540
|
|
|
563
541
|
self.logger.info(f"Creating new async vector store instance for collection: {collection_name}")
|
|
564
542
|
if embeddings is None:
|
|
565
543
|
embeddings = self.get_embeddings()
|
|
566
544
|
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
try:
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
except Exception as e:
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
545
|
+
await self._aensure_collection_exists(collection_name, embeddings, check_existence=True)
|
|
546
|
+
|
|
547
|
+
# try:
|
|
548
|
+
# self.logger.info(f"Testing embedding function for collection '{collection_name}'...")
|
|
549
|
+
# await embeddings.aembed_query("validation_test_string")
|
|
550
|
+
# self.logger.info("Embedding function is valid.")
|
|
551
|
+
# except Exception as e:
|
|
552
|
+
# self.logger.error(
|
|
553
|
+
# f"The provided embedding function is invalid and failed with error: {e}. "
|
|
554
|
+
# f"Cannot create a vector store for collection '{collection_name}'."
|
|
555
|
+
# )
|
|
556
|
+
# raise RuntimeError(f"Invalid embedding function provided.") from e
|
|
579
557
|
|
|
580
558
|
index_params = self.index_params or {
|
|
581
559
|
"metric_type": metric_type,
|
|
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
|
|
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
|