Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.

Commit 217de4e

Browse files
authored
langchain[patch]: de-beta init_chat_model (langchain-ai#27558)
1 parent 4466caa commit 217de4e

File tree

1 file changed

+29
-26
lines changed
  • libs/langchain/langchain/chat_models

1 file changed

+29
-26
lines changed

libs/langchain/langchain/chat_models/base.py

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
overload,
2020
)
2121

22-
from langchain_core._api import beta
2322
from langchain_core.language_models import (
2423
BaseChatModel,
2524
LanguageModelInput,
@@ -83,7 +82,6 @@ def init_chat_model(
8382
# FOR CONTRIBUTORS: If adding support for a new provider, please append the provider
8483
# name to the supported list in the docstring below. Do *not* change the order of the
8584
# existing providers.
86-
@beta()
8785
def init_chat_model(
8886
model: Optional[str] = None,
8987
*,
@@ -96,38 +94,39 @@ def init_chat_model(
9694
) -> Union[BaseChatModel, _ConfigurableModel]:
9795
"""Initialize a ChatModel from the model name and provider.
9896
99-
Must have the integration package corresponding to the model provider installed.
97+
**Note:** Must have the integration package corresponding to the model provider
98+
installed.
10099
101100
Args:
102101
model: The name of the model, e.g. "gpt-4o", "claude-3-opus-20240229".
103102
model_provider: The model provider. Supported model_provider values and the
104-
corresponding integration package:
105-
106-
- openai (langchain-openai)
107-
- anthropic (langchain-anthropic)
108-
- azure_openai (langchain-openai)
109-
- google_vertexai (langchain-google-vertexai)
110-
- google_genai (langchain-google-genai)
111-
- bedrock (langchain-aws)
112-
- bedrock_converse (langchain-aws)
113-
- cohere (langchain-cohere)
114-
- fireworks (langchain-fireworks)
115-
- together (langchain-together)
116-
- mistralai (langchain-mistralai)
117-
- huggingface (langchain-huggingface)
118-
- groq (langchain-groq)
119-
- ollama (langchain-ollama) [support added in langchain==0.2.12]
103+
corresponding integration package are:
104+
105+
- 'openai' -> langchain-openai
106+
- 'anthropic' -> langchain-anthropic
107+
- 'azure_openai' -> langchain-openai
108+
- 'google_vertexai' -> langchain-google-vertexai
109+
- 'google_genai' -> langchain-google-genai
110+
- 'bedrock' -> langchain-aws
111+
- 'bedrock_converse' -> langchain-aws
112+
- 'cohere' -> langchain-cohere
113+
- 'fireworks' -> langchain-fireworks
114+
- 'together' -> langchain-together
115+
- 'mistralai' -> langchain-mistralai
116+
- 'huggingface' -> langchain-huggingface
117+
- 'groq' -> langchain-groq
118+
- 'ollama' -> langchain-ollama
120119
121120
Will attempt to infer model_provider from model if not specified. The
122121
following providers will be inferred based on these model prefixes:
123122
124-
- gpt-3..., gpt-4..., or o1... -> openai
125-
- claude... -> anthropic
126-
- amazon.... -> bedrock
127-
- gemini... -> google_vertexai
128-
- command... -> cohere
129-
- accounts/fireworks... -> fireworks
130-
- mistral... -> mistralai
123+
- 'gpt-3...' | 'gpt-4...' | 'o1...' -> 'openai'
124+
- 'claude...' -> 'anthropic'
125+
- 'amazon....' -> 'bedrock'
126+
- 'gemini...' -> 'google_vertexai'
127+
- 'command...' -> 'cohere'
128+
- 'accounts/fireworks...' -> 'fireworks'
129+
- 'mistral...' -> 'mistralai'
131130
configurable_fields: Which model parameters are
132131
configurable:
133132
@@ -286,6 +285,10 @@ class GetPopulation(BaseModel):
286285
Support for langchain_aws.ChatBedrockConverse added
287286
(model_provider="bedrock_converse").
288287
288+
.. versionchanged:: 0.3.5
289+
290+
Out of beta.
291+
289292
""" # noqa: E501
290293
if not model and not configurable_fields:
291294
configurable_fields = ("model", "model_provider")

0 commit comments

Comments
 (0)