-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from mborne/open-webui
feat: add open-webui to experiment LLM capabilities
- Loading branch information
Showing
6 changed files
with
327 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
DEVBOX_HOSTNAME=dev.localhost | ||
WEBUI_AUTH=False | ||
OPENAI_API_KEY= | ||
PIPELINES_API_KEY=0p3n-w3bu! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Open WebUI | ||
|
||
Containers running [Open WebUI](https://github.com/open-webui/open-webui?tab=readme-ov-file#open-webui-formerly-ollama-webui-) and [ollama](https://hub.docker.com/r/ollama/ollama) to get started with LLM locally. | ||
|
||
## Usage with docker | ||
|
||
* Ensure that GPU support is enabled in docker (or adapt [docker-compose.yaml](docker-compose.yaml)) : | ||
|
||
```bash | ||
docker run --gpus all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark | ||
``` | ||
|
||
* Start : `docker compose up -d` | ||
* Open https://open-webui.dev.localhost | ||
* To use [ollama API](https://github.com/ollama/ollama/blob/main/docs/api.md#api) : | ||
|
||
```bash | ||
# list models | ||
curl -sS http://localhost:11434/api/tags | jq -r '.models[].name' | ||
|
||
# pull model from https://ollama.com/library | ||
curl http://localhost:11434/api/pull -d '{ | ||
"name": "llama3" | ||
}' | ||
|
||
# use model | ||
curl http://localhost:11434/api/generate -d '{ | ||
"model": "llama3", | ||
"prompt": "Why is the sky blue?" | ||
}' | ||
``` | ||
|
||
## Custom model | ||
|
||
To create custom model from [OLLAMA Modelfile](https://github.com/ollama/ollama/tree/main?tab=readme-ov-file#customize-a-prompt), a sample [models/geoassistant](models/geoassistant/README.md) is available : | ||
|
||
```bash | ||
docker compose exec ollama | ||
ollama create geoassistant -f /models/geoassistant/Modelfile | ||
ollama run geoassistant | ||
# Do you know the most visited museums in Paris? | ||
``` | ||
|
||
|
||
## Resources | ||
|
||
* [Open WebUI - Getting Started](https://docs.openwebui.com/getting-started/) | ||
* [mborne/toolbox - cuda-toolkit](https://github.com/mborne/toolbox/tree/master/cuda-toolkit#ressources) | ||
|
||
[OLLAMA](https://github.com/ollama/ollama) : | ||
|
||
* [ollama](https://github.com/ollama/ollama/tree/main?tab=readme-ov-file#ollama) | ||
* [hub.docker.com - ollama/ollama](https://hub.docker.com/r/ollama/ollama) | ||
* [ollama - API](https://github.com/ollama/ollama/blob/main/docs/api.md#api) | ||
|
||
[Pipelines](https://docs.openwebui.com/pipelines) : | ||
|
||
* https://docs.openwebui.com/pipelines/#-quick-start-with-docker | ||
* https://ikasten.io/2024/06/03/getting-started-with-openwebui-pipelines/ | ||
* https://raw.githubusercontent.com/open-webui/pipelines/main/examples/filters/function_calling_filter_pipeline.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
services: | ||
# https://docs.openwebui.com/getting-started/ | ||
open-webui: | ||
#image: ghcr.io/open-webui/open-webui:main | ||
image: ghcr.io/open-webui/open-webui:cuda | ||
container_name: open-webui | ||
ports: | ||
- 3000:8080 | ||
environment: | ||
- WEBUI_AUTH=False | ||
- OLLAMA_BASE_URL=http://ollama:11434 | ||
- GLOBAL_LOG_LEVEL="DEBUG" | ||
# add pipelines | ||
- OPENAI_API_BASE_URL=https://api.openai.com/v1;http://pipelines:9099 | ||
- OPENAI_API_KEYS=${OPENAI_API_KEY};${PIPELINES_API_KEY} | ||
volumes: | ||
- open-webui:/app/backend/data | ||
deploy: | ||
resources: | ||
reservations: | ||
devices: | ||
- driver: nvidia | ||
capabilities: ["gpu"] | ||
count: all | ||
labels: | ||
- "traefik.enable=true" | ||
# https://open-webui.dev.localhost | ||
- "traefik.http.routers.open-webui.rule=Host(`open-webui.${DEVBOX_HOSTNAME}`)" | ||
- "traefik.http.routers.open-webui.service=open-webui-service@docker" | ||
- "traefik.http.services.open-webui-service.loadbalancer.server.port=8080" | ||
restart: unless-stopped | ||
|
||
# https://hub.docker.com/r/ollama/ollama | ||
ollama: | ||
image: ollama/ollama:latest | ||
container_name: ollama | ||
ports: | ||
- 11434:11434 | ||
volumes: | ||
- ollama:/root/.ollama | ||
- ./models:/models:ro | ||
deploy: | ||
resources: | ||
reservations: | ||
devices: | ||
- driver: nvidia | ||
capabilities: ["gpu"] | ||
count: all | ||
labels: | ||
- "traefik.enable=true" | ||
# https://ollama.dev.localhost | ||
- "traefik.http.routers.ollama.rule=Host(`ollama.${DEVBOX_HOSTNAME}`)" | ||
- "traefik.http.routers.ollama.service=ollama-service@docker" | ||
- "traefik.http.services.ollama-service.loadbalancer.server.port=11434" | ||
restart: unless-stopped | ||
|
||
# https://docs.openwebui.com/pipelines/#-quick-start-with-docker | ||
# https://ikasten.io/2024/06/03/getting-started-with-openwebui-pipelines/ | ||
# https://raw.githubusercontent.com/open-webui/pipelines/main/examples/filters/function_calling_filter_pipeline.py | ||
pipelines: | ||
image: ghcr.io/open-webui/pipelines:main | ||
container_name: pipelines | ||
ports: | ||
- 9099:9099 | ||
environment: | ||
- PIPELINES_API_KEY=${PIPELINES_API_KEY} | ||
volumes: | ||
- pipelines:/app/pipelines | ||
restart: unless-stopped | ||
|
||
volumes: | ||
ollama: | ||
name: ollama | ||
open-webui: | ||
name: open-webui | ||
pipelines: | ||
name: pipelines | ||
|
||
networks: | ||
default: | ||
name: devbox | ||
external: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM llama3:latest | ||
PARAMETER temperature 0.8 | ||
SYSTEM """ | ||
You are a model trained to provide information about locations. | ||
If you can't find locations from user message, explain your role. | ||
You will respond with the requested information as a FeatureCollection in GeoJSON format with properties including the type of the location, its name, description, your sources, links and any relevant comments. | ||
Note that : | ||
- You reply using user language | ||
- GeoJSON result must be indented and surrounded by markdown markers (```json ... ```) | ||
- For the geometry, you produce GeoJSON points with the coordinates you found | ||
""" | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# geoassistant | ||
|
||
## Model | ||
|
||
See [Modelfile](Modelfile) | ||
|
||
## Question | ||
|
||
Do you know the most visited museums in Paris? | ||
|
||
## Answer | ||
|
||
I can provide information about locations! | ||
|
||
Here are the most visited museums in Paris: | ||
|
||
```json | ||
{ | ||
"type": "FeatureCollection", | ||
"features": [ | ||
{ | ||
"type": "Feature", | ||
"geometry": {"type": "Point", "coordinates": [2.2931, 48.8647]}, | ||
"properties": { | ||
"name": "The Louvre Museum", | ||
"description": "One of the world's largest and most famous museums, it houses an | ||
impressive collection of art and artifacts from ancient civilizations to the 19th century.", | ||
"sources": ["Wikipedia", "Paris Tourist Office"], | ||
"links": ["https://www.louvre.fr/", | ||
"https://en.parisinfo.com/paris-museum-magazine/louvre-museum"] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"geometry": {"type": "Point", "coordinates": [2.3319, 48.8678]}, | ||
"properties": { | ||
"name": "Orsay Museum", | ||
"description": "A museum of Impressionist and Post-Impressionist art, featuring works by | ||
Monet, Renoir, Degas, Seurat, and Van Gogh.", | ||
"sources": ["Wikipedia", "Paris Tourist Office"], | ||
"links": ["https://www.musee-orsay.fr/", | ||
"https://en.parisinfo.com/paris-museum-magazine/orangery-museum"] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"geometry": {"type": "Point", "coordinates": [2.2941, 48.8657]}, | ||
"properties": { | ||
"name": "Rodin Museum", | ||
"description": "A museum dedicated to the works of French sculptor Auguste Rodin, | ||
featuring many of his famous pieces.", | ||
"sources": ["Wikipedia", "Paris Tourist Office"], | ||
"links": ["https://www.musee-rodin.fr/", "https://en.parisinfo.com/paris-museum-magazine | ||
rodin-museum"] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"geometry": {"type": "Point", "coordinates": [2.3308, 48.8669]}, | ||
"properties": { | ||
"name": "Quai Branly Museum", | ||
"description": "A museum showcasing art and artifacts from Africa, Asia, Oceania, and | ||
the Americas.", | ||
"sources": ["Wikipedia", "Paris Tourist Office"], | ||
"links": ["https://www.quaibranly.fr/", "https://en.parisinfo.com/paris-museum-magazine | ||
quen-braun-ly-museum"] | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
Note: The coordinates provided are approximate and represent the general location of each museum | ||
in Paris. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
{ | ||
"type": "FeatureCollection", | ||
"features": [ | ||
{ | ||
"type": "Feature", | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [ | ||
2.2931, | ||
48.8647 | ||
] | ||
}, | ||
"properties": { | ||
"name": "The Louvre Museum", | ||
"description": "One of the world's largest and most famous museums, it houses an impressive collection of art and artifacts from ancient civilizations to the 19th century.", | ||
"sources": [ | ||
"Wikipedia", | ||
"Paris Tourist Office" | ||
], | ||
"links": [ | ||
"https://www.louvre.fr/", | ||
"https://en.parisinfo.com/paris-museum-magazine/louvre-museum" | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [ | ||
2.3319, | ||
48.8678 | ||
] | ||
}, | ||
"properties": { | ||
"name": "Orsay Museum", | ||
"description": "A museum of Impressionist and Post-Impressionist art, featuring works by Monet, Renoir, Degas, Seurat, and Van Gogh.", | ||
"sources": [ | ||
"Wikipedia", | ||
"Paris Tourist Office" | ||
], | ||
"links": [ | ||
"https://www.musee-orsay.fr/", | ||
"https://en.parisinfo.com/paris-museum-magazine/orangery-museum" | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [ | ||
2.2941, | ||
48.8657 | ||
] | ||
}, | ||
"properties": { | ||
"name": "Rodin Museum", | ||
"description": "A museum dedicated to the works of French sculptor Auguste Rodin, featuring many of his famous pieces.", | ||
"sources": [ | ||
"Wikipedia", | ||
"Paris Tourist Office" | ||
], | ||
"links": [ | ||
"https://www.musee-rodin.fr/", | ||
"https://en.parisinfo.com/paris-museum-magazinerodin-museum" | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [ | ||
2.3308, | ||
48.8669 | ||
] | ||
}, | ||
"properties": { | ||
"name": "Quai Branly Museum", | ||
"description": "A museum showcasing art and artifacts from Africa, Asia, Oceania, and the Americas.", | ||
"sources": [ | ||
"Wikipedia", | ||
"Paris Tourist Office" | ||
], | ||
"links": [ | ||
"https://www.quaibranly.fr/", | ||
"https://en.parisinfo.com/paris-museum-magazinequen-braun-ly-museum" | ||
] | ||
} | ||
} | ||
] | ||
} |