Skip to content

fix: #2823 AnyLLM reasoning extraction for iterable vLLM/any-llm Reasoning objects#2822

Merged
seratch merged 1 commit intoopenai:mainfrom
ziqi-cn:codex/fix-any-llm-reasoning-flatten
Apr 2, 2026
Merged

fix: #2823 AnyLLM reasoning extraction for iterable vLLM/any-llm Reasoning objects#2822
seratch merged 1 commit intoopenai:mainfrom
ziqi-cn:codex/fix-any-llm-reasoning-flatten

Conversation

@ziqi-cn
Copy link
Copy Markdown
Contributor

@ziqi-cn ziqi-cn commented Apr 1, 2026

Summary

Fix AnyLLMModel reasoning extraction on the chat-completions path for any-llm Reasoning objects.

This was observed with a vLLM OpenAI-compatible endpoint, where reasoning deltas reached AnyLLMModel as values like Reasoning(content="用户"). The previous implementation flattened generic iterables before checking .content, .text, and .thinking, so iterable Pydantic objects could be normalized incorrectly as content用户 instead of 用户.

This change makes the helper prefer reasoning attributes first, then fall back to iterable flattening.

Test plan

  • Added a regression test covering Reasoning(content="用户")
  • Ran uv run pytest tests/models/test_any_llm_model.py -q
  • Ran make format
  • Ran make lint

Issue number

Closes #2823

Checks

  • I've added new tests (if relevant)
  • I've added/updated the relevant documentation
  • I've run make lint and make format
  • I've made sure tests pass

@seratch seratch changed the title Fix AnyLLM reasoning extraction for iterable vLLM/any-llm Reasoning objects fix: #2823 AnyLLM reasoning extraction for iterable vLLM/any-llm Reasoning objects Apr 2, 2026
@seratch seratch added this to the 0.13.x milestone Apr 2, 2026
@seratch seratch merged commit fe9e70f into openai:main Apr 2, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AnyLLMModel corrupts vLLM reasoning deltas by flattening iterable Reasoning objects too early

2 participants