what is difference between RawFunctionTool and Fun...
# ask-ai
n
what is difference between RawFunctionTool and FunctionTool ?
t
Thanks for reaching out, Darshak. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm glad you asked about the difference between
RawFunctionTool
and
FunctionTool
! Let me walk you through it in a simple way: • RawFunctionTool: Here, the function gets the raw arguments dictionary exactly as the LLM passes it. It expects a parameter named
raw_arguments
of type
dict[str, Any]
, which holds all the unprocessed JSON arguments. This means you have direct access to the raw data without any automatic type conversion or validation—giving you full control. • FunctionTool: On the other hand, this tool automatically converts the LLM arguments to fit the function’s typed parameters. It validates the arguments against the function signature and properly constructs Python types (like turning JSON strings into the right Python objects). This makes it a more user-friendly and type-safe option. So, to sum it up,
RawFunctionTool
gives you low-level access to the raw JSON arguments, while
FunctionTool
offers a smoother, type-safe experience with automatic parsing and validation. I hope this helps clarify things! If you have any more questions, feel free to ask—I’m here to help. Sources: livekit-plugins/livekit-plugins-google/livekit/plugins/google/llm.py