Skip to content

Commit facd1c3

Browse files
Type chcking enhancements for pydantic tools
1 parent 0acb757 commit facd1c3

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

stackone_ai/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ def implementation(**kwargs: Any) -> Any:
496496
return Tool.from_schema(
497497
function=implementation,
498498
name=self.name,
499-
description=self.description or "",
499+
description=self.description,
500500
json_schema=json_schema,
501501
)
502502

stackone_ai/toolset.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from collections.abc import Coroutine, Sequence
1212
from dataclasses import dataclass
1313
from importlib import metadata
14-
from typing import Any, Literal, TypedDict, TypeVar
14+
from typing import TYPE_CHECKING, Any, Literal, TypedDict, TypeVar
1515

1616
from pydantic import BaseModel, Field, PrivateAttr, ValidationError, field_validator
1717

@@ -32,6 +32,9 @@
3232
)
3333
from stackone_ai.utils.normalize import _normalize_action_name
3434

35+
if TYPE_CHECKING:
36+
from pydantic_ai.tools import Tool as PydanticAITool
37+
3538
logger = logging.getLogger("stackone.tools")
3639

3740
SearchMode = Literal["auto", "semantic", "local"]
@@ -757,7 +760,7 @@ def pydantic_ai(
757760
*,
758761
mode: Literal["search_and_execute"] | None = None,
759762
account_ids: list[str] | None = None,
760-
) -> list[Any]:
763+
) -> list[PydanticAITool]:
761764
"""Get tools as Pydantic AI ``Tool`` instances.
762765
763766
Args:

0 commit comments

Comments
 (0)