Skip to content

fix(provider): normalize DeepSeek non-string message content - #3458

Merged
Re-bin merged 1 commit into
HKUDS:mainfrom
boogieLing:fix/deepseek-content-normalization-clean
Apr 27, 2026
Merged

Re-bin merged 1 commit into
HKUDS:mainfrom
boogieLing:fix/deepseek-content-normalization-clean

Conversation

@boogieLing

Copy link
Copy Markdown
Contributor

Summary

Normalize non-string messages[*].content payloads before provider dispatch to improve DeepSeek/OpenAI-compatible request robustness.

Scope

  • nanobot/providers/openai_compat_provider.py
  • tests/providers/test_litellm_kwargs.py

Rationale

Some upstream tool/provider paths can produce non-string content blocks. This patch ensures stable provider input normalization without changing session/history behavior.

Validation

  • uv run --extra dev pytest tests/providers/test_litellm_kwargs.py -q (passed)

Risk

Low. Provider payload normalization only; no session/memory lifecycle changes.

@chengyongru

Copy link
Copy Markdown
Collaborator

#3328

@Re-bin Re-bin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is the right kind of fix.

The change is narrow and provider-scoped: DeepSeek gets strict string content normalization, while other OpenAI-compatible providers keep their existing block/list content behavior. That is the boundary I wanted to see here.

I pulled in the latest main and reviewed the three-dot diff. It stays limited to:

  • nanobot/providers/openai_compat_provider.py
  • tests/providers/test_litellm_kwargs.py

I also ran the relevant provider tests locally:

python -m pytest tests/providers/test_litellm_kwargs.py -q

Result: 58 passed.

From my side, this is clean, practical, and ready to merge.

@Re-bin
Re-bin merged commit 8e0ce59 into HKUDS:main Apr 27, 2026
8 checks passed
@boogieLing
boogieLing deleted the fix/deepseek-content-normalization-clean branch April 27, 2026 09:12
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