1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Github Copilot + OllamaでローカルLLM実行させてみる

Posted at

Github Copilotで、自サーバ内のOllama内モデルを使ってみる

目的

ローカルLLM用のPCを購入したのでVScode上で使っているGithub Copilotのproライセンスを捨てて、ローカルLLMでどうにかしたいと思ったため。

環境

ローカルLLMPC

mouseコンピュータのNETGEAR
CPU:AMD Ryzen™ 5 4500
GPU:NVIDIA® GeForce RTX™ 5060 Ti (16GB)
メモリ:80G(増築)

docker compose

services:
  ollama:
    image: ollama/ollama:latest
    container_name: ollama
    runtime: nvidia
    volumes:
      - ./ollama_data:/root/.ollama
    ports:
      - "11434:11434"
    restart: unless-stopped

  ollama-webui:
    image: ghcr.io/open-webui/open-webui:main
    container_name: ollama-webui
    ports:
      - "49152:8080"
    volumes:
      - ./ollama_webui_data:/app/backend/data
    environment:
      OLLAMA_BASE_URL: "http://ollama:11434/"
      ENABLE_RAG_WEB_SEARCH: True
      RAG_WEB_SEARCH_ENGINE: "searxng"
      RAG_WEB_SEARCH_RESULT_COUNT: 3
      RAG_WEB_SEARCH_CONCURRENT_REQUESTS: 10
      SEARXNG_QUERY_URL: "http://searxng:8080/search?lang=ja&q=<query>"
      USER_PERMISSIONS_WORKSPACE_TOOLS_ACCESS: True
    depends_on:
      - ollama
    restart: unless-stopped

  searxng:
    container_name: searxng
    image: searxng/searxng:latest
    ports:
      - "8080:8080"
    volumes:
      - ./searxng:/etc/searxng:rw
    environment:
      SEARXNG_HOSTNAME: http://searxng:8080
    restart: unless-stopped
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - SETGID
      - SETUID
      - DAC_OVERRIDE
    logging:
      driver: "json-file"
      options:
        max-size: "1m"
        max-file: "1"

リバースプロキシ用PC

2万円くらいのミニPC
CPU:N100
メモリ:16GB
リバースプロキシ過去記事

やりかた

前提

リバースプロキシ側でollamaにアクセスできること
自身は9003番ポートとollamaのポートを接続させています。

# リバースプロキシ用PCで
$ curl http://127.0.0.1:9003/
Ollama is running

Github Copilot設定

Ollamaのエンドポイントの設定後、画面のreload
image.png

チャット画面からモデルの管理を選択
image.png

Ollamaを選択
image.png

Ollamaに入っているモデルが選択可能
image.png

チャットに選択したモデルが追加
image.png

最後に

LLM用PCでnvidia-smiを見るとチャットの時にGPUが回っているのでローカルモデルが使われていることがわかる。

回答がそっけないから、システムプロンプトの設定はしっかり行う必要があるかもしれない。
あとはweb検索ができないので、そのあたりもどうするか検討が必要。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?