The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
feat(model-profiles): support more providers (#33766)
ccurme424214041ecc
diff --git a/libs/model-profiles/langchain_model_profiles/data/augmentations/providers/amazon-bedrock.toml b/libs/model-profiles/langchain_model_profiles/data/augmentations/providers/amazon-bedrock.tomlnew file mode 100644index 0000000000..658df1dafd--- /dev/null+++ b/libs/model-profiles/langchain_model_profiles/data/augmentations/providers/amazon-bedrock.toml@@ -0,0 +1,6 @@+[profile]+image_url_inputs = true+pdf_inputs = true+pdf_tool_message = true+image_tool_message = true+structured_output = falsediff --git a/libs/model-profiles/langchain_model_profiles/data/augmentations/providers/google.toml b/libs/model-profiles/langchain_model_profiles/data/augmentations/providers/google.tomlnew file mode 100644index 0000000000..3b652c5d00--- /dev/null+++ b/libs/model-profiles/langchain_model_profiles/data/augmentations/providers/google.toml@@ -0,0 +1,6 @@+[profile]+image_url_inputs = true+pdf_inputs = true+image_tool_message = true+tool_choice = true+structured_output = truediff --git a/libs/model-profiles/langchain_model_profiles/data/augmentations/providers/google_vertexai.toml b/libs/model-profiles/langchain_model_profiles/data/augmentations/providers/google_vertexai.tomlnew file mode 100644index 0000000000..3b652c5d00--- /dev/null+++ b/libs/model-profiles/langchain_model_profiles/data/augmentations/providers/google_vertexai.toml@@ -0,0 +1,6 @@+[profile]+image_url_inputs = true+pdf_inputs = true+image_tool_message = true+tool_choice = true+structured_output = truediff --git a/libs/model-profiles/langchain_model_profiles/model_profile.py b/libs/model-profiles/langchain_model_profiles/model_profile.pyindex b67ddb80c9..6eb06a860e 100644--- a/libs/model-profiles/langchain_model_profiles/model_profile.py+++ b/libs/model-profiles/langchain_model_profiles/model_profile.py@@ -1,5 +1,7 @@"""Model profiles package."""+import re+from typing_extensions import TypedDictfrom langchain_model_profiles._data_loader import _DataLoader@@ -79,27 +81,67 @@ _LOADER = _DataLoader()_lc_type_to_provider_id = {"openai-chat": "openai",+ "azure-openai-chat": "azure","anthropic-chat": "anthropic",+ "chat-google-generative-ai": "google",+ "vertexai": "google-vertex",+ "anthropic-chat-vertexai": "google-vertex-anthropic",+ "amazon_bedrock_chat": "amazon-bedrock",+ "amazon_bedrock_converse_chat": "amazon-bedrock",+ "chat-ai21": "ai21",+ "chat-deepseek": "deepseek",+ "fireworks-chat": "fireworks-ai",+ "groq-chat": "groq",+ "huggingface-chat-wrapper": "huggingface",+ "mistralai-chat": "mistral",+ "chat-ollama": "ollama",+ "perplexitychat": "perplexity",+ "together-chat": "togetherai",+ "upstage-chat": "upstage",+ "xai-chat": "xai",}-def get_model_profile(provider_id: str, model_id: str) -> ModelProfile | None:+def _translate_provider_and_model_id(provider: str, model: str) -> tuple[str, str]:+ """Translate LangChain provider and model to models.dev equivalents.++ Args:+ provider: LangChain provider ID.+ model: LangChain model ID.++ Returns:+ A tuple containing the models.dev provider ID and model ID.+ """+ provider_id = _lc_type_to_provider_id.get(provider, provider)++ if provider_id in ("google", "google-vertex"):+ # convert models/gemini-2.0-flash-001 to gemini-2.0-flash+ model_id = re.sub(r"-\d{3}$", "", model.replace("models/", ""))+ elif provider_id == "amazon-bedrock":+ # strip region prefixes like "us."+ model_id = re.sub(r"^[A-Za-z]{2}\.", "", model)+ else:+ model_id = model++ return provider_id, model_id+++def get_model_profile(provider: str, model: str) -> ModelProfile | None:"""Get the model capabilities for a given model.Args:- provider_id: Identifier for provider (e.g., `'openai'`, `'anthropic'`).- model_id: Identifier for model (e.g., `'gpt-5'`,+ provider: Identifier for provider (e.g., `'openai'`, `'anthropic'`).+ model: Identifier for model (e.g., `'gpt-5'`,`'claude-sonnet-4-5-20250929'`).Returns:The model capabilities or `None` if not found in the data."""- if not provider_id or not model_id:+ if not provider or not model:return None- data = _LOADER.get_profile_data(- _lc_type_to_provider_id.get(provider_id, provider_id), model_id- )+ provider_id, model_id = _translate_provider_and_model_id(provider, model)+ data = _LOADER.get_profile_data(provider_id, model_id)if not data:# If either (1) provider not found or (2) model not found under matched providerreturn Nonediff --git a/libs/model-profiles/tests/unit_tests/test_chat_model.py b/libs/model-profiles/tests/unit_tests/test_chat_model.pyindex ef808e5a1b..26fb9bef62 100644--- a/libs/model-profiles/tests/unit_tests/test_chat_model.py+++ b/libs/model-profiles/tests/unit_tests/test_chat_model.py@@ -1,6 +1,5 @@"""End to end test for fetching model profiles from a chat model."""-import pytestfrom langchain.chat_models import init_chat_model@@ -12,7 +11,7 @@ def test_chat_model() -> None:assert model.profile["structured_output"]-def test_chat_model_no_data(monkeypatch: pytest.MonkeyPatch) -> None:+def test_chat_model_no_data() -> None:"""Test that chat model handles missing profile data."""model = init_chat_model("openai:gpt-fake", api_key="foo")assert model.profile == {}diff --git a/libs/model-profiles/tests/unit_tests/test_model_profile.py b/libs/model-profiles/tests/unit_tests/test_model_profile.pynew file mode 100644index 0000000000..44c40c640a--- /dev/null+++ b/libs/model-profiles/tests/unit_tests/test_model_profile.py@@ -0,0 +1,31 @@+"""Test provider and model ID mappings."""++import pytest++from langchain_model_profiles.model_profile import get_model_profile+++ ("provider", "model_id"),+ [+ ("openai-chat", "gpt-5"),+ ("azure-openai-chat", "gpt-5"),+ ("anthropic-chat", "claude-sonnet-4-5"),+ ("vertexai", "models/gemini-2.0-flash-001"),+ ("chat-google-generative-ai", "models/gemini-2.0-flash-001"),+ ("amazon_bedrock_chat", "anthropic.claude-sonnet-4-20250514-v1:0"),+ ("amazon_bedrock_converse_chat", "anthropic.claude-sonnet-4-20250514-v1:0"),+ # ("chat-ai21", "jamba-mini"), # no data yet # noqa: ERA001+ ("chat-deepseek", "deepseek-reasoner"),+ ("fireworks-chat", "accounts/fireworks/models/gpt-oss-20b"),+ ("groq-chat", "llama-3.3-70b-versatile"),+ ("huggingface-chat-wrapper", "Qwen/Qwen3-235B-A22B-Thinking-2507"),+ ("mistralai-chat", "mistral-large-latest"),+ # ("chat-ollama", "llama3.1"), # no data yet # noqa: ERA001+ ("perplexitychat", "sonar"),+ ("xai-chat", "grok-4"),+ ],+)+def test_id_translation(provider: str, model_id: str) -> None:+ """Test translation from LangChain to model / provider IDs."""+ assert get_model_profile(provider, model_id)