swarmauri-core 0.6.0.dev119__tar.gz → 0.6.0.dev121__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.dev119 → swarmauri_core-0.6.0.dev121}/PKG-INFO +1 -1
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/pyproject.toml +1 -1
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/ComponentBase.py +19 -65
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/README.md +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/README.md +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/agent_apis/IAgentCommands.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/agent_apis/IAgentRouterCRUD.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/agent_apis/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/agent_factories/IExportConf.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/agent_factories/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/agents/IAgent.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/agents/IAgentConversation.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/agents/IAgentParser.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/agents/IAgentRetrieve.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/agents/IAgentSystemContext.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/agents/IAgentToolkit.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/agents/IAgentVectorStore.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/agents/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/chains/ICallableChain.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/chains/IChain.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/chains/IChainContext.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/chains/IChainContextLoader.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/chains/IChainDependencyResolver.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/chains/IChainFactory.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/chains/IChainStep.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/chains/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/chunkers/IChunker.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/chunkers/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/control_panels/IControlPanel.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/control_panels/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/conversations/IConversation.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/conversations/IMaxSize.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/conversations/ISystemContext.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/conversations/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/dataconnectors/IDataConnector.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/dataconnectors/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/distances/IDistanceSimilarity.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/distances/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/document_stores/IDocumentRetrieve.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/document_stores/IDocumentStore.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/document_stores/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/documents/IDocument.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/documents/IExperimentDocument.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/documents/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/embeddings/IFeature.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/embeddings/ISaveModel.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/embeddings/IVectorize.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/embeddings/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/experiment_stores/IExperimentStore.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/experiment_stores/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/factories/IFactory.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/factories/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/image_gens/IGenImage.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/image_gens/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/llms/IFit.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/llms/IPredict.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/llms/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/measurements/IMeasurement.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/measurements/IMeasurementAggregate.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/measurements/IMeasurementCalculate.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/measurements/IThreshold.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/measurements/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/messages/IMessage.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/messages/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/parsers/IParser.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/parsers/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/pipelines/IPipeline.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/pipelines/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/prompts/IPrompt.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/prompts/IPromptMatrix.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/prompts/ITemplate.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/prompts/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/schema_converters/ISchemaConvert.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/schema_converters/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/service_registries/IServiceRegistry.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/service_registries/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/state/IState.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/swarm_apis/IAgentRegistrationAPI.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/swarm_apis/ISwarmAPI.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/swarm_apis/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/swarms/ISwarm.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/swarms/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/task_mgmt_strategies/ITaskMgmtStrategy.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/task_mgmt_strategies/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/toolkits/IToolkit.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/toolkits/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/tools/IParameter.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/tools/ITool.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/tools/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/tracing/IChainTracer.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/tracing/ITraceContext.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/tracing/ITracer.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/tracing/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/transports/ITransport.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/transports/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/utils/ITransactional.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/utils/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/vcms/IPredictVision.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/vcms/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/vector_stores/ICloudVectorStore.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/vector_stores/IPersistentVectorStore.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/vector_stores/ISimilarity.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/vector_stores/IVectorNorm.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/vector_stores/IVectorStore.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/vector_stores/IVectorStoreRetrieve.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/vector_stores/IVectorStoreSaveLoad.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/vector_stores/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/vectors/IVector.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/vectors/IVectorMeta.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/vectors/IVectorProduct.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/vectors/IVectorTransform.py +0 -0
- {swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/vectors/__init__.py +0 -0
|
@@ -44,10 +44,10 @@ 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
|
-
|
|
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
51
|
return Annotated[union_type, Field(discriminator='type')]
|
|
52
52
|
|
|
53
53
|
class ResourceTypes(Enum):
|
|
@@ -117,7 +117,6 @@ class ComponentBase(BaseModel):
|
|
|
117
117
|
return cls.__name__
|
|
118
118
|
return v
|
|
119
119
|
|
|
120
|
-
|
|
121
120
|
# Normative Class Methods
|
|
122
121
|
def __swm_class_hash__(self):
|
|
123
122
|
sig_hash = hashlib.sha256()
|
|
@@ -153,7 +152,7 @@ class ComponentBase(BaseModel):
|
|
|
153
152
|
return True
|
|
154
153
|
return False
|
|
155
154
|
|
|
156
|
-
# Experimental properties in support of
|
|
155
|
+
# Experimental properties in support of Remote Execution
|
|
157
156
|
|
|
158
157
|
@property
|
|
159
158
|
def swm_path(self):
|
|
@@ -181,7 +180,7 @@ class ComponentBase(BaseModel):
|
|
|
181
180
|
cls.TYPE_REGISTRY[resource_type] = {}
|
|
182
181
|
cls.TYPE_REGISTRY[resource_type][type_name] = subclass
|
|
183
182
|
# Automatically recreate models after registering a new type
|
|
184
|
-
cls.
|
|
183
|
+
cls.recreate_models()
|
|
185
184
|
logger.info(f"Registered type '{type_name}' for resource '{resource_type.__name__}' with subclass '{subclass.__name__}'")
|
|
186
185
|
return subclass
|
|
187
186
|
return decorator
|
|
@@ -211,11 +210,6 @@ class ComponentBase(BaseModel):
|
|
|
211
210
|
if resource_type not in cls.MODEL_REGISTRY[model_cls]:
|
|
212
211
|
cls.MODEL_REGISTRY[model_cls].append(resource_type)
|
|
213
212
|
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
213
|
return model_cls
|
|
220
214
|
return decorator
|
|
221
215
|
|
|
@@ -236,13 +230,13 @@ class ComponentBase(BaseModel):
|
|
|
236
230
|
@classmethod
|
|
237
231
|
def field_contains_subclass_union(cls, field_annotation) -> bool:
|
|
238
232
|
"""
|
|
239
|
-
Check if the field annotation contains a SubclassUnion
|
|
233
|
+
Check if the field annotation contains a SubclassUnion.
|
|
240
234
|
|
|
241
235
|
Parameters:
|
|
242
236
|
- field_annotation: The type annotation of the field.
|
|
243
237
|
|
|
244
238
|
Returns:
|
|
245
|
-
- True if SubclassUnion
|
|
239
|
+
- True if SubclassUnion is present, False otherwise.
|
|
246
240
|
"""
|
|
247
241
|
if isinstance(field_annotation, type(SubclassUnion)):
|
|
248
242
|
return True
|
|
@@ -253,15 +247,13 @@ class ComponentBase(BaseModel):
|
|
|
253
247
|
elif origin in {list, List, dict, Dict, Union}:
|
|
254
248
|
args = get_args(field_annotation)
|
|
255
249
|
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
250
|
return False
|
|
259
251
|
|
|
260
252
|
|
|
261
253
|
@classmethod
|
|
262
254
|
def extract_resource_types_from_field(cls, field_annotation) -> List[Type['ComponentBase']]:
|
|
263
255
|
"""
|
|
264
|
-
Extracts all resource types from a field annotation that uses SubclassUnion
|
|
256
|
+
Extracts all resource types from a field annotation that uses SubclassUnion.
|
|
265
257
|
|
|
266
258
|
Parameters:
|
|
267
259
|
- field_annotation: The type annotation of the field.
|
|
@@ -298,9 +290,6 @@ class ComponentBase(BaseModel):
|
|
|
298
290
|
# Handle Dict[key_type, SubclassUnion[ResourceType]]
|
|
299
291
|
value_type = args[1]
|
|
300
292
|
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
293
|
|
|
305
294
|
return resource_types
|
|
306
295
|
|
|
@@ -367,10 +356,15 @@ class ComponentBase(BaseModel):
|
|
|
367
356
|
# Include None in the Union and maintain the discriminator
|
|
368
357
|
registered_classes = list(cls.TYPE_REGISTRY.get(resource_type, {}).values())
|
|
369
358
|
if not registered_classes:
|
|
370
|
-
# Use
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
359
|
+
# Use Any as a placeholder if no subclasses are registered
|
|
360
|
+
union_type = Any
|
|
361
|
+
else:
|
|
362
|
+
union_type = Union[tuple(registered_classes)]
|
|
363
|
+
union_with_none = Union[tuple([union_type, type(None)])]
|
|
364
|
+
new_type = Annotated[
|
|
365
|
+
union_with_none,
|
|
366
|
+
Field(discriminator="type")
|
|
367
|
+
]
|
|
374
368
|
|
|
375
369
|
return new_type
|
|
376
370
|
|
|
@@ -417,44 +411,4 @@ class ComponentBase(BaseModel):
|
|
|
417
411
|
else:
|
|
418
412
|
raise ValueError(f"Field '{field_name}' does not exist in model '{model_class.__name__}'")
|
|
419
413
|
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
|
|
414
|
+
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.dev119 → swarmauri_core-0.6.0.dev121}/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.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/agents/IAgentParser.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/agents/IAgentRetrieve.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/agents/IAgentToolkit.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/agents/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/chains/ICallableChain.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/chains/IChainContext.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/chains/IChainFactory.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/chains/IChainStep.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/chains/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/chunkers/IChunker.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/chunkers/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/conversations/IMaxSize.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/conversations/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/distances/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/documents/IDocument.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/documents/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/embeddings/IFeature.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/embeddings/ISaveModel.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/embeddings/IVectorize.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/embeddings/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/factories/IFactory.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/factories/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/image_gens/IGenImage.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/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.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/measurements/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/messages/IMessage.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/messages/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/parsers/IParser.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/parsers/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/pipelines/IPipeline.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/pipelines/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/prompts/IPrompt.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/prompts/IPromptMatrix.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/prompts/ITemplate.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/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.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/swarm_apis/ISwarmAPI.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/swarm_apis/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/swarms/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/toolkits/IToolkit.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/toolkits/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/tools/IParameter.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/tools/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/tracing/IChainTracer.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/tracing/ITraceContext.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/tracing/ITracer.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/tracing/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/transports/ITransport.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/transports/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/utils/ITransactional.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/utils/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/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.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/vector_stores/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/vectors/IVector.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/vectors/IVectorMeta.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/vectors/IVectorProduct.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev119 → swarmauri_core-0.6.0.dev121}/swarmauri_core/vectors/__init__.py
RENAMED
|
File without changes
|