from abc import ABC, abstractmethod
from typing import Optional, List, Any, Literal
from pydantic import Field
from swarmauri.core.ComponentBase import ComponentBase, ResourceTypes
from swarmauri.standard.tools.concrete.Parameter import Parameter
from swarmauri.core.tools.ITool import ITool
# #def __getstate__(self):
# return {'type': self.type, 'function': self.function}
#def __iter__(self):
# yield ('type', self.type)
# yield ('function', self.function)
# @property
# def function(self):
# # Dynamically constructing the parameters schema
# properties = {}
# required = []
# for param in self.parameters:
# properties[param.name] = {
# "type": param.type,
# "description": param.description,
# }
# if param.enum:
# properties[param.name]['enum'] = param.enum
# if param.required:
# required.append(param.name)
# function = {
# "name": self.name,
# "description": self.description,
# "parameters": {
# "type": "object",
# "properties": properties,
# }
# }
# if required: # Only include 'required' if there are any required parameters
# function['parameters']['required'] = required
# return function
# def as_dict(self):
# #return asdict(self)
# return {'type': self.type, 'function': self.function}