Skip to content

Commit 86361a3

Browse files
committed
fix: Apply strict JSON schema validation in FunctionTool constructor
1 parent db85a6d commit 86361a3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/agents/tool.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from .items import RunItem
2525
from .logger import logger
2626
from .run_context import RunContextWrapper
27+
from .strict_schema import ensure_strict_json_schema
2728
from .tool_context import ToolContext
2829
from .tracing import SpanError
2930
from .util import _error_tracing
@@ -93,6 +94,10 @@ class FunctionTool:
9394
and returns whether the tool is enabled. You can use this to dynamically enable/disable a tool
9495
based on your context/state."""
9596

97+
def __post_init__(self):
98+
if self.strict_json_schema:
99+
self.params_json_schema = ensure_strict_json_schema(self.params_json_schema)
100+
96101

97102
@dataclass
98103
class FileSearchTool:

0 commit comments

Comments
 (0)