Skip to content

fix: add missing serializer registration to 6 chat adapters (#1477)#1496

Open
EvanYao826 wants to merge 2 commits into
i-am-bee:mainfrom
EvanYao826:fix/add-missing-serializer-registration
Open

fix: add missing serializer registration to 6 chat adapters (#1477)#1496
EvanYao826 wants to merge 2 commits into
i-am-bee:mainfrom
EvanYao826:fix/add-missing-serializer-registration

Conversation

@EvanYao826

Copy link
Copy Markdown

Summary

Fixes #1477

6 of 12 TypeScript chat adapters were missing the static { ClassName.register() } call needed for proper serializer/deserializer support. This PR adds the missing registration to all concrete adapter classes.

Changes

Adapter Class Status
amazon-bedrock AmazonBedrockChatModel ✅ Added
azure-openai AzureOpenAIChatModel ✅ Added
google-vertex GoogleVertexChatModel ✅ Added
langchain LangChainChatModel ✅ Added
openai OpenAIChatModel ✅ Added
watsonx WatsonxChatModel ✅ Added
vercel VercelChatModel ⏭️ Skipped (abstract class)

Already registered (no changes needed)

  • anthropic, dummy, groq, ollama — this.register()
  • xai — XAIChatModel.register()

Verification

Each adapter now has a static initializer block at the end of the class:

static {
    ClassName.register();
}

This matches the pattern used by the 4 already-registered adapters (anthropic, dummy, groq, ollama) and ensures that ChatModel.fromName() can properly deserialize instances of these adapters.

@EvanYao826 EvanYao826 requested a review from a team as a code owner June 15, 2026 09:12
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 15, 2026
@github-actions github-actions Bot added the typescript Typescript related functionality label Jun 15, 2026

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request adds static initialization blocks to automatically register several chat model adapters, including Amazon Bedrock, Azure OpenAI, Google Vertex, LangChain, OpenAI, and Watsonx. The reviewer recommends using 'this.register()' instead of referencing the class names directly inside the static blocks, which is more idiomatic, robust against future class renames, and consistent with other adapters in the codebase.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +29 to +32
static {
AmazonBedrockChatModel.register();
}
} No newline at end of file

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.

medium

Using this.register() inside the static block is more idiomatic and robust than referencing the class name directly. In a static block, this refers to the class constructor itself, which prevents potential bugs if the class is renamed in the future. Additionally, this aligns with the pattern already used by other adapters in the codebase (such as anthropic, dummy, groq, and ollama). This suggestion also adds a trailing newline to the file.

Suggested change
static {
AmazonBedrockChatModel.register();
}
}
static {
this.register();
}
}

Comment on lines +29 to +32
static {
AzureOpenAIChatModel.register();
}
} No newline at end of file

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.

medium

Using this.register() inside the static block is more idiomatic and robust than referencing the class name directly. In a static block, this refers to the class constructor itself, which prevents potential bugs if the class is renamed in the future. Additionally, this aligns with the pattern already used by other adapters in the codebase (such as anthropic, dummy, groq, and ollama). This suggestion also adds a trailing newline to the file.

Suggested change
static {
AzureOpenAIChatModel.register();
}
}
static {
this.register();
}
}

Comment on lines +29 to +32
static {
GoogleVertexChatModel.register();
}
} No newline at end of file

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.

medium

Using this.register() inside the static block is more idiomatic and robust than referencing the class name directly. In a static block, this refers to the class constructor itself, which prevents potential bugs if the class is renamed in the future. Additionally, this aligns with the pattern already used by other adapters in the codebase (such as anthropic, dummy, groq, and ollama). This suggestion also adds a trailing newline to the file.

Suggested change
static {
GoogleVertexChatModel.register();
}
}
static {
this.register();
}
}

Comment on lines +153 to +156
static {
LangChainChatModel.register();
}
} No newline at end of file

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.

medium

Using this.register() inside the static block is more idiomatic and robust than referencing the class name directly. In a static block, this refers to the class constructor itself, which prevents potential bugs if the class is renamed in the future. Additionally, this aligns with the pattern already used by other adapters in the codebase (such as anthropic, dummy, groq, and ollama). This suggestion also adds a trailing newline to the file.

Suggested change
static {
LangChainChatModel.register();
}
}
static {
this.register();
}
}

Comment on lines +26 to +29
static {
OpenAIChatModel.register();
}
} No newline at end of file

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.

medium

Using this.register() inside the static block is more idiomatic and robust than referencing the class name directly. In a static block, this refers to the class constructor itself, which prevents potential bugs if the class is renamed in the future. Additionally, this aligns with the pattern already used by other adapters in the codebase (such as anthropic, dummy, groq, and ollama). This suggestion also adds a trailing newline to the file.

Suggested change
static {
OpenAIChatModel.register();
}
}
static {
this.register();
}
}

Comment on lines +302 to +305
static {
WatsonxChatModel.register();
}
} No newline at end of file

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.

medium

Using this.register() inside the static block is more idiomatic and robust than referencing the class name directly. In a static block, this refers to the class constructor itself, which prevents potential bugs if the class is renamed in the future. Additionally, this aligns with the pattern already used by other adapters in the codebase (such as anthropic, dummy, groq, and ollama). This suggestion also adds a trailing newline to the file.

Suggested change
static {
WatsonxChatModel.register();
}
}
static {
this.register();
}
}

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Jun 22, 2026
@Tomas2D

Tomas2D commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Hi @EvanYao826 — the change itself is approved (correct and complete fix for #1477), but it's blocked by a failing DCO check: neither of the two commits is signed off.

To sign off both commits and refresh the branch in one go:

git fetch origin
git rebase --signoff origin/main
git push --force-with-lease

(The Signed-off-by: email must match your commit-author email.) Rebasing on origin/main also clears the "out of date" state. Once DCO is green I'll get this merged. Thanks!

Fixes i-am-bee#1477

6 of 12 TypeScript chat adapters were missing the static register()
call, which is needed for proper serializer/deserializer support:

- amazon-bedrock: AmazonBedrockChatModel.register()
- azure-openai: AzureOpenAIChatModel.register()
- google-vertex: GoogleVertexChatModel.register()
- langchain: LangChainChatModel.register()
- openai: OpenAIChatModel.register()
- watsonx: WatsonxChatModel.register()

The following adapters already had registration:
- anthropic, dummy, groq, ollama (this.register())
- xai (XAIChatModel.register())

Note: vercel is abstract and does not need registration.
Signed-off-by: EvanYao826 <2869018789@qq.com>
Signed-off-by: EvanYao826 <2869018789@qq.com>
@EvanYao826 EvanYao826 force-pushed the fix/add-missing-serializer-registration branch from 506d981 to 3485a2c Compare June 30, 2026 02:03
@EvanYao826

Copy link
Copy Markdown
Author

Hi @Tomas2D — both commits have been signed off and force-pushed. Could you trigger the DCO check again? Thanks for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files. typescript Typescript related functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verify serializer registration coverage of TypeScript chat adapters

2 participants