mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-06 21:20:33 +00:00
langchain: add support for Google Anthropic Vertex AI model garden provider in init_chat_model (#28177)
Simple modification to add support for anthropic models deployed in Google Vertex AI model garden in `init_chat_model` importing `ChatAnthropicVertex` - [v] **Lint and test**
This commit is contained in:
parent
ff7b01af88
commit
24bfa062bf
@ -116,6 +116,7 @@ def init_chat_model(
|
||||
- 'huggingface' -> langchain-huggingface
|
||||
- 'groq' -> langchain-groq
|
||||
- 'ollama' -> langchain-ollama
|
||||
- 'google_anthropic_vertex' -> langchain-google-vertexai
|
||||
|
||||
Will attempt to infer model_provider from model if not specified. The
|
||||
following providers will be inferred based on these model prefixes:
|
||||
@ -410,6 +411,11 @@ def _init_chat_model_helper(
|
||||
from langchain_aws import ChatBedrockConverse
|
||||
|
||||
return ChatBedrockConverse(model=model, **kwargs)
|
||||
elif model_provider == "google_anthropic_vertex":
|
||||
_check_pkg("langchain_google_vertexai")
|
||||
from langchain_google_vertexai.model_garden import ChatAnthropicVertex
|
||||
|
||||
return ChatAnthropicVertex(model=model, **kwargs)
|
||||
else:
|
||||
supported = ", ".join(_SUPPORTED_PROVIDERS)
|
||||
raise ValueError(
|
||||
@ -433,6 +439,7 @@ _SUPPORTED_PROVIDERS = {
|
||||
"groq",
|
||||
"bedrock",
|
||||
"bedrock_converse",
|
||||
"google_anthropic_vertex",
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user