Skip to content

Commit 4fb6248

Browse files
committed
refactor(core): remove inheritance from BaseModel and add to_dict method to Fn class
Signed-off-by: OEvortex <abhat8283@gmail.com>
1 parent a5ba919 commit 4fb6248

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

HelpingAI/tools/core.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,27 @@
55
from dataclasses import dataclass, field
66
from typing import Dict, Any, Optional, Callable, Union, List
77

8-
from ..base_models import BaseModel
98
from .schema import generate_schema_from_function, validate_schema
109
from .errors import ToolExecutionError, SchemaValidationError, ToolRegistrationError
1110

1211

1312
@dataclass
14-
class Fn(BaseModel):
13+
class Fn:
1514
"""Represents a callable function/tool with metadata and standard tool format compatibility."""
1615

1716
name: str
1817
description: str
1918
parameters: Dict[str, Any]
2019
function: Optional[Callable] = None
2120

21+
def to_dict(self) -> Dict[str, Any]:
22+
"""Convert the model to a dictionary."""
23+
return {
24+
'name': self.name,
25+
'description': self.description,
26+
'parameters': self.parameters
27+
}
28+
2229
def to_tool_format(self) -> Dict[str, Any]:
2330
"""Convert to standard tool format.
2431

0 commit comments

Comments
 (0)