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

@@ -63,7 +63,11 @@ class ModelLoadBalancer:
63
63
  # Instantiate models
64
64
  for model_config in self.models_config:
65
65
  model_id = model_config['id']
66
- self.models[model_id] = self._instantiate_model(model_config)
66
+ model_instance = self._instantiate_model(model_config)
67
+ if model_instance is not None:
68
+ self.models[model_id] = model_instance
69
+ else:
70
+ self.logger.warning(f"Model with id {model_id} was not loaded due to instantiation error.")
67
71
 
68
72
  self._config_loaded = True
69
73
  self.logger.debug("Model balancer: configuration loaded successfully.")
@@ -141,15 +145,21 @@ class ModelLoadBalancer:
141
145
  kwargs['temperature'] = model_config['temperature']
142
146
  return ChatOpenAI(**kwargs)
143
147
  elif provider == 'azure-openai-embeddings':
144
- return AzureOpenAIEmbeddings(
145
- model=model_config['model_name'],
146
- azure_deployment=model_config['deployment_name'],
147
- openai_api_version=model_config['api_version'],
148
- api_key=model_config['api_key'],
149
- azure_endpoint=model_config['api_base'],
150
- dimensions=model_config.get('dimensions', 1536),
151
- chunk_size=16, request_timeout=60, max_retries=2
152
- )
148
+ try:
149
+ emb_kwargs = dict(
150
+ model=model_config['model_name'],
151
+ azure_deployment=model_config['deployment_name'],
152
+ openai_api_version=model_config['api_version'],
153
+ api_key=model_config['api_key'],
154
+ azure_endpoint=model_config['api_base'],
155
+ chunk_size=16, request_timeout=60, max_retries=2
156
+ )
157
+ if 'dimensions' in model_config:
158
+ emb_kwargs['dimensions'] = model_config['dimensions']
159
+ return AzureOpenAIEmbeddings(**emb_kwargs)
160
+ except Exception as e:
161
+ self.logger.error(f"Failed to instantiate AzureOpenAIEmbeddings: {e}")
162
+ return None
153
163
  elif provider == 'google-genai':
154
164
  kwargs = {
155
165
  'google_api_key': model_config['api_key'],
@@ -373,49 +373,6 @@ class VDBService(object):
373
373
 
374
374
  return vdb
375
375
 
376
- def delete_old_indexes(self, url: str = None, vdb: Milvus = None) -> (bool | None):
377
- """ Delete old indexes of the same source_url
378
-
379
- Args:
380
- url (str): source url
381
- vdb (Milvus): Milvus/Zilliz instance
382
- """
383
- self.logger.info(f"Delete old indexes of the same source_url:{url}")
384
-
385
- if url is None or vdb is None:
386
- return None
387
-
388
- # Delete indexes of the same source_url
389
- expr = f'source_url == "{url}" or source == "{url}"'
390
- pks = vdb.get_pks(expr)
391
-
392
- # Delete entities by pks
393
- if pks is not None and len(pks) > 0 :
394
- res = vdb.delete(pks)
395
- self.logger.info("Deleted old indexes result: " + str(res))
396
- return res
397
-
398
- def delete_old_indexes_by_id(self, source_id: str = None, vdb: Milvus = None) -> (bool | None):
399
- """ Delete old indexes of the same source_id
400
-
401
- Args:
402
- source_id (str): source id
403
- """
404
- self.logger.info(f"Delete old indexes of the same source_id:{source_id}")
405
-
406
- if source_id is None or vdb is None:
407
- return None
408
-
409
- # Delete indexes of the same source_id
410
- expr = f'source_id == "{source_id}"'
411
- pks = vdb.get_pks(expr)
412
-
413
- # Delete entities by pks
414
- if pks is not None and len(pks) > 0 :
415
- res = vdb.delete(pks)
416
- self.logger.info("Deleted old indexes result: " + str(res))
417
- return res
418
-
419
376
  def drop_collection(self, collection_name: str) -> None:
420
377
  """
421
378
  Deletes a collection from the vector database and removes it from the cache.
@@ -461,4 +418,46 @@ class VDBService(object):
461
418
  return RuntimeError(f"collection_name must be not null or check out your client to link milvus")
462
419
  client.delete(collection_name=collection_name, filter=filter)
463
420
  except Exception as e:
464
- raise RuntimeError(f"delete collection data failed: {str(e)}")
421
+ raise RuntimeError(f"delete collection data failed: {str(e)}")
422
+
423
+ @staticmethod
424
+ def delete_old_indexes(url: str = None, vdb: Milvus = None) -> (bool | None):
425
+ """ Delete old indexes of the same source_url
426
+
427
+ Args:
428
+ url (str): source url
429
+ vdb (Milvus): Milvus/Zilliz instance
430
+ """
431
+ # Logging is not performed in static method
432
+ if url is None or vdb is None:
433
+ return None
434
+
435
+ # Delete indexes of the same source_url
436
+ expr = f'source_url == "{url}" or source == "{url}"'
437
+ pks = vdb.get_pks(expr)
438
+
439
+ # Delete entities by pks
440
+ if pks is not None and len(pks) > 0 :
441
+ res = vdb.delete(pks)
442
+ return res
443
+
444
+ @staticmethod
445
+ def delete_old_indexes_by_id(source_id: str = None, vdb: Milvus = None) -> (bool | None):
446
+ """ Delete old indexes of the same source_id
447
+
448
+ Args:
449
+ source_id (str): source id
450
+ """
451
+ # Logging is not performed in static method
452
+ if source_id is None or vdb is None:
453
+ return None
454
+
455
+ # Delete indexes of the same source_id
456
+ expr = f'source_id == "{source_id}"'
457
+ pks = vdb.get_pks(expr)
458
+
459
+ # Delete entities by pks
460
+ if pks is not None and len(pks) > 0 :
461
+ res = vdb.delete(pks)
462
+ return res
463
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: crewplus
3
- Version: 0.2.23
3
+ Version: 0.2.25
4
4
  Summary: Base services for CrewPlus AI applications
5
5
  Author-Email: Tim Liu <tim@opsmateai.com>
6
6
  License: MIT
@@ -1,22 +1,22 @@
1
- crewplus-0.2.23.dist-info/METADATA,sha256=1JXSjwepooQSfWJsmXsYlX0OiuyJPUuA4TnxDLG6saA,4991
2
- crewplus-0.2.23.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
- crewplus-0.2.23.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
- crewplus-0.2.23.dist-info/licenses/LICENSE,sha256=2_NHSHRTKB_cTcT_GXgcenOCtIZku8j343mOgAguTfc,1087
1
+ crewplus-0.2.25.dist-info/METADATA,sha256=NynftFjnRM1sFSQfe8PUWMRDuo1YOWyyyjgODaegtBs,4991
2
+ crewplus-0.2.25.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
+ crewplus-0.2.25.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
+ crewplus-0.2.25.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=zUM4ZwUfGMBDx-j7Wehf_KC5yYXPTK8BK_oeO5veIXQ,398
7
7
  crewplus/services/azure_chat_model.py,sha256=xPuIsQpLV5Y3Ntwe3eqvquhBjh35g65VlF22AWJdEcU,8648
8
8
  crewplus/services/gemini_chat_model.py,sha256=HMDt7TKlLpQ43ZPxY9omG64EGFkP846BXT_SfyBeM0I,38415
9
9
  crewplus/services/init_services.py,sha256=U91zoMNJlOEKyldarNnATjeZDT2V-0CrXPAwI64hZkw,758
10
- crewplus/services/model_load_balancer.py,sha256=lRCMKOUl-buLBsOKbtUT2gJEIjoc-WzB7kseztkM4EE,8857
10
+ crewplus/services/model_load_balancer.py,sha256=HH_eHxFfxgarPWFGpANg7dgShnWca4q46Jz0b1vJ4Sw,9405
11
11
  crewplus/utils/__init__.py,sha256=2Gk1n5srFJQnFfBuYTxktdtKOVZyNrFcNaZKhXk35Pw,142
12
12
  crewplus/utils/schema_action.py,sha256=GDaBoVFQD1rXqrLVSMTfXYW1xcUu7eDcHsn57XBSnIg,422
13
13
  crewplus/utils/schema_document_updater.py,sha256=frvffxn2vbi71fHFPoGb9hq7gH2azmmdq17p-Fumnvg,7322
14
14
  crewplus/vectorstores/milvus/__init__.py,sha256=egGncAdjlXG6ekTQvKMKqhvKBifrUrPlsSB0-bpvq4A,229
15
15
  crewplus/vectorstores/milvus/milvus_schema_manager.py,sha256=2IZT61LVui21Pt5Z3y8YYS2dYcwzkgUKxMq2NA0-lQE,9222
16
16
  crewplus/vectorstores/milvus/schema_milvus.py,sha256=IvKdUCH451HJ-F3TUR5jDjqwQlQs4SEXAQ_th4JAnfc,12117
17
- crewplus/vectorstores/milvus/vdb_service.py,sha256=ojKzwk_SIXw89nJIeMa9fi_IbtWe96HB__hlmwEAn0s,21287
17
+ crewplus/vectorstores/milvus/vdb_service.py,sha256=wCltxZc0aD27iTu7wjveHqQWPEF2VyO4B2WGQCheeVs,21118
18
18
  docs/GeminiChatModel.md,sha256=_IQyup3ofAa2HxfSurO1GYUEezTHYYt5Q1khYNVThGM,8040
19
19
  docs/ModelLoadBalancer.md,sha256=aGHES1dcXPz4c7Y8kB5-vsCNJjriH2SWmjBkSGoYKiI,4398
20
20
  docs/VDBService.md,sha256=Dw286Rrf_fsi13jyD3Bo4Sy7nZ_G7tYm7d8MZ2j9hxk,9375
21
21
  docs/index.md,sha256=3tlc15uR8lzFNM5WjdoZLw0Y9o1P1gwgbEnOdIBspqc,1643
22
- crewplus-0.2.23.dist-info/RECORD,,
22
+ crewplus-0.2.25.dist-info/RECORD,,