swarmauri-core 0.6.0.dev118__tar.gz → 0.6.0.dev120__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.dev118 → swarmauri_core-0.6.0.dev120}/PKG-INFO +1 -1
  2. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/pyproject.toml +1 -1
  3. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/ComponentBase.py +20 -65
  4. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/README.md +0 -0
  5. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/README.md +0 -0
  6. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/__init__.py +0 -0
  7. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agent_apis/IAgentCommands.py +0 -0
  8. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agent_apis/IAgentRouterCRUD.py +0 -0
  9. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agent_apis/__init__.py +0 -0
  10. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agent_factories/IExportConf.py +0 -0
  11. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agent_factories/__init__.py +0 -0
  12. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agents/IAgent.py +0 -0
  13. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agents/IAgentConversation.py +0 -0
  14. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agents/IAgentParser.py +0 -0
  15. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agents/IAgentRetrieve.py +0 -0
  16. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agents/IAgentSystemContext.py +0 -0
  17. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agents/IAgentToolkit.py +0 -0
  18. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agents/IAgentVectorStore.py +0 -0
  19. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agents/__init__.py +0 -0
  20. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/ICallableChain.py +0 -0
  21. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/IChain.py +0 -0
  22. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/IChainContext.py +0 -0
  23. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/IChainContextLoader.py +0 -0
  24. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/IChainDependencyResolver.py +0 -0
  25. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/IChainFactory.py +0 -0
  26. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/IChainStep.py +0 -0
  27. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/__init__.py +0 -0
  28. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chunkers/IChunker.py +0 -0
  29. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chunkers/__init__.py +0 -0
  30. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/control_panels/IControlPanel.py +0 -0
  31. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/control_panels/__init__.py +0 -0
  32. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/conversations/IConversation.py +0 -0
  33. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/conversations/IMaxSize.py +0 -0
  34. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/conversations/ISystemContext.py +0 -0
  35. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/conversations/__init__.py +0 -0
  36. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/dataconnectors/IDataConnector.py +0 -0
  37. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/dataconnectors/__init__.py +0 -0
  38. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/distances/IDistanceSimilarity.py +0 -0
  39. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/distances/__init__.py +0 -0
  40. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/document_stores/IDocumentRetrieve.py +0 -0
  41. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/document_stores/IDocumentStore.py +0 -0
  42. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/document_stores/__init__.py +0 -0
  43. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/documents/IDocument.py +0 -0
  44. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/documents/IExperimentDocument.py +0 -0
  45. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/documents/__init__.py +0 -0
  46. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/embeddings/IFeature.py +0 -0
  47. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/embeddings/ISaveModel.py +0 -0
  48. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/embeddings/IVectorize.py +0 -0
  49. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/embeddings/__init__.py +0 -0
  50. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/experiment_stores/IExperimentStore.py +0 -0
  51. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/experiment_stores/__init__.py +0 -0
  52. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/factories/IFactory.py +0 -0
  53. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/factories/__init__.py +0 -0
  54. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/image_gens/IGenImage.py +0 -0
  55. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/image_gens/__init__.py +0 -0
  56. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/llms/IFit.py +0 -0
  57. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/llms/IPredict.py +0 -0
  58. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/llms/__init__.py +0 -0
  59. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/measurements/IMeasurement.py +0 -0
  60. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/measurements/IMeasurementAggregate.py +0 -0
  61. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/measurements/IMeasurementCalculate.py +0 -0
  62. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/measurements/IThreshold.py +0 -0
  63. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/measurements/__init__.py +0 -0
  64. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/messages/IMessage.py +0 -0
  65. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/messages/__init__.py +0 -0
  66. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/parsers/IParser.py +0 -0
  67. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/parsers/__init__.py +0 -0
  68. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/pipelines/IPipeline.py +0 -0
  69. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/pipelines/__init__.py +0 -0
  70. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/prompts/IPrompt.py +0 -0
  71. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/prompts/IPromptMatrix.py +0 -0
  72. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/prompts/ITemplate.py +0 -0
  73. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/prompts/__init__.py +0 -0
  74. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/schema_converters/ISchemaConvert.py +0 -0
  75. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/schema_converters/__init__.py +0 -0
  76. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/service_registries/IServiceRegistry.py +0 -0
  77. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/service_registries/__init__.py +0 -0
  78. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/state/IState.py +0 -0
  79. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/swarm_apis/IAgentRegistrationAPI.py +0 -0
  80. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/swarm_apis/ISwarmAPI.py +0 -0
  81. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/swarm_apis/__init__.py +0 -0
  82. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/swarms/ISwarm.py +0 -0
  83. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/swarms/__init__.py +0 -0
  84. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/task_mgmt_strategies/ITaskMgmtStrategy.py +0 -0
  85. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/task_mgmt_strategies/__init__.py +0 -0
  86. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/toolkits/IToolkit.py +0 -0
  87. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/toolkits/__init__.py +0 -0
  88. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/tools/IParameter.py +0 -0
  89. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/tools/ITool.py +0 -0
  90. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/tools/__init__.py +0 -0
  91. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/tracing/IChainTracer.py +0 -0
  92. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/tracing/ITraceContext.py +0 -0
  93. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/tracing/ITracer.py +0 -0
  94. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/tracing/__init__.py +0 -0
  95. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/transports/ITransport.py +0 -0
  96. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/transports/__init__.py +0 -0
  97. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/utils/ITransactional.py +0 -0
  98. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/utils/__init__.py +0 -0
  99. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vcms/IPredictVision.py +0 -0
  100. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vcms/__init__.py +0 -0
  101. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vector_stores/ICloudVectorStore.py +0 -0
  102. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vector_stores/IPersistentVectorStore.py +0 -0
  103. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vector_stores/ISimilarity.py +0 -0
  104. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vector_stores/IVectorNorm.py +0 -0
  105. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vector_stores/IVectorStore.py +0 -0
  106. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vector_stores/IVectorStoreRetrieve.py +0 -0
  107. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vector_stores/IVectorStoreSaveLoad.py +0 -0
  108. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vector_stores/__init__.py +0 -0
  109. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vectors/IVector.py +0 -0
  110. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vectors/IVectorMeta.py +0 -0
  111. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vectors/IVectorProduct.py +0 -0
  112. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vectors/IVectorTransform.py +0 -0
  113. {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/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.dev118
3
+ Version: 0.6.0.dev120
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.dev118"
3
+ version = "0.6.0.dev120"
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"
@@ -44,11 +44,11 @@ class SubclassUnion(Generic[T], type):
44
44
  """
45
45
  registered_classes = list(ComponentBase.TYPE_REGISTRY.get(resource_type, {}).values())
46
46
  if not registered_classes:
47
- logger.warning(f"No subclasses registered for resource type '{resource_type.__name__}'. Using 'PlaceholderPlugin' as a placeholder.")
48
- registered_classes = [PlaceholderPlugin]
49
-
50
- union_type = Union[tuple(registered_classes)]
51
- return Annotated[union_type, Field(serialization_alias=f"SubclassUnion[{resource_type.__name__}]", discriminator='type')]
47
+ logger.warning(f"No subclasses registered for resource type '{resource_type.__name__}'. Using 'Any' as a placeholder.")
48
+ union_type = Any
49
+ else:
50
+ union_type = Union[tuple(registered_classes)]
51
+ return Annotated[union_type, Field(discriminator='type')]
52
52
 
53
53
  class ResourceTypes(Enum):
54
54
  UNIVERSAL_BASE = "ComponentBase"
@@ -181,7 +181,7 @@ class ComponentBase(BaseModel):
181
181
  cls.TYPE_REGISTRY[resource_type] = {}
182
182
  cls.TYPE_REGISTRY[resource_type][type_name] = subclass
183
183
  # Automatically recreate models after registering a new type
184
- cls.recreate_models_for_resource(resource_type)
184
+ cls.recreate_models()
185
185
  logger.info(f"Registered type '{type_name}' for resource '{resource_type.__name__}' with subclass '{subclass.__name__}'")
186
186
  return subclass
187
187
  return decorator
@@ -211,11 +211,6 @@ class ComponentBase(BaseModel):
211
211
  if resource_type not in cls.MODEL_REGISTRY[model_cls]:
212
212
  cls.MODEL_REGISTRY[model_cls].append(resource_type)
213
213
  logger.info(f"Registered model '{model_cls.__name__}' for resource '{resource_type.__name__}'")
214
-
215
- # Recreate models for all associated resource types
216
- for resource_type in cls.MODEL_REGISTRY[model_cls]:
217
- cls.recreate_models_for_resource(resource_type)
218
-
219
214
  return model_cls
220
215
  return decorator
221
216
 
@@ -233,16 +228,16 @@ class ComponentBase(BaseModel):
233
228
  """
234
229
  return cls.TYPE_REGISTRY.get(resource_type, {}).get(type_name)
235
230
 
236
- @classmethod
231
+ @classmethod
237
232
  def field_contains_subclass_union(cls, field_annotation) -> bool:
238
233
  """
239
- Check if the field annotation contains a SubclassUnion or the placeholder PlaceholderPlugin.
234
+ Check if the field annotation contains a SubclassUnion.
240
235
 
241
236
  Parameters:
242
237
  - field_annotation: The type annotation of the field.
243
238
 
244
239
  Returns:
245
- - True if SubclassUnion or PlaceholderPlugin is present, False otherwise.
240
+ - True if SubclassUnion is present, False otherwise.
246
241
  """
247
242
  if isinstance(field_annotation, type(SubclassUnion)):
248
243
  return True
@@ -253,15 +248,13 @@ class ComponentBase(BaseModel):
253
248
  elif origin in {list, List, dict, Dict, Union}:
254
249
  args = get_args(field_annotation)
255
250
  return any(cls.field_contains_subclass_union(arg) for arg in args)
256
- elif inspect.isclass(field_annotation) and issubclass(field_annotation, PlaceholderPlugin):
257
- return True
258
251
  return False
259
252
 
260
253
 
261
254
  @classmethod
262
255
  def extract_resource_types_from_field(cls, field_annotation) -> List[Type['ComponentBase']]:
263
256
  """
264
- Extracts all resource types from a field annotation that uses SubclassUnion or PlaceholderPlugin.
257
+ Extracts all resource types from a field annotation that uses SubclassUnion.
265
258
 
266
259
  Parameters:
267
260
  - field_annotation: The type annotation of the field.
@@ -298,9 +291,6 @@ class ComponentBase(BaseModel):
298
291
  # Handle Dict[key_type, SubclassUnion[ResourceType]]
299
292
  value_type = args[1]
300
293
  resource_types.extend(cls.extract_resource_types_from_field(value_type))
301
- elif inspect.isclass(field_annotation) and issubclass(field_annotation, PlaceholderPlugin):
302
- # Placeholder resource type
303
- resource_types.append(field_annotation)
304
294
 
305
295
  return resource_types
306
296
 
@@ -367,10 +357,15 @@ class ComponentBase(BaseModel):
367
357
  # Include None in the Union and maintain the discriminator
368
358
  registered_classes = list(cls.TYPE_REGISTRY.get(resource_type, {}).values())
369
359
  if not registered_classes:
370
- # Use PlaceholderPlugin as a placeholder if no subclasses are registered
371
- registered_classes = [PlaceholderPlugin]
372
- union_with_none = Union[tuple(registered_classes + [type(None)])]
373
- new_type = Annotated[union_with_none, Field(discriminator="type")]
360
+ # Use Any as a placeholder if no subclasses are registered
361
+ union_type = Any
362
+ else:
363
+ union_type = Union[tuple(registered_classes)]
364
+ union_with_none = Union[tuple([union_type, type(None)])]
365
+ new_type = Annotated[
366
+ union_with_none,
367
+ Field(discriminator="type")
368
+ ]
374
369
 
375
370
  return new_type
376
371
 
@@ -417,44 +412,4 @@ class ComponentBase(BaseModel):
417
412
  else:
418
413
  raise ValueError(f"Field '{field_name}' does not exist in model '{model_class.__name__}'")
419
414
  model_class.model_rebuild(force=True)
420
- logger.info("All models have been successfully recreated.")
421
-
422
- @classmethod
423
- def recreate_models_for_resource(cls, resource_type: Type[T]):
424
- """
425
- Recreate only the models associated with the given resource type.
426
- """
427
- with cls._lock:
428
- models_with_fields = {}
429
- for model_cls, res_types in cls.MODEL_REGISTRY.items():
430
- if resource_type in res_types:
431
- models_with_fields[model_cls] = {}
432
- for field_name, field in model_cls.__fields__.items():
433
- field_annotation = model_cls.__annotations__.get(field_name)
434
- if not field_annotation:
435
- continue
436
-
437
- # Check if SubclassUnion is used in the field type
438
- if not cls.field_contains_subclass_union(field_annotation):
439
- continue # Only process fields that use SubclassUnion
440
-
441
- # Determine the new type based on the annotation and resource_type
442
- new_type = cls.determine_new_type(field_annotation, resource_type)
443
-
444
- models_with_fields[model_cls][field_name] = new_type
445
-
446
- for model_class, fields in models_with_fields.items():
447
- for field_name, new_type in fields.items():
448
- if field_name in model_class.model_fields:
449
- model_class.model_fields[field_name].annotation = new_type
450
- else:
451
- raise ValueError(f"Field '{field_name}' does not exist in model '{model_class.__name__}'")
452
- model_class.model_rebuild(force=True)
453
- logger.info(f"Models associated with resource '{resource_type.__name__}' have been successfully recreated.")
454
-
455
-
456
- class PlaceholderPlugin(ComponentBase):
457
- """
458
- Placeholder base class for plugins when no subclasses are registered.
459
- """
460
- pass
415
+ logger.info("All models have been successfully recreated.")