Feature Type
Would make my life easier
Feature Description
When the LLM makes a function call with invalid arguments (e.g., missing required fields, wrong types, invalid enum values), Livekit attempts to parse the arguments in a pydantic model (see here) which raises a ValidationError. Livekit does catch the exception and generate a tool output (see here). However it hardcodes "An internal error occurred" in the output (see here). This gives the LLM no feedback about what was wrong with its arguments, so it has no signal to self-correct.
Potential fix: catching the pydantic ValidationError and raising a ToolError would fix it, as tool errors are surfaced to the LLM (see here).
Workarounds / Alternatives
No response
Additional Context
No response
Feature Type
Would make my life easier
Feature Description
When the LLM makes a function call with invalid arguments (e.g., missing required fields, wrong types, invalid enum values), Livekit attempts to parse the arguments in a pydantic model (see here) which raises a
ValidationError. Livekit does catch the exception and generate a tool output (see here). However it hardcodes "An internal error occurred" in the output (see here). This gives the LLM no feedback about what was wrong with its arguments, so it has no signal to self-correct.Potential fix: catching the pydantic
ValidationErrorand raising aToolErrorwould fix it, as tool errors are surfaced to the LLM (see here).Workarounds / Alternatives
No response
Additional Context
No response