Skip to content

fix: return error to LLM for unknown function calls in voice path#4938

Open
rupesh-svg wants to merge 1 commit intolivekit:mainfrom
rupesh-svg:fix/return-error-for-unknown-function-calls
Open

fix: return error to LLM for unknown function calls in voice path#4938
rupesh-svg wants to merge 1 commit intolivekit:mainfrom
rupesh-svg:fix/return-error-for-unknown-function-calls

Conversation

@rupesh-svg
Copy link

Fixes #4933

The voice path in generation.py silently drops unknown function calls with continue, leaving tool_output.output empty. This causes the agent to stop responding since agent_activity.py only retriggers the LLM when tool outputs are present.

Now returns a FunctionCallResult with is_error=True via make_tool_output, matching the existing pattern in llm/utils.py and the validation error handler in the same function.

When the LLM calls a function not registered in the tool context, the
voice path silently skips it with `continue`, leaving tool_output.output
empty. This causes the agent to stop responding entirely since the
downstream code in agent_activity.py only retriggers the LLM when
tool outputs are present.

Return a FunctionCallResult with is_error=True (via make_tool_output)
so the LLM receives the error and can recover gracefully. This matches
the existing behavior in llm/utils.py and the validation error handler
already present in the same function.

Fixes livekit#4933
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Voice path silently drops unknown function calls instead of returning error to LLM

2 participants