Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Test Case Failure]: tests/unit/control_panels/ControlPanel_unit_test.py::test_serialization #1041

Open
github-actions bot opened this issue Dec 19, 2024 · 0 comments

Comments

@github-actions
Copy link

Test Case:

tests/unit/control_panels/ControlPanel_unit_test.py::test_serialization

Failure Details:

tests/unit/control_panels/ControlPanel_unit_test.py:75: in test_serialization
    == ControlPanel.model_validate_json(control_panel.model_dump_json()).id
/home/runner/.cache/pypoetry/virtualenvs/swarmauri-dnwSkKe9-py3.12/lib/python3.12/site-packages/swarmauri_core/ComponentBase.py:217: in model_validate_json
    return target_cls.model_validate(payload_dict)
E   pydantic_core._pydantic_core.ValidationError: 3 validation errors for ControlPanel
E   agent_factory.type
E     Input should be 'FactoryBase' [type=literal_error, input_value='AgentFactory', input_type=str]
E       For further information visit https://errors.pydantic.dev/2.10/v/literal_error
E   service_registry.type
E     Input should be 'ServiceRegistryBase' [type=literal_error, input_value='ServiceRegistry', input_type=str]
E       For further information visit https://errors.pydantic.dev/2.10/v/literal_error
E   task_mgt_strategy.type
E     Input should be 'TaskMgtStrategyBase' [type=literal_error, input_value='RoundRobinStrategy', input_type=str]
E       For further information visit https://errors.pydantic.dev/2.10/v/literal_error

Suggested Fix (via Agent):

The error message indicates that there are three validation errors for the ControlPanel model. The errors occur because the type field of agent_factory, service_registry, and task_mgt_strategy do not match the expected values.

The expected values are FactoryBase, ServiceRegistryBase, and TaskMgtStrategyBase, but the actual values are AgentFactory, ServiceRegistry, and RoundRobinStrategy, respectively.

To fix this issue, you need to ensure that the type field of these objects is set to the correct values. You can do this by updating the code that creates these objects to use the correct types.

For example, instead of creating an AgentFactory object, you should create a FactoryBase object. Similarly, instead of creating a ServiceRegistry object, you should create a ServiceRegistryBase object, and instead of creating a RoundRobinStrategy object, you should create a TaskMgtStrategyBase object.

Here is an example of how you can update the code to fix this issue:

agent_factory = FactoryBase()
service_registry = ServiceRegistryBase()
task_mgt_strategy = TaskMgtStrategyBase()

Alternatively, you can update the ControlPanel model to accept the actual types of these objects by modifying the type field to include the actual types in the Literal type hint. For example:

from typing import Literal

class ControlPanel:
    agent_factory: Literal['FactoryBase', 'AgentFactory']
    service_registry: Literal['ServiceRegistryBase', 'ServiceRegistry']
    task_mgt_strategy: Literal['TaskMgtStrategyBase', 'RoundRobinStrategy']

This will allow the ControlPanel model to accept both the base types and the actual types of these objects.


Context:

Labels:

This issue is auto-labeled for the swarmauri package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

0 participants