[GH-ISSUE #3845] [langchain]: invalid Python indentifier in init_chat_model docstring examples #2766

Open
opened 2026-06-05 17:26:41 -04:00 by yindo · 3 comments
Owner

Originally created by @TheLibzter on GitHub (May 2, 2026).
Original GitHub issue: https://github.com/langchain-ai/docs/issues/3845

Type of issue

issue / bug

Language

Python

Description

The init_chat_model example blocks in:

  • libs/langchain_v1/langchain/chat_models/base.py
  • libs/langchain/langchain_classic/chat_models/base.py

use gemini_2-5_flash as a variable name in Python code examples. This is not a valid Python identifier (due to the - character), so users attempting to copy-paste the example to try the Gemini provider will encounter a syntax error, making the documentation misleading.

Suggested fix: Rename the variable to a valid Python identifier (gemini_2_5_flash).

I can open a PR to fix this if this approach is acceptable.

Originally created by @TheLibzter on GitHub (May 2, 2026). Original GitHub issue: https://github.com/langchain-ai/docs/issues/3845 ### Type of issue issue / bug ### Language Python ### Description The `init_chat_model` example blocks in: - libs/langchain_v1/langchain/chat_models/base.py - libs/langchain/langchain_classic/chat_models/base.py use `gemini_2-5_flash` as a variable name in Python code examples. This is not a valid Python identifier (due to the - character), so users attempting to copy-paste the example to try the Gemini provider will encounter a syntax error, making the documentation misleading. Suggested fix: Rename the variable to a valid Python identifier (gemini_2_5_flash). I can open a PR to fix this if this approach is acceptable.
yindo added the langchainexternal labels 2026-06-05 17:26:41 -04:00
Author
Owner

@Yacklin commented on GitHub (May 2, 2026):

You posted a good issue in a wrong repo lol

<!-- gh-comment-id:4365304419 --> @Yacklin commented on GitHub (May 2, 2026): You posted a good issue in a wrong repo lol
Author
Owner

@Yacklin commented on GitHub (May 2, 2026):

I made a PR for this one

<!-- gh-comment-id:4365329156 --> @Yacklin commented on GitHub (May 2, 2026): I made a PR for this one
Author
Owner

@TheLibzter commented on GitHub (May 3, 2026):

yeah i was kind of unsure where to post it, oopsie. Thank you!

<!-- gh-comment-id:4366164912 --> @TheLibzter commented on GitHub (May 3, 2026): yeah i was kind of unsure where to post it, oopsie. Thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#2766