swarmauri-core 0.6.0.dev127__tar.gz → 0.6.0.dev129__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.
Files changed (113) hide show
  1. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/PKG-INFO +1 -1
  2. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/pyproject.toml +1 -1
  3. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/ComponentBase.py +48 -21
  4. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/README.md +0 -0
  5. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/README.md +0 -0
  6. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/__init__.py +0 -0
  7. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/agent_apis/IAgentCommands.py +0 -0
  8. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/agent_apis/IAgentRouterCRUD.py +0 -0
  9. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/agent_apis/__init__.py +0 -0
  10. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/agent_factories/IExportConf.py +0 -0
  11. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/agent_factories/__init__.py +0 -0
  12. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/agents/IAgent.py +0 -0
  13. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/agents/IAgentConversation.py +0 -0
  14. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/agents/IAgentParser.py +0 -0
  15. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/agents/IAgentRetrieve.py +0 -0
  16. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/agents/IAgentSystemContext.py +0 -0
  17. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/agents/IAgentToolkit.py +0 -0
  18. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/agents/IAgentVectorStore.py +0 -0
  19. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/agents/__init__.py +0 -0
  20. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/chains/ICallableChain.py +0 -0
  21. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/chains/IChain.py +0 -0
  22. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/chains/IChainContext.py +0 -0
  23. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/chains/IChainContextLoader.py +0 -0
  24. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/chains/IChainDependencyResolver.py +0 -0
  25. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/chains/IChainFactory.py +0 -0
  26. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/chains/IChainStep.py +0 -0
  27. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/chains/__init__.py +0 -0
  28. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/chunkers/IChunker.py +0 -0
  29. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/chunkers/__init__.py +0 -0
  30. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/control_panels/IControlPanel.py +0 -0
  31. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/control_panels/__init__.py +0 -0
  32. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/conversations/IConversation.py +0 -0
  33. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/conversations/IMaxSize.py +0 -0
  34. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/conversations/ISystemContext.py +0 -0
  35. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/conversations/__init__.py +0 -0
  36. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/dataconnectors/IDataConnector.py +0 -0
  37. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/dataconnectors/__init__.py +0 -0
  38. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/distances/IDistanceSimilarity.py +0 -0
  39. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/distances/__init__.py +0 -0
  40. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/document_stores/IDocumentRetrieve.py +0 -0
  41. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/document_stores/IDocumentStore.py +0 -0
  42. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/document_stores/__init__.py +0 -0
  43. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/documents/IDocument.py +0 -0
  44. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/documents/IExperimentDocument.py +0 -0
  45. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/documents/__init__.py +0 -0
  46. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/embeddings/IFeature.py +0 -0
  47. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/embeddings/ISaveModel.py +0 -0
  48. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/embeddings/IVectorize.py +0 -0
  49. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/embeddings/__init__.py +0 -0
  50. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/experiment_stores/IExperimentStore.py +0 -0
  51. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/experiment_stores/__init__.py +0 -0
  52. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/factories/IFactory.py +0 -0
  53. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/factories/__init__.py +0 -0
  54. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/image_gens/IGenImage.py +0 -0
  55. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/image_gens/__init__.py +0 -0
  56. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/llms/IFit.py +0 -0
  57. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/llms/IPredict.py +0 -0
  58. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/llms/__init__.py +0 -0
  59. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/measurements/IMeasurement.py +0 -0
  60. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/measurements/IMeasurementAggregate.py +0 -0
  61. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/measurements/IMeasurementCalculate.py +0 -0
  62. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/measurements/IThreshold.py +0 -0
  63. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/measurements/__init__.py +0 -0
  64. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/messages/IMessage.py +0 -0
  65. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/messages/__init__.py +0 -0
  66. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/parsers/IParser.py +0 -0
  67. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/parsers/__init__.py +0 -0
  68. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/pipelines/IPipeline.py +0 -0
  69. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/pipelines/__init__.py +0 -0
  70. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/prompts/IPrompt.py +0 -0
  71. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/prompts/IPromptMatrix.py +0 -0
  72. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/prompts/ITemplate.py +0 -0
  73. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/prompts/__init__.py +0 -0
  74. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/schema_converters/ISchemaConvert.py +0 -0
  75. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/schema_converters/__init__.py +0 -0
  76. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/service_registries/IServiceRegistry.py +0 -0
  77. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/service_registries/__init__.py +0 -0
  78. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/state/IState.py +0 -0
  79. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/swarm_apis/IAgentRegistrationAPI.py +0 -0
  80. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/swarm_apis/ISwarmAPI.py +0 -0
  81. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/swarm_apis/__init__.py +0 -0
  82. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/swarms/ISwarm.py +0 -0
  83. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/swarms/__init__.py +0 -0
  84. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/task_mgmt_strategies/ITaskMgmtStrategy.py +0 -0
  85. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/task_mgmt_strategies/__init__.py +0 -0
  86. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/toolkits/IToolkit.py +0 -0
  87. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/toolkits/__init__.py +0 -0
  88. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/tools/IParameter.py +0 -0
  89. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/tools/ITool.py +0 -0
  90. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/tools/__init__.py +0 -0
  91. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/tracing/IChainTracer.py +0 -0
  92. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/tracing/ITraceContext.py +0 -0
  93. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/tracing/ITracer.py +0 -0
  94. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/tracing/__init__.py +0 -0
  95. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/transports/ITransport.py +0 -0
  96. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/transports/__init__.py +0 -0
  97. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/utils/ITransactional.py +0 -0
  98. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/utils/__init__.py +0 -0
  99. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/vcms/IPredictVision.py +0 -0
  100. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/vcms/__init__.py +0 -0
  101. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/vector_stores/ICloudVectorStore.py +0 -0
  102. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/vector_stores/IPersistentVectorStore.py +0 -0
  103. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/vector_stores/ISimilarity.py +0 -0
  104. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/vector_stores/IVectorNorm.py +0 -0
  105. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/vector_stores/IVectorStore.py +0 -0
  106. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/vector_stores/IVectorStoreRetrieve.py +0 -0
  107. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/vector_stores/IVectorStoreSaveLoad.py +0 -0
  108. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/vector_stores/__init__.py +0 -0
  109. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/vectors/IVector.py +0 -0
  110. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/vectors/IVectorMeta.py +0 -0
  111. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/vectors/IVectorProduct.py +0 -0
  112. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/vectors/IVectorTransform.py +0 -0
  113. {swarmauri_core-0.6.0.dev127 → swarmauri_core-0.6.0.dev129}/swarmauri_core/vectors/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: swarmauri-core
3
- Version: 0.6.0.dev127
3
+ Version: 0.6.0.dev129
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,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "swarmauri-core"
3
- version = "0.6.0.dev127"
3
+ version = "0.6.0.dev129"
4
4
  description = "This repository includes core interfaces for the Swarmauri framework."
5
5
  authors = ["Jacob Stewart <jacob@swarmauri.com>"]
6
6
  license = "Apache-2.0"
@@ -28,7 +28,7 @@ from typing import (
28
28
  logger = logging.getLogger(__name__)
29
29
  T = TypeVar("T", bound="ComponentBase")
30
30
 
31
- class SubclassUnion(Generic[T], type):
31
+ class SubclassUnion(type):
32
32
  """
33
33
  A generic class to create discriminated unions based on resource types.
34
34
  """
@@ -99,7 +99,7 @@ class ComponentBase(BaseModel):
99
99
  # Class-level registry mapping resource types to their type mappings
100
100
  TYPE_REGISTRY: ClassVar[Dict[Type['ComponentBase'], Dict[str, Type['ComponentBase']]]] = {}
101
101
  # Model registry mapping models to their resource types
102
- MODEL_REGISTRY: ClassVar[Dict[Type[BaseModel], Type['ComponentBase']]] = {}
102
+ MODEL_REGISTRY: ClassVar[Dict[Type[BaseModel], List[Type['ComponentBase']]]] = {}
103
103
  _lock: ClassVar[Lock] = Lock()
104
104
 
105
105
  name: Optional[str] = None
@@ -140,11 +140,11 @@ class ComponentBase(BaseModel):
140
140
 
141
141
  @classmethod
142
142
  def swm_ismethod_registered(cls, method_name: str):
143
- return method_name in cls.public_interfaces()
143
+ return method_name in cls.swm_public_interfaces()
144
144
 
145
145
  @classmethod
146
146
  def swm_method_signature(cls, input_signature):
147
- for method_name in cls.public_interfaces():
147
+ for method_name in cls.swm_public_interfaces():
148
148
  method = getattr(cls, method_name)
149
149
  if callable(method):
150
150
  sig = str(inspect.signature(method))
@@ -152,8 +152,6 @@ class ComponentBase(BaseModel):
152
152
  return True
153
153
  return False
154
154
 
155
- # Experimental properties in support of Remote Execution
156
-
157
155
  @property
158
156
  def swm_path(self):
159
157
  if self.host and self.owner:
@@ -196,9 +194,9 @@ class ComponentBase(BaseModel):
196
194
  if model_cls not in cls.MODEL_REGISTRY:
197
195
  cls.MODEL_REGISTRY[model_cls] = []
198
196
 
199
- # Inspect all fields to find SubclassUnion annotations
197
+ # Inspect all fields to find SubclassUnion annotations, including inherited fields
200
198
  for field_name, field in model_cls.__fields__.items():
201
- field_annotation = model_cls.__annotations__.get(field_name)
199
+ field_annotation = cls.get_field_annotation(model_cls, field_name)
202
200
  if not field_annotation:
203
201
  continue
204
202
 
@@ -210,10 +208,29 @@ class ComponentBase(BaseModel):
210
208
  if resource_type not in cls.MODEL_REGISTRY[model_cls]:
211
209
  cls.MODEL_REGISTRY[model_cls].append(resource_type)
212
210
  logger.info(f"Registered model '{model_cls.__name__}' for resource '{resource_type.__name__}'")
213
- cls.recreate_models()
214
211
  return model_cls
215
212
  return decorator
216
213
 
214
+ @classmethod
215
+ def get_field_annotation(cls, model_cls: Type[BaseModel], field_name: str):
216
+ """
217
+ Retrieve the field annotation for a given field, including inherited fields.
218
+
219
+ Parameters:
220
+ - model_cls: The Pydantic model class.
221
+ - field_name: The name of the field.
222
+
223
+ Returns:
224
+ - The type annotation of the field, or None if not found.
225
+ """
226
+ for base in inspect.getmro(model_cls):
227
+ if base == object:
228
+ continue
229
+ annotations = getattr(base, '__annotations__', {})
230
+ if field_name in annotations:
231
+ return annotations[field_name]
232
+ return None
233
+
217
234
  @classmethod
218
235
  def get_class_by_type(cls, resource_type: Type[T], type_name: str) -> Type['ComponentBase']:
219
236
  """
@@ -250,7 +267,6 @@ class ComponentBase(BaseModel):
250
267
  return any(cls.field_contains_subclass_union(arg) for arg in args)
251
268
  return False
252
269
 
253
-
254
270
  @classmethod
255
271
  def extract_resource_types_from_field(cls, field_annotation) -> List[Type['ComponentBase']]:
256
272
  """
@@ -294,7 +310,6 @@ class ComponentBase(BaseModel):
294
310
 
295
311
  return resource_types
296
312
 
297
-
298
313
  @classmethod
299
314
  def determine_new_type(cls, field_annotation, resource_type):
300
315
  """
@@ -369,20 +384,28 @@ class ComponentBase(BaseModel):
369
384
 
370
385
  return new_type
371
386
 
372
-
373
387
  @classmethod
374
388
  def generate_models_with_fields(cls) -> Dict[Type[BaseModel], Dict[str, Any]]:
375
389
  """
376
- Automatically generate the models_with_fields dictionary based on registered models.
377
-
390
+ Automatically generate the models_with_fields dictionary based on registered models,
391
+ including subclasses that inherit fields using SubclassUnion.
392
+
378
393
  Returns:
379
394
  - A dictionary mapping model classes to their fields and corresponding resource types.
380
395
  """
381
396
  models_with_fields = {}
382
- for model_cls, resource_types in cls.MODEL_REGISTRY.items():
397
+
398
+ # Collect all models, including subclasses of registered models
399
+ all_models = set(cls.MODEL_REGISTRY.keys())
400
+ for model_cls in list(all_models):
401
+ for subclass in model_cls.__subclasses__():
402
+ if issubclass(subclass, BaseModel):
403
+ all_models.add(subclass)
404
+
405
+ for model_cls in all_models:
383
406
  models_with_fields[model_cls] = {}
384
- for field_name, field in model_cls.__fields__.items():
385
- field_annotation = model_cls.__annotations__.get(field_name)
407
+ for field_name in model_cls.__fields__:
408
+ field_annotation = cls.get_field_annotation(model_cls, field_name)
386
409
  if not field_annotation:
387
410
  continue
388
411
 
@@ -398,6 +421,7 @@ class ComponentBase(BaseModel):
398
421
 
399
422
  return models_with_fields
400
423
 
424
+
401
425
  @classmethod
402
426
  def recreate_models(cls):
403
427
  """
@@ -411,8 +435,11 @@ class ComponentBase(BaseModel):
411
435
  model_class.model_fields[field_name].annotation = new_type
412
436
  else:
413
437
  raise ValueError(f"Field '{field_name}' does not exist in model '{model_class.__name__}'")
414
- if model_class.model_rebuild(force=True):
438
+ try:
439
+ model_class.model_rebuild(force=True)
415
440
  logger.debug(f"'{model_class}' has been successfully recreated.")
416
- else:
417
- logger.debug(f"'{model_class}' recreation has failed.")
418
- logger.info("All models have been successfully recreated.")
441
+ except ValidationError as ve:
442
+ logger.error(f"Validation error while rebuilding model '{model_class.__name__}': {ve}")
443
+ except Exception as e:
444
+ logger.error(f"Error while rebuilding model '{model_class.__name__}': {e}")
445
+ logger.info("All models have been successfully recreated.")