Skip to content

fix(llm): drop the dangling openai.responses entry from _provider_format.__all__ - #8008

Merged
longcw merged 2 commits into
livekit:mainfrom
ShivamSharma43:fix/provider-format-all
Oct 26, 2026
Merged

longcw merged 2 commits into
livekit:mainfrom
ShivamSharma43:fix/provider-format-all

Conversation

@ShivamSharma43

Copy link
Copy Markdown
Contributor

Problem

A star import of the provider-format package fails:

from livekit.agents.llm._provider_format import *
# AttributeError: module 'livekit.agents.llm._provider_format' has no attribute 'openai.responses'

Root cause

#4192 added "openai.responses" to _provider_format.__all__. But openai.responses is a format name that ChatContext.to_provider_format and ToolContext.parse_function_tools accept, not a submodule: _provider_format/openai.py is a single module, and the Responses converters (to_responses_chat_ctx, to_responses_fnc_ctx) live inside it. A star import looks up every __all__ entry on the package, so the dotted name raises. Tools that read __all__, such as docs builds, get the bad name too.

This is the same class of bug as #7894 and #7981.

Fix

  • Remove "openai.responses" from __all__. The "openai.responses" format still works; nothing that dispatches on it changes.
  • Add tests/test_package_exports.py, which star-imports every livekit.agents package that defines __all__ (30 packages), so a dangling entry anywhere in the core package now fails the unit gate.

Tests

  • test_star_import_resolves_every_all_entry[livekit.agents.llm._provider_format] fails on main with the AttributeError above; the other 29 packages pass on both.
uv run pytest tests/test_package_exports.py tests/test_chat_ctx.py    # 117 passed, 1 skipped
uv run ruff check tests/test_package_exports.py livekit-agents/livekit/agents/llm/_provider_format
uv run ruff format --check tests/test_package_exports.py livekit-agents/livekit/agents/llm/_provider_format
uv run mypy --platform linux -p livekit.agents.llm._provider_format   # Success: no issues found

I also star-imported every plugin package. The only failures are aws, azure and nvidia, which raise the intended "install the optional extra" ImportError for their realtime modules, so I kept the new test to livekit.agents.

🤖 Generated with Claude Code

…mat.__all__

`openai.responses` is a provider-format name accepted by
`ChatContext.to_provider_format`, not a submodule: the Responses
converters live in `_provider_format.openai`. Listing it in `__all__`
made `from livekit.agents.llm._provider_format import *` raise
AttributeError.

Add a unit test that star-imports every livekit.agents package that
defines `__all__`, so a dangling entry anywhere in the package fails CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ShivamSharma43
ShivamSharma43 requested a review from a team as a code owner October 21, 2026 05:53
Copilot AI balanced review requested due to automatic review settings October 21, 2026 05:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@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: No Issues Found

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

Devin Review

@longcw longcw 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.

_provider_format is a private package, though, and nothing should star-import it. Please drop tests/test_package_exports.py.

_provider_format is private and nothing star-imports it, as requested in review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ShivamSharma43

Copy link
Copy Markdown
Contributor Author

Dropped tests/test_package_exports.py in 672ad2c, so the PR is now only the __all__ fix. Thanks for the review!

@longcw
longcw merged commit d882288 into livekit:main Oct 26, 2026
14 checks passed
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.

3 participants