cool-iron-91629
05/08/2025, 2:56 PMtall-airline-16756
05/08/2025, 2:56 PMtall-airline-16756
05/08/2025, 2:57 PMfunction_tool
decorator with the raw_schema
parameter. Here's an example:
from livekit.agents import function_tool
# Create a function tool using raw JSON schema
@function_tool(raw_schema={
"name": "my_function",
"description": "Description of my function",
"parameters": {
# JSON schema parameters here
}
})
async def my_function(raw_arguments: dict[str, object]):
# Function implementation
# raw_arguments contains the parsed JSON arguments
pass
The raw_schema
parameter accepts a dictionary that follows OpenAI's function definition format, which must include at least the name
and parameters
keys. This method is compatible with LLM providers supporting raw JSON Schema-based function definitions.
Sources: Tree View: | dse-workbenchcool-iron-91629
05/08/2025, 4:34 PM# JSON schema parameters
here look like?tall-airline-16756
05/08/2025, 4:34 PM# JSON schema parameters
should look like in practice. However, the raw_schema
must include a name
and parameters
key, and the parameters should follow the JSON schema format.
If you have a specific use case in mind, I recommend defining the parameters based on the expected input and output of your function, adhering to JSON schema standards. If you need further assistance, feel free to provide more details!cool-iron-91629
05/08/2025, 4:40 PMtall-airline-16756
05/08/2025, 4:40 PMstring
).
As long as the parameters
key adheres to JSON schema standards, this should work. If you encounter any issues, feel free to share the error or behavior you're observing, and I can assist further!