Skip to content

feat(langchain): Broaden AI provider detection beyond OpenAI and Anthropic#5707

Draft
ericapisani wants to merge 1 commit intomasterfrom
ep/broaden-langgraph-model-support-6d0
Draft

feat(langchain): Broaden AI provider detection beyond OpenAI and Anthropic#5707
ericapisani wants to merge 1 commit intomasterfrom
ep/broaden-langgraph-model-support-6d0

Conversation

@ericapisani
Copy link
Member

Summary

  • Extracts a _get_ai_system() helper that generically detects AI providers from LangChain's _type field, replacing hardcoded "anthropic" / "openai" checks.
  • Splits _type on - and skips non-provider segments (cloud prefixes like "azure" and descriptors like "chat" / "llm") to return the actual provider name.
  • Adds support for Cohere, Ollama, Mistral, Fireworks, HuggingFace, Groq, NVIDIA, xAI, DeepSeek, Google, and any future LangChain providers without code changes.

Test plan

  • Parametrized test with 23 cases covering real LangChain _llm_type values from 14 providers
  • Edge cases: empty string, None, cloud-prefix-only ("azure"), underscore-separated ("amazon_bedrock_chat")
  • Existing OpenAI/Anthropic behavior is preserved (backwards compatible)
  • CI passes

🤖 Generated with Claude Code

…ropic

Extract _get_ai_system() to generically detect AI providers from LangChain's
_type field instead of hardcoding only "anthropic" and "openai". The function
splits on "-" and skips non-provider segments (cloud prefixes like "azure" and
descriptors like "chat"/"llm") to return the actual provider name.

This adds support for Cohere, Ollama, Mistral, Fireworks, HuggingFace, Groq,
NVIDIA, xAI, DeepSeek, Google, and any future LangChain providers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ericapisani ericapisani requested a review from a team as a code owner March 19, 2026 12:07
@ericapisani ericapisani marked this pull request as draft March 19, 2026 12:07
@ericapisani
Copy link
Member Author

@cursoragent please review this

@cursor
Copy link

cursor bot commented Mar 19, 2026

Please finish setting up background agents. Go to Cursor

@github-actions
Copy link
Contributor

github-actions bot commented Mar 19, 2026

Codecov Results 📊

13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 9.79s

All tests are passing successfully.

❌ Patch coverage is 0.00%. Project has 14374 uncovered lines.

Files with missing lines (1)
File Patch % Lines
langchain.py 3.24% ⚠️ 598 Missing

Generated by Codecov Action

@github-actions
Copy link
Contributor

Codecov Results 📊

9 passed | ⏭️ 1 skipped | Total: 10 | Pass Rate: 90% | Execution Time: 3.63s

All tests are passing successfully.

❌ Patch coverage is 0.00%. Project has 14771 uncovered lines.

Files with missing lines (1)
File Patch % Lines
langchain.py 3.24% ⚠️ 598 Missing

Generated by Codecov Action

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant