swarmauri-core 0.6.0.dev134__py3-none-any.whl → 0.6.0.dev136__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.
@@ -344,7 +344,7 @@ class ComponentBase(BaseModel):
344
344
  # Append the new ResourceType
345
345
  metadata.append(ResourceType(resource_type))
346
346
  logger.debug(f"Preserving existing metadata and adding ResourceType for resource '{resource_type.__name__}'")
347
- field_annotation = Annotated[base_type, *metadata]
347
+ field_annotation = Annotated[tuple([base_type, *metadata])]
348
348
 
349
349
  # Construct the new type with SubclassUnion and discriminated Union
350
350
  subclass_union = SubclassUnion[resource_type]
@@ -407,19 +407,33 @@ class ComponentBase(BaseModel):
407
407
  @classmethod
408
408
  def recreate_models(cls):
409
409
  """
410
- Recreate all models based on the dynamically generated models_with_fields.
410
+ Recreate all models based on the dynamically generated models_with_fields and type_models_with_fields.
411
411
  """
412
412
  with cls._lock:
413
+ # Generate field mappings for MODEL_REGISTRY
413
414
  models_with_fields = cls.generate_models_with_fields()
414
- for model_class, fields in models_with_fields.items():
415
+ # Generate field mappings for TYPE_REGISTRY
416
+ type_models_with_fields = cls.recreate_type_models()
417
+
418
+ # Combine both dictionaries
419
+ combined_models_with_fields = {**models_with_fields, **type_models_with_fields}
420
+
421
+ for model_class, fields in combined_models_with_fields.items():
415
422
  for field_name, new_type in fields.items():
416
423
  if field_name in model_class.model_fields:
417
- model_class.model_fields[field_name].annotation = new_type
424
+ original_type = model_class.model_fields[field_name].annotation
425
+ if original_type != new_type:
426
+ model_class.model_fields[field_name].annotation = new_type
427
+ logger.debug(f"Updated field '{field_name}' in model '{model_class.__name__}' from '{original_type}' to '{new_type}'")
428
+ else:
429
+ logger.debug(f"No change for field '{field_name}' in model '{model_class.__name__}'")
418
430
  else:
419
- raise ValueError(f"Field '{field_name}' does not exist in model '{model_class.__name__}'")
431
+ logger.error(f"Field '{field_name}' does not exist in model '{model_class.__name__}'")
432
+ continue # Skip to next field
433
+
420
434
  try:
421
435
  model_class.model_rebuild(force=True)
422
- logger.debug(f"'{model_class}' has been successfully recreated.")
436
+ logger.debug(f"'{model_class.__name__}' has been successfully recreated.")
423
437
  except ValidationError as ve:
424
438
  logger.error(f"Validation error while rebuilding model '{model_class.__name__}': {ve}")
425
439
  except Exception as e:
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: swarmauri-core
3
- Version: 0.6.0.dev134
3
+ Version: 0.6.0.dev136
4
4
  Summary: This repository includes core interfaces for the Swarmauri framework.
5
5
  Home-page: http://github.com/swarmauri/swarmauri-sdk
6
6
  License: Apache-2.0
@@ -1,4 +1,4 @@
1
- swarmauri_core/ComponentBase.py,sha256=uYsnIk5Vx8Apz9C3KvT6yBkl99NL_fTGLqasD9e66Us,17070
1
+ swarmauri_core/ComponentBase.py,sha256=M9igl3XA5IgLM9v8BmzfePT0iRRmZP_lnNf0RCrson0,17926
2
2
  swarmauri_core/README.md,sha256=4aqnW3CVwRFMwvmncVf-QbE8LBBrEwgP6cig3Zvf_74,1655
3
3
  swarmauri_core/__init__.py,sha256=x29ORwVY2TLG3oJqAWFjUucWBLcbzygZgfbYeItoJ94,296
4
4
  swarmauri_core/agent_apis/IAgentCommands.py,sha256=Bp1FqWMITA22WPJ0lx_vnwMUeWu33Z3IZyYQJZa-t8M,1961
@@ -108,6 +108,6 @@ swarmauri_core/vectors/IVectorMeta.py,sha256=OdGEqkuBKmfluQ1po8GowchtZWMVY3hJSHe
108
108
  swarmauri_core/vectors/IVectorProduct.py,sha256=qGIM0OrBW8yXo2lYH2Zi_Qz7tmPoQSkEUP_AJOAZ6pc,2043
109
109
  swarmauri_core/vectors/IVectorTransform.py,sha256=JcIg_xH4NBLYXlzdHsXPrgl7P63JmjZz5qn8r4TUImg,1265
110
110
  swarmauri_core/vectors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
111
- swarmauri_core-0.6.0.dev134.dist-info/METADATA,sha256=VI7gXFCXDrIPv49ZNWdLBKRIeBHFBKPQ9MvooFS2Mno,2368
112
- swarmauri_core-0.6.0.dev134.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
113
- swarmauri_core-0.6.0.dev134.dist-info/RECORD,,
111
+ swarmauri_core-0.6.0.dev136.dist-info/METADATA,sha256=R4nq9CWBATboY9tO1L_dIG3JFLyF_Xta8S2OLQblurQ,2368
112
+ swarmauri_core-0.6.0.dev136.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
113
+ swarmauri_core-0.6.0.dev136.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.1
2
+ Generator: poetry-core 2.0.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any