crewplus 0.2.5__py3-none-any.whl → 0.2.6__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.

@@ -248,8 +248,8 @@ class VDBService(object):
248
248
  def get_vector_store(self, collection_name: str, embeddings: Embeddings = None, metric_type: str = "L2") -> Zilliz:
249
249
  """
250
250
  Gets a vector store instance, creating it if it doesn't exist for the collection.
251
-
252
- This method caches instances by collection name to avoid re-instantiation.
251
+ This method validates both the embedding function and the vector store connection
252
+ before caching the instance to prevent faulty instances from being reused.
253
253
 
254
254
  Args:
255
255
  collection_name (str): The name of the collection in the vector database.
@@ -272,6 +272,19 @@ class VDBService(object):
272
272
  if embeddings is None:
273
273
  embeddings = self.get_embeddings()
274
274
 
275
+ # 1. Validate the embedding function before proceeding.
276
+ try:
277
+ self.logger.debug(f"Testing embedding function for collection '{collection_name}'...")
278
+ embeddings.embed_query("validation_test_string")
279
+ self.logger.debug("Embedding function is valid.")
280
+ except Exception as e:
281
+ self.logger.error(
282
+ f"The provided embedding function is invalid and failed with error: {e}. "
283
+ f"Cannot create a vector store for collection '{collection_name}'."
284
+ )
285
+ raise RuntimeError(f"Invalid embedding function provided.") from e
286
+
287
+ # If embeddings are valid, proceed to create the Zilliz instance.
275
288
  index_params = self.index_params or {
276
289
  "metric_type": metric_type,
277
290
  "index_type": "AUTOINDEX",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: crewplus
3
- Version: 0.2.5
3
+ Version: 0.2.6
4
4
  Summary: Base services for CrewPlus AI applications
5
5
  Author-Email: Tim Liu <tim@opsmateai.com>
6
6
  License: MIT
@@ -1,7 +1,7 @@
1
- crewplus-0.2.5.dist-info/METADATA,sha256=D9FcMOIX_tv8VbPdxDfA_0WwIjvT5Q3Wkyy6x8OAtpY,4909
2
- crewplus-0.2.5.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
- crewplus-0.2.5.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
- crewplus-0.2.5.dist-info/licenses/LICENSE,sha256=2_NHSHRTKB_cTcT_GXgcenOCtIZku8j343mOgAguTfc,1087
1
+ crewplus-0.2.6.dist-info/METADATA,sha256=EWHY3KjrDXJjYeO-WqNITUVJ_3gzhjMwE6f6trstGD0,4909
2
+ crewplus-0.2.6.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
+ crewplus-0.2.6.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
+ crewplus-0.2.6.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,9 +12,9 @@ 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=QfoQaB1JBdhX8XY-2iz65i7OqPn3u8Vzyq_w0YIpZpE,16718
15
+ crewplus/vectorstores/milvus/vdb_service.py,sha256=iCiSXcmtpD9tW1WYyJ1P0SRJEFEsUoH3lY65mnwf6R8,17524
16
16
  docs/GeminiChatModel.md,sha256=_IQyup3ofAa2HxfSurO1GYUEezTHYYt5Q1khYNVThGM,8040
17
17
  docs/ModelLoadBalancer.md,sha256=aGHES1dcXPz4c7Y8kB5-vsCNJjriH2SWmjBkSGoYKiI,4398
18
- docs/VDBService.md,sha256=vrdYqI5BCLgwOIsEP0NSCQgKDIHXFQ6nj1-9nENZOjQ,9364
18
+ docs/VDBService.md,sha256=Dw286Rrf_fsi13jyD3Bo4Sy7nZ_G7tYm7d8MZ2j9hxk,9375
19
19
  docs/index.md,sha256=3tlc15uR8lzFNM5WjdoZLw0Y9o1P1gwgbEnOdIBspqc,1643
20
- crewplus-0.2.5.dist-info/RECORD,,
20
+ crewplus-0.2.6.dist-info/RECORD,,
docs/VDBService.md CHANGED
@@ -101,7 +101,7 @@ This requires the `ModelLoadBalancer` to have been initialized, as shown in the
101
101
  # The service will call get_model_balancer() internally to get the initialized instance.
102
102
  embedding_model = vdb_service.get_embeddings(
103
103
  from_model_balancer=True,
104
- provider="azure-openai",
104
+ provider="azure-openai-embeddings",
105
105
  model_type="embedding-large" # Specify the model type configured in the balancer
106
106
  )
107
107