Files
ai_env/tools/gen_aichat_conf.sh

34 lines
1.2 KiB
Bash
Executable File

#!/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