LobeChat
Ctrl K
Back to Discovery
OllamaOllama
@Ollama
40 models
Ollama provides models that cover a wide range of fields, including code generation, mathematical operations, multilingual processing, and conversational interaction, catering to diverse enterprise-level and localized deployment needs.

Supported Models

Ollama
Maximum Context Length
128K
Maximum Output Length
--
Input Price
--
Output Price
--
Maximum Context Length
128K
Maximum Output Length
--
Input Price
--
Output Price
--
Maximum Context Length
128K
Maximum Output Length
--
Input Price
--
Output Price
--
Maximum Context Length
16K
Maximum Output Length
--
Input Price
--
Output Price
--

在 LobeChat 中使用 Ollama

在 LobeChat 中使用 Ollama

Ollama 是一款强大的本地运行大型语言模型(LLM)的框架,支持多种语言模型,包括 Llama 2, Mistral 等。现在,LobeChat 已经支持与 Ollama 的集成,这意味着你可以在 LobeChat 中轻松使用 Ollama 提供的语言模型来增强你的应用。

本文档将指导你如何在 LobeChat 中使用 Ollama:

在 macOS 下使用 Ollama

本地安装 Ollama

下载 Ollama for macOS 并解压、安装。

配置 Ollama 允许跨域访问

由于 Ollama 的默认参数配置,启动时设置了仅本地访问,所以跨域访问以及端口监听需要进行额外的环境变量设置 OLLAMA_ORIGINS。使用 launchctl 设置环境变量:

bash
launchctl setenv OLLAMA_ORIGINS "*"

完成设置后,需要重启 Ollama 应用程序。

在 LobeChat 中与本地大模型对话

接下来,你就可以使用 LobeChat 与本地 LLM 对话了。

在 LobeChat 中与 llama3 对话

在 windows 下使用 Ollama

本地安装 Ollama

下载 Ollama for Windows 并安装。

配置 Ollama 允许跨域访问

由于 Ollama 的默认参数配置,启动时设置了仅本地访问,所以跨域访问以及端口监听需要进行额外的环境变量设置 OLLAMA_ORIGINS

在 Windows 上,Ollama 继承了您的用户和系统环境变量。

  1. 首先通过 Windows 任务栏点击 Ollama 退出程序。
  2. 从控制面板编辑系统环境变量。
  3. 为您的用户账户编辑或新建 Ollama 的环境变量 OLLAMA_ORIGINS,值设为 *
  4. 点击OK/应用保存后重启系统。
  5. 重新运行Ollama

在 LobeChat 中与本地大模型对话

接下来,你就可以使用 LobeChat 与本地 LLM 对话了。

在 linux 下使用 Ollama

本地安装 Ollama

通过以下命令安装:

bash
curl -fsSL https://ollama.com/install.sh | sh

或者,你也可以参考 Linux 手动安装指南

配置 Ollama 允许跨域访问

由于 Ollama 的默认参数配置,启动时设置了仅本地访问,所以跨域访问以及端口监听需要进行额外的环境变量设置 OLLAMA_ORIGINS。如果 Ollama 作为 systemd 服务运行,应该使用systemctl设置环境变量:

  1. 通过调用sudo systemctl edit ollama.service编辑 systemd 服务。
bash
sudo systemctl edit ollama.service
  1. 对于每个环境变量,在[Service]部分下添加Environment
bash
[Service]
Environment="OLLAMA_HOST=0.0.0.0"
Environment="OLLAMA_ORIGINS=*"
  1. 保存并退出。
  2. 重载 systemd 并重启 Ollama:
bash
sudo systemctl daemon-reload
sudo systemctl restart ollama

在 LobeChat 中与本地大模型对话

接下来,你就可以使用 LobeChat 与本地 LLM 对话了。

使用 docker 部署使用 Ollama

拉取 Ollama 镜像

如果你更倾向于使用 Docker,Ollama 也提供了官方 Docker 镜像,你可以通过以下命令拉取:

docker pull ollama/ollama

配置 Ollama 允许跨域访问

由于 Ollama 的默认参数配置,启动时设置了仅本地访问,所以跨域访问以及端口监听需要进行额外的环境变量设置 OLLAMA_ORIGINS

如果 Ollama 作为 Docker 容器运行,你可以将环境变量添加到 docker run 命令中。

bash
docker run -d --gpus=all -v ollama:/root/.ollama -e OLLAMA_ORIGINS="*" -p 11434:11434 --name ollama ollama/ollama

在 LobeChat 中与本地大模型对话

接下来,你就可以使用 LobeChat 与本地 LLM 对话了。

安装 Ollama 模型

Ollama 支持多种模型,你可以在 Ollama Library 中查看可用的模型列表,并根据需求选择合适的模型。

LobeChat 中安装

在 LobeChat 中,我们默认开启了一些常用的大语言模型,例如 llama3、 Gemma 、 Mistral 等。当你选中模型进行对话时,我们会提示你需要下载该模型。

LobeChat 提示安装 Ollama 模型

下载完成后即可开始对话。

用 Ollama 拉取模型到本地

当然,你也可以通过在终端执行以下命令安装模型,以 llama3 为例:

ollama pull llama3

自定义配置

你可以在 设置 -> 语言模型 中找到 Ollama 的配置选项,你可以在这里配置 Ollama 的代理、模型名称等。

Ollama 服务商设置

你可以前往 与 Ollama 集成 了解如何部署 LobeChat ,以满足与 Ollama 的集成需求。

Related Providers

LobeHubLobeHub
@LobeHub
12 models
LobeChat Cloud utilizes officially deployed APIs to access AI models, employing a credit system to measure usage based on the tokens consumed by large models.
OpenAIOpenAI
@OpenAI
22 models
OpenAI is a global leader in artificial intelligence research, with models like the GPT series pushing the frontiers of natural language processing. OpenAI is committed to transforming multiple industries through innovative and efficient AI solutions. Their products demonstrate significant performance and cost-effectiveness, widely used in research, business, and innovative applications.
Anthropic
ClaudeClaude
@Anthropic
7 models
Anthropic is a company focused on AI research and development, offering a range of advanced language models such as Claude 3.5 Sonnet, Claude 3 Sonnet, Claude 3 Opus, and Claude 3 Haiku. These models achieve an ideal balance between intelligence, speed, and cost, suitable for various applications from enterprise workloads to rapid-response scenarios. Claude 3.5 Sonnet, as their latest model, has excelled in multiple evaluations while maintaining a high cost-performance ratio.
AWS
BedrockBedrock
@Bedrock
12 models
Bedrock is a service provided by Amazon AWS, focusing on delivering advanced AI language and visual models for enterprises. Its model family includes Anthropic's Claude series, Meta's Llama 3.1 series, and more, offering a range of options from lightweight to high-performance, supporting tasks such as text generation, conversation, and image processing for businesses of varying scales and needs.
Google
GeminiGemini
@Google
11 models
Google's Gemini series represents its most advanced, versatile AI models, developed by Google DeepMind, designed for multimodal capabilities, supporting seamless understanding and processing of text, code, images, audio, and video. Suitable for various environments from data centers to mobile devices, it significantly enhances the efficiency and applicability of AI models.