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.
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/PKG-INFO +1 -1
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/pyproject.toml +1 -1
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/ComponentBase.py +20 -65
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/README.md +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/README.md +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agent_apis/IAgentCommands.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agent_apis/IAgentRouterCRUD.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agent_apis/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agent_factories/IExportConf.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agent_factories/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agents/IAgent.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agents/IAgentConversation.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agents/IAgentParser.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agents/IAgentRetrieve.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agents/IAgentSystemContext.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agents/IAgentToolkit.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agents/IAgentVectorStore.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agents/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/ICallableChain.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/IChain.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/IChainContext.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/IChainContextLoader.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/IChainDependencyResolver.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/IChainFactory.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/IChainStep.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chunkers/IChunker.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chunkers/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/control_panels/IControlPanel.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/control_panels/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/conversations/IConversation.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/conversations/IMaxSize.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/conversations/ISystemContext.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/conversations/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/dataconnectors/IDataConnector.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/dataconnectors/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/distances/IDistanceSimilarity.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/distances/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/document_stores/IDocumentRetrieve.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/document_stores/IDocumentStore.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/document_stores/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/documents/IDocument.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/documents/IExperimentDocument.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/documents/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/embeddings/IFeature.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/embeddings/ISaveModel.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/embeddings/IVectorize.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/embeddings/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/experiment_stores/IExperimentStore.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/experiment_stores/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/factories/IFactory.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/factories/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/image_gens/IGenImage.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/image_gens/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/llms/IFit.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/llms/IPredict.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/llms/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/measurements/IMeasurement.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/measurements/IMeasurementAggregate.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/measurements/IMeasurementCalculate.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/measurements/IThreshold.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/measurements/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/messages/IMessage.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/messages/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/parsers/IParser.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/parsers/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/pipelines/IPipeline.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/pipelines/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/prompts/IPrompt.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/prompts/IPromptMatrix.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/prompts/ITemplate.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/prompts/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/schema_converters/ISchemaConvert.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/schema_converters/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/service_registries/IServiceRegistry.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/service_registries/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/state/IState.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/swarm_apis/IAgentRegistrationAPI.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/swarm_apis/ISwarmAPI.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/swarm_apis/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/swarms/ISwarm.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/swarms/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/task_mgmt_strategies/ITaskMgmtStrategy.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/task_mgmt_strategies/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/toolkits/IToolkit.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/toolkits/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/tools/IParameter.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/tools/ITool.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/tools/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/tracing/IChainTracer.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/tracing/ITraceContext.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/tracing/ITracer.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/tracing/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/transports/ITransport.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/transports/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/utils/ITransactional.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/utils/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vcms/IPredictVision.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vcms/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vector_stores/ICloudVectorStore.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vector_stores/IPersistentVectorStore.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vector_stores/ISimilarity.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vector_stores/IVectorNorm.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vector_stores/IVectorStore.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vector_stores/IVectorStoreRetrieve.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vector_stores/IVectorStoreSaveLoad.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vector_stores/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vectors/IVector.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vectors/IVectorMeta.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vectors/IVectorProduct.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vectors/IVectorTransform.py +0 -0
- {swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vectors/__init__.py +0 -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 '
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return Annotated[union_type, Field(
|
|
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.
|
|
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
|
-
|
|
231
|
+
@classmethod
|
|
237
232
|
def field_contains_subclass_union(cls, field_annotation) -> bool:
|
|
238
233
|
"""
|
|
239
|
-
Check if the field annotation contains a SubclassUnion
|
|
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
|
|
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
|
|
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
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
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.")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agent_apis/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agents/IAgentParser.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agents/IAgentRetrieve.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agents/IAgentToolkit.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/agents/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/ICallableChain.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/IChainContext.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/IChainFactory.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/IChainStep.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chains/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chunkers/IChunker.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/chunkers/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/conversations/IMaxSize.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/conversations/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/distances/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/documents/IDocument.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/documents/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/embeddings/IFeature.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/embeddings/ISaveModel.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/embeddings/IVectorize.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/embeddings/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/factories/IFactory.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/factories/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/image_gens/IGenImage.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/image_gens/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/measurements/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/messages/IMessage.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/messages/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/parsers/IParser.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/parsers/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/pipelines/IPipeline.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/pipelines/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/prompts/IPrompt.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/prompts/IPromptMatrix.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/prompts/ITemplate.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/prompts/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/swarm_apis/ISwarmAPI.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/swarm_apis/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/swarms/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/toolkits/IToolkit.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/toolkits/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/tools/IParameter.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/tools/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/tracing/IChainTracer.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/tracing/ITraceContext.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/tracing/ITracer.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/tracing/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/transports/ITransport.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/transports/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/utils/ITransactional.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/utils/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vcms/IPredictVision.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vector_stores/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vectors/IVector.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vectors/IVectorMeta.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vectors/IVectorProduct.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev118 → swarmauri_core-0.6.0.dev120}/swarmauri_core/vectors/__init__.py
RENAMED
|
File without changes
|