Find answers from the community

Updated 3 months ago

I'm getting an error when attempting to

I'm getting an error when attempting to use a function tool without any parameters. I followed the "useless_tool()" example from the docs below, but receive the error ValueError: invalid method signature.
Plain Text
def useless_tool() -> int:
    """This is a uselss tool."""
    return "This is a uselss output."

useless_tool = FunctionTool.from_defaults(fn=useless_tool)

If I add any parameter the error goes away i.e. def useless_tool(dummy: int) -> int:
L
A
2 comments
Hmmm I guess our function that parses the schema from the function assumes that there are arguments.

Adding a dummy argument seems like an OK workaround for now?
Yeah definitely. I figured it was a bug since the docs example here didn't work. Will ticket it https://github.com/run-llama/llama_index/blob/main/docs/examples/agent/openai_forced_function_call.ipynb
Add a reply
Sign up and join the conversation on Discord