swarmauri-core 0.6.0.dev128__tar.gz → 0.6.0.dev130__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.dev128 → swarmauri_core-0.6.0.dev130}/PKG-INFO +1 -1
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/pyproject.toml +1 -1
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/ComponentBase.py +44 -9
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/README.md +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/README.md +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/agent_apis/IAgentCommands.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/agent_apis/IAgentRouterCRUD.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/agent_apis/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/agent_factories/IExportConf.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/agent_factories/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/agents/IAgent.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/agents/IAgentConversation.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/agents/IAgentParser.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/agents/IAgentRetrieve.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/agents/IAgentSystemContext.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/agents/IAgentToolkit.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/agents/IAgentVectorStore.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/agents/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/chains/ICallableChain.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/chains/IChain.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/chains/IChainContext.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/chains/IChainContextLoader.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/chains/IChainDependencyResolver.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/chains/IChainFactory.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/chains/IChainStep.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/chains/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/chunkers/IChunker.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/chunkers/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/control_panels/IControlPanel.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/control_panels/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/conversations/IConversation.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/conversations/IMaxSize.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/conversations/ISystemContext.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/conversations/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/dataconnectors/IDataConnector.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/dataconnectors/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/distances/IDistanceSimilarity.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/distances/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/document_stores/IDocumentRetrieve.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/document_stores/IDocumentStore.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/document_stores/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/documents/IDocument.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/documents/IExperimentDocument.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/documents/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/embeddings/IFeature.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/embeddings/ISaveModel.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/embeddings/IVectorize.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/embeddings/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/experiment_stores/IExperimentStore.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/experiment_stores/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/factories/IFactory.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/factories/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/image_gens/IGenImage.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/image_gens/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/llms/IFit.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/llms/IPredict.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/llms/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/measurements/IMeasurement.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/measurements/IMeasurementAggregate.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/measurements/IMeasurementCalculate.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/measurements/IThreshold.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/measurements/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/messages/IMessage.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/messages/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/parsers/IParser.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/parsers/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/pipelines/IPipeline.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/pipelines/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/prompts/IPrompt.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/prompts/IPromptMatrix.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/prompts/ITemplate.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/prompts/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/schema_converters/ISchemaConvert.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/schema_converters/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/service_registries/IServiceRegistry.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/service_registries/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/state/IState.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/swarm_apis/IAgentRegistrationAPI.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/swarm_apis/ISwarmAPI.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/swarm_apis/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/swarms/ISwarm.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/swarms/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/task_mgmt_strategies/ITaskMgmtStrategy.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/task_mgmt_strategies/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/toolkits/IToolkit.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/toolkits/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/tools/IParameter.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/tools/ITool.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/tools/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/tracing/IChainTracer.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/tracing/ITraceContext.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/tracing/ITracer.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/tracing/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/transports/ITransport.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/transports/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/utils/ITransactional.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/utils/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/vcms/IPredictVision.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/vcms/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/vector_stores/ICloudVectorStore.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/vector_stores/IPersistentVectorStore.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/vector_stores/ISimilarity.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/vector_stores/IVectorNorm.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/vector_stores/IVectorStore.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/vector_stores/IVectorStoreRetrieve.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/vector_stores/IVectorStoreSaveLoad.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/vector_stores/__init__.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/vectors/IVector.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/vectors/IVectorMeta.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/vectors/IVectorProduct.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/vectors/IVectorTransform.py +0 -0
- {swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/vectors/__init__.py +0 -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(
|
|
31
|
+
class SubclassUnion(type):
|
|
32
32
|
"""
|
|
33
33
|
A generic class to create discriminated unions based on resource types.
|
|
34
34
|
"""
|
|
@@ -44,7 +44,7 @@ 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.
|
|
47
|
+
logger.debug(f"No subclasses registered for resource type '{resource_type.__name__}'. Using 'Any' as a placeholder.")
|
|
48
48
|
return Annotated[Any, Field(...)]
|
|
49
49
|
else:
|
|
50
50
|
union_type = Union[tuple(registered_classes)]
|
|
@@ -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
|
|
@@ -237,15 +237,22 @@ class ComponentBase(BaseModel):
|
|
|
237
237
|
Returns:
|
|
238
238
|
- True if SubclassUnion is present, False otherwise.
|
|
239
239
|
"""
|
|
240
|
+
logger.debug(f"Checking if field annotation '{field_annotation}' contains a SubclassUnion")
|
|
240
241
|
if isinstance(field_annotation, type(SubclassUnion)):
|
|
242
|
+
logger.debug(f"Field annotation '{field_annotation}' is directly a SubclassUnion")
|
|
241
243
|
return True
|
|
242
244
|
origin = get_origin(field_annotation)
|
|
243
245
|
if origin is Annotated:
|
|
244
246
|
args = get_args(field_annotation)
|
|
247
|
+
logger.debug(f"Field annotation '{field_annotation}' is Annotated with args {args}")
|
|
245
248
|
return cls.field_contains_subclass_union(args[0])
|
|
246
249
|
elif origin in {list, List, dict, Dict, Union}:
|
|
247
250
|
args = get_args(field_annotation)
|
|
248
|
-
|
|
251
|
+
logger.debug(f"Field annotation '{field_annotation}' has origin '{origin.__name__}' with args {args}")
|
|
252
|
+
result = any(cls.field_contains_subclass_union(arg) for arg in args)
|
|
253
|
+
logger.debug(f"Field annotation '{field_annotation}' contains SubclassUnion: {result}")
|
|
254
|
+
return result
|
|
255
|
+
logger.debug(f"Field annotation '{field_annotation}' does not contain a SubclassUnion")
|
|
249
256
|
return False
|
|
250
257
|
|
|
251
258
|
|
|
@@ -260,6 +267,7 @@ class ComponentBase(BaseModel):
|
|
|
260
267
|
Returns:
|
|
261
268
|
- A list of resource type classes.
|
|
262
269
|
"""
|
|
270
|
+
logger.debug(f"Extracting resource types from field annotation '{field_annotation}'")
|
|
263
271
|
resource_types = []
|
|
264
272
|
|
|
265
273
|
origin = get_origin(field_annotation)
|
|
@@ -267,32 +275,41 @@ class ComponentBase(BaseModel):
|
|
|
267
275
|
|
|
268
276
|
if origin is Annotated:
|
|
269
277
|
# Extract the actual type from Annotated
|
|
278
|
+
logger.debug(f"Field annotation '{field_annotation}' is Annotated")
|
|
270
279
|
field_annotation = args[0]
|
|
271
280
|
origin = get_origin(field_annotation)
|
|
272
281
|
args = get_args(field_annotation)
|
|
273
282
|
|
|
274
283
|
if origin is Union:
|
|
284
|
+
logger.debug(f"Field annotation '{field_annotation}' is a Union")
|
|
275
285
|
for arg in args:
|
|
276
286
|
if cls.field_contains_subclass_union(arg):
|
|
287
|
+
logger.debug(f"Union member '{arg}' contains a SubclassUnion")
|
|
277
288
|
resource_types.extend(cls.extract_resource_types_from_field(arg))
|
|
278
289
|
elif inspect.isclass(field_annotation) and issubclass(field_annotation, SubclassUnion):
|
|
279
290
|
# Assuming SubclassUnion is generic and parameterized
|
|
291
|
+
logger.debug(f"Field annotation '{field_annotation}' is a subclass of SubclassUnion")
|
|
280
292
|
subclass_args = get_args(field_annotation)
|
|
281
293
|
if subclass_args:
|
|
282
294
|
resource_type = subclass_args[0]
|
|
295
|
+
logger.debug(f"Extracted resource type '{resource_type.__name__}' from SubclassUnion")
|
|
283
296
|
resource_types.append(resource_type)
|
|
284
297
|
elif origin in {list, List}:
|
|
285
298
|
# Handle List[SubclassUnion[ResourceType]]
|
|
286
299
|
item_type = args[0]
|
|
300
|
+
logger.debug(f"Field annotation '{field_annotation}' is a List with item type '{item_type}'")
|
|
287
301
|
resource_types.extend(cls.extract_resource_types_from_field(item_type))
|
|
288
302
|
elif origin in {dict, Dict}:
|
|
289
303
|
# Handle Dict[key_type, SubclassUnion[ResourceType]]
|
|
290
304
|
value_type = args[1]
|
|
305
|
+
logger.debug(f"Field annotation '{field_annotation}' is a Dict with value type '{value_type}'")
|
|
291
306
|
resource_types.extend(cls.extract_resource_types_from_field(value_type))
|
|
307
|
+
else:
|
|
308
|
+
logger.debug(f"Field annotation '{field_annotation}' does not match any known patterns for SubclassUnion")
|
|
292
309
|
|
|
310
|
+
logger.debug(f"Extracted resource types: {[rt.__name__ for rt in resource_types]}")
|
|
293
311
|
return resource_types
|
|
294
312
|
|
|
295
|
-
|
|
296
313
|
@classmethod
|
|
297
314
|
def determine_new_type(cls, field_annotation, resource_type):
|
|
298
315
|
"""
|
|
@@ -305,6 +322,7 @@ class ComponentBase(BaseModel):
|
|
|
305
322
|
Returns:
|
|
306
323
|
- The updated type annotation incorporating SubclassUnion.
|
|
307
324
|
"""
|
|
325
|
+
logger.debug(f"Determining new type for field annotation '{field_annotation}' with resource type '{resource_type.__name__}'")
|
|
308
326
|
origin = get_origin(field_annotation)
|
|
309
327
|
args = get_args(field_annotation)
|
|
310
328
|
|
|
@@ -313,20 +331,24 @@ class ComponentBase(BaseModel):
|
|
|
313
331
|
if origin is Union and type(None) in args:
|
|
314
332
|
# Handle Optional and Union types
|
|
315
333
|
non_none_args = [arg for arg in args if arg is not type(None)]
|
|
334
|
+
logger.debug(f"Field annotation '{field_annotation}' is Optional/Union with non-None args {non_none_args}")
|
|
316
335
|
if len(non_none_args) == 1:
|
|
317
336
|
field_annotation = non_none_args[0]
|
|
318
337
|
origin = get_origin(field_annotation)
|
|
319
338
|
args = get_args(field_annotation)
|
|
320
339
|
is_optional = True
|
|
340
|
+
logger.debug(f"Field is Optional with single non-None type '{field_annotation}'")
|
|
321
341
|
else:
|
|
322
342
|
field_annotation = Union[tuple(non_none_args)]
|
|
323
343
|
origin = get_origin(field_annotation)
|
|
324
344
|
args = get_args(field_annotation)
|
|
325
345
|
is_optional = True
|
|
346
|
+
logger.debug(f"Field is Optional with multiple non-None types '{field_annotation}'")
|
|
326
347
|
|
|
327
348
|
# Handle Annotated types by extracting the underlying type
|
|
328
349
|
if origin is Annotated:
|
|
329
350
|
# Extract the actual type from Annotated
|
|
351
|
+
logger.debug(f"Field annotation '{field_annotation}' is Annotated")
|
|
330
352
|
field_annotation = args[0]
|
|
331
353
|
origin = get_origin(field_annotation)
|
|
332
354
|
args = get_args(field_annotation)
|
|
@@ -334,22 +356,28 @@ class ComponentBase(BaseModel):
|
|
|
334
356
|
if origin in {list, List}:
|
|
335
357
|
# Handle List[SubclassUnion[ResourceType]]
|
|
336
358
|
new_type = List[SubclassUnion[resource_type]]
|
|
359
|
+
logger.debug(f"New type for List field: '{new_type}'")
|
|
337
360
|
elif origin in {dict, Dict}:
|
|
338
361
|
# Handle Dict[key_type, SubclassUnion[ResourceType]]
|
|
339
362
|
key_type, value_type = args
|
|
340
363
|
new_type = Dict[key_type, SubclassUnion[resource_type]]
|
|
364
|
+
logger.debug(f"New type for Dict field: '{new_type}'")
|
|
341
365
|
elif origin is Union:
|
|
342
366
|
# Handle Union types
|
|
343
367
|
union_types = []
|
|
344
368
|
for arg in args:
|
|
345
369
|
if cls.field_contains_subclass_union(arg):
|
|
346
370
|
union_types.append(SubclassUnion[resource_type])
|
|
371
|
+
logger.debug(f"Added SubclassUnion[{resource_type.__name__}] to Union types")
|
|
347
372
|
else:
|
|
348
373
|
union_types.append(arg)
|
|
374
|
+
logger.debug(f"Added type '{arg}' to Union types")
|
|
349
375
|
new_type = Union[tuple(union_types)]
|
|
376
|
+
logger.debug(f"New Union type: '{new_type}'")
|
|
350
377
|
else:
|
|
351
378
|
# Handle non-generic types
|
|
352
379
|
new_type = SubclassUnion[resource_type]
|
|
380
|
+
logger.debug(f"New non-generic SubclassUnion type: '{new_type}'")
|
|
353
381
|
|
|
354
382
|
if is_optional:
|
|
355
383
|
# Include None in the Union and maintain the discriminator
|
|
@@ -357,14 +385,18 @@ class ComponentBase(BaseModel):
|
|
|
357
385
|
if not registered_classes:
|
|
358
386
|
# Use Any as a placeholder if no subclasses are registered
|
|
359
387
|
union_type = Any
|
|
388
|
+
logger.debug(f"No registered subclasses for resource type '{resource_type.__name__}'. Using 'Any' in Optional type.")
|
|
360
389
|
else:
|
|
361
390
|
union_type = Union[tuple(registered_classes)]
|
|
391
|
+
logger.debug(f"Registered subclasses for resource type '{resource_type.__name__}': {[cls.__name__ for cls in registered_classes]}")
|
|
362
392
|
union_with_none = Union[tuple([union_type, type(None)])]
|
|
363
393
|
new_type = Annotated[
|
|
364
394
|
union_with_none,
|
|
365
395
|
Field(discriminator="type")
|
|
366
396
|
]
|
|
397
|
+
logger.debug(f"Final new type with Optional: '{new_type}'")
|
|
367
398
|
|
|
399
|
+
logger.debug(f"Determined new type for field: '{new_type}'")
|
|
368
400
|
return new_type
|
|
369
401
|
|
|
370
402
|
|
|
@@ -409,8 +441,11 @@ class ComponentBase(BaseModel):
|
|
|
409
441
|
model_class.model_fields[field_name].annotation = new_type
|
|
410
442
|
else:
|
|
411
443
|
raise ValueError(f"Field '{field_name}' does not exist in model '{model_class.__name__}'")
|
|
412
|
-
|
|
444
|
+
try:
|
|
445
|
+
model_class.model_rebuild(force=True)
|
|
413
446
|
logger.debug(f"'{model_class}' has been successfully recreated.")
|
|
414
|
-
|
|
415
|
-
logger.
|
|
416
|
-
|
|
447
|
+
except ValidationError as ve:
|
|
448
|
+
logger.error(f"Validation error while rebuilding model '{model_class.__name__}': {ve}")
|
|
449
|
+
except Exception as e:
|
|
450
|
+
logger.error(f"Error while rebuilding model '{model_class.__name__}': {e}")
|
|
451
|
+
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.dev128 → swarmauri_core-0.6.0.dev130}/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.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/agents/IAgentParser.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/agents/IAgentRetrieve.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/agents/IAgentToolkit.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/agents/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/chains/ICallableChain.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/chains/IChainContext.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/chains/IChainFactory.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/chains/IChainStep.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/chains/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/chunkers/IChunker.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/chunkers/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/conversations/IMaxSize.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/conversations/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/distances/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/documents/IDocument.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/documents/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/embeddings/IFeature.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/embeddings/ISaveModel.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/embeddings/IVectorize.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/embeddings/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/factories/IFactory.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/factories/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/image_gens/IGenImage.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/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.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/measurements/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/messages/IMessage.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/messages/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/parsers/IParser.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/parsers/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/pipelines/IPipeline.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/pipelines/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/prompts/IPrompt.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/prompts/IPromptMatrix.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/prompts/ITemplate.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/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.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/swarm_apis/ISwarmAPI.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/swarm_apis/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/swarms/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/toolkits/IToolkit.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/toolkits/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/tools/IParameter.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/tools/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/tracing/IChainTracer.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/tracing/ITraceContext.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/tracing/ITracer.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/tracing/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/transports/ITransport.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/transports/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/utils/ITransactional.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/utils/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/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.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/vector_stores/__init__.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/vectors/IVector.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/vectors/IVectorMeta.py
RENAMED
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/vectors/IVectorProduct.py
RENAMED
|
File without changes
|
|
File without changes
|
{swarmauri_core-0.6.0.dev128 → swarmauri_core-0.6.0.dev130}/swarmauri_core/vectors/__init__.py
RENAMED
|
File without changes
|