repowiselangchain-ai/langchain

Code health of langchain-ai/langchain

Repowise scores langchain-ai/langchain at 7.2 out of 10 for code health, which reads as good, alongside maintainability 8.5 and static performance 10.0 on the same scale. There are 3,096 open findings across the three pillars, and the lowest-scoring file is base.py at 1.0. Scores are computed from complexity, duplication, churn and git fix history, not from a linter.

Findings by severity

205 critical, 644 high, 807 medium, 1,440 low.

Hotspots

45 files are flagged as hotspots. The top 5:

  • libs/partners/openrouter/langchain_openrouter/data/_profiles.py: 71 commits in the last 90 days from 3 contributors
  • libs/partners/anthropic/langchain_anthropic/chat_models.py: 23 commits in the last 90 days from 45 contributors with 21 recent bug fixes
  • libs/partners/openai/langchain_openai/chat_models/base.py: 13 commits in the last 90 days from 81 contributors with 18 recent bug fixes
  • libs/partners/fireworks/langchain_fireworks/data/_profiles.py: 24 commits in the last 90 days from 5 contributors with 1 recent bug fix
  • libs/core/langchain_core/runnables/base.py: 4 commits in the last 90 days from 36 contributors with 2 recent bug fixes

Lowest-scoring files

  • libs/partners/openai/langchain_openai/chat_models/base.py: 1.0 out of 10 with 18 bug fixes in the last 180 days
  • libs/partners/anthropic/langchain_anthropic/chat_models.py: 1.0 out of 10 with 21 bug fixes in the last 180 days
  • libs/core/langchain_core/language_models/chat_models.py: 1.0 out of 10 with 7 bug fixes in the last 180 days
  • libs/core/langchain_core/messages/utils.py: 1.0 out of 10 with 4 bug fixes in the last 180 days
  • libs/partners/fireworks/langchain_fireworks/chat_models.py: 1.0 out of 10 with 10 bug fixes in the last 180 days

Checked against bug fixes

Of the 20 files Repowise scores lowest, 19 had a bug fix in the last 180 days. Across all 2,683 scored files, 9.8% had a bug fix in that window.

Dead code and refactoring

Repowise found 2 unused exports. 115 refactoring targets across 115 files would raise the score.

More on langchain: summary and FAQ, codebase overview, architecture.

Related guide: Best dead code detection tools by language