Skip to content

Fix model header normalization for custom providers#1577

Open
corazzione wants to merge 1 commit intobytedance:mainfrom
corazzione:fix/model-header-normalization
Open

Fix model header normalization for custom providers#1577
corazzione wants to merge 1 commit intobytedance:mainfrom
corazzione:fix/model-header-normalization

Conversation

@corazzione
Copy link
Copy Markdown
Contributor

@corazzione corazzione commented Mar 29, 2026

Fixes #1531

Summary

This PR makes model construction more tolerant of custom provider headers that are accidentally declared at the model root in config.yaml.

Problem

Some custom-provider configs include HTTP headers such as User-Agent. When those header entries leak into the model config root instead of being nested under default_headers, DeerFlow forwards them as direct constructor kwargs and provider SDKs fail with errors like:

  • AsyncCompletions.create() got an unexpected keyword argument 'User-Agent'

Fix

  • normalize header-like extra config keys into default_headers before instantiating the model class
  • preserve the existing default_headers flow
  • add a regression test covering User-Agent normalization for a custom provider config

Validation

  • ./.venv/Scripts/python.exe -m pytest tests/test_model_factory.py -q
  • ./.venv/Scripts/python.exe -m ruff check packages/harness/deerflow/models/factory.py tests/test_model_factory.py

@corazzione corazzione marked this pull request as ready for review March 29, 2026 20:06
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.

kimi2.5 config.yaml issue

1 participant