Skip to content

Commit

Permalink
chore: add a TypedDict to parameters definition
Browse files Browse the repository at this point in the history
  • Loading branch information
mmikita95 committed Dec 5, 2024
1 parent 83a5153 commit 4e122e6
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/writer/ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,31 @@ class GraphTool(Tool):
subqueries: bool


class FunctionToolParameterMeta(TypedDict):
type: Union[
Literal["string"],
Literal["number"],
Literal["integer"],
Literal["float"],
Literal["boolean"],
Literal["array"],
Literal["object"],
Literal["null"]
]
description: str


class FunctionTool(Tool):
callable: Callable
name: str
description: Optional[str]
parameters: Dict[str, Dict[str, str]]
parameters: Dict[str, FunctionToolParameterMeta]


def create_function_tool(
callable: Callable,
name: str,
parameters: Optional[Dict[str, Dict[str, str]]] = None,
parameters: Optional[Dict[str, FunctionToolParameterMeta]] = None,
description: Optional[str] = None
) -> FunctionTool:
parameters = parameters or {}
Expand Down

0 comments on commit 4e122e6

Please sign in to comment.