mirror of
https://github.com/hwchase17/langchain.git
synced 2026-03-18 02:53:16 +00:00
fix(langchain): infer provider from mixed-case prefixes (#34672)
Fix provider inference for mixed-case model prefixes and add matching unit coverage.
This commit is contained in:
@@ -501,7 +501,7 @@ def _attempt_infer_model_provider(model_name: str) -> str | None:
|
||||
return "cohere"
|
||||
|
||||
# Fireworks models
|
||||
if model_name.startswith("accounts/fireworks"):
|
||||
if model_lower.startswith("accounts/fireworks"):
|
||||
return "fireworks"
|
||||
|
||||
# Google models
|
||||
@@ -509,7 +509,7 @@ def _attempt_infer_model_provider(model_name: str) -> str | None:
|
||||
return "google_vertexai"
|
||||
|
||||
# AWS Bedrock models
|
||||
if model_name.startswith("amazon.") or model_lower.startswith(("anthropic.", "meta.")):
|
||||
if model_lower.startswith(("amazon.", "anthropic.", "meta.")):
|
||||
return "bedrock"
|
||||
|
||||
# Mistral models
|
||||
|
||||
@@ -78,11 +78,14 @@ def test_supported_providers_is_sorted() -> None:
|
||||
("claude-3-haiku-20240307", "anthropic"),
|
||||
("command-r-plus", "cohere"),
|
||||
("accounts/fireworks/models/mixtral-8x7b-instruct", "fireworks"),
|
||||
("Accounts/Fireworks/models/mixtral-8x7b-instruct", "fireworks"),
|
||||
("gemini-1.5-pro", "google_vertexai"),
|
||||
("gemini-2.5-pro", "google_vertexai"),
|
||||
("gemini-3-pro-preview", "google_vertexai"),
|
||||
("amazon.titan-text-express-v1", "bedrock"),
|
||||
("Amazon.Titan-Text-Express-v1", "bedrock"),
|
||||
("anthropic.claude-v2", "bedrock"),
|
||||
("Anthropic.Claude-V2", "bedrock"),
|
||||
("mistral-small", "mistralai"),
|
||||
("mixtral-8x7b", "mistralai"),
|
||||
("deepseek-v3", "deepseek"),
|
||||
|
||||
Reference in New Issue
Block a user