ChatOllama chat models. For detailed documentation of all ChatOllama features and configurations head to the API reference.
Overview
Integration details
Ollama allows you to use a wide range of models with different capabilities. Some of the fields in the details table below only apply to a subset of models that Ollama offers. For a complete list of supported models and model variants, see the Ollama model library and search by tag.Model features
See the links in the table headers below for guides on how to use specific features.Setup
Follow these instructions to set up and run a local Ollama instance. Then, download the@langchain/ollama package.
Credentials
If you want to get automated tracing of your model calls you can also set your LangSmith API key by uncommenting below:Installation
The LangChain ChatOllama integration lives in the@langchain/ollama package:
Instantiation
Now we can instantiate our model object and generate chat completions:Invocation
Tools
Ollama now offers support for native tool calling for a subset of their available models. The example below demonstrates how you can invoke a tool from an Ollama model.Structured output
Ollama natively supports structured output for all models, allowing you to force the model to return a specific format by calling.withStructuredOutput().
method: "functionCalling" option:
Multimodal models
Ollama supports open source multimodal models like LLaVA in versions 0.1.15 and up. You can pass images as part of a message’scontent field to multimodal-capable models like this:
API reference
For detailed documentation of allChatOllama features and configurations head to the API reference.
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

