19
19
overload ,
20
20
)
21
21
22
- from langchain_core ._api import beta
23
22
from langchain_core .language_models import (
24
23
BaseChatModel ,
25
24
LanguageModelInput ,
@@ -83,7 +82,6 @@ def init_chat_model(
83
82
# FOR CONTRIBUTORS: If adding support for a new provider, please append the provider
84
83
# name to the supported list in the docstring below. Do *not* change the order of the
85
84
# existing providers.
86
- @beta ()
87
85
def init_chat_model (
88
86
model : Optional [str ] = None ,
89
87
* ,
@@ -96,38 +94,39 @@ def init_chat_model(
96
94
) -> Union [BaseChatModel , _ConfigurableModel ]:
97
95
"""Initialize a ChatModel from the model name and provider.
98
96
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.
100
99
101
100
Args:
102
101
model: The name of the model, e.g. "gpt-4o", "claude-3-opus-20240229".
103
102
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
120
119
121
120
Will attempt to infer model_provider from model if not specified. The
122
121
following providers will be inferred based on these model prefixes:
123
122
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'
131
130
configurable_fields: Which model parameters are
132
131
configurable:
133
132
@@ -286,6 +285,10 @@ class GetPopulation(BaseModel):
286
285
Support for langchain_aws.ChatBedrockConverse added
287
286
(model_provider="bedrock_converse").
288
287
288
+ .. versionchanged:: 0.3.5
289
+
290
+ Out of beta.
291
+
289
292
""" # noqa: E501
290
293
if not model and not configurable_fields :
291
294
configurable_fields = ("model" , "model_provider" )
0 commit comments