From 14edb8b5f31a36e1c0f1cfe8276e5c45ec380c70 Mon Sep 17 00:00:00 2001 From: Nansike Date: Wed, 13 Aug 2025 12:20:41 +0800 Subject: [PATCH 1/2] Add Japanese and English versions of gpt-oss deployment doc. --- docs.json | 10 +- ...s Local Deployment with Ollama and Dify.md | 130 ++++++++++++++++++ ...¼‹Dify ã«ã‚ˆã‚‹ gpt-oss ã®ãƒ­ãƒ¼ã‚«ãƒ«ãƒ‡ãƒ—ロイ.md | 99 +++++++++++++ 3 files changed, 236 insertions(+), 3 deletions(-) create mode 100644 en/development/models-integration/gpt-oss Local Deployment with Ollama and Dify.md create mode 100644 ja-jp/development/models-integration/Ollama+Dify ã«ã‚ˆã‚‹ gpt-oss ã®ãƒ­ãƒ¼ã‚«ãƒ«ãƒ‡ãƒ—ロイ.md diff --git a/docs.json b/docs.json index 4d2037f6..3309a4b7 100644 --- a/docs.json +++ b/docs.json @@ -12,6 +12,7 @@ "light": "https://assets-docs.dify.ai/2025/05/d05cfc6ebe48f725d171dc71c64a5d16.svg", "dark": "https://assets-docs.dify.ai/2025/05/c51f1cda47c1d9a4a162d7736f6e4c53.svg" }, + "navigation": { "versions": [ { @@ -388,7 +389,8 @@ "en/development/models-integration/ollama", "en/development/models-integration/litellm", "en/development/models-integration/gpustack", - "en/development/models-integration/aws-bedrock-deepseek" + "en/development/models-integration/aws-bedrock-deepseek", + "en/development/models-integration/gpt-oss-local-deployment" ] }, { @@ -1048,7 +1050,8 @@ "zh-hans/development/models-integration/ollama", "zh-hans/development/models-integration/litellm", "zh-hans/development/models-integration/gpustack", - "zh-hans/development/models-integration/aws-bedrock-deepseek" + "zh-hans/development/models-integration/aws-bedrock-deepseek", + "zh-hans/development/models-integration/gpt-oss-local-deployment" ] }, { @@ -1691,7 +1694,8 @@ "ja-jp/development/models-integration/ollama", "ja-jp/development/models-integration/litellm", "ja-jp/development/models-integration/gpustack", - "ja-jp/development/models-integration/aws-bedrock-deepseek" + "ja-jp/development/models-integration/aws-bedrock-deepseek", + "ja-jp/development/models-integration/gpt-oss-local-deployment" ] }, { diff --git a/en/development/models-integration/gpt-oss Local Deployment with Ollama and Dify.md b/en/development/models-integration/gpt-oss Local Deployment with Ollama and Dify.md new file mode 100644 index 00000000..0218c9b8 --- /dev/null +++ b/en/development/models-integration/gpt-oss Local Deployment with Ollama and Dify.md @@ -0,0 +1,130 @@ +--- +title: " gpt-oss Local Deployment with Ollama and Dify " +--- +# I. Introduction + +The gpt-oss series is an open-source model first released by OpenAI in August 2025. + +> gpt-oss:20b (fits systems with ~16 GB memory) +> +> gpt-oss:120b (designed for ≥ 60 GB memory) + +You can run it locally with Ollama. No cloud calls. Data stays on your machine, which helps with privacy and latency. + +Dify is an open-source platform for building AI Agents and Workflows. This guide shows how to run gpt-oss with Ollama and plug it into Dify for a private, high-performance setup. + +* * * + +# II. Environment Setup + +## Step 1: Run gpt-oss with Ollama + +1. Install Ollama + + +[Download](https://ollama.com/) and install for macOS, Windows, or Linux. If anything is unclear, see the [official docs](https://docs.dify.ai/en/development/models-integration/ollama#integrate-local-models-deployed-by-ollama). + + + +2. Pull a model + + +```Bash +# Recommended for most dev machines +ollama pull gpt-oss:20b + +# For large GPUs or multi-GPU hosts +ollama pull gpt-oss:120b +``` + +Both models are pre‑quantized in **MXFP4** , suitable for local deployment. + + + +3. Start Ollama + + +The default endpoint is http://localhost:11434. + +## Step 2: Install Dify locally + +See the [Dify docs](https://docs.dify.ai/en/getting-started/install-self-hosted/readme) for full instructions. Or follow the quick tutorial below. + +### Prerequisites + +Install [Docker](https://www.docker.com/products/docker-desktop/) and make sure Docker Engine is running. + +![1](https://raw.githubusercontent.com/NanSike/image-host/main/images/1.png) + + + +### Install steps + +```Bash +git clone https://github.com/langgenius/Dify.git +cd Dify/docker +cp .env.example .env +docker compose up -d +``` + +![2](https://raw.githubusercontent.com/NanSike/image-host/main/images/2.png) + +Open your local Dify instance and complete the initial setup. + +![3](https://raw.githubusercontent.com/NanSike/image-host/main/images/3.png) + +# III. Add the model and test chat + +1. In **Settings → Model Providers → Ollama** , click **Add Ollama model type** . + + +![4](https://raw.githubusercontent.com/NanSike/image-host/main/images/4.png) + +2. Set **Base URL** to `http://localhost:11434`, select **Model name** `gpt-oss:20b`, and fill in the required fields. + + +![5](https://raw.githubusercontent.com/NanSike/image-host/main/images/5.png) + + + +3. Create a blank template + + +![6](https://raw.githubusercontent.com/NanSike/image-host/main/images/6.png) + + + +4. Select the app or workflow type you want to build. + + +![7](https://raw.githubusercontent.com/NanSike/image-host/main/images/7.png) + +* * * + +# IV. Verification and Usage + +* On Dify’s **model testing** page, send a prompt and check that the response looks correct. + +* In a workflow, add an **LLM** node, select `gpt-oss:20b`, and connect the nodes end to end. + + +![8](https://raw.githubusercontent.com/NanSike/image-host/main/images/8.png) + +![9](https://raw.githubusercontent.com/NanSike/image-host/main/images/9.png) + +* * * + +# V. Appendix — FAQ and tips + +**Model Pull Is Slow** + +* *Configure a Docker proxy or use an image mirror to speed up downloads.* + + +**Insufficient GPU Memory** + +* *Use* *`gpt-oss:20b`*. You can enable CPU offloading, but responses will be slower.* + +**Port Access Issues** + +* *Check firewall rules, port bindings, and Docker network settings to ensure connectivity.* \ No newline at end of file diff --git a/ja-jp/development/models-integration/Ollama+Dify ã«ã‚ˆã‚‹ gpt-oss ã®ãƒ­ãƒ¼ã‚«ãƒ«ãƒ‡ãƒ—ロイ.md b/ja-jp/development/models-integration/Ollama+Dify ã«ã‚ˆã‚‹ gpt-oss ã®ãƒ­ãƒ¼ã‚«ãƒ«ãƒ‡ãƒ—ロイ.md new file mode 100644 index 00000000..b56c5a3b --- /dev/null +++ b/ja-jp/development/models-integration/Ollama+Dify ã«ã‚ˆã‚‹ gpt-oss ã®ãƒ­ãƒ¼ã‚«ãƒ«ãƒ‡ãƒ—ロイ.md @@ -0,0 +1,99 @@ +--- +title: " Ollama+Dify ã«ã‚ˆã‚‹ gpt-oss ã®ãƒ­ãƒ¼ã‚«ãƒ«ãƒ‡ãƒ—ロイ" +--- + +## ã¯ã˜ã‚ã« + +gpt-ossシリーズã¯ã€2025å¹´8月ã«OpenAIã‹ã‚‰ãƒªãƒªãƒ¼ã‚¹ã•れãŸã‚ªãƒ¼ãƒ—ンソースモデルã§ã™ã€‚ +- gpt-oss:20b(約16GBã®ãƒ¡ãƒ¢ãƒªã‚’æŒã¤ã‚·ã‚¹ãƒ†ãƒ å‘ã‘) +- gpt-oss:120b(60GB以上ã®ãƒ¡ãƒ¢ãƒªã«å¯¾å¿œï¼‰ + +ローカルã§Ollamaを使用ã—ã¦å®Ÿè¡Œã§ãã¾ã™ã€‚クラウド呼ã³å‡ºã—ã¯ä¸è¦ã§ã€ãƒ‡ãƒ¼ã‚¿ã¯å¸¸ã«ãƒ­ãƒ¼ã‚«ãƒ«ã«ä¿å­˜ã•れã€ãƒ—ライãƒã‚·ãƒ¼ä¿è­·ã¨ä½Žé…å»¶ã«è²¢çŒ®ã—ã¾ã™ã€‚ + +Difyã¯AIエージェントやワークフローを構築ã™ã‚‹ãŸã‚ã®ã‚ªãƒ¼ãƒ—ンソースプラットフォームã§ã™ã€‚ã“ã®ã‚¬ã‚¤ãƒ‰ã§ã¯ã€Ollamaを使ã£ã¦gpt-ossを実行ã—ã€Difyã«æŽ¥ç¶šã—ã¦ãƒ—ライベートã‹ã¤é«˜æ€§èƒ½ãªè¨­å®šã‚’è¡Œã†æ–¹æ³•を示ã—ã¾ã™ã€‚ + +## 環境ã®ã‚»ãƒƒãƒˆã‚¢ãƒƒãƒ— + +### ステップ1:Ollamaã§gpt-ossを実行ã™ã‚‹ + +**1. Ollamaをインストール** + +[Ollamaã®å…¬å¼ã‚µã‚¤ãƒˆ](https://ollama.com/)を通ã—ã¦macOSã€Windowsã€ã¾ãŸã¯Linux用ã«ãƒ€ã‚¦ãƒ³ãƒ­ãƒ¼ãƒ‰ã—ã¦ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã—ã¦ãã ã•ã„。 + +**2. gpt-ossモデルをインストール** + +```Bash +# 開発マシン用ã«ãŠã™ã™ã‚ +ollama pull gpt-oss:20b + +# å¤§è¦æ¨¡GPUã¾ãŸã¯ãƒžãƒ«ãƒGPUホスト用ã«ãŠã™ã™ã‚ +ollama pull gpt-oss:120b +``` + +ã“れらã®ãƒ¢ãƒ‡ãƒ«ã¯ã™ã§ã«æ··åˆç²¾åº¦ãƒ•ォーマット(MXFP4)ã§é‡å­åŒ–ã•れã¦ãŠã‚Šã€ãƒ­ãƒ¼ã‚«ãƒ«ãƒ‡ãƒ—ロイã«é©ã—ã¦ã„ã¾ã™ã€‚ + +**3. Ollamaã®èµ·å‹•** + +デフォルトã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆã¯http://localhost:11434ã§ã™ã€‚ + +### ステップ2:Difyをローカルã«ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ« + +Difyã®[å…¬å¼ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆ](https://docs.dify.ai/ja-jp/getting-started/install-self-hosted/readme)ã«å®Œå…¨ãªæ‰‹é †ãŒã‚りã¾ã™ã€‚ã‚‚ã—ãã¯ã“ã¡ã‚‰ã®ã‚·ãƒ³ãƒ—ルãªãƒãƒ¥ãƒ¼ãƒˆãƒªã‚¢ãƒ«ã‚’ã”覧ãã ã•ã„。 + +**剿æ¡ä»¶** +[Docker](https://www.docker.com/products/docker-desktop/)をインストールã—ã€Dockerã‚¨ãƒ³ã‚¸ãƒ³ãŒæ­£å¸¸ã«å‹•作ã—ã¦ã„ã‚‹ã“ã¨ã‚’確èªã—ã¦ãã ã•ã„。 + +![1](https://raw.githubusercontent.com/NanSike/image-host/main/images/1.png) + +**インストール手順** + +```Bash +git clone https://github.com/langgenius/Dify.git +cd Dify/docker +cp .env.example .env +docker compose up -d +``` + +![2](https://raw.githubusercontent.com/NanSike/image-host/main/images/2.png) + +ローカルDifyインスタンスを開ãã€åˆæœŸè¨­å®šã‚’完了ã•ã›ã¦ãã ã•ã„。 + +![3](https://raw.githubusercontent.com/NanSike/image-host/main/images/3.png) + +## モデルã®è¿½åŠ ã¨ãƒãƒ£ãƒƒãƒˆã®ãƒ†ã‚¹ãƒˆ + +1. **設定 > モデルプロãƒã‚¤ãƒ€ãƒ¼ > Ollama** ã«ç§»å‹•ã—ã€**「Ollamaモデルタイプを追加ã€**をクリックã—ã¦ãã ã•ã„。 + +![4](https://raw.githubusercontent.com/NanSike/image-host/main/images/4.png) + +2. 基本URLã‚’`http://localhost:11434`ã«è¨­å®šã—ã€ãƒ¢ãƒ‡ãƒ«åã«`gpt-oss`ã‚’é¸æŠžã—ã€å¿…è¦ãªãƒ•ィールドを埋ã‚ã¦ãã ã•ã„。 + +![5](https://raw.githubusercontent.com/NanSike/image-host/main/images/5.png) + +3. 空ã®ãƒ†ãƒ³ãƒ—レートを作æˆã—ã¾ã™ã€‚ + +![6](https://raw.githubusercontent.com/NanSike/image-host/main/images/6.png) + +4. 構築ã—ãŸã„アプリã®ã‚¿ã‚¤ãƒ—ã‚’é¸æŠžã—ã¦ãã ã•ã„。 + +![7](https://raw.githubusercontent.com/NanSike/image-host/main/images/7.png) + +## 検証ã¨ä½¿ç”¨ + +- Difyã®**モデルテスト**ページã§ãƒ—ロンプトをé€ä¿¡ã—ã€å¿œç­”ãŒæœŸå¾…通りã§ã‚ã‚‹ã“ã¨ã‚’確èªã—ã¦ãã ã•ã„。 +- ワークフローã«**LLMノード**を追加ã—ã€`gpt-oss:20b`ã‚’é¸æŠžã—ã¦ãƒŽãƒ¼ãƒ‰ã‚’ã‚¨ãƒ³ãƒ‰ãƒ„ãƒ¼ã‚¨ãƒ³ãƒ‰ã§æŽ¥ç¶šã—ã¦ãã ã•ã„。 + +![8](https://raw.githubusercontent.com/NanSike/image-host/main/images/8.png) + +![9](https://raw.githubusercontent.com/NanSike/image-host/main/images/9.png) + +## よãã‚ã‚‹è³ªå• + +1. モデルã®ãƒ€ã‚¦ãƒ³ãƒ­ãƒ¼ãƒ‰ãŒé…ã„ + ダウンロードを高速化ã™ã‚‹ãŸã‚ã«ã€Dockerプロキシを設定ã™ã‚‹ã‹ã€ã‚¤ãƒ¡ãƒ¼ã‚¸ãƒŸãƒ©ãƒ¼ã‚’使用ã—ã¦ãã ã•ã„。 + +2. GPUメモリä¸è¶³ + `gpt-oss:20b`を使用ã—ã¦ãã ã•ã„。CPUオフローディングを有効ã«ã™ã‚‹ã“ã¨ã‚‚ã§ãã¾ã™ãŒã€ãã®å ´åˆã¯å¿œç­”ãŒé…ããªã‚Šã¾ã™ã€‚ + +3. ãƒãƒ¼ãƒˆã‚¢ã‚¯ã‚»ã‚¹ã®å•題 + 接続を確èªã™ã‚‹ãŸã‚ã«ã€ãƒ•ァイアウォールã®ãƒ«ãƒ¼ãƒ«ã€ãƒãƒ¼ãƒˆã®ãƒã‚¤ãƒ³ãƒ‡ã‚£ãƒ³ã‚°ã€ãŠã‚ˆã³Dockerãƒãƒƒãƒˆãƒ¯ãƒ¼ã‚¯è¨­å®šã‚’確èªã—ã¦ãã ã•ã„。 \ No newline at end of file From 0bab2ead93d0ba502950fd3c8b5dfab478fd2e2c Mon Sep 17 00:00:00 2001 From: Nansike Date: Wed, 13 Aug 2025 14:25:34 +0800 Subject: [PATCH 2/2] Add Chinese document --- .../models-integration/gpt-oss + Ollama.md | 152 ++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 zh-hans/development/models-integration/gpt-oss + Ollama.md diff --git a/zh-hans/development/models-integration/gpt-oss + Ollama.md b/zh-hans/development/models-integration/gpt-oss + Ollama.md new file mode 100644 index 00000000..7ddc12f2 --- /dev/null +++ b/zh-hans/development/models-integration/gpt-oss + Ollama.md @@ -0,0 +1,152 @@ +--- +title: " gpt-oss + Ollama æœ¬åœ°åŒ–éƒ¨ç½²æŒ‡å— " +--- +# 一ã€å¼•言 + +* gpt-oss 系列是 OpenAI 于 2025 å¹´ 8 月首次å‘å¸ƒçš„å¼€æºæ¨¡åž‹ã€‚ + + +> gpt-oss:20b(适用于约 16GB 的内存) +> +> gpt-oss:120b(适用于≥ 60GB 的内存) + +* 使用 Ollama 在本地部署,无需å‘云端å‘é€ API 请求。数æ®å§‹ç»ˆåœ¨æœ¬åœ°è¿è¡Œï¼Œé€‚用于对éšç§å’Œå“åº”é€Ÿåº¦æœ‰è¦æ±‚的场景。 + +* Dify 是一个开æºçš„ LLM 应用平å°ï¼Œæ”¯æŒé›†æˆæœ¬åœ°æ¨¡åž‹ã€å¿«é€Ÿæž„建 AI 应用程åºå’Œ RAG æµç¨‹ã€‚ + + +**目标:** 展示如何使用 Ollama 在本地部署 gpt-oss 并将其集æˆåˆ° Dify ä¸­ï¼Œä»¥æž„å»ºä¸€ä¸ªç§æœ‰ä¸”安全的 LLM æœåŠ¡ã€‚ + +* * * + +# **二ã€çŽ¯å¢ƒå‡†å¤‡** + +## **第一步:使用 Ollama 本地部署 gpt-oss 模型** + +1. 安装 Ollama + + +访问 [Ollama 官网](https://ollama.com)ä¸‹è½½å®‰è£…ï¼Œæ ¹æ®æ“作系统选择 macOSã€Windows 或 Linux 版本。 + + + +2. æ‹‰å– gpt-oss 模型 + + +* gpt-oss:20bï¼ˆæŽ¨èæ—¥å¸¸å¼€å‘机器,需 ≥ 16 GB 显存或统一内存) `ollama pull gpt-oss:20b` + + + + +* gpt-oss:120b(需 ≥ 60 GB 显存或多 GPU 支æŒï¼‰ `ollama pull gpt-oss:120b` + + +这两个模型å‡é»˜è®¤å·²é‡åŒ–为 MXFP4 æ ¼å¼ï¼Œé€‚åˆå¤§å¤šæ•°æœ¬åœ°éƒ¨ç½²åœºæ™¯ + + + +3. å¯åЍ Ollama æœåŠ¡ + + +æœåŠ¡é»˜è®¤ç›‘å¬åœ¨ï¼š http://localhost:11434。 + + + +## **第二步:本地部署 Dify 并准备接入** + +详细内容å‚考Dify[官方文档](https://docs.dify.ai/zh-hans/getting-started/install-self-hosted/readme),也å¯ä»¥å‚考如下简易教程。 + +### å‰ç½®æ¡ä»¶ + +下载安装[Docker](https://www.docker.com/products/docker-desktop/) 环境,安装完毕åŽç¡®è®¤ Docker Engine 能正常è¿è¡Œã€‚ + +![1](https://raw.githubusercontent.com/NanSike/image-host/main/images/1.png) + + + + +### 本地部署Dify + +1. 使用Git克隆 + + +`git clone` `https://github.com/langgenius/Dify.git` + + + +2. 进入 Dify æºä»£ç çš„ docker 目录,执行一键å¯åŠ¨å‘½ä»¤ï¼š + + +`cd Dify/docker` `cp .env.example .env` `d`ouyin + +![2](https://raw.githubusercontent.com/NanSike/image-host/main/images/2.png) + +3. 进入本地 Difyï¼Œå¡«å†™ç›¸å…³ä¿¡æ¯ + + +![3](https://raw.githubusercontent.com/NanSike/image-host/main/images/3.png) + +* * * + +# **ä¸‰ã€æ·»åŠ æ¨¡åž‹å¹¶æµ‹è¯•èŠå¤©æŽ¥å£** + +1. 点击页é¢å³ä¸Šè§’的设置,进入åŽé€‰æ‹©æ¨¡åž‹æä¾›å•†ï¼Œç‚¹å‡»æ·»åŠ  Ollama 模型类型: **Settings > Model Providers > Ollama** + + +![4](https://raw.githubusercontent.com/NanSike/image-host/main/images/4.png) + + + +2. 请填写 ollama 的相关信æ¯ã€‚å°† **“gpt-oss:20bâ€** 选作模型åç§°ã€‚å¦‚æœ‰ä»»ä½•ä¸æ¸…楚的地方,您å¯ä»¥å‚考官方详细的[部署文档](https://docs.dify.ai/en/development/models-integration/ollama#integrate-local-models-deployed-by-ollama)æ¥æ“作 ollama。 + + +![5](https://raw.githubusercontent.com/NanSike/image-host/main/images/5.png) + + + +3. æ–°å»ºç©ºç™½æ¨¡æ¿ + + +![6](https://raw.githubusercontent.com/NanSike/image-host/main/images/6.png) + + + +4. 选择您想创建的类型 + + +![7](https://raw.githubusercontent.com/NanSike/image-host/main/images/7.png) + +* * * + +# **å››ã€éªŒè¯ä¸Žä½¿ç”¨** + +* 在 Dify 的模型测试页é¢ä¸­ï¼Œè¾“入适当的æç¤ºè¯­ï¼Œå¹¶ç¡®è®¤æ¨¡åž‹çš„å“åº”ç¬¦åˆæ‚¨çš„预期。 + +* 在您的应用æµç¨‹ä¸­æ·»åŠ ä¸€ä¸ªç®€å•çš„ LLM 节点,选择 gpt-oss:20b ä½œä¸ºæ¨¡åž‹ï¼Œå¹¶ç¡®ä¿æ•´ä¸ªå·¥ä½œæµç¨‹è¿žæŽ¥æ— è¯¯ã€‚ + + +![8](https://raw.githubusercontent.com/NanSike/image-host/main/images/8.png) + +![9](https://raw.githubusercontent.com/NanSike/image-host/main/images/9.png) + + +* * * + +# **五ã€é™„录** + +**常è§é—®é¢˜åŠå»ºè®®** + +* **模型下载速度慢** + + +æç¤ºï¼šé…ç½® Docker ä»£ç†æˆ–使用图åƒåŠ é€ŸæœåŠ¡ä»¥åŠ å¿«ä¸‹è½½é€Ÿåº¦ã€‚ + +* **GPU 内存ä¸è¶³** + + +æç¤ºï¼šå¯¹äºŽ GPU 内存有é™çš„设备,请使用 gpt-oss:20b。您还å¯ä»¥å¯ç”¨ CPU 转å‘功能,但这样会导致å“åº”é€Ÿåº¦å˜æ…¢ã€‚ + +* **端å£è®¿é—®é—®é¢˜** + + +æç¤ºï¼šæ£€æŸ¥é˜²ç«å¢™è§„则ã€ç«¯å£ç»‘定和 Docker 网络设置,以确ä¿è¿žæŽ¥æ­£å¸¸ã€‚ \ No newline at end of file