Thanks to visit codestin.com
Credit goes to github.com

Skip to content

remove structured LLM output from voice pipeline#6345

Merged
tinalenguyen merged 1 commit into
mainfrom
tina/rm-structured-output
Jul 7, 2026
Merged

remove structured LLM output from voice pipeline#6345
tinalenguyen merged 1 commit into
mainfrom
tina/rm-structured-output

Conversation

@tinalenguyen

Copy link
Copy Markdown
Member

Backs out the structured-output feature that shipped inside the expressive mode PR (#6116), leaving expressive mode itself intact:

  • Agent.llm_output_format class attribute and its init_subclass validation, plus the derived _response_field_name
  • llm.Response / llm.ResponseField annotations (llm/response_field.py)
  • ChatMessage.llm_output
  • streaming partial-JSON parse and final strict parse in generation._llm_inference_task, and _extract_spoken_text
  • BaseModel plumbing through text_ch / tts_node / TTSNode / perform_tts_inference / transcription and the segment channels

Backs out the structured-output feature that shipped inside the
expressive mode PR (#6116), leaving expressive mode itself intact:

- Agent.llm_output_format class attribute and its __init_subclass__
  validation, plus the derived _response_field_name
- llm.Response / llm.ResponseField annotations (llm/response_field.py)
- ChatMessage.llm_output
- streaming partial-JSON parse and final strict parse in
  generation._llm_inference_task, and _extract_spoken_text
- BaseModel plumbing through text_ch / tts_node / TTSNode /
  perform_tts_inference / transcription and the segment channels
@tinalenguyen tinalenguyen requested a review from a team as a code owner July 7, 2026 19:32

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 2 potential issues.

Open in Devin Review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

πŸ” Breaking public API removal: tts_node signature, ChatMessage.llm_output, and Agent.llm_output_format

This PR removes three public API surfaces that downstream users may depend on:

  1. Agent.llm_output_format class attribute and the __init_subclass__ validation β€” any subclass setting this will silently lose structured output support.
  2. ChatMessage.llm_output field (chat_context.py:293-294 in the base) β€” any code reading msg.llm_output will get an AttributeError at runtime.
  3. Agent.tts_node and Agent.default.tts_node signatures changed from AsyncIterable[str | BaseModel] to AsyncIterable[str] β€” any user override with the old signature will still work (it's contravariant), but code that was sending BaseModel instances into the stream will break.
  4. llm.Response and llm.ResponseField are no longer exported from livekit.agents.llm.

The removal itself is internally consistent (no dangling references found), but this is a significant breaking change that should be documented in a changelog or migration guide.

Open in Devin Review

Was this helpful? React with πŸ‘ or πŸ‘Ž to provide feedback.

@@ -117,8 +116,6 @@
"RealtimeSessionRestoredEvent",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

πŸ” Pre-existing: RealtimeSessionRestoredEvent listed in all but never imported

RealtimeSessionRestoredEvent appears in __all__ at line 116 but is not imported from any submodule. This means from livekit.agents.llm import RealtimeSessionRestoredEvent will raise an ImportError. This is a pre-existing issue (present in the base commit 77d1d399) and not introduced by this PR, but it's in the same __all__ block that was modified (lines 119-121 were removed).

Open in Devin Review

Was this helpful? React with πŸ‘ or πŸ‘Ž to provide feedback.

@tinalenguyen tinalenguyen merged commit c49416d into main Jul 7, 2026
24 of 26 checks passed
@tinalenguyen tinalenguyen deleted the tina/rm-structured-output branch July 7, 2026 19:39
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.

2 participants