Skip to content

Bug: LangChain Serialization Protocol for Custom Model Providers #2026

@xunliu

Description

@xunliu

Problem

Two custom model providers were missing the LangChain serialization protocol, causing to receive {"type": "not_implemented"} instead of the actual model kwargs.

Affected classes

Class File Parent
PatchedChatDeepSeek deerflow/models/patched_deepseek.py ChatDeepSeek
CodexChatModel deerflow/models/openai_codex_provider.py BaseChatModel

Root cause

ChatDeepSeek does not implement is_lc_serializable(), so it returns False (the Serializable base class default). When a subclass inherits this, to_json() short-circuits to {"type": "not_implemented", "repr": "..."} with no kwargs field.

CodexChatModel inherits directly from BaseChatModel, which also does not override is_lc_serializable().

The other patched providers (PatchedChatOpenAI, PatchedChatMiniMax, VllmChatModel, ClaudeChatModel) are unaffected because their parent classes (ChatOpenAI, ChatAnthropic) already return True.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions