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

@@ -16,7 +16,7 @@ import uuid
16
16
 
17
17
  from ...services.init_services import get_model_balancer
18
18
  from .schema_milvus import SchemaMilvus, DEFAULT_SCHEMA
19
- from .milvus_schema_manager import MilvusSchemaManager
19
+ #from .milvus_schema_manager import MilvusSchemaManager
20
20
 
21
21
  class VDBService(object):
22
22
  """
@@ -93,7 +93,7 @@ class VDBService(object):
93
93
  >>> assert vector_store is same_vector_store
94
94
  """
95
95
  _client: MilvusClient
96
- _async_client: AsyncMilvusClient
96
+ _async_client: Optional[AsyncMilvusClient] = None
97
97
  _instances: Dict[str, Milvus] = {}
98
98
  _async_instances: Dict[str, Milvus] = {}
99
99
 
@@ -154,6 +154,8 @@ class VDBService(object):
154
154
  self.logger.error(msg)
155
155
  raise ValueError(msg)
156
156
 
157
+ self._provider = provider # Store provider for lazy initialization
158
+
157
159
  # Create separate aliases for sync and async clients to avoid connection handler race conditions.
158
160
  self.sync_alias = f"crewplus-vdb-sync-{uuid.uuid4()}"
159
161
  self.async_alias = f"crewplus-vdb-async-{uuid.uuid4()}"
@@ -163,12 +165,13 @@ class VDBService(object):
163
165
  self.connection_args['alias'] = self.sync_alias
164
166
 
165
167
  self._client = self._initialize_milvus_client(provider)
166
- self._async_client = self._initialize_async_milvus_client(provider)
168
+ # lazy-initialize async milvus
169
+ # self._async_client = self._initialize_async_milvus_client(provider)
167
170
 
168
171
  self.schema = schema
169
172
  self.index_params = self.settings.get("index_params")
170
173
 
171
- self.schema_manager = MilvusSchemaManager(client=self._client, async_client=self._async_client)
174
+ #self.schema_manager = MilvusSchemaManager(client=self._client, async_client=self._async_client)
172
175
 
173
176
  self.logger.info("VDBService initialized successfully")
174
177
 
@@ -240,20 +243,28 @@ class VDBService(object):
240
243
 
241
244
  def get_vector_client(self) -> MilvusClient:
242
245
  """
243
- Returns the active MilvusClient instance.
246
+ Returns the active MilvusClient instance, initializing it if necessary.
244
247
 
245
248
  Returns:
246
249
  MilvusClient: The initialized client for interacting with the vector database.
247
250
  """
251
+ if self._client is None:
252
+ self.logger.debug("Initializing synchronous MilvusClient...")
253
+ self._client = self._initialize_milvus_client(self._provider)
254
+
248
255
  return self._client
249
256
 
250
257
  def get_async_vector_client(self) -> AsyncMilvusClient:
251
258
  """
252
- Returns the active AsyncMilvusClient instance.
259
+ Returns the active AsyncMilvusClient instance, initializing it if necessary.
253
260
 
254
261
  Returns:
255
262
  AsyncMilvusClient: The initialized async client for interacting with the vector database.
256
263
  """
264
+ if self._async_client is None:
265
+ self.logger.debug("Initializing asynchronous AsyncMilvusClient...")
266
+ self._async_client = self._initialize_async_milvus_client(self._provider)
267
+
257
268
  return self._async_client
258
269
 
259
270
  def get_vector_field(self, collection_name: str) -> str:
@@ -374,6 +385,9 @@ class VDBService(object):
374
385
  index_params=self.index_params
375
386
  )
376
387
 
388
+ #ensure using async connection alias
389
+ schema_milvus.aclient._using = self.async_alias
390
+
377
391
  schema_to_use = self.schema or DEFAULT_SCHEMA
378
392
  if not self.schema:
379
393
  self.logger.warning(f"No schema provided for VDBService. Using DEFAULT_SCHEMA for collection '{collection_name}'.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: crewplus
3
- Version: 0.2.56
3
+ Version: 0.2.58
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.56.dist-info/METADATA,sha256=ccwA_6ip1D6ZEviEIiTtshF4wqO54TS5THUBV7wDSJY,5459
2
- crewplus-0.2.56.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
- crewplus-0.2.56.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
- crewplus-0.2.56.dist-info/licenses/LICENSE,sha256=2_NHSHRTKB_cTcT_GXgcenOCtIZku8j343mOgAguTfc,1087
1
+ crewplus-0.2.58.dist-info/METADATA,sha256=bcVORIdlBj4keo_14dBUc9N6UDu9ch2p8JmBXSvFqIk,5459
2
+ crewplus-0.2.58.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
+ crewplus-0.2.58.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
+ crewplus-0.2.58.dist-info/licenses/LICENSE,sha256=2_NHSHRTKB_cTcT_GXgcenOCtIZku8j343mOgAguTfc,1087
5
5
  crewplus/__init__.py,sha256=m46HkZL1Y4toD619NL47Sn2Qe084WFFSFD7e6VoYKZc,284
6
6
  crewplus/callbacks/__init__.py,sha256=YG7ieeb91qEjp1zF0-inEN7mjZ7yT_D2yzdWFT8Z1Ws,63
7
7
  crewplus/callbacks/async_langfuse_handler.py,sha256=A4uFeLpvOUdc58M7sZoE65_C1V98u0QCvx5jUquM0pM,7006
@@ -17,9 +17,9 @@ crewplus/utils/schema_document_updater.py,sha256=frvffxn2vbi71fHFPoGb9hq7gH2azmm
17
17
  crewplus/vectorstores/milvus/__init__.py,sha256=OeYv2rdyG7tcREIjBJPyt2TbE54NvyeRoWMe7LwopRE,245
18
18
  crewplus/vectorstores/milvus/milvus_schema_manager.py,sha256=-QRav-hzu-XWeJ_yKUMolal_EyMUspSg-nvh5sqlrlQ,11442
19
19
  crewplus/vectorstores/milvus/schema_milvus.py,sha256=wwNpfqsKS0xeozZES40IvB0iNwUtpCall_7Hkg0dL1g,27223
20
- crewplus/vectorstores/milvus/vdb_service.py,sha256=AomZTlwKaw1r_9xgWPVJGBJlJjMlwb-Jn1CWBSsS2Eg,34387
20
+ crewplus/vectorstores/milvus/vdb_service.py,sha256=sVDThSfsSq_aISJToU4yWY0nRfm9cOyIpIj_0YeJCXg,35111
21
21
  docs/GeminiChatModel.md,sha256=zZYyl6RmjZTUsKxxMiC9O4yV70MC4TD-IGUmWhIDBKA,8677
22
22
  docs/ModelLoadBalancer.md,sha256=aGHES1dcXPz4c7Y8kB5-vsCNJjriH2SWmjBkSGoYKiI,4398
23
23
  docs/VDBService.md,sha256=Dw286Rrf_fsi13jyD3Bo4Sy7nZ_G7tYm7d8MZ2j9hxk,9375
24
24
  docs/index.md,sha256=3tlc15uR8lzFNM5WjdoZLw0Y9o1P1gwgbEnOdIBspqc,1643
25
- crewplus-0.2.56.dist-info/RECORD,,
25
+ crewplus-0.2.58.dist-info/RECORD,,