You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
The create_tool_from_function is very useful as well as the tool decorator for not requiring users to have to specify description and parameters when converting a function into a tool.
However, when working from a yaml file (like in dC) it's not easy to use either of these conveniences.
Describe the solution you'd like
So I was wondering if we could update Tool to optionally require description and parameters and if they are missing we use the logic in create_tool_from_function to auto fill the parameters and description.
Describe alternatives you've considered
Leave as is and require users in Pipeline Studio to have to specify description and parameters when using Tool.
Additional context
What do you think @anakin87 since you've worked on this a lot?
The text was updated successfully, but these errors were encountered:
Based on my understanding, the idea is this: incorporate the create_tool_from_function logic into Tool.
This would allow the following:
fromhaystack.toolsimportTooldefget_weather(
city: Annotated[str, "the city for which to get the weather"] ="Munich",
unit: Annotated[Literal["Celsius", "Fahrenheit"], "the unit for the temperature"] ="Celsius",
nullable_param: Annotated[Optional[str], "a nullable parameter"] =None,
) ->str:
"""A simple function to get the current weather for a location."""returnf"Weather report for {city}: 20 {unit}, sunny"my_tool=Tool(name="get_weather", function=get_weather) # also the name could be easily inferred if we want.
Technically, there would be some difficulties related to the fact that we cannot do the following using a dataclass
Is your feature request related to a problem? Please describe.
The
create_tool_from_function
is very useful as well as thetool
decorator for not requiring users to have to specifydescription
andparameters
when converting a function into a tool.However, when working from a yaml file (like in dC) it's not easy to use either of these conveniences.
Describe the solution you'd like
So I was wondering if we could update
Tool
to optionally requiredescription
andparameters
and if they are missing we use the logic increate_tool_from_function
to auto fill the parameters and description.Describe alternatives you've considered
Leave as is and require users in Pipeline Studio to have to specify description and parameters when using Tool.
Additional context
What do you think @anakin87 since you've worked on this a lot?
The text was updated successfully, but these errors were encountered: