crewplus 0.2.5__tar.gz → 0.2.6__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.

@@ -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
@@ -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",
@@ -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
 
@@ -6,7 +6,7 @@ build-backend = "pdm.backend"
6
6
 
7
7
  [project]
8
8
  name = "crewplus"
9
- version = "0.2.5"
9
+ version = "0.2.6"
10
10
  description = "Base services for CrewPlus AI applications"
11
11
  authors = [
12
12
  { name = "Tim Liu", email = "tim@opsmateai.com" },
File without changes
File without changes
File without changes
File without changes