Skip to content

Commit 1393dad

Browse files
committed
review comment
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
1 parent 645b4f6 commit 1393dad

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

mellea/backends/tools.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def tool(*, name: str | None = None) -> Callable[[Callable], MelleaTool]: ...
100100

101101

102102
def tool(
103-
func: Callable | None = None, *, name: str | None = None
103+
func: Callable | None = None, name: str | None = None
104104
) -> MelleaTool | Callable[[Callable], MelleaTool]:
105105
"""Decorator to mark a function as a Mellea tool.
106106
@@ -137,12 +137,16 @@ def tool(
137137
>>> # Must use .run() to invoke the tool
138138
>>> result = get_weather.run(location="Boston")
139139
140-
With custom name:
140+
With custom name (as decorator):
141141
>>> @tool(name="weather_api")
142142
... def get_weather(location: str) -> dict:
143143
... return {"location": location}
144144
>>>
145145
>>> result = get_weather.run(location="New York")
146+
147+
With custom name (as function):
148+
>>> def new_tool(): ...
149+
>>> differently_named_tool = tool(new_tool, name="different_name")
146150
"""
147151

148152
def decorator(f: Callable) -> MelleaTool:

0 commit comments

Comments
 (0)