0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Ollama】リモートPCのローカルLLMを、LangChainで利用してみる

0
Posted at

リモートPCのローカルLLMを、ローカルPCのLangChainから利用してみました.

Ollamaのインストール

Ollamaのインストールは、こちらを確認してください。

モデルをインストール

モデルの一覧はこちらを確認してください。

私は、MetaのLlama3.2をインストールしました.

ollama pull llama3.2

環境変数を設定して、Ollamaを起動

Ollamaが起動している場合は、終了してください.

Linux/Mac

export OLLAMA_HOST=0.0.0.0:11434
ollama serve

Windows

$env:OLLAMA_HOST="0.0.0.0:11434"
ollama serve

LangChainで実行

from langchain.chat_models import init_chat_model

model = init_chat_model(
    model="llama3.2",
    model_provider="ollama",
    base_url="http://[Remote IP Address]:11434"
)

response = model.invoke("Ollamaとは?")

print(response.content)

Output

Ollamaは、2019年に設立された日本のインターネットコミュニティサイトです。Ollamaは、ユーザー同士が情報を交換し、アイデアを共有できるプラットフォームとして機能しています。

Ollamaでは、さまざまなトピックに関する Форัม、ブログ、イベントの開催などが可能です。また、ユーザーは自分のプロフィールと内容の詳細情報を管理でき、他userともメッセージやコメントを交換することができます。

Ollamaは、特に日本語学習者や研究者・専門家などの利点を提供しており、多くのユーザーが活用しています。
0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?