[PR #2591] [MERGED] oss(deepagents): fix chat model tab snippets #2576

Closed
opened 2026-02-17 17:23:33 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/docs/pull/2591
Author: @mdrxy
Created: 2/11/2026
Status: Merged
Merged: 2/11/2026
Merged by: @mdrxy

Base: mainHead: mdrxy/fix-snippet


📝 Commits (1)

  • 33e178c oss(deepagents): fix chat model tab snippets

📊 Changes

1 file changed (+8 additions, -26 deletions)

View changed files

📝 src/snippets/chat-model-tabs-da.mdx (+8 -26)

📄 Description

  • Remove unnecessary init_chat_model() calls that wrapped already-instantiated BaseChatModel instances in the Deep Agents "Model Class" code examples
  • Affects all provider tabs (OpenAI, Anthropic, Azure, Google, AWS Bedrock, HuggingFace) in the chat model tabs snippet

Why

init_chat_model() is a convenience function that converts a string model identifier (e.g., "openai:gpt-4.1") into a BaseChatModel instance. Wrapping an already-instantiated BaseChatModel (e.g., ChatOpenAI(model="gpt-4.1")) inside init_chat_model(model=...) is wrong — the object is already the type that init_chat_model would return. This also removes the unnecessary from langchain.chat_models import init_chat_model` import from each example.


I think the confusion may have arose from LLMToolSelectorMiddleware


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/docs/pull/2591 **Author:** [@mdrxy](https://github.com/mdrxy) **Created:** 2/11/2026 **Status:** ✅ Merged **Merged:** 2/11/2026 **Merged by:** [@mdrxy](https://github.com/mdrxy) **Base:** `main` ← **Head:** `mdrxy/fix-snippet` --- ### 📝 Commits (1) - [`33e178c`](https://github.com/langchain-ai/docs/commit/33e178c113e1b2aa2778bf66e1a08741377617e4) oss(deepagents): fix chat model tab snippets ### 📊 Changes **1 file changed** (+8 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `src/snippets/chat-model-tabs-da.mdx` (+8 -26) </details> ### 📄 Description - Remove unnecessary `init_chat_model()` calls that wrapped already-instantiated `BaseChatModel` instances in the Deep Agents "Model Class" code examples - Affects all provider tabs (OpenAI, Anthropic, Azure, Google, AWS Bedrock, HuggingFace) in the chat model tabs snippet ## Why `init_chat_model()` is a convenience function that converts a **string** model identifier (e.g., `"openai:gpt-4.1"`) into a `BaseChatModel` instance. Wrapping an already-instantiated `BaseChatModel` (e.g., `ChatOpenAI(model="gpt-4.1")`) inside `init_chat_model(model=...)` is wrong — the object is already the type that `init_chat_model` would return. This also removes the unnecessary `from langchain.chat_models import `init_chat_model` import from each example. --- I think the confusion may have arose from `LLMToolSelectorMiddleware` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-17 17:23:33 -05:00
yindo closed this issue 2026-02-17 17:23:33 -05:00
yindo changed title from [PR #2591] oss(deepagents): fix chat model tab snippets to [PR #2591] [MERGED] oss(deepagents): fix chat model tab snippets 2026-06-05 18:19:22 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#2576