Update aichat version and add conf generation using ollama API.

This commit is contained in:
ben
2025-09-23 07:20:38 +02:00
parent 1c19200e73
commit 4e7d7f88a0
5 changed files with 43 additions and 39 deletions

33
tools/gen_aichat_conf.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/usr/bin/env bash
DEFAULT_MODEL=$(echo "${MODELS}" | cut -d',' -f2)
EMBEDDING_MODEL=$(echo "${MODELS}" | cut -d',' -f1)
if [[ -z ${EMBEDDING_MODEL} ]] || [[ -z ${DEFAULT_MODEL} ]]; then
echo "MODELS in .env are missing."
exit 1
fi
echo "rag_embedding_model: ollama:${EMBEDDING_MODEL}
rag_chunk_size: 8192
rag_chunk_overlap: 409
model: ollama:${DEFAULT_MODEL}
temperature: 0
clients:
- type: openai-compatible
name: ollama
api_base: http://${OLLAMA_HOST}:11434/v1
api_key: ${LLM_API_KEY}
models:"
MODELS_LIST=$(echo "${MODELS}" | cut -d',' -f2- | tr ',' ' ')
for i in ${MODELS_LIST}; do
echo " - name: ${i}"
echo -n " max_input_tokens: "
curl -s "http://${OLLAMA_HOST}:11434/api/show" -H 'Authorization: Bearer 634e87c39907a94faa5f1618c9e501b1' -d "{\"model\": \"${i}\"}" | jq '.model_info | with_entries(select(.key | endswith(".context_length")))[]'
TOOLS=$(curl -s "http://${OLLAMA_HOST}:11434/api/show" -H 'Authorization: Bearer 634e87c39907a94faa5f1618c9e501b1' -d "{\"model\": \"${i}\"}" | jq -r .capabilities[] | grep tools)
if [[ -z "${TOOLS}" ]]; then
echo " supports_function_calling: false"
else
echo " supports_function_calling: true"
fi
done