ChatOllama chat models。有关所有 ChatOllama 功能和配置的详细文档,请前往 API 参考。
概述
集成详情
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.模型功能
请参阅下表标题中的链接,了解如何使用特定功能。设置
Follow these instructions to set up and run a local Ollama instance. Then, download the@langchain/ollama package.
凭证
如果你想要自动追踪模型调用,还可以设置你的 LangSmith API 密钥,取消注释以下内容:安装
LangChain 的 ChatOllama 集成位于@langchain/ollama 包中:
实例化
现在我们可以实例化模型对象并生成聊天补全:调用
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.结构化输出
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 参考
有关所有ChatOllama 功能和配置的详细文档,请前往 API 参考。
将这些文档连接到 Claude、VSCode 等工具,通过 MCP 获取实时答案。

