Ollama

Ollama

Get up and running with large language models.

shell 安装

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

docker镜像源, /etc/docker/daemon.json

1
https://docker.registry.cyou

CPU only , Install

1
docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama

Run model locally

1
docker exec -it ollama ollama run llama3
1
ollama pull llama3.1

REST API

Ollama has a REST API for running and managing models.

Generate a response

1
2
3
4
curl http://192.168.31.4:11434/api/generate -d '{
"model": "llama3.1",
"prompt":"Why is the sky blue?"
}'

Chat with a model

1
2
3
4
5
6
curl http://192.168.31.4:11434/api/chat -d '{
"model": "llama3.1",
"messages": [
{ "role": "user", "content": "why is the sky blue?" }
]
}'

See the API documentation for all endpoints.

Open WebUI (Formerly Ollama WebUI)

  • If Ollama is on your computer, use this command:
  • If Ollama is on a Different Server, use this command:
  • For CPU Only: If you’re not using a GPU, use this command instead:

GitHub - ollama/ollama

GitHub - open-webui/open-webui

GitHub - 1Panel-dev/MaxKB

文章目录