Improve models configuration

This commit is contained in:
ben
2025-09-20 14:30:22 +02:00
parent 65839496c4
commit 1c19200e73
4 changed files with 39 additions and 33 deletions

View File

@@ -31,14 +31,13 @@ Note that it is probably possible to run the project on other GPUs or modern Mac
## How to launch the server
Choose the models you wish to use in the `docker-compose.yaml` file.
Choose the models you wish to use in the `.env` file. Put the embedding model first and the default model second.
```bash
environment:
- MODELS=...
MODELS=gemma3n:e4b,nomic-embed-text,gpt-oss:20b,llama3.1:8b,llama3.2:3b,gemma3:12b-it-qat
```
Add an API key to secure server access by adding a `.env` file like this:
Add an API key to secure server access by adding a `.env` file like this (you can generate one with `openssl rand -hex 16`):
```bash
LLM_API_KEY=1234567890

View File

@@ -24,7 +24,7 @@ services:
build:
dockerfile: src/ollama_provision/Dockerfile
environment:
- MODELS=nomic-embed-text,llama3.1:8b,qwen2.5:7b,gemma3:12b-it-qat,gemma3:27b-it-qat,gpt-oss:20b
- MODELS=${MODELS}
volumes:
- ollama:/root/.ollama
restart: no

View File

@@ -21,6 +21,31 @@ if [[ ! -z $OLLAMA_HOST ]]; then
cat ~/.config/aichat/config.yaml | sed "s/http/https/" >~/.config/aichat/config.yaml.tmp
cat ~/.config/aichat/config.yaml.tmp | sed "s/localhost:11434/${OLLAMA_HOST}/" >~/.config/aichat/config.yaml
fi
DEFAULT_MODEL=$(cat .env | grep '^MODELS=' | cut -d'=' -f2 | cut -d',' -f2)
EMBEDDING_MODEL=$(cat .env | grep '^MODELS=' | cut -d'=' -f2 | cut -d',' -f1)
if [[ -z ${EMBEDDING_MODEL} ]] || [[ -z ${DEFAULT_MODEL} ]]; then
echo "MODELS in .env are missing."
exit 1
fi
cat ~/.config/aichat/config.yaml | sed "s/__EMBEDDING_MODEL__/ollama:${EMBEDDING_MODEL}/" >~/.config/aichat/config.yaml.tmp
cat ~/.config/aichat/config.yaml.tmp | sed "s/__DEFAULT_MODEL__/ollama:${DEFAULT_MODEL}/" >~/.config/aichat/config.yaml
MODELS=$(cat .env | grep '^MODELS=' | cut -d'=' -f2 | cut -d',' -f2- | tr ',' ' ')
for i in ${MODELS}; do
echo " - name: ${i}" >>~/.config/aichat/config.yaml
echo
read -p "Does the model ${i} support function calling? [y/N] " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo " supports_function_calling: true" >>~/.config/aichat/config.yaml
else
echo " supports_function_calling: false" >>~/.config/aichat/config.yaml
fi
echo
read -rp "What is the maximum number of input tokens ${i} supports? [128000] " max_input_tokens
max_input_tokens=${max_input_tokens:-128000}
echo " max_input_tokens: ${max_input_tokens}" >>~/.config/aichat/config.yaml
done
mkdir -p ~/.config/aichat/roles
cp src/aichat/roles/* ~/.config/aichat/roles/

View File

@@ -1,9 +1,9 @@
# see https://github.com/sigoden/aichat/blob/main/config.example.yaml
rag_embedding_model: ollama:nomic-embed-text
rag_embedding_model: __EMBEDDING_MODEL__
rag_chunk_size: 8192
rag_chunk_overlap: 409
model: ollama:gemma3:12b-it-qat
model: __DEFAULT_MODEL__
temperature: 0
clients:
- type: openai-compatible
@@ -11,21 +11,3 @@ clients:
api_base: http://localhost:11434/v1
api_key: __LLM_API_KEY__
models:
- name: gemma3:4b
supports_function_calling: true
max_input_tokens: 128000
- name: gemma3:12b-it-qat
supports_function_calling: true
max_input_tokens: 128000
- name: gemma3:27b-it-qat
supports_function_calling: true
max_input_tokens: 128000
- name: gpt-oss:20b
supports_function_calling: true
max_input_tokens: 128000
- name: llama3.1:8b
supports_function_calling: true
max_input_tokens: 128000
- name: qwen2.5:7b
supports_function_calling: true
max_input_tokens: 128000