Skip to main content

Chat models

Features (natively supported)​

All ChatModels implement the Runnable interface, which comes with default implementations of all methods, ie. ainvoke, batch, abatch, stream, astream. This gives all ChatModels basic support for async, streaming and batch, which by default is implemented as below:

  • Async support defaults to calling the respective sync method in asyncio's default thread pool executor. This lets other async functions in your application make progress while the ChatModel is being executed, by moving this call to a background thread.
  • Streaming support defaults to returning an Iterator (or AsyncIterator in the case of async streaming) of a single value, the final result returned by the underlying ChatModel provider. This obviously doesn't give you token-by-token streaming, which requires native support from the ChatModel provider, but ensures your code that expects an iterator of tokens can work for any of our ChatModel integrations.
  • Batch support defaults to calling the underlying ChatModel in parallel for each input by making use of a thread pool executor (in the sync batch case) or asyncio.gather (in the async batch case). The concurrency can be controlled with the max_concurrency key in RunnableConfig.

Each ChatModel integration can optionally provide native implementations to truly enable async or streaming. The table shows, for each integration, which features have been implemented with native support.

ModelInvokeAsync invokeStreamAsync streamTool callingStructured outputPython Package
AzureChatOpenAIβœ…βŒβŒβŒβœ…βœ…langchain-openai
BedrockChatβœ…βŒβœ…βŒβŒβŒlangchain-community
ChatAnthropicβœ…βŒβŒβŒβœ…βœ…langchain-anthropic
ChatAnyscaleβœ…βœ…βœ…βœ…βŒβŒlangchain-community
ChatBaichuanβœ…βŒβœ…βŒβŒβŒlangchain-community
ChatCohereβœ…βŒβŒβŒβœ…βœ…langchain-cohere
ChatCozeβœ…βŒβœ…βŒβŒβŒlangchain-community
ChatDatabricksβœ…βŒβœ…βŒβŒβŒlangchain-community
ChatDeepInfraβœ…βœ…βœ…βœ…βŒβŒlangchain-community
ChatEverlyAIβœ…βœ…βœ…βœ…βŒβŒlangchain-community
ChatFireworksβœ…βŒβŒβŒβœ…βœ…langchain-fireworks
ChatFriendliβœ…βœ…βœ…βœ…βŒβŒlangchain-community
ChatGooglePalmβœ…βœ…βŒβŒβŒβŒlangchain-community
ChatGroqβœ…βŒβŒβŒβœ…βœ…langchain-groq
ChatHuggingFaceβœ…βœ…βœ…βœ…βŒβŒlangchain-community
ChatHunyuanβœ…βŒβœ…βŒβŒβŒlangchain-community
ChatJavelinAIGatewayβœ…βœ…βŒβŒβŒβŒlangchain-community
ChatKineticaβœ…βŒβŒβŒβŒβŒlangchain-community
ChatKonkoβœ…βŒβŒβŒβŒβŒlangchain-community
ChatLiteLLMβœ…βœ…βœ…βœ…βŒβŒlangchain-community
ChatLiteLLMRouterβœ…βœ…βœ…βœ…βŒβŒlangchain-community
ChatMLXβœ…βœ…βœ…βŒβŒβŒlangchain-community
ChatMLflowAIGatewayβœ…βŒβŒβŒβŒβŒlangchain-community
ChatMaritalkβœ…βœ…βœ…βœ…βŒβŒlangchain-community
ChatMistralAIβœ…βŒβŒβŒβœ…βœ…langchain-mistralai
ChatMlflowβœ…βŒβœ…βŒβŒβŒlangchain-community
ChatOctoAIβœ…βœ…βœ…βœ…βŒβŒlangchain-community
ChatOllamaβœ…βœ…βœ…βœ…βŒβŒlangchain-community
ChatOpenAIβœ…βŒβŒβŒβœ…βœ…langchain-openai
ChatPerplexityβœ…βŒβœ…βŒβŒβŒlangchain-community
ChatPremAIβœ…βŒβœ…βŒβŒβŒlangchain-community
ChatSparkLLMβœ…βŒβœ…βŒβŒβŒlangchain-community
ChatTongyiβœ…βœ…βœ…βœ…βŒβŒlangchain-community
ChatVertexAIβœ…βŒβŒβŒβœ…βœ…langchain-google-vertexai
ChatYandexGPTβœ…βœ…βŒβŒβŒβŒlangchain-community
ChatYuan2βœ…βœ…βœ…βœ…βŒβŒlangchain-community
ChatZhipuAIβœ…βœ…βœ…βœ…βŒβŒlangchain-community
ErnieBotChatβœ…βŒβŒβŒβŒβŒlangchain-community
GPTRouterβœ…βœ…βœ…βœ…βŒβŒlangchain-community
GigaChatβœ…βœ…βœ…βœ…βŒβŒlangchain-community
JinaChatβœ…βœ…βœ…βœ…βŒβŒlangchain-community
LlamaEdgeChatServiceβœ…βŒβœ…βŒβŒβŒlangchain-community
MiniMaxChatβœ…βœ…βŒβŒβŒβŒlangchain-community
PaiEasChatEndpointβœ…βŒβŒβœ…βŒβŒlangchain-community
PromptLayerChatOpenAIβœ…βŒβŒβŒβŒβŒlangchain-community
QianfanChatEndpointβœ…βœ…βœ…βœ…βŒβŒlangchain-community
SolarChatβœ…βœ…βœ…βœ…βŒβŒlangchain-community
VolcEngineMaasChatβœ…βŒβœ…βŒβŒβŒlangchain-community

Help us out by providing feedback on this documentation page: